You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Arthur Chan <ar...@gmail.com> on 2015/04/25 15:57:25 UTC

How to cast binary to timestamp

Hi,

Please help!
My Hive is 1.1.0, Hbase 0.98.11

I have an external Hbase table which stores timestamp in binary,  I need to
map this Hbase table as the external table in Hive and extract the year
month and day from the timestamp.

in HBase
scan 'my_page',
{COLUMNS=>['f:ts:c(org.apache.hadoop.hbase.util.Bytes).toLong']}
result which is good: column=f:ts, timestamp=1428474453096,
value=1428474450357

I have created the external table in hive.
select cast(cast(ts as string) as bigint) from temp_page;
I got "NULL"

Any idea about how to cast Binary to Timestamp in Hive?

Regards