FAQ
Author: jdere
Date: Tue Dec 9 19:00:25 2014
New Revision: 1644152

URL: http://svn.apache.org/r1644152
Log:
HIVE-9003: Vectorized IF expr broken for the scalar and scalar case (Matt McCline via Jason Dere)

Added:
     hive/trunk/ql/src/test/queries/clientpositive/vector_if_expr.q
     hive/trunk/ql/src/test/results/clientpositive/tez/vector_if_expr.q.out
     hive/trunk/ql/src/test/results/clientpositive/vector_if_expr.q.out
Modified:
     hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/IfExprStringScalarStringScalar.java

Modified: hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/IfExprStringScalarStringScalar.java
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/IfExprStringScalarStringScalar.java?rev=1644152&r1=1644151&r2=1644152&view=diff
==============================================================================
--- hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/IfExprStringScalarStringScalar.java (original)
+++ hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/IfExprStringScalarStringScalar.java Tue Dec 9 19:00:25 2014
@@ -88,7 +88,7 @@ public class IfExprStringScalarStringSca
            if (vector1[i] == 1) {
              outputColVector.setRef(i, arg2Scalar, 0, arg2Scalar.length);
            } else {
- outputColVector.setRef(i, arg3Scalar, 0, arg2Scalar.length);
+ outputColVector.setRef(i, arg3Scalar, 0, arg3Scalar.length);
            }
          }
        } else {
@@ -96,7 +96,7 @@ public class IfExprStringScalarStringSca
            if (vector1[i] == 1) {
              outputColVector.setRef(i, arg2Scalar, 0, arg2Scalar.length);
            } else {
- outputColVector.setRef(i, arg3Scalar, 0, arg2Scalar.length);
+ outputColVector.setRef(i, arg3Scalar, 0, arg3Scalar.length);
            }
          }
        }
@@ -107,7 +107,7 @@ public class IfExprStringScalarStringSca
            if (!arg1ColVector.isNull[i] && vector1[i] == 1) {
              outputColVector.setRef(i, arg2Scalar, 0, arg2Scalar.length);
            } else {
- outputColVector.setRef(i, arg3Scalar, 0, arg2Scalar.length);
+ outputColVector.setRef(i, arg3Scalar, 0, arg3Scalar.length);
            }
          }
        } else {
@@ -115,7 +115,7 @@ public class IfExprStringScalarStringSca
            if (!arg1ColVector.isNull[i] && vector1[i] == 1) {
              outputColVector.setRef(i, arg2Scalar, 0, arg2Scalar.length);
            } else {
- outputColVector.setRef(i, arg3Scalar, 0, arg2Scalar.length);
+ outputColVector.setRef(i, arg3Scalar, 0, arg3Scalar.length);
            }
          }
        }

Added: hive/trunk/ql/src/test/queries/clientpositive/vector_if_expr.q
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/queries/clientpositive/vector_if_expr.q?rev=1644152&view=auto
==============================================================================
--- hive/trunk/ql/src/test/queries/clientpositive/vector_if_expr.q (added)
+++ hive/trunk/ql/src/test/queries/clientpositive/vector_if_expr.q Tue Dec 9 19:00:25 2014
@@ -0,0 +1,9 @@
+SET hive.vectorized.execution.enabled=true;
+set hive.fetch.task.conversion=minimal;
+
+EXPLAIN
+SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1;
+
+SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1 LIMIT 5;
+
+SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND NOT cboolean1 ORDER BY cboolean1 LIMIT 5;
\ No newline at end of file

Added: hive/trunk/ql/src/test/results/clientpositive/tez/vector_if_expr.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/tez/vector_if_expr.q.out?rev=1644152&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/tez/vector_if_expr.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/tez/vector_if_expr.q.out Tue Dec 9 19:00:25 2014
@@ -0,0 +1,82 @@
+PREHOOK: query: EXPLAIN
+SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Tez
+ Edges:
+ Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+ Vertices:
+ Map 1
+ Map Operator Tree:
+ TableScan
+ alias: alltypesorc
+ Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Filter Operator
+ predicate: (cboolean1 is not null and cboolean1) (type: boolean)
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: cboolean1 (type: boolean), if(cboolean1, 'first', 'second') (type: string)
+ outputColumnNames: _col0, _col1
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ Reduce Output Operator
+ key expressions: _col0 (type: boolean)
+ sort order: +
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ value expressions: _col1 (type: string)
+ Execution mode: vectorized
+ Reducer 2
+ Reduce Operator Tree:
+ Select Operator
+ expressions: KEY.reducesinkkey0 (type: boolean), VALUE._col0 (type: string)
+ outputColumnNames: _col0, _col1
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+ Execution mode: vectorized
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1 LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1 LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+true first
+true first
+true first
+true first
+true first
+PREHOOK: query: SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND NOT cboolean1 ORDER BY cboolean1 LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND NOT cboolean1 ORDER BY cboolean1 LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+false second
+false second
+false second
+false second
+false second

Added: hive/trunk/ql/src/test/results/clientpositive/vector_if_expr.q.out
URL: http://svn.apache.org/viewvc/hive/trunk/ql/src/test/results/clientpositive/vector_if_expr.q.out?rev=1644152&view=auto
==============================================================================
--- hive/trunk/ql/src/test/results/clientpositive/vector_if_expr.q.out (added)
+++ hive/trunk/ql/src/test/results/clientpositive/vector_if_expr.q.out Tue Dec 9 19:00:25 2014
@@ -0,0 +1,75 @@
+PREHOOK: query: EXPLAIN
+SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1
+PREHOOK: type: QUERY
+POSTHOOK: query: EXPLAIN
+SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Map Operator Tree:
+ TableScan
+ alias: alltypesorc
+ Statistics: Num rows: 12288 Data size: 377237 Basic stats: COMPLETE Column stats: NONE
+ Filter Operator
+ predicate: (cboolean1 is not null and cboolean1) (type: boolean)
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ Select Operator
+ expressions: cboolean1 (type: boolean), if(cboolean1, 'first', 'second') (type: string)
+ outputColumnNames: _col0, _col1
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ Reduce Output Operator
+ key expressions: _col0 (type: boolean)
+ sort order: +
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ value expressions: _col1 (type: string)
+ Execution mode: vectorized
+ Reduce Operator Tree:
+ Select Operator
+ expressions: KEY.reducesinkkey0 (type: boolean), VALUE._col0 (type: string)
+ outputColumnNames: _col0, _col1
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ File Output Operator
+ compressed: false
+ Statistics: Num rows: 3072 Data size: 94309 Basic stats: COMPLETE Column stats: NONE
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+ Stage: Stage-0
+ Fetch Operator
+ limit: -1
+ Processor Tree:
+ ListSink
+
+PREHOOK: query: SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1 LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND cboolean1 ORDER BY cboolean1 LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+true first
+true first
+true first
+true first
+true first
+PREHOOK: query: SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND NOT cboolean1 ORDER BY cboolean1 LIMIT 5
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT cboolean1, IF (cboolean1, 'first', 'second') FROM alltypesorc WHERE cboolean1 IS NOT NULL AND NOT cboolean1 ORDER BY cboolean1 LIMIT 5
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+false second
+false second
+false second
+false second
+false second

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommits @
categorieshive, hadoop
postedDec 9, '14 at 7:00p
activeDec 9, '14 at 7:00p
posts1
users1
websitehive.apache.org

1 user in discussion

Jdere: 1 post

People

Translate

site design / logo © 2021 Grokbase