Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Phoenix view is distorting the date colum

avatar
Super Collaborator

hbase has the correct time but when I query the data from phoenix view its showing totally wrong date value?

hbase info

 10017175360300  column=F1:INSERT_TIME, timestamp=1530027357550, value=2017-02-05 15:36:31.0

phoenix info

0: jdbc:phoenix:dotstohdamn201.tolls.dot.stat> select ufmid,insert_time from "Sami:UFM2" where ufmid='10017175360300';
 +-----------------+-------------------------------+
 |      UFMID      |          INSERT_TIME          |
 +-----------------+-------------------------------+
 | 10017175360300  | 177670840-06-01 22:47:08.077  |
 +-----------------+-------------------------------+

phoenix view

 CREATE VIEW "Sami:UFM2" (
 UFMID VARCHAR PRIMARY KEY,
 "EXLIST"."LIST1" varchar,
 "EXLIST"."LIST2" varchar,
 "EXLIST"."LIST3" varchar,
 "EXLIST"."LIST4" varchar,
 "EXLIST"."LIST5" varchar,
 "EXLIST"."LIST6" varchar,
 "EXLIST"."LIST7" varchar,
 "EXLIST"."LIST8" varchar,
 "EXLIST"."LIST9" varchar,
 "EXLIST"."LIST10" varchar,
 "EXLIST"."LIST11" varchar,
 "EXLIST"."LIST12" varchar,
 "EXLIST"."LIST13" varchar,
 "EXLIST"."LIST14" varchar,
 "EXLIST"."LIST15" varchar,
 "EXLIST"."LIST16" varchar,
 "EXLIST"."LIST17" varchar,
 "EXLIST"."LIST18" varchar,
 "EXLIST"."LIST19" varchar,
 "EXLIST"."LIST20" varchar,
 "EXLIST"."LIST21" varchar,
 "F1"."INSERT_TIME" date,
 "F1"."LANEID" varchar,
 "F1"."LANEUFMSEQNO" varchar,
 "F1"."PLAZAID" varchar,
 "F1"."TIPUFMSEQ" varchar,
 "F1"."TIP_ID" varchar,
 "F1"."TXNTM" date) SALT_BUCKETS=10 ;
1 ACCEPTED SOLUTION

avatar
Super Guru

Phoenix does not use the trivial serialization that you have written into your HBase table by hand. Use the Phoenix API to write the data into your table for complex data types. Or, create your view on your physical table using the TO_DATE function in your view definition to convert the VARCHAR data to a DATE.

View solution in original post

1 REPLY 1

avatar
Super Guru

Phoenix does not use the trivial serialization that you have written into your HBase table by hand. Use the Phoenix API to write the data into your table for complex data types. Or, create your view on your physical table using the TO_DATE function in your view definition to convert the VARCHAR data to a DATE.