I have a table that looks like:
ID start_time end_time username
1 1451674800 1451692800 blah
And I want a table that looks like:
ID username hours
1 blah [11, 12, 13, 14, 15, 16]
Where [11, 12, 13, 14, 15, 16] is an array with values corresponding to the hours (PST) which lie between 1451674800 and 1451692800 (UNIX time).
My thought is that I need to use Hive's timestamp functions, but I am so incredibly unfamiliar with Hive and especially with the timestamp functions that I don't even know where to begin.
First create function which convert UNIX time to ordinal time. Can take from here
Then calculate DATEDIFF(hh,start_time,end_time). Add this number of hours begining from DATEPART(dd,start_time) and concatenate them.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.