You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Saurabh Nanda <sa...@gmail.com> on 2009/07/13 10:32:40 UTC

DATETIME or TIMESTAMP data type?

Hi,

I'm a complete Hive newbie, so please excuse me if this question sounds too
dumb. I didn't see a native date/time data type at
http://wiki.apache.org/hadoop/Hive/LanguageManual/DDL. Is this an omission
in the documentation or does Hive really not have a native date/time data
type?

Should I convert the timestamp in my log files to a Unix timestamp (BIGINT)
and store it? Or should I treat the timestamp as a STRING?

Thanks,
Saurabh.
-- 
http://nandz.blogspot.com
http://foodieforlife.blogspot.com

Re: DATETIME or TIMESTAMP data type?

Posted by Frederick Oko <fr...@gmail.com>.
We had written similar UDF to leverage simple date math via conversion to
Unix timestamp but didn't devise any mechanism to overcome the drift when
doing 'now()-to_unixtime(a.ts)' since now() is continually revaluated over
the lifetime of the MR job per record -- is there any way to force single,
pre-MR parse-time evaluation of now() to literal? In many cases the drift
can be ignored (e.g. age) and obvious workaround is to dynamically generate
the query with static timestamp as opposed to now().

On Jul 13, 2009 1:49 AM, "Zheng Shao" <zs...@gmail.com> wrote:

Hi Saurabh,

Hive does not have a native date/time data type. In all the cases that
we have seen, storing timestamp as BIGINT or STRING is good enough for
our users' applications.

There is a set of UDFs for date/time stored as bigint/string:
http://wiki.apache.org/hadoop/Hive/LanguageManual/UDF#head-8c92c62e9912ded44cc753d56fdf973ca1377f37
It's also very easy to write your own UDFs.

Zheng

On Mon, Jul 13, 2009 at 1:32 AM, Saurabh Nanda<sa...@gmail.com>
wrote: > Hi, > > I'm a compl...
--
Yours,
Zheng

Re: DATETIME or TIMESTAMP data type?

Posted by Zheng Shao <zs...@gmail.com>.
Hi Saurabh,

Hive does not have a native date/time data type. In all the cases that
we have seen, storing timestamp as BIGINT or STRING is good enough for
our users' applications.

There is a set of UDFs for date/time stored as bigint/string:
http://wiki.apache.org/hadoop/Hive/LanguageManual/UDF#head-8c92c62e9912ded44cc753d56fdf973ca1377f37
It's also very easy to write your own UDFs.

Zheng

On Mon, Jul 13, 2009 at 1:32 AM, Saurabh Nanda<sa...@gmail.com> wrote:
> Hi,
>
> I'm a complete Hive newbie, so please excuse me if this question sounds too
> dumb. I didn't see a native date/time data type at
> http://wiki.apache.org/hadoop/Hive/LanguageManual/DDL. Is this an omission
> in the documentation or does Hive really not have a native date/time data
> type?
>
> Should I convert the timestamp in my log files to a Unix timestamp (BIGINT)
> and store it? Or should I treat the timestamp as a STRING?
>
> Thanks,
> Saurabh.
> --
> http://nandz.blogspot.com
> http://foodieforlife.blogspot.com
>



-- 
Yours,
Zheng