You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Ganesha Shreedhara (Jira)" <ji...@apache.org> on 2019/09/24 05:32:00 UTC
[jira] [Created] (HIVE-22233) Wrong result with vectorized
execution when column value is casted to TINYINT
Ganesha Shreedhara created HIVE-22233:
-----------------------------------------
Summary: Wrong result with vectorized execution when column value is casted to TINYINT
Key: HIVE-22233
URL: https://issues.apache.org/jira/browse/HIVE-22233
Project: Hive
Issue Type: Bug
Affects Versions: 3.1.1
Reporter: Ganesha Shreedhara
Casting a column value to TINYINT is giving incorrect result when vectorized execution is enabled. This is only when the sub query as SUM/COUNT aggregation operations in IF condition.
*Steps to reproduce:*
{code:java}
create table test(id int);
insert into test values (1);
SELECT CAST(col AS TINYINT) col_cast FROM ( SELECT IF(SUM(1) > 0, 1, 0) col FROM test) x;
{code}
*Result:*
{code:java}
0{code}
*Expected result:*
{code:java}
1{code}
We get the expected result when hive.vectorized.execution.enabled is disabled.
We also get the expected result when we don't CAST or don't have SUM/COUNT aggregation in IF condition.
The following queries give correct result when vectorized execution is enabled.
{code:java}
SELECT CAST(col AS INT) col_cast FROM ( SELECT IF(SUM(1) > 0, 1, 0) col FROM test) x;
SELECT col FROM ( SELECT IF(SUM(1) > 0, 1, 0) col FROM test) x;
SELECT CAST(col AS INT) col_cast FROM ( SELECT IF(2 > 1, 1, 0) col FROM test) x;
SELECT CAST(col AS INT) col_cast FROM ( SELECT IF(true, 1, 0) col FROM test) x;
{code}
This issue is only when we use *CAST(col AS TINYINT)* along with *IF(SUM(1) > 0, 1, 0) or IF(COUNT(1) > 0, 1, 0)* in sub query.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)