You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by "Ladda, Anand" <la...@microstrategy.com> on 2012/05/26 15:27:52 UTC

FW: Filtering on TIMESTAMP data type

How do I set-up a filter constant for TIMESTAMP datatype. In Hive 0.7 since timestamps were represented as strings a query like this would return data

select * from LU_day where day_date ='2010-01-01 00:00:00';

But now with day_date as a TIMESTAMP column it doesn't. Is there some type of a TO_TIMESTAMP function in hive to convert the string constant into a TIMESTAMP one

As a workaround I can do

select * from LU_DAY where TO_DATE(day_date) = '2010-01-01' but that would be a problem for partitioning pruning, etc



RE: Filtering on TIMESTAMP data type

Posted by "Ladda, Anand" <la...@microstrategy.com>.
Can anyone helpout with the TIMESTAMP literals piece. So far, I've gotten

Select day_timestamp from lu_day where day_timestamp > to_utc_timestamp('2012-06-04 00:00:00', 'GMT') to work ok and give me back timestamps greater than the one in the literal. Is this the best function to get this to work or is there something else I should be using

From: Ladda, Anand
Sent: Monday, May 28, 2012 11:00 AM
To: user@hive.apache.org
Subject: RE: FW: Filtering on TIMESTAMP data type

Debarshi
Didn't quite follow your first comment. I get the write-your-own UDF part but was wondering how others have been transitioning from STRING dates to TIMESTAMP dates and getting filtering, partition pruning, etc to work with constants
-Anand

From: Debarshi Basak [mailto:debarshi.basak@tcs.com]
Sent: Saturday, May 26, 2012 11:54 AM
To: user@hive.apache.org<ma...@hive.apache.org>
Subject: Re: FW: Filtering on TIMESTAMP data type

I guess it exist gotta check.
btw...You can always go and write a udf


Debarshi Basak
Tata Consultancy Services
Mailto: debarshi.basak@tcs.com<ma...@tcs.com>
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________

-----"Ladda, Anand" wrote: -----
To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>, "dev@hive.apache.org<ma...@hive.apache.org>" <de...@hive.apache.org>>
From: "Ladda, Anand" <la...@microstrategy.com>>
Date: 05/26/2012 06:58PM
Subject: FW: Filtering on TIMESTAMP data type
How do I set-up a filter constant for TIMESTAMP datatype. In Hive 0.7 since timestamps were represented as strings a query like this would return data

select * from LU_day where day_date ='2010-01-01 00:00:00';

But now with day_date as a TIMESTAMP column it doesn't. Is there some type of a TO_TIMESTAMP function in hive to convert the string constant into a TIMESTAMP one

As a workaround I can do

select * from LU_DAY where TO_DATE(day_date) = '2010-01-01' but that would be a problem for partitioning pruning, etc



=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you

RE: FW: Filtering on TIMESTAMP data type

Posted by "Ladda, Anand" <la...@microstrategy.com>.
Debarshi
Didn't quite follow your first comment. I get the write-your-own UDF part but was wondering how others have been transitioning from STRING dates to TIMESTAMP dates and getting filtering, partition pruning, etc to work with constants
-Anand

From: Debarshi Basak [mailto:debarshi.basak@tcs.com]
Sent: Saturday, May 26, 2012 11:54 AM
To: user@hive.apache.org
Subject: Re: FW: Filtering on TIMESTAMP data type

I guess it exist gotta check.
btw...You can always go and write a udf


Debarshi Basak
Tata Consultancy Services
Mailto: debarshi.basak@tcs.com<ma...@tcs.com>
Website: http://www.tcs.com
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________

-----"Ladda, Anand" wrote: -----
To: "user@hive.apache.org<ma...@hive.apache.org>" <us...@hive.apache.org>>, "dev@hive.apache.org<ma...@hive.apache.org>" <de...@hive.apache.org>>
From: "Ladda, Anand" <la...@microstrategy.com>>
Date: 05/26/2012 06:58PM
Subject: FW: Filtering on TIMESTAMP data type
How do I set-up a filter constant for TIMESTAMP datatype. In Hive 0.7 since timestamps were represented as strings a query like this would return data

select * from LU_day where day_date ='2010-01-01 00:00:00';

But now with day_date as a TIMESTAMP column it doesn't. Is there some type of a TO_TIMESTAMP function in hive to convert the string constant into a TIMESTAMP one

As a workaround I can do

select * from LU_DAY where TO_DATE(day_date) = '2010-01-01' but that would be a problem for partitioning pruning, etc



=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you