mardi 19 juillet 2016

How do I generate an array of hours from a pair of timestamps in Hive?

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.

Aucun commentaire:

Enregistrer un commentaire