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 21:55:52 GMT
Repository: hive
Updated Branches:
  refs/heads/master 57158da63 -> 7be02aec7


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/7be02aec
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/7be02aec
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/7be02aec

Branch: refs/heads/master
Commit: 7be02aec7321d87889c0c06cff040d5fa2200e64
Parents: 57158da
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 14:55:12 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/7be02aec/itests/src/test/resources/testconfiguration.properties
----------------------------------------------------------------------
diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties
index 2851720..0d3e1cc 100644
--- a/itests/src/test/resources/testconfiguration.properties
+++ b/itests/src/test/resources/testconfiguration.properties
@@ -192,6 +192,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/7be02aec/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 34f9329..2483196 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
@@ -1528,7 +1528,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)) {
@@ -1554,9 +1554,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)) {
@@ -1583,9 +1583,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/7be02aec/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/7be02aec/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/7be02aec/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