It looks like you have everything stored as strings in the original table.
So if you created the view over an existing table, they would need to all
be VARCHARs.


-Dan

On Sat, Feb 28, 2015 at 10:06 AM, Ganesh R <[email protected]> wrote:

> Naga,
>
> The issue is not with Phoenix view on Phoenix table. it's with Phoenix
> view on HBase table.
> Refer my initial post to reproduce it.
>
> Thanks!
>
>
>   On Saturday, 28 February 2015 6:42 AM, Naga Vijayapuram <
> [email protected]> wrote:
>
>
>  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 <[email protected]> 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
>
>
>
>
>

Reply via email to