hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mmccl...@apache.org
Subject hive git commit: HIVE-11839: Vectorization wrong results with filter of (CAST AS CHAR) (Matt McCline reviewed by Sergey Shelukin)
Date Wed, 16 Sep 2015 23:43:56 GMT
Repository: hive
Updated Branches:
  refs/heads/branch-1 efd059c50 -> 3e73b1e68


HIVE-11839: Vectorization wrong results with filter of (CAST AS CHAR) (Matt McCline reviewed
by Sergey Shelukin)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/3e73b1e6
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/3e73b1e6
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/3e73b1e6

Branch: refs/heads/branch-1
Commit: 3e73b1e6806646115fb5dce405b08e0127777005
Parents: efd059c
Author: Matt McCline <mmccline@hortonworks.com>
Authored: Wed Sep 16 14:55:12 2015 -0700
Committer: Matt McCline <mmccline@hortonworks.com>
Committed: Wed Sep 16 16:43:38 2015 -0700

----------------------------------------------------------------------
 .../test/resources/testconfiguration.properties |  1 +
 .../ql/exec/vector/VectorizationContext.java    | 10 +++---
 .../queries/clientpositive/vector_char_cast.q   |  9 +++++
 .../clientpositive/tez/vector_char_cast.q.out   | 35 ++++++++++++++++++++
 .../clientpositive/vector_char_cast.q.out       | 35 ++++++++++++++++++++
 5 files changed, 85 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/3e73b1e6/itests/src/test/resources/testconfiguration.properties
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties
index 5593662..859804f 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -191,6 +191,7 @@ minitez.query.files.shared=alter_merge_2_orc.q,\
   vector_between_in.q,\
   vector_binary_join_groupby.q,\
   vector_bucket.q,\
+  vector_char_cast.q,\
   vector_cast_constant.q,\
   vector_char_2.q,\
   vector_char_4.q,\

