You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by "Petter von Dolwitz (Hem)" <pe...@gmail.com> on 2014/01/23 15:20:00 UTC
Usage of TIMESTAMP
Hi,
I have a table where one column (ts) is of type TIMESTAMP. How am I
supposed to use this in my query?
The following attempt does not give me a result.
SELECT * FROM mytable WHERE ts > "2014-01-23 00:00:00";
If I change it to the below it works:
SELECT * FROM mytable WHERE ts > cast("2014-01-23 00:00:00" as TIMESTAMP);
Shouldn't Hive (0.10) convert the string for me without the need of an
explicit cast?
Thanks,
Petter
Re: Usage of TIMESTAMP
Posted by "Petter von Dolwitz (Hem)" <pe...@gmail.com>.
Hi Jason,
thank you for sorting this out for me!
/Petter
2014/1/24 Jason Dere <jd...@hortonworks.com>
> See HIVE-2558 - the comparison between timestamp and string was done by
> converting both values to a number.
> i think this behavior should be changed, as of Hive-0.12
>
> Jason
>
> On Jan 23, 2014, at 6:20 AM, Petter von Dolwitz (Hem) <
> petter.von.dolwitz@gmail.com> wrote:
>
> > Hi,
> >
> > I have a table where one column (ts) is of type TIMESTAMP. How am I
> supposed to use this in my query?
> >
> > The following attempt does not give me a result.
> > SELECT * FROM mytable WHERE ts > "2014-01-23 00:00:00";
> >
> > If I change it to the below it works:
> > SELECT * FROM mytable WHERE ts > cast("2014-01-23 00:00:00" as
> TIMESTAMP);
> >
> > Shouldn't Hive (0.10) convert the string for me without the need of an
> explicit cast?
> >
> > Thanks,
> > Petter
> >
> >
>
>
> --
> CONFIDENTIALITY NOTICE
> NOTICE: This message is intended for the use of the individual or entity to
> which it is addressed and may contain information that is confidential,
> privileged and exempt from disclosure under applicable law. If the reader
> of this message is not the intended recipient, you are hereby notified that
> any printing, copying, dissemination, distribution, disclosure or
> forwarding of this communication is strictly prohibited. If you have
> received this communication in error, please contact the sender immediately
> and delete it from your system. Thank You.
>
Re: Usage of TIMESTAMP
Posted by Jason Dere <jd...@hortonworks.com>.
See HIVE-2558 - the comparison between timestamp and string was done by converting both values to a number.
i think this behavior should be changed, as of Hive-0.12
Jason
On Jan 23, 2014, at 6:20 AM, Petter von Dolwitz (Hem) <pe...@gmail.com> wrote:
> Hi,
>
> I have a table where one column (ts) is of type TIMESTAMP. How am I supposed to use this in my query?
>
> The following attempt does not give me a result.
> SELECT * FROM mytable WHERE ts > "2014-01-23 00:00:00";
>
> If I change it to the below it works:
> SELECT * FROM mytable WHERE ts > cast("2014-01-23 00:00:00" as TIMESTAMP);
>
> Shouldn't Hive (0.10) convert the string for me without the need of an explicit cast?
>
> Thanks,
> Petter
>
>
--
CONFIDENTIALITY NOTICE
NOTICE: This message is intended for the use of the individual or entity to
which it is addressed and may contain information that is confidential,
privileged and exempt from disclosure under applicable law. If the reader
of this message is not the intended recipient, you are hereby notified that
any printing, copying, dissemination, distribution, disclosure or
forwarding of this communication is strictly prohibited. If you have
received this communication in error, please contact the sender immediately
and delete it from your system. Thank You.