unix_timestamp() returns the unix time given a date string:
e.g. unix_timestamp('2009-03-20 11:30:01') = 1237573801
please see:
http://wiki.apache.org/hadoop/Hive/LanguageManual/UDF#Date_Functions
Cheers,
Paul
From: tom kersnick [mailto:[email protected]]
Sent: Thursday, April 01, 2010 1:12 PM
To: [email protected]
Subject: unix_timestamp function
hive> describe ut;
OK
time bigint
day string
Time taken: 0.128 seconds
hive> select * from ut;
OK
1270145333155 tuesday
Time taken: 0.085 seconds
When I run this simple query, I'm getting a NULL for the time column with data
type bigint.
hive> select unix_timestamp(time),day from ut;
Total MapReduce jobs = 1
Launching Job 1 out of 1
Number of reduce tasks is set to 0 since there's no reduce operator
Starting Job = job_201003031204_0080, Tracking URL =
http://master:50030/jobdetails.jsp?jobid=job_201003031204_0080
Kill Command = /usr/local/hadoop/bin/../bin/hadoop job
-Dmapred.job.tracker=master:54311 -kill job_201003031204_0080
2010-04-01 16:03:54,024 Stage-1 map = 0%, reduce = 0%
2010-04-01 16:04:06,128 Stage-1 map = 100%, reduce = 0%
2010-04-01 16:04:09,150 Stage-1 map = 100%, reduce = 100%
Ended Job = job_201003031204_0080
OK
NULL tuesday
Time taken: 16.981 seconds
Any ideas?
Thanks!
/tom