Well, like i said the issue is not with Phoenix view on Phoenix table. 
Issue: Phoenix view on HBase table. 
Anything which goes inside HBase goes as an array of bytes. Its responsibility 
of client (Phoenix view in this case) to convert it into appropriate data 
types. 
Steps to reproduce:- Create a HBase table (using HBase shell)- Put values in 
column identifiers. Values can be date, int, float (as per my initial post).- 
Create Phoenix view with appropriate data types (date, int, float and not 
varchar for all cols).- Run a select query. You won't see the same values are 
you'll see in HBase shell get command. 
Refer the link if above steps aren't clear - 
https://github.com/forcedotcom/phoenix/issues/316 (I am trying to do something 
similar, not the same)
Question: Does phoenix view on pre-existing HBase table support only varchars?? 
or is it an issue/enhancement?
 

     On Saturday, 28 February 2015 10:12 AM, Dan Di Spaltro 
<[email protected]> wrote:
   

 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