Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Hbase - Impala query to order by time stamp and day

Highlighted

Hbase - Impala query to order by time stamp and day

 
1 REPLY 1
Highlighted

Re: Hbase - Impala query to order by time stamp and day

Super Guru

@Gayathri Devi

A better tool to read data from HBase is Phoenix. Phoenix is purpose built to run on top of HBase. I think you should consider using that.

Data is stored in HBase in lexicographical order. So 1, 2, 3, 4, 5, 6, 7, 8, 9 , 10 will be stored as 1, 10, 2, 3, 4, 5, 6, 7, 8, 9.

When you are reading data using Impala, order by sorts according to lexicographical order. You are going to see incorrect results and think that order by is not working because of the way HBase orders data. You should only do order by on "String" columns for correct results.

as for your date comparison, you are rightly using to_date() and you can use datediff (timestamp, timestamp) to get days between two timstamps.

Don't have an account?
Coming from Hortonworks? Activate your account here