phoenix-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naga Vijayapuram <Naga_Vijayapu...@gap.com>
Subject Re: Incorrect data retrieval: Phoenix table on HBase
Date Sat, 28 Feb 2015 14:42:07 GMT
Please check your view creation statement.  It works for me …

> create table NV.T1 (name varchar(30), age integer, grade float, dob date not null, constraint
nv_t1_pk primary key (name, dob));

> create view NV.V1 as select * from NV.T1;

> upsert into NV.T1 values ('John Doe', 23, 3.5, to_date('1981-07-01 04:02:01'));

> select * from NV.T1;
+------------+------------+------------+---------------------+
|    NAME    |    AGE     |   GRADE    |         DOB         |
+------------+------------+------------+---------------------+
| John Doe   | 23         | 3.5        | 1981-07-01          |
+------------+------------+------------+---------------------+

> select * from NV.V1;
+------------+------------+------------+---------------------+
|    NAME    |    AGE     |   GRADE    |         DOB         |
+------------+------------+------------+---------------------+
| John Doe   | 23         | 3.5        | 1981-07-01          |
+------------+------------+------------+---------------------+

Naga


On Feb 27, 2015, at 12:23 PM, Ganesh R <rganesh84@yahoo.co.in<mailto:rganesh84@yahoo.co.in>>
wrote:

Hello,
I am trying to create phoenix table with appropriate data types on existing HBase table.

HBase table:

hbase(main):017:0> get 'P_VIEW_TEST', '1'
COLUMN                                        CELL
 DATA:DT_VAL                                  timestamp=1425066171071, value=2015-02-27 00:00:00.000
 DATA:FT_VAL                                  timestamp=1425066195810, value=3.29
 DATA:IT_VAL                                  timestamp=1425067277161, value=4345

Phoenix table:

CREATE VIEW P_VIEW_TEST(
        DT_VAL          DATE,
        FT_VAL          FLOAT,
        IT_VAL          INTEGER
) default_column_family='DATA';

-- View gets created -- No issues.
However when i query the view.

select * from P_VIEW_TEST;

+---------------------+------------+------------+
|       DT_VAL        |   FT_VAL           |   IT_VAL   |
+---------------------+------------+------------+
| 840-02-22          | -1.09997624E8 |     -1271712715 |
+---------------------+------------+------------+

So to retrieve right data in Phoenix view (on Hbase table), the view should always have all
column types as "varchar" ??

Thanks,
Ganesh R



Mime
View raw message