[
https://issues.apache.org/jira/browse/HIVE-8391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14164181#comment-14164181
]
Jason Dere commented on HIVE-8391:
----------------------------------
I think there may be something wrong with the vectorized query.
First, let's take a look at time timestamp to numeric value conversion for the
value used in the timestamp predicates:
{noformat}
hive> select ts, cast(ts as int), cast(ts as double) from (select cast(-29071.0
as timestamp) as ts) as q;
1969-12-31 07:55:29 -29071 -29071.0
hive> select ts, cast(ts as int), cast(ts as double) from (select cast(0.0 as
timestamp) as ts) as q;
1969-12-31 16:00:00 0 0.0
{noformat}
So substituting in the numeric comparisons for timestamp comparisons, in theory
these 2 queries below should return the same result. But in vectorized mode
they do not. With vectorized mode off, these queries both return 1826 with the
attached patch.
{noformat}
hive> SET hive.vectorized.execution.enabled=true;
hive> select count(*)
> FROM alltypesorc
> WHERE
> ((ctinyint != 0)
> AND
> (((ctimestamp1 <= 0)
> OR ((ctinyint = cint) OR (cstring2 LIKE 'ss')))
> AND ((988888 < cdouble)
> OR ((ctimestamp2 > -29071) AND (3569 >= cdouble)))))
> ;
OK
487
Time taken: 1.486 seconds, Fetched: 1 row(s)
hive> select count(*)
> FROM alltypesorc
> WHERE
> ((ctinyint != 0)
> AND
> (((ctimestamp1 <= timestamp('1969-12-31 16:00:00'))
> OR ((ctinyint = cint) OR (cstring2 LIKE 'ss')))
> AND ((988888 < cdouble)
> OR ((ctimestamp2 > timestamp('1969-12-31 07:55:29')) AND
(3569 >= cdouble)))));
OK
1826
Time taken: 1.441 seconds, Fetched: 1 row(s)
{noformat}
> Comparion between TIMESTAMP and Integer types goes to STRING as "common
> comparison denominator" instead of a numeric type
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: HIVE-8391
> URL: https://issues.apache.org/jira/browse/HIVE-8391
> Project: Hive
> Issue Type: Bug
> Components: CBO, Logical Optimizer
> Affects Versions: 0.14.0
> Reporter: Matt McCline
> Assignee: Jason Dere
> Priority: Critical
> Fix For: 0.14.0
>
> Attachments: HIVE-8391.1.patch, vectorization_7.q
>
>
> Discovered while investigating why vectorization_7.q has different results
> for non-vectorized [+CBO] and vectorized [+CBO].
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)