http://git-wip-us.apache.org/repos/asf/hive/blob/3e73b1e6/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
index 06b32f3..cb3ce07 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java
@@ -1531,7 +1531,7 @@ public class VectorizationContext {
       // Boolean must come before the integer family. It's a special case.
       return createVectorExpression(CastBooleanToStringViaLongToString.class, childExpr,
Mode.PROJECTION, null);
     } else if (isIntFamily(inputType)) {
-      return createVectorExpression(CastLongToString.class, childExpr, Mode.PROJECTION, null);
+      return createVectorExpression(CastLongToString.class, childExpr, Mode.PROJECTION, returnType);
     } else if (isDecimalFamily(inputType)) {
       return createVectorExpression(CastDecimalToString.class, childExpr, Mode.PROJECTION,
returnType);
     } else if (isDateFamily(inputType)) {
@@ -1555,9 +1555,9 @@ public class VectorizationContext {
     }
     if (inputType.equals("boolean")) {
       // Boolean must come before the integer family. It's a special case.
-      return createVectorExpression(CastBooleanToCharViaLongToChar.class, childExpr, Mode.PROJECTION,
null);
+      return createVectorExpression(CastBooleanToCharViaLongToChar.class, childExpr, Mode.PROJECTION,
returnType);
     } else if (isIntFamily(inputType)) {
-      return createVectorExpression(CastLongToChar.class, childExpr, Mode.PROJECTION, null);
+      return createVectorExpression(CastLongToChar.class, childExpr, Mode.PROJECTION, returnType);
     } else if (isDecimalFamily(inputType)) {
       return createVectorExpression(CastDecimalToChar.class, childExpr, Mode.PROJECTION,
returnType);
     } else if (isDateFamily(inputType)) {
@@ -1584,9 +1584,9 @@ public class VectorizationContext {
     }
     if (inputType.equals("boolean")) {
       // Boolean must come before the integer family. It's a special case.
-      return createVectorExpression(CastBooleanToVarCharViaLongToVarChar.class, childExpr,
Mode.PROJECTION, null);
+      return createVectorExpression(CastBooleanToVarCharViaLongToVarChar.class, childExpr,
Mode.PROJECTION, returnType);
     } else if (isIntFamily(inputType)) {
-      return createVectorExpression(CastLongToVarChar.class, childExpr, Mode.PROJECTION,
null);
+      return createVectorExpression(CastLongToVarChar.class, childExpr, Mode.PROJECTION,
returnType);
     } else if (isDecimalFamily(inputType)) {
       return createVectorExpression(CastDecimalToVarChar.class, childExpr, Mode.PROJECTION,
returnType);
     } else if (isDateFamily(inputType)) {

http://git-wip-us.apache.org/repos/asf/hive/blob/3e73b1e6/ql/src/test/queries/clientpositive/vector_char_cast.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/vector_char_cast.q b/ql/src/test/queries/clientpositive/vector_char_cast.q
new file mode 100644
index 0000000..bc78d51
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/vector_char_cast.q
@@ -0,0 +1,9 @@
+create table s1(id smallint) stored as orc;
+
+insert into table s1 values (1000),(1001),(1002),(1003),(1000);
+
+set hive.vectorized.execution.enabled=true;
+select count(1) from s1 where cast(id as char(4))='1000';
+
+set hive.vectorized.execution.enabled=false;
+select count(1) from s1 where cast(id as char(4))='1000';
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/3e73b1e6/ql/src/test/results/clientpositive/tez/vector_char_cast.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/vector_char_cast.q.out b/ql/src/test/results/clientpositive/tez/vector_char_cast.q.out
new file mode 100644
index 0000000..dbeae74
--- /dev/null
+++ b/ql/src/test/results/clientpositive/tez/vector_char_cast.q.out
@@ -0,0 +1,35 @@
+PREHOOK: query: create table s1(id smallint) stored as orc
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@s1
+POSTHOOK: query: create table s1(id smallint) stored as orc
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@s1
+PREHOOK: query: insert into table s1 values (1000),(1001),(1002),(1003),(1000)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__1
+PREHOOK: Output: default@s1
+POSTHOOK: query: insert into table s1 values (1000),(1001),(1002),(1003),(1000)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__1
+POSTHOOK: Output: default@s1
+POSTHOOK: Lineage: s1.id EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1,
type:string, comment:), ]
+PREHOOK: query: select count(1) from s1 where cast(id as char(4))='1000'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@s1
+#### A masked pattern was here ####
+POSTHOOK: query: select count(1) from s1 where cast(id as char(4))='1000'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@s1
+#### A masked pattern was here ####
+2
+PREHOOK: query: select count(1) from s1 where cast(id as char(4))='1000'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@s1
+#### A masked pattern was here ####
+POSTHOOK: query: select count(1) from s1 where cast(id as char(4))='1000'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@s1
+#### A masked pattern was here ####
+2

http://git-wip-us.apache.org/repos/asf/hive/blob/3e73b1e6/ql/src/test/results/clientpositive/vector_char_cast.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/vector_char_cast.q.out b/ql/src/test/results/clientpositive/vector_char_cast.q.out
new file mode 100644
index 0000000..dbeae74
--- /dev/null
+++ b/ql/src/test/results/clientpositive/vector_char_cast.q.out
@@ -0,0 +1,35 @@
+PREHOOK: query: create table s1(id smallint) stored as orc
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@s1
+POSTHOOK: query: create table s1(id smallint) stored as orc
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@s1
+PREHOOK: query: insert into table s1 values (1000),(1001),(1002),(1003),(1000)
+PREHOOK: type: QUERY
+PREHOOK: Input: default@values__tmp__table__1
+PREHOOK: Output: default@s1
+POSTHOOK: query: insert into table s1 values (1000),(1001),(1002),(1003),(1000)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@values__tmp__table__1
+POSTHOOK: Output: default@s1
+POSTHOOK: Lineage: s1.id EXPRESSION [(values__tmp__table__1)values__tmp__table__1.FieldSchema(name:tmp_values_col1,
type:string, comment:), ]
+PREHOOK: query: select count(1) from s1 where cast(id as char(4))='1000'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@s1
+#### A masked pattern was here ####
+POSTHOOK: query: select count(1) from s1 where cast(id as char(4))='1000'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@s1
+#### A masked pattern was here ####
+2
+PREHOOK: query: select count(1) from s1 where cast(id as char(4))='1000'
+PREHOOK: type: QUERY
+PREHOOK: Input: default@s1
+#### A masked pattern was here ####
+POSTHOOK: query: select count(1) from s1 where cast(id as char(4))='1000'
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@s1
+#### A masked pattern was here ####
+2


Mime
View raw message