Hive database convert epochtime into YYYY-MM-DD format -


i have access hive database.in database time stored epochtime inside bigint column.i retrive data in yyyy-mm-dd format.can please me this

table description

temp_table name string ts bigint age int

ts column stores data in epoch time stamp format

when give select * temp_table

values retrived are

bob 1374752536 12

i need output as

bob 2013-07-25 12:14:17 12

you make use of from_unixtime() date function provided hive. converts timestamp string representing timestamp.

usage :

hive> select from_unixtime(1374752536) demo; 

example :

input :

bob 1374752536 12 tariq 1374778369 25 

query :

hive> create external table demo2(name string, ts bigint, age int) row format delimited fields terminated ' ' location '/inputs/date/';

hive> select from_unixtime(ts) demo2;

output :

ok  2013-07-25 17:12:16  2013-07-26 00:22:49  time taken: 6.3 seconds 

hth


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -