[
https://issues.apache.org/jira/browse/HIVE-4800?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jason Dere updated HIVE-4800:
-----------------------------
Description:
During partition pruning the partition columns are treated as string values,
even if the partition table was defined as being of type timestamp. If the
user specifies a predicate with a Timestamp type, the comparison does not work
correctly between the string and date types.
For example:
create table part1 (
c1 int,
c2 string
) partitioned by (dt timestamp);
insert overwrite table part1 partition(dt='2001-01-01 01:02:03')
select key, value from src limit 2;
-- This query returns no results
select * from part1 where dt=timestamp('2001-01-01 01:02:03');
-- This query works fine
select * from part1 where dt='2001-01-01 01:02:03';
A workaround is to simply not use the timestamp() function and simply compare
the values as strings, as is done in the 2nd query.
> Partition pruning doesn't work properly with timestamp type
> -----------------------------------------------------------
>
> Key: HIVE-4800
> URL: https://issues.apache.org/jira/browse/HIVE-4800
> Project: Hive
> Issue Type: Bug
> Components: Types
> Affects Versions: 0.11.0
> Reporter: Jason Dere
>
> During partition pruning the partition columns are treated as string values,
> even if the partition table was defined as being of type timestamp. If the
> user specifies a predicate with a Timestamp type, the comparison does not
> work correctly between the string and date types.
> For example:
> create table part1 (
> c1 int,
> c2 string
> ) partitioned by (dt timestamp);
> insert overwrite table part1 partition(dt='2001-01-01 01:02:03')
> select key, value from src limit 2;
> -- This query returns no results
> select * from part1 where dt=timestamp('2001-01-01 01:02:03');
> -- This query works fine
> select * from part1 where dt='2001-01-01 01:02:03';
> A workaround is to simply not use the timestamp() function and simply compare
> the values as strings, as is done in the 2nd query.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira