You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2018/11/12 18:04:21 UTC

[01/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Repository: hive
Updated Branches:
  refs/heads/master dca389b06 -> 558876462


http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/join_cond_pushdown_3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join_cond_pushdown_3.q.out b/ql/src/test/results/clientpositive/spark/join_cond_pushdown_3.q.out
index 44f9b5d..4190a21 100644
--- a/ql/src/test/results/clientpositive/spark/join_cond_pushdown_3.q.out
+++ b/ql/src/test/results/clientpositive/spark/join_cond_pushdown_3.q.out
@@ -396,14 +396,14 @@ STAGE PLANS:
                     Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                       Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: string)
+                        Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                        value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
             Execution mode: vectorized
         Map 5 
             Map Operator Tree:
@@ -426,13 +426,13 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col1 (type: string)
-                  1 _col1 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17
+                  1 _col0 (type: string)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
                 Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string)
+                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -441,10 +441,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25
                 Statistics: Num rows: 728 Data size: 178830 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col18 (type: int), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: string), _col23 (type: int), _col24 (type: string), _col25 (type: double), _col26 (type: string), 1 (type: int), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                  expressions: _col17 (type: int), _col18 (type: string), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: int), _col23 (type: string), _col24 (type: double), _col25 (type: string), 1 (type: int), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
                   Statistics: Num rows: 728 Data size: 178830 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator


[36/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_2.q.out b/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_2.q.out
index 37970ab..7e09d5e 100644
--- a/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_2.q.out
@@ -51,14 +51,14 @@ STAGE PLANS:
                     predicate: (csmallint < 100S) (type: boolean)
                     Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                      Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col1) (type: int)
+                        key expressions: _col12 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col1) (type: int)
-                        Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col12 (type: int)
+                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -72,14 +72,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToInteger(key) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -92,14 +92,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: (UDFToInteger(key) + 0) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (UDFToInteger(_col0) + 0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (UDFToInteger(_col0) + 0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -110,9 +110,9 @@ STAGE PLANS:
                      Inner Join 0 to 1
                      Inner Join 0 to 2
                 keys:
-                  0 UDFToInteger(_col1) (type: int)
-                  1 UDFToInteger(_col0) (type: int)
-                  2 (UDFToInteger(_col0) + 0) (type: int)
+                  0 _col12 (type: int)
+                  1 _col0 (type: int)
+                  2 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 791 Data size: 6700 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
@@ -251,14 +251,14 @@ STAGE PLANS:
                     predicate: (csmallint < 100S) (type: boolean)
                     Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                      Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col1) (type: int)
+                        key expressions: _col12 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col1) (type: int)
-                        Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col12 (type: int)
+                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -272,14 +272,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToInteger(key) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -292,14 +292,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: (UDFToInteger(key) + 0) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (UDFToInteger(_col0) + 0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (UDFToInteger(_col0) + 0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -310,9 +310,9 @@ STAGE PLANS:
                      Inner Join 0 to 1
                      Inner Join 0 to 2
                 keys:
-                  0 UDFToInteger(_col1) (type: int)
-                  1 UDFToInteger(_col0) (type: int)
-                  2 (UDFToInteger(_col0) + 0) (type: int)
+                  0 _col12 (type: int)
+                  1 _col0 (type: int)
+                  2 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 791 Data size: 6700 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
@@ -451,14 +451,14 @@ STAGE PLANS:
                     predicate: (csmallint < 100S) (type: boolean)
                     Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                      Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col1) (type: int)
+                        key expressions: _col12 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col1) (type: int)
-                        Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col12 (type: int)
+                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -472,14 +472,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToInteger(key) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -492,14 +492,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: (UDFToInteger(key) + 0) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (UDFToInteger(_col0) + 0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (UDFToInteger(_col0) + 0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -510,9 +510,9 @@ STAGE PLANS:
                      Inner Join 0 to 1
                      Inner Join 0 to 2
                 keys:
-                  0 UDFToInteger(_col1) (type: int)
-                  1 UDFToInteger(_col0) (type: int)
-                  2 (UDFToInteger(_col0) + 0) (type: int)
+                  0 _col12 (type: int)
+                  1 _col0 (type: int)
+                  2 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 791 Data size: 6700 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_3.q.out b/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_3.q.out
index 3a0d0a9..8caf6c7 100644
--- a/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_3.q.out
+++ b/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_3.q.out
@@ -35,17 +35,17 @@ STAGE PLANS:
                   alias: a
                   Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean)
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                    Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), (cint < 100) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                    Statistics: Num rows: 12288 Data size: 3142322 Basic stats: COMPLETE Column stats: COMPLETE
                     Limit
                       Number of rows: 1
-                      Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 314 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 314 Basic stats: COMPLETE Column stats: COMPLETE
                         TopN Hash Memory Usage: 0.1
-                        value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
+                        value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
         Map 4 
@@ -54,32 +54,32 @@ STAGE PLANS:
                   alias: b
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: string)
+                    expressions: UDFToInteger(key) (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: UDFToInteger(_col0) (type: int)
+                      key expressions: _col0 (type: int)
                       sort order: +
-                      Map-reduce partition columns: UDFToInteger(_col0) (type: int)
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: int)
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: tinyint), VALUE._col1 (type: smallint), VALUE._col2 (type: int), VALUE._col3 (type: bigint), VALUE._col4 (type: float), VALUE._col5 (type: double), VALUE._col6 (type: string), VALUE._col7 (type: string), VALUE._col8 (type: timestamp), VALUE._col9 (type: timestamp), VALUE._col10 (type: boolean), VALUE._col11 (type: boolean)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                expressions: VALUE._col0 (type: tinyint), VALUE._col1 (type: smallint), VALUE._col2 (type: int), VALUE._col3 (type: bigint), VALUE._col4 (type: float), VALUE._col5 (type: double), VALUE._col6 (type: string), VALUE._col7 (type: string), VALUE._col8 (type: timestamp), VALUE._col9 (type: timestamp), VALUE._col10 (type: boolean), VALUE._col11 (type: boolean), VALUE._col12 (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                Statistics: Num rows: 1 Data size: 314 Basic stats: COMPLETE Column stats: COMPLETE
                 Limit
                   Number of rows: 1
-                  Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 1 Data size: 314 Basic stats: COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col2 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col2 (type: int)
-                    Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
+                    Statistics: Num rows: 1 Data size: 314 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -87,11 +87,11 @@ STAGE PLANS:
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {(KEY.reducesinkkey0 < 100)}
+                  0 {VALUE._col11}
                   1 
                 keys:
                   0 _col2 (type: int)
-                  1 UDFToInteger(_col0) (type: int)
+                  1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 2 Data size: 620 Basic stats: COMPLETE Column stats: COMPLETE
                 Limit
@@ -138,8 +138,7 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE)
-        Reducer 3 <- Map 4 (CUSTOM_SIMPLE_EDGE), Reducer 2 (CUSTOM_SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE), Map 3 (BROADCAST_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -148,79 +147,68 @@ STAGE PLANS:
                   alias: a
                   Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean)
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                    Statistics: Num rows: 12288 Data size: 3093170 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), (cint < 100) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                    Statistics: Num rows: 12288 Data size: 3142322 Basic stats: COMPLETE Column stats: COMPLETE
                     Limit
                       Number of rows: 1
-                      Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 314 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 314 Basic stats: COMPLETE Column stats: COMPLETE
                         TopN Hash Memory Usage: 0.1
-                        value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
+                        value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
-        Map 4 
+        Map 3 
             Map Operator Tree:
                 TableScan
                   alias: b
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: string)
+                    expressions: UDFToInteger(key) (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: UDFToInteger(_col0) (type: int)
+                      key expressions: _col0 (type: int)
                       sort order: +
-                      Map-reduce partition columns: UDFToInteger(_col0) (type: int)
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: int)
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: tinyint), VALUE._col1 (type: smallint), VALUE._col2 (type: int), VALUE._col3 (type: bigint), VALUE._col4 (type: float), VALUE._col5 (type: double), VALUE._col6 (type: string), VALUE._col7 (type: string), VALUE._col8 (type: timestamp), VALUE._col9 (type: timestamp), VALUE._col10 (type: boolean), VALUE._col11 (type: boolean)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                expressions: VALUE._col0 (type: tinyint), VALUE._col1 (type: smallint), VALUE._col2 (type: int), VALUE._col3 (type: bigint), VALUE._col4 (type: float), VALUE._col5 (type: double), VALUE._col6 (type: string), VALUE._col7 (type: string), VALUE._col8 (type: timestamp), VALUE._col9 (type: timestamp), VALUE._col10 (type: boolean), VALUE._col11 (type: boolean), VALUE._col12 (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                Statistics: Num rows: 1 Data size: 314 Basic stats: COMPLETE Column stats: COMPLETE
                 Limit
                   Number of rows: 1
-                  Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col2 (type: int)
-                    sort order: +
-                    Map-reduce partition columns: _col2 (type: int)
-                    Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
-        Reducer 3 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Map Join Operator
-                condition map:
-                     Left Outer Join 0 to 1
-                filter predicates:
-                  0 {(KEY.reducesinkkey0 < 100)}
-                  1 
-                keys:
-                  0 KEY.reducesinkkey0 (type: int)
-                  1 KEY.reducesinkkey0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                input vertices:
-                  1 Map 4
-                Statistics: Num rows: 2 Data size: 620 Basic stats: COMPLETE Column stats: COMPLETE
-                DynamicPartitionHashJoin: true
-                HybridGraceHashJoin: true
-                Limit
-                  Number of rows: 1
-                  Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
-                  File Output Operator
-                    compressed: false
-                    Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  Statistics: Num rows: 1 Data size: 314 Basic stats: COMPLETE Column stats: COMPLETE
+                  Map Join Operator
+                    condition map:
+                         Left Outer Join 0 to 1
+                    filter predicates:
+                      0 {_col12}
+                      1 
+                    keys:
+                      0 _col2 (type: int)
+                      1 _col0 (type: int)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
+                    input vertices:
+                      1 Map 3
+                    Statistics: Num rows: 2 Data size: 620 Basic stats: COMPLETE Column stats: COMPLETE
+                    Limit
+                      Number of rows: 1
+                      Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                      File Output Operator
+                        compressed: false
+                        Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                        table:
+                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -255,8 +243,7 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE)
-        Reducer 3 <- Map 4 (CUSTOM_SIMPLE_EDGE), Reducer 2 (CUSTOM_SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE), Map 3 (BROADCAST_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -278,20 +265,20 @@ STAGE PLANS:
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
-        Map 4 
+        Map 3 
             Map Operator Tree:
                 TableScan
                   alias: b
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: string)
+                    expressions: UDFToInteger(key) (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: UDFToInteger(_col0) (type: int)
+                      key expressions: _col0 (type: int)
                       sort order: +
-                      Map-reduce partition columns: UDFToInteger(_col0) (type: int)
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: int)
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -304,37 +291,26 @@ STAGE PLANS:
                 Limit
                   Number of rows: 1
                   Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col2 (type: int)
-                    sort order: +
-                    Map-reduce partition columns: _col2 (type: int)
-                    Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
-        Reducer 3 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Map Join Operator
-                condition map:
-                     Left Outer Join 0 to 1
-                keys:
-                  0 KEY.reducesinkkey0 (type: int)
-                  1 KEY.reducesinkkey0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                input vertices:
-                  1 Map 4
-                Statistics: Num rows: 2 Data size: 620 Basic stats: COMPLETE Column stats: COMPLETE
-                DynamicPartitionHashJoin: true
-                HybridGraceHashJoin: true
-                Limit
-                  Number of rows: 1
-                  Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
-                  File Output Operator
-                    compressed: false
-                    Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  Map Join Operator
+                    condition map:
+                         Left Outer Join 0 to 1
+                    keys:
+                      0 _col2 (type: int)
+                      1 _col0 (type: int)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
+                    input vertices:
+                      1 Map 3
+                    Statistics: Num rows: 2 Data size: 620 Basic stats: COMPLETE Column stats: COMPLETE
+                    Limit
+                      Number of rows: 1
+                      Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                      File Output Operator
+                        compressed: false
+                        Statistics: Num rows: 1 Data size: 310 Basic stats: COMPLETE Column stats: COMPLETE
+                        table:
+                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/tez_fixed_bucket_pruning.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/tez_fixed_bucket_pruning.q.out b/ql/src/test/results/clientpositive/llap/tez_fixed_bucket_pruning.q.out
index 76fe6ea..1574565 100644
--- a/ql/src/test/results/clientpositive/llap/tez_fixed_bucket_pruning.q.out
+++ b/ql/src/test/results/clientpositive/llap/tez_fixed_bucket_pruning.q.out
@@ -465,16 +465,16 @@ POSTHOOK: Input: default@l3_monthly_dw_dimplan
 #### A masked pattern was here ####
 OPTIMIZED SQL: SELECT CAST(7147200 AS BIGINT) AS `project_object_id`, `t9`.`plan_key`, `t9`.`project_key`
 FROM (SELECT `t4`.`plan_key`, `t6`.`project_key`
-FROM (SELECT `t3`.`l3_snapshot_number`, `t2`.`plan_detail_object_id`, `t2`.`project_object_id`, `t0`.`idp_data_date`, `t0`.`l3_snapshot_number` AS `l3_snapshot_number0`, `t0`.`plan_key`, `t0`.`finplan_detail_object_id`
-FROM (SELECT CAST(DATE '2017-12-28' AS DATE) AS `idp_data_date`, `l3_snapshot_number`, `plan_key`, `finplan_detail_object_id`
+FROM (SELECT `t3`.`l3_snapshot_number`, `t2`.`plan_detail_object_id`, `t0`.`l3_snapshot_number` AS `l3_snapshot_number0`, `t0`.`plan_key`, `t0`.`finplan_detail_object_id`
+FROM (SELECT `l3_snapshot_number`, `plan_key`, `finplan_detail_object_id`
 FROM `default`.`l3_monthly_dw_dimplan`
 WHERE `idp_data_date` = DATE '2017-12-28') AS `t0`
-RIGHT JOIN ((SELECT `plan_detail_object_id`, CAST(7147200 AS BIGINT) AS `project_object_id`
+RIGHT JOIN ((SELECT `plan_detail_object_id`
 FROM `default`.`l3_clarity__l3_monthly_dw_factplan_dw_stg_2018022300104_1`
 WHERE `project_object_id` = 7147200) AS `t2`,
 (SELECT `l3_snapshot_number`
 FROM `default`.`l3_clarity__l3_snap_number_2018022300104`) AS `t3`) ON `t0`.`finplan_detail_object_id` = `t2`.`plan_detail_object_id` AND `t0`.`l3_snapshot_number` = `t3`.`l3_snapshot_number`) AS `t4`
-LEFT JOIN (SELECT `project_key`, `l3_snapshot_number`, CAST(7147200 AS BIGINT) AS `project_object_id`, CAST(DATE '2017-12-28' AS DATE) AS `idp_data_date`
+LEFT JOIN (SELECT `project_key`, `l3_snapshot_number`
 FROM `default`.`l3_clarity__l3_monthly_dw_factplan_datajoin_1_s2_2018022300104_1`
 WHERE `idp_data_date` = DATE '2017-12-28' AND `project_object_id` = 7147200) AS `t6` ON `t4`.`l3_snapshot_number` = `t6`.`l3_snapshot_number`
 ORDER BY `t4`.`plan_key`, `t6`.`project_key`
@@ -506,7 +506,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: plan_detail_object_id (type: bigint)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 15 Data size: 240 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 15 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
@@ -514,7 +514,7 @@ STAGE PLANS:
                         keys:
                           0 
                           1 
-                        outputColumnNames: _col0, _col2
+                        outputColumnNames: _col0, _col1
                         input vertices:
                           1 Map 3
                         Position of Big Table: 0
@@ -524,16 +524,16 @@ STAGE PLANS:
                                Left Outer Join 0 to 1
                           Estimated key counts: Map 4 => 90170
                           keys:
-                            0 _col2 (type: bigint), _col0 (type: bigint)
-                            1 _col1 (type: bigint), _col3 (type: bigint)
-                          outputColumnNames: _col2, _col5
+                            0 _col1 (type: bigint), _col0 (type: bigint)
+                            1 _col0 (type: bigint), _col2 (type: bigint)
+                          outputColumnNames: _col1, _col3
                           input vertices:
                             1 Map 4
                           Position of Big Table: 0
                           Statistics: Num rows: 30 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                           Select Operator
-                            expressions: _col2 (type: bigint), _col5 (type: bigint)
-                            outputColumnNames: _col0, _col5
+                            expressions: _col1 (type: bigint), _col3 (type: bigint)
+                            outputColumnNames: _col0, _col3
                             Statistics: Num rows: 30 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                             Map Join Operator
                               condition map:
@@ -542,13 +542,13 @@ STAGE PLANS:
                               keys:
                                 0 _col0 (type: bigint)
                                 1 _col1 (type: bigint)
-                              outputColumnNames: _col5, _col7
+                              outputColumnNames: _col3, _col5
                               input vertices:
                                 1 Map 5
                               Position of Big Table: 0
                               Statistics: Num rows: 30 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                               Select Operator
-                                expressions: _col5 (type: bigint), _col7 (type: bigint)
+                                expressions: _col3 (type: bigint), _col5 (type: bigint)
                                 outputColumnNames: _col0, _col1
                                 Statistics: Num rows: 30 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                                 Reduce Output Operator
@@ -700,16 +700,16 @@ STAGE PLANS:
                     Statistics: Num rows: 90170 Data size: 7213600 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: l3_snapshot_number (type: bigint), plan_key (type: bigint), finplan_detail_object_id (type: bigint)
-                      outputColumnNames: _col1, _col2, _col3
-                      Statistics: Num rows: 90170 Data size: 7213600 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 90170 Data size: 2164080 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col1 (type: bigint), _col3 (type: bigint)
+                        key expressions: _col0 (type: bigint), _col2 (type: bigint)
                         null sort order: aa
                         sort order: ++
-                        Map-reduce partition columns: _col1 (type: bigint), _col3 (type: bigint)
-                        Statistics: Num rows: 90170 Data size: 7213600 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: bigint), _col2 (type: bigint)
+                        Statistics: Num rows: 90170 Data size: 2164080 Basic stats: COMPLETE Column stats: COMPLETE
                         tag: 1
-                        value expressions: _col2 (type: bigint)
+                        value expressions: _col1 (type: bigint)
                         auto parallelism: true
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -782,13 +782,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: project_key (type: bigint), l3_snapshot_number (type: bigint)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: bigint)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col1 (type: bigint)
-                        Statistics: Num rows: 1 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                         tag: 1
                         value expressions: _col0 (type: bigint)
                         auto parallelism: true
@@ -974,16 +974,16 @@ POSTHOOK: Input: default@l3_monthly_dw_dimplan
 #### A masked pattern was here ####
 OPTIMIZED SQL: SELECT CAST(7147200 AS BIGINT) AS `project_object_id`, `t9`.`plan_key`, `t9`.`project_key`
 FROM (SELECT `t4`.`plan_key`, `t6`.`project_key`
-FROM (SELECT `t3`.`l3_snapshot_number`, `t2`.`plan_detail_object_id`, `t2`.`project_object_id`, `t0`.`idp_data_date`, `t0`.`l3_snapshot_number` AS `l3_snapshot_number0`, `t0`.`plan_key`, `t0`.`finplan_detail_object_id`
-FROM (SELECT CAST(DATE '2017-12-28' AS DATE) AS `idp_data_date`, `l3_snapshot_number`, `plan_key`, `finplan_detail_object_id`
+FROM (SELECT `t3`.`l3_snapshot_number`, `t2`.`plan_detail_object_id`, `t0`.`l3_snapshot_number` AS `l3_snapshot_number0`, `t0`.`plan_key`, `t0`.`finplan_detail_object_id`
+FROM (SELECT `l3_snapshot_number`, `plan_key`, `finplan_detail_object_id`
 FROM `default`.`l3_monthly_dw_dimplan`
 WHERE `idp_data_date` = DATE '2017-12-28') AS `t0`
-RIGHT JOIN ((SELECT `plan_detail_object_id`, CAST(7147200 AS BIGINT) AS `project_object_id`
+RIGHT JOIN ((SELECT `plan_detail_object_id`
 FROM `default`.`l3_clarity__l3_monthly_dw_factplan_dw_stg_2018022300104_1`
 WHERE `project_object_id` = 7147200) AS `t2`,
 (SELECT `l3_snapshot_number`
 FROM `default`.`l3_clarity__l3_snap_number_2018022300104`) AS `t3`) ON `t0`.`finplan_detail_object_id` = `t2`.`plan_detail_object_id` AND `t0`.`l3_snapshot_number` = `t3`.`l3_snapshot_number`) AS `t4`
-LEFT JOIN (SELECT `project_key`, `l3_snapshot_number`, CAST(7147200 AS BIGINT) AS `project_object_id`, CAST(DATE '2017-12-28' AS DATE) AS `idp_data_date`
+LEFT JOIN (SELECT `project_key`, `l3_snapshot_number`
 FROM `default`.`l3_clarity__l3_monthly_dw_factplan_datajoin_1_s2_2018022300104_1`
 WHERE `idp_data_date` = DATE '2017-12-28' AND `project_object_id` = 7147200) AS `t6` ON `t4`.`l3_snapshot_number` = `t6`.`l3_snapshot_number`
 ORDER BY `t4`.`plan_key`, `t6`.`project_key`
@@ -1015,7 +1015,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: plan_detail_object_id (type: bigint)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 15 Data size: 240 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 15 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
@@ -1023,7 +1023,7 @@ STAGE PLANS:
                         keys:
                           0 
                           1 
-                        outputColumnNames: _col0, _col2
+                        outputColumnNames: _col0, _col1
                         input vertices:
                           1 Map 3
                         Position of Big Table: 0
@@ -1033,16 +1033,16 @@ STAGE PLANS:
                                Left Outer Join 0 to 1
                           Estimated key counts: Map 4 => 90170
                           keys:
-                            0 _col2 (type: bigint), _col0 (type: bigint)
-                            1 _col1 (type: bigint), _col3 (type: bigint)
-                          outputColumnNames: _col2, _col5
+                            0 _col1 (type: bigint), _col0 (type: bigint)
+                            1 _col0 (type: bigint), _col2 (type: bigint)
+                          outputColumnNames: _col1, _col3
                           input vertices:
                             1 Map 4
                           Position of Big Table: 0
                           Statistics: Num rows: 30 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                           Select Operator
-                            expressions: _col2 (type: bigint), _col5 (type: bigint)
-                            outputColumnNames: _col0, _col5
+                            expressions: _col1 (type: bigint), _col3 (type: bigint)
+                            outputColumnNames: _col0, _col3
                             Statistics: Num rows: 30 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                             Map Join Operator
                               condition map:
@@ -1051,13 +1051,13 @@ STAGE PLANS:
                               keys:
                                 0 _col0 (type: bigint)
                                 1 _col1 (type: bigint)
-                              outputColumnNames: _col5, _col7
+                              outputColumnNames: _col3, _col5
                               input vertices:
                                 1 Map 5
                               Position of Big Table: 0
                               Statistics: Num rows: 30 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                               Select Operator
-                                expressions: _col5 (type: bigint), _col7 (type: bigint)
+                                expressions: _col3 (type: bigint), _col5 (type: bigint)
                                 outputColumnNames: _col0, _col1
                                 Statistics: Num rows: 30 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                                 Reduce Output Operator
@@ -1210,16 +1210,16 @@ STAGE PLANS:
                     Statistics: Num rows: 90170 Data size: 7213600 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: l3_snapshot_number (type: bigint), plan_key (type: bigint), finplan_detail_object_id (type: bigint)
-                      outputColumnNames: _col1, _col2, _col3
-                      Statistics: Num rows: 90170 Data size: 7213600 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 90170 Data size: 2164080 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col1 (type: bigint), _col3 (type: bigint)
+                        key expressions: _col0 (type: bigint), _col2 (type: bigint)
                         null sort order: aa
                         sort order: ++
-                        Map-reduce partition columns: _col1 (type: bigint), _col3 (type: bigint)
-                        Statistics: Num rows: 90170 Data size: 7213600 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: bigint), _col2 (type: bigint)
+                        Statistics: Num rows: 90170 Data size: 2164080 Basic stats: COMPLETE Column stats: COMPLETE
                         tag: 1
-                        value expressions: _col2 (type: bigint)
+                        value expressions: _col1 (type: bigint)
                         auto parallelism: true
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -1292,13 +1292,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: project_key (type: bigint), l3_snapshot_number (type: bigint)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: bigint)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col1 (type: bigint)
-                        Statistics: Num rows: 1 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                         tag: 1
                         value expressions: _col0 (type: bigint)
                         auto parallelism: true

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/tez_self_join.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/tez_self_join.q.out b/ql/src/test/results/clientpositive/llap/tez_self_join.q.out
index c8bde87..fafd5b8 100644
--- a/ql/src/test/results/clientpositive/llap/tez_self_join.q.out
+++ b/ql/src/test/results/clientpositive/llap/tez_self_join.q.out
@@ -115,14 +115,14 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 176 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: id1 (type: int), id3 (type: string)
-                      outputColumnNames: _col0, _col2
-                      Statistics: Num rows: 1 Data size: 176 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 1 Data size: 90 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 176 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col2 (type: string)
+                        Statistics: Num rows: 1 Data size: 90 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col1 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -150,12 +150,12 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3
+                outputColumnNames: _col2
                 Statistics: Num rows: 1 Data size: 86 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 86 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col3 (type: string)
+                  value expressions: _col2 (type: string)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -165,10 +165,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col3
+                outputColumnNames: _col2
                 Statistics: Num rows: 1 Data size: 86 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: 'ab' (type: string), _col3 (type: string)
+                  expressions: 'ab' (type: string), _col2 (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 172 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/tez_vector_dynpart_hashjoin_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/tez_vector_dynpart_hashjoin_2.q.out b/ql/src/test/results/clientpositive/llap/tez_vector_dynpart_hashjoin_2.q.out
index 37970ab..7e09d5e 100644
--- a/ql/src/test/results/clientpositive/llap/tez_vector_dynpart_hashjoin_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/tez_vector_dynpart_hashjoin_2.q.out
@@ -51,14 +51,14 @@ STAGE PLANS:
                     predicate: (csmallint < 100S) (type: boolean)
                     Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                      Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col1) (type: int)
+                        key expressions: _col12 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col1) (type: int)
-                        Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col12 (type: int)
+                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -72,14 +72,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToInteger(key) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -92,14 +92,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: (UDFToInteger(key) + 0) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (UDFToInteger(_col0) + 0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (UDFToInteger(_col0) + 0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -110,9 +110,9 @@ STAGE PLANS:
                      Inner Join 0 to 1
                      Inner Join 0 to 2
                 keys:
-                  0 UDFToInteger(_col1) (type: int)
-                  1 UDFToInteger(_col0) (type: int)
-                  2 (UDFToInteger(_col0) + 0) (type: int)
+                  0 _col12 (type: int)
+                  1 _col0 (type: int)
+                  2 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 791 Data size: 6700 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
@@ -251,14 +251,14 @@ STAGE PLANS:
                     predicate: (csmallint < 100S) (type: boolean)
                     Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                      Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col1) (type: int)
+                        key expressions: _col12 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col1) (type: int)
-                        Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col12 (type: int)
+                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -272,14 +272,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToInteger(key) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -292,14 +292,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: (UDFToInteger(key) + 0) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (UDFToInteger(_col0) + 0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (UDFToInteger(_col0) + 0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -310,9 +310,9 @@ STAGE PLANS:
                      Inner Join 0 to 1
                      Inner Join 0 to 2
                 keys:
-                  0 UDFToInteger(_col1) (type: int)
-                  1 UDFToInteger(_col0) (type: int)
-                  2 (UDFToInteger(_col0) + 0) (type: int)
+                  0 _col12 (type: int)
+                  1 _col0 (type: int)
+                  2 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 791 Data size: 6700 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
@@ -451,14 +451,14 @@ STAGE PLANS:
                     predicate: (csmallint < 100S) (type: boolean)
                     Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
-                      Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), UDFToInteger(csmallint) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                      Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col1) (type: int)
+                        key expressions: _col12 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col1) (type: int)
-                        Statistics: Num rows: 4096 Data size: 1031250 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col12 (type: int)
+                        Statistics: Num rows: 4096 Data size: 1043486 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -472,14 +472,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToInteger(key) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToInteger(_col0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: UDFToInteger(_col0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -492,14 +492,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: (UDFToInteger(key) + 0) (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (UDFToInteger(_col0) + 0) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (UDFToInteger(_col0) + 0) (type: int)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -510,9 +510,9 @@ STAGE PLANS:
                      Inner Join 0 to 1
                      Inner Join 0 to 2
                 keys:
-                  0 UDFToInteger(_col1) (type: int)
-                  1 UDFToInteger(_col0) (type: int)
-                  2 (UDFToInteger(_col0) + 0) (type: int)
+                  0 _col12 (type: int)
+                  1 _col0 (type: int)
+                  2 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 791 Data size: 6700 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator


[31/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/masking_3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/masking_3.q.out b/ql/src/test/results/clientpositive/masking_3.q.out
index 15a8963..725d905 100644
--- a/ql/src/test/results/clientpositive/masking_3.q.out
+++ b/ql/src/test/results/clientpositive/masking_3.q.out
@@ -54,12 +54,16 @@ STAGE PLANS:
           mode: mergepartial
           outputColumnNames: _col0
           Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -72,20 +76,20 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col1 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col1 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string)
           TableScan
             Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
+              key expressions: _col1 (type: double)
               sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Map-reduce partition columns: _col1 (type: double)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: int)
       Reduce Operator Tree:
@@ -93,21 +97,25 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1
+            0 _col1 (type: double)
+            1 _col1 (type: double)
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Group By Operator
-            keys: _col0 (type: string), _col1 (type: int)
-            mode: hash
+          Select Operator
+            expressions: _col0 (type: string), _col2 (type: int)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            Group By Operator
+              keys: _col0 (type: string), _col1 (type: int)
+              mode: hash
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-1
     Map Reduce
@@ -712,12 +720,16 @@ STAGE PLANS:
           mode: mergepartial
           outputColumnNames: _col0
           Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -730,20 +742,20 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col1 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col1 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string)
           TableScan
             Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
+              key expressions: _col1 (type: double)
               sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Map-reduce partition columns: _col1 (type: double)
               Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: int)
       Reduce Operator Tree:
@@ -751,21 +763,25 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1
+            0 _col1 (type: double)
+            1 _col1 (type: double)
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Group By Operator
-            keys: _col0 (type: string), _col1 (type: int)
-            mode: hash
+          Select Operator
+            expressions: _col0 (type: string), _col2 (type: int)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            Group By Operator
+              keys: _col0 (type: string), _col1 (type: int)
+              mode: hash
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-1
     Map Reduce
@@ -1367,12 +1383,16 @@ STAGE PLANS:
           mode: mergepartial
           outputColumnNames: _col0
           Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -1385,20 +1405,20 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col1 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col1 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string)
           TableScan
             Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
+              key expressions: _col1 (type: double)
               sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Map-reduce partition columns: _col1 (type: double)
               Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: int)
       Reduce Operator Tree:
@@ -1406,21 +1426,25 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1
+            0 _col1 (type: double)
+            1 _col1 (type: double)
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Group By Operator
-            keys: _col0 (type: string), _col1 (type: int)
-            mode: hash
+          Select Operator
+            expressions: _col0 (type: string), _col2 (type: int)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            Group By Operator
+              keys: _col0 (type: string), _col1 (type: int)
+              mode: hash
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-1
     Map Reduce
@@ -2021,12 +2045,16 @@ STAGE PLANS:
           mode: mergepartial
           outputColumnNames: _col0
           Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -2039,20 +2067,20 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col1 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col1 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string)
           TableScan
             Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
+              key expressions: _col1 (type: double)
               sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Map-reduce partition columns: _col1 (type: double)
               Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: int)
       Reduce Operator Tree:
@@ -2060,21 +2088,25 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1
+            0 _col1 (type: double)
+            1 _col1 (type: double)
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Group By Operator
-            keys: _col0 (type: string), _col1 (type: int)
-            mode: hash
+          Select Operator
+            expressions: _col0 (type: string), _col2 (type: int)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            Group By Operator
+              keys: _col0 (type: string), _col1 (type: int)
+              mode: hash
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-1
     Map Reduce
@@ -2659,9 +2691,9 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 STAGE DEPENDENCIES:
   Stage-4 is a root stage
   Stage-3 depends on stages: Stage-4
-  Stage-1 depends on stages: Stage-3
-  Stage-2 depends on stages: Stage-1
-  Stage-0 depends on stages: Stage-2
+  Stage-2 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
+  Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
   Stage: Stage-4
@@ -2691,12 +2723,16 @@ STAGE PLANS:
           mode: mergepartial
           outputColumnNames: _col0
           Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-3
     Map Reduce
@@ -2709,20 +2745,20 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col1 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col1 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string)
           TableScan
             Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
+              key expressions: _col1 (type: double)
               sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Map-reduce partition columns: _col1 (type: double)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: int)
       Reduce Operator Tree:
@@ -2730,23 +2766,27 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1
+            0 _col1 (type: double)
+            1 _col1 (type: double)
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Group By Operator
-            keys: _col0 (type: string), _col1 (type: int)
-            mode: hash
+          Select Operator
+            expressions: _col0 (type: string), _col2 (type: int)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            Group By Operator
+              keys: _col0 (type: string), _col1 (type: int)
+              mode: hash
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-1
+  Stage: Stage-2
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -2781,24 +2821,21 @@ STAGE PLANS:
             1 UDFToDouble(_col0) (type: double), _col1 (type: int)
           outputColumnNames: _col0, _col1
           Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: string), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1, _col2
+            Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-2
+  Stage: Stage-1
     Map Reduce
       Map Operator Tree:
           TableScan
-            Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
-              sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-              Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: int), _col1 (type: string)
-          TableScan
             alias: srcpart
             filterExpr: key is not null (type: boolean)
             Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE
@@ -2806,31 +2843,42 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string), ds (type: string), hr (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                expressions: key (type: string), value (type: string), ds (type: string), hr (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col4 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col4 (type: double)
                   Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+          TableScan
+            Reduce Output Operator
+              key expressions: _col2 (type: double)
+              sort order: +
+              Map-reduce partition columns: _col2 (type: double)
+              Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
+              value expressions: _col0 (type: int), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+            0 _col4 (type: double)
+            1 _col2 (type: double)
+          outputColumnNames: _col0, _col1, _col2, _col3, _col5, _col6
           Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col5 (type: int), _col6 (type: string), _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -2859,40 +2907,40 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 #### A masked pattern was here ####
 0	val_0	0	val_0	2008-04-09	12
+0	val_0	0	val_0	2008-04-09	12
+0	val_0	0	val_0	2008-04-09	12
 0	val_0	0	val_0	2008-04-08	11
-0	val_0	0	val_0	2008-04-09	11
 0	val_0	0	val_0	2008-04-08	11
-0	val_0	0	val_0	2008-04-09	12
-0	val_0	0	val_0	2008-04-08	12
-0	val_0	0	val_0	2008-04-08	12
 0	val_0	0	val_0	2008-04-08	11
 0	val_0	0	val_0	2008-04-09	11
-0	val_0	0	val_0	2008-04-08	12
 0	val_0	0	val_0	2008-04-09	11
-0	val_0	0	val_0	2008-04-09	12
-0	val_0	0	val_0	2008-04-09	12
-0	val_0	0	val_0	2008-04-08	11
 0	val_0	0	val_0	2008-04-09	11
 0	val_0	0	val_0	2008-04-08	11
+0	val_0	0	val_0	2008-04-08	11
+0	val_0	0	val_0	2008-04-08	11
+0	val_0	0	val_0	2008-04-09	12
 0	val_0	0	val_0	2008-04-09	12
+0	val_0	0	val_0	2008-04-09	12
+0	val_0	0	val_0	2008-04-08	12
+0	val_0	0	val_0	2008-04-08	12
+0	val_0	0	val_0	2008-04-08	12
 0	val_0	0	val_0	2008-04-08	12
 0	val_0	0	val_0	2008-04-08	12
+0	val_0	0	val_0	2008-04-08	12
+0	val_0	0	val_0	2008-04-08	11
+0	val_0	0	val_0	2008-04-08	11
 0	val_0	0	val_0	2008-04-08	11
 0	val_0	0	val_0	2008-04-09	11
-0	val_0	0	val_0	2008-04-08	12
 0	val_0	0	val_0	2008-04-09	11
-0	val_0	0	val_0	2008-04-09	12
-0	val_0	0	val_0	2008-04-09	12
-0	val_0	0	val_0	2008-04-08	11
 0	val_0	0	val_0	2008-04-09	11
-0	val_0	0	val_0	2008-04-08	11
-0	val_0	0	val_0	2008-04-09	12
 0	val_0	0	val_0	2008-04-08	12
 0	val_0	0	val_0	2008-04-08	12
-0	val_0	0	val_0	2008-04-08	11
-0	val_0	0	val_0	2008-04-09	11
 0	val_0	0	val_0	2008-04-08	12
 0	val_0	0	val_0	2008-04-09	11
+0	val_0	0	val_0	2008-04-09	11
+0	val_0	0	val_0	2008-04-09	11
+0	val_0	0	val_0	2008-04-09	12
+0	val_0	0	val_0	2008-04-09	12
 0	val_0	0	val_0	2008-04-09	12
 2	val_2	2	val_2	2008-04-09	11
 2	val_2	2	val_2	2008-04-08	11
@@ -2903,40 +2951,40 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 4	val_4	4	val_4	2008-04-08	11
 4	val_4	4	val_4	2008-04-09	11
 5	val_5	5	val_5	2008-04-08	11
-5	val_5	5	val_5	2008-04-09	12
-5	val_5	5	val_5	2008-04-08	12
 5	val_5	5	val_5	2008-04-08	11
 5	val_5	5	val_5	2008-04-08	11
 5	val_5	5	val_5	2008-04-09	12
-5	val_5	5	val_5	2008-04-08	12
-5	val_5	5	val_5	2008-04-09	11
-5	val_5	5	val_5	2008-04-09	11
-5	val_5	5	val_5	2008-04-09	11
-5	val_5	5	val_5	2008-04-08	12
 5	val_5	5	val_5	2008-04-09	12
-5	val_5	5	val_5	2008-04-08	11
 5	val_5	5	val_5	2008-04-09	12
 5	val_5	5	val_5	2008-04-08	12
-5	val_5	5	val_5	2008-04-08	11
-5	val_5	5	val_5	2008-04-08	11
-5	val_5	5	val_5	2008-04-09	12
 5	val_5	5	val_5	2008-04-08	12
-5	val_5	5	val_5	2008-04-09	11
-5	val_5	5	val_5	2008-04-09	11
-5	val_5	5	val_5	2008-04-09	11
 5	val_5	5	val_5	2008-04-08	12
-5	val_5	5	val_5	2008-04-09	12
 5	val_5	5	val_5	2008-04-08	11
-5	val_5	5	val_5	2008-04-09	12
-5	val_5	5	val_5	2008-04-08	12
 5	val_5	5	val_5	2008-04-08	11
 5	val_5	5	val_5	2008-04-08	11
+5	val_5	5	val_5	2008-04-08	11
+5	val_5	5	val_5	2008-04-08	11
+5	val_5	5	val_5	2008-04-08	11
+5	val_5	5	val_5	2008-04-09	12
 5	val_5	5	val_5	2008-04-09	12
+5	val_5	5	val_5	2008-04-09	12
+5	val_5	5	val_5	2008-04-08	12
 5	val_5	5	val_5	2008-04-08	12
+5	val_5	5	val_5	2008-04-08	12
+5	val_5	5	val_5	2008-04-09	11
+5	val_5	5	val_5	2008-04-09	11
+5	val_5	5	val_5	2008-04-09	11
+5	val_5	5	val_5	2008-04-09	11
+5	val_5	5	val_5	2008-04-09	11
 5	val_5	5	val_5	2008-04-09	11
 5	val_5	5	val_5	2008-04-09	11
 5	val_5	5	val_5	2008-04-09	11
+5	val_5	5	val_5	2008-04-09	11
+5	val_5	5	val_5	2008-04-08	12
 5	val_5	5	val_5	2008-04-08	12
+5	val_5	5	val_5	2008-04-08	12
+5	val_5	5	val_5	2008-04-09	12
+5	val_5	5	val_5	2008-04-09	12
 5	val_5	5	val_5	2008-04-09	12
 8	val_8	8	val_8	2008-04-08	11
 8	val_8	8	val_8	2008-04-09	11
@@ -2955,56 +3003,56 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 11	val_11	11	val_11	2008-04-08	12
 11	val_11	11	val_11	2008-04-08	11
 12	val_12	12	val_12	2008-04-09	12
+12	val_12	12	val_12	2008-04-09	12
 12	val_12	12	val_12	2008-04-08	11
-12	val_12	12	val_12	2008-04-09	11
-12	val_12	12	val_12	2008-04-08	12
 12	val_12	12	val_12	2008-04-08	11
-12	val_12	12	val_12	2008-04-08	12
 12	val_12	12	val_12	2008-04-09	11
-12	val_12	12	val_12	2008-04-09	12
-12	val_12	12	val_12	2008-04-09	12
-12	val_12	12	val_12	2008-04-08	11
 12	val_12	12	val_12	2008-04-09	11
 12	val_12	12	val_12	2008-04-08	12
+12	val_12	12	val_12	2008-04-08	12
+12	val_12	12	val_12	2008-04-08	11
 12	val_12	12	val_12	2008-04-08	11
 12	val_12	12	val_12	2008-04-08	12
+12	val_12	12	val_12	2008-04-08	12
+12	val_12	12	val_12	2008-04-09	11
 12	val_12	12	val_12	2008-04-09	11
 12	val_12	12	val_12	2008-04-09	12
+12	val_12	12	val_12	2008-04-09	12
+15	val_15	15	val_15	2008-04-08	12
 15	val_15	15	val_15	2008-04-08	12
 15	val_15	15	val_15	2008-04-08	11
+15	val_15	15	val_15	2008-04-08	11
 15	val_15	15	val_15	2008-04-09	12
 15	val_15	15	val_15	2008-04-09	12
-15	val_15	15	val_15	2008-04-09	11
-15	val_15	15	val_15	2008-04-08	11
-15	val_15	15	val_15	2008-04-09	11
-15	val_15	15	val_15	2008-04-08	12
-15	val_15	15	val_15	2008-04-08	12
-15	val_15	15	val_15	2008-04-08	11
 15	val_15	15	val_15	2008-04-09	12
 15	val_15	15	val_15	2008-04-09	12
 15	val_15	15	val_15	2008-04-09	11
+15	val_15	15	val_15	2008-04-09	11
 15	val_15	15	val_15	2008-04-08	11
+15	val_15	15	val_15	2008-04-08	11
+15	val_15	15	val_15	2008-04-09	11
 15	val_15	15	val_15	2008-04-09	11
 15	val_15	15	val_15	2008-04-08	12
+15	val_15	15	val_15	2008-04-08	12
 17	val_17	17	val_17	2008-04-09	11
 17	val_17	17	val_17	2008-04-09	12
 17	val_17	17	val_17	2008-04-08	12
 17	val_17	17	val_17	2008-04-08	11
 18	val_18	18	val_18	2008-04-08	12
 18	val_18	18	val_18	2008-04-08	12
+18	val_18	18	val_18	2008-04-08	12
+18	val_18	18	val_18	2008-04-08	12
+18	val_18	18	val_18	2008-04-08	11
 18	val_18	18	val_18	2008-04-08	11
 18	val_18	18	val_18	2008-04-09	12
 18	val_18	18	val_18	2008-04-09	12
-18	val_18	18	val_18	2008-04-09	11
-18	val_18	18	val_18	2008-04-09	11
-18	val_18	18	val_18	2008-04-08	11
-18	val_18	18	val_18	2008-04-08	12
-18	val_18	18	val_18	2008-04-08	12
-18	val_18	18	val_18	2008-04-08	11
 18	val_18	18	val_18	2008-04-09	12
 18	val_18	18	val_18	2008-04-09	12
 18	val_18	18	val_18	2008-04-09	11
 18	val_18	18	val_18	2008-04-09	11
+18	val_18	18	val_18	2008-04-09	11
+18	val_18	18	val_18	2008-04-09	11
+18	val_18	18	val_18	2008-04-08	11
 18	val_18	18	val_18	2008-04-08	11
 19	val_19	19	val_19	2008-04-09	11
 19	val_19	19	val_19	2008-04-09	12
@@ -3015,36 +3063,36 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 20	val_20	20	val_20	2008-04-08	12
 20	val_20	20	val_20	2008-04-09	12
 24	val_24	24	val_24	2008-04-09	12
+24	val_24	24	val_24	2008-04-09	12
 24	val_24	24	val_24	2008-04-08	11
 24	val_24	24	val_24	2008-04-08	11
-24	val_24	24	val_24	2008-04-09	12
-24	val_24	24	val_24	2008-04-08	12
-24	val_24	24	val_24	2008-04-08	12
-24	val_24	24	val_24	2008-04-09	11
-24	val_24	24	val_24	2008-04-09	11
-24	val_24	24	val_24	2008-04-09	12
 24	val_24	24	val_24	2008-04-08	11
 24	val_24	24	val_24	2008-04-08	11
 24	val_24	24	val_24	2008-04-09	12
+24	val_24	24	val_24	2008-04-09	12
+24	val_24	24	val_24	2008-04-08	12
 24	val_24	24	val_24	2008-04-08	12
 24	val_24	24	val_24	2008-04-08	12
+24	val_24	24	val_24	2008-04-08	12
+24	val_24	24	val_24	2008-04-09	11
+24	val_24	24	val_24	2008-04-09	11
 24	val_24	24	val_24	2008-04-09	11
 24	val_24	24	val_24	2008-04-09	11
 26	val_26	26	val_26	2008-04-09	12
-26	val_26	26	val_26	2008-04-08	11
-26	val_26	26	val_26	2008-04-09	11
 26	val_26	26	val_26	2008-04-09	12
-26	val_26	26	val_26	2008-04-09	11
-26	val_26	26	val_26	2008-04-08	12
-26	val_26	26	val_26	2008-04-08	12
 26	val_26	26	val_26	2008-04-08	11
-26	val_26	26	val_26	2008-04-09	12
 26	val_26	26	val_26	2008-04-08	11
 26	val_26	26	val_26	2008-04-09	11
+26	val_26	26	val_26	2008-04-09	11
 26	val_26	26	val_26	2008-04-09	12
+26	val_26	26	val_26	2008-04-09	12
+26	val_26	26	val_26	2008-04-09	11
 26	val_26	26	val_26	2008-04-09	11
 26	val_26	26	val_26	2008-04-08	12
 26	val_26	26	val_26	2008-04-08	12
+26	val_26	26	val_26	2008-04-08	12
+26	val_26	26	val_26	2008-04-08	12
+26	val_26	26	val_26	2008-04-08	11
 26	val_26	26	val_26	2008-04-08	11
 27	val_27	27	val_27	2008-04-09	12
 27	val_27	27	val_27	2008-04-09	11
@@ -3067,77 +3115,77 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 34	val_34	34	val_34	2008-04-08	11
 34	val_34	34	val_34	2008-04-08	12
 35	val_35	35	val_35	2008-04-09	12
+35	val_35	35	val_35	2008-04-09	12
+35	val_35	35	val_35	2008-04-09	12
 35	val_35	35	val_35	2008-04-08	12
-35	val_35	35	val_35	2008-04-09	11
-35	val_35	35	val_35	2008-04-08	11
 35	val_35	35	val_35	2008-04-08	12
 35	val_35	35	val_35	2008-04-08	12
 35	val_35	35	val_35	2008-04-09	11
-35	val_35	35	val_35	2008-04-09	12
-35	val_35	35	val_35	2008-04-08	11
-35	val_35	35	val_35	2008-04-08	11
-35	val_35	35	val_35	2008-04-09	12
 35	val_35	35	val_35	2008-04-09	11
-35	val_35	35	val_35	2008-04-09	12
-35	val_35	35	val_35	2008-04-08	12
 35	val_35	35	val_35	2008-04-09	11
 35	val_35	35	val_35	2008-04-08	11
-35	val_35	35	val_35	2008-04-08	12
-35	val_35	35	val_35	2008-04-08	12
-35	val_35	35	val_35	2008-04-09	11
-35	val_35	35	val_35	2008-04-09	12
 35	val_35	35	val_35	2008-04-08	11
 35	val_35	35	val_35	2008-04-08	11
-35	val_35	35	val_35	2008-04-09	12
-35	val_35	35	val_35	2008-04-09	11
-35	val_35	35	val_35	2008-04-09	12
 35	val_35	35	val_35	2008-04-08	12
-35	val_35	35	val_35	2008-04-09	11
-35	val_35	35	val_35	2008-04-08	11
 35	val_35	35	val_35	2008-04-08	12
 35	val_35	35	val_35	2008-04-08	12
+35	val_35	35	val_35	2008-04-08	12
+35	val_35	35	val_35	2008-04-08	12
+35	val_35	35	val_35	2008-04-08	12
+35	val_35	35	val_35	2008-04-09	11
 35	val_35	35	val_35	2008-04-09	11
+35	val_35	35	val_35	2008-04-09	11
+35	val_35	35	val_35	2008-04-09	12
 35	val_35	35	val_35	2008-04-09	12
+35	val_35	35	val_35	2008-04-09	12
+35	val_35	35	val_35	2008-04-08	11
 35	val_35	35	val_35	2008-04-08	11
 35	val_35	35	val_35	2008-04-08	11
+35	val_35	35	val_35	2008-04-08	11
+35	val_35	35	val_35	2008-04-08	11
+35	val_35	35	val_35	2008-04-08	11
+35	val_35	35	val_35	2008-04-09	12
 35	val_35	35	val_35	2008-04-09	12
+35	val_35	35	val_35	2008-04-09	12
+35	val_35	35	val_35	2008-04-09	11
+35	val_35	35	val_35	2008-04-09	11
 35	val_35	35	val_35	2008-04-09	11
 37	val_37	37	val_37	2008-04-09	12
-37	val_37	37	val_37	2008-04-08	12
-37	val_37	37	val_37	2008-04-08	11
-37	val_37	37	val_37	2008-04-09	11
-37	val_37	37	val_37	2008-04-09	11
 37	val_37	37	val_37	2008-04-09	12
 37	val_37	37	val_37	2008-04-08	12
-37	val_37	37	val_37	2008-04-08	11
-37	val_37	37	val_37	2008-04-09	12
 37	val_37	37	val_37	2008-04-08	12
 37	val_37	37	val_37	2008-04-08	11
+37	val_37	37	val_37	2008-04-08	11
+37	val_37	37	val_37	2008-04-09	11
+37	val_37	37	val_37	2008-04-09	11
 37	val_37	37	val_37	2008-04-09	11
 37	val_37	37	val_37	2008-04-09	11
 37	val_37	37	val_37	2008-04-09	12
+37	val_37	37	val_37	2008-04-09	12
+37	val_37	37	val_37	2008-04-08	12
 37	val_37	37	val_37	2008-04-08	12
 37	val_37	37	val_37	2008-04-08	11
+37	val_37	37	val_37	2008-04-08	11
 41	val_41	41	val_41	2008-04-08	11
 41	val_41	41	val_41	2008-04-09	11
 41	val_41	41	val_41	2008-04-09	12
 41	val_41	41	val_41	2008-04-08	12
 42	val_42	42	val_42	2008-04-09	12
-42	val_42	42	val_42	2008-04-09	11
-42	val_42	42	val_42	2008-04-08	12
-42	val_42	42	val_42	2008-04-08	12
 42	val_42	42	val_42	2008-04-09	12
-42	val_42	42	val_42	2008-04-08	11
 42	val_42	42	val_42	2008-04-09	11
-42	val_42	42	val_42	2008-04-08	11
-42	val_42	42	val_42	2008-04-09	12
 42	val_42	42	val_42	2008-04-09	11
 42	val_42	42	val_42	2008-04-08	12
 42	val_42	42	val_42	2008-04-08	12
+42	val_42	42	val_42	2008-04-08	12
+42	val_42	42	val_42	2008-04-08	12
+42	val_42	42	val_42	2008-04-09	12
 42	val_42	42	val_42	2008-04-09	12
 42	val_42	42	val_42	2008-04-08	11
+42	val_42	42	val_42	2008-04-08	11
+42	val_42	42	val_42	2008-04-09	11
 42	val_42	42	val_42	2008-04-09	11
 42	val_42	42	val_42	2008-04-08	11
+42	val_42	42	val_42	2008-04-08	11
 43	val_43	43	val_43	2008-04-09	12
 43	val_43	43	val_43	2008-04-08	12
 43	val_43	43	val_43	2008-04-09	11
@@ -3151,21 +3199,21 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 47	val_47	47	val_47	2008-04-09	12
 47	val_47	47	val_47	2008-04-09	11
 51	val_51	51	val_51	2008-04-09	12
-51	val_51	51	val_51	2008-04-08	12
-51	val_51	51	val_51	2008-04-08	11
-51	val_51	51	val_51	2008-04-08	11
-51	val_51	51	val_51	2008-04-09	11
 51	val_51	51	val_51	2008-04-09	12
 51	val_51	51	val_51	2008-04-08	12
-51	val_51	51	val_51	2008-04-09	11
-51	val_51	51	val_51	2008-04-09	12
 51	val_51	51	val_51	2008-04-08	12
 51	val_51	51	val_51	2008-04-08	11
 51	val_51	51	val_51	2008-04-08	11
+51	val_51	51	val_51	2008-04-08	11
+51	val_51	51	val_51	2008-04-08	11
+51	val_51	51	val_51	2008-04-09	11
 51	val_51	51	val_51	2008-04-09	11
 51	val_51	51	val_51	2008-04-09	12
+51	val_51	51	val_51	2008-04-09	12
+51	val_51	51	val_51	2008-04-08	12
 51	val_51	51	val_51	2008-04-08	12
 51	val_51	51	val_51	2008-04-09	11
+51	val_51	51	val_51	2008-04-09	11
 53	val_53	53	val_53	2008-04-08	11
 53	val_53	53	val_53	2008-04-09	11
 53	val_53	53	val_53	2008-04-09	12
@@ -3179,21 +3227,21 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 57	val_57	57	val_57	2008-04-09	11
 57	val_57	57	val_57	2008-04-09	12
 58	val_58	58	val_58	2008-04-08	11
-58	val_58	58	val_58	2008-04-09	11
-58	val_58	58	val_58	2008-04-09	12
 58	val_58	58	val_58	2008-04-08	11
-58	val_58	58	val_58	2008-04-08	12
 58	val_58	58	val_58	2008-04-09	11
-58	val_58	58	val_58	2008-04-09	12
-58	val_58	58	val_58	2008-04-08	12
-58	val_58	58	val_58	2008-04-08	11
 58	val_58	58	val_58	2008-04-09	11
 58	val_58	58	val_58	2008-04-09	12
+58	val_58	58	val_58	2008-04-09	12
 58	val_58	58	val_58	2008-04-08	11
+58	val_58	58	val_58	2008-04-08	11
+58	val_58	58	val_58	2008-04-08	12
 58	val_58	58	val_58	2008-04-08	12
 58	val_58	58	val_58	2008-04-09	11
+58	val_58	58	val_58	2008-04-09	11
+58	val_58	58	val_58	2008-04-09	12
 58	val_58	58	val_58	2008-04-09	12
 58	val_58	58	val_58	2008-04-08	12
+58	val_58	58	val_58	2008-04-08	12
 64	val_64	64	val_64	2008-04-09	12
 64	val_64	64	val_64	2008-04-08	11
 64	val_64	64	val_64	2008-04-08	12
@@ -3207,95 +3255,95 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 66	val_66	66	val_66	2008-04-08	11
 66	val_66	66	val_66	2008-04-08	12
 67	val_67	67	val_67	2008-04-09	12
-67	val_67	67	val_67	2008-04-09	11
 67	val_67	67	val_67	2008-04-09	12
 67	val_67	67	val_67	2008-04-09	11
-67	val_67	67	val_67	2008-04-08	11
-67	val_67	67	val_67	2008-04-08	12
-67	val_67	67	val_67	2008-04-08	11
-67	val_67	67	val_67	2008-04-08	12
-67	val_67	67	val_67	2008-04-09	12
 67	val_67	67	val_67	2008-04-09	11
 67	val_67	67	val_67	2008-04-09	12
+67	val_67	67	val_67	2008-04-09	12
 67	val_67	67	val_67	2008-04-09	11
+67	val_67	67	val_67	2008-04-09	11
+67	val_67	67	val_67	2008-04-08	11
 67	val_67	67	val_67	2008-04-08	11
 67	val_67	67	val_67	2008-04-08	12
+67	val_67	67	val_67	2008-04-08	12
+67	val_67	67	val_67	2008-04-08	11
 67	val_67	67	val_67	2008-04-08	11
 67	val_67	67	val_67	2008-04-08	12
+67	val_67	67	val_67	2008-04-08	12
 69	val_69	69	val_69	2008-04-09	12
 69	val_69	69	val_69	2008-04-08	11
 69	val_69	69	val_69	2008-04-08	12
 69	val_69	69	val_69	2008-04-09	11
 70	val_70	70	val_70	2008-04-09	11
-70	val_70	70	val_70	2008-04-08	12
+70	val_70	70	val_70	2008-04-09	11
 70	val_70	70	val_70	2008-04-09	11
 70	val_70	70	val_70	2008-04-08	12
-70	val_70	70	val_70	2008-04-08	11
-70	val_70	70	val_70	2008-04-09	12
+70	val_70	70	val_70	2008-04-08	12
 70	val_70	70	val_70	2008-04-08	12
 70	val_70	70	val_70	2008-04-09	11
-70	val_70	70	val_70	2008-04-08	11
-70	val_70	70	val_70	2008-04-09	12
-70	val_70	70	val_70	2008-04-08	11
-70	val_70	70	val_70	2008-04-09	12
 70	val_70	70	val_70	2008-04-09	11
-70	val_70	70	val_70	2008-04-08	12
 70	val_70	70	val_70	2008-04-09	11
 70	val_70	70	val_70	2008-04-08	12
-70	val_70	70	val_70	2008-04-08	11
-70	val_70	70	val_70	2008-04-09	12
 70	val_70	70	val_70	2008-04-08	12
-70	val_70	70	val_70	2008-04-09	11
+70	val_70	70	val_70	2008-04-08	12
+70	val_70	70	val_70	2008-04-08	11
 70	val_70	70	val_70	2008-04-08	11
-70	val_70	70	val_70	2008-04-09	12
 70	val_70	70	val_70	2008-04-08	11
 70	val_70	70	val_70	2008-04-09	12
-70	val_70	70	val_70	2008-04-09	11
+70	val_70	70	val_70	2008-04-09	12
+70	val_70	70	val_70	2008-04-09	12
 70	val_70	70	val_70	2008-04-08	12
-70	val_70	70	val_70	2008-04-09	11
 70	val_70	70	val_70	2008-04-08	12
-70	val_70	70	val_70	2008-04-08	11
-70	val_70	70	val_70	2008-04-09	12
 70	val_70	70	val_70	2008-04-08	12
 70	val_70	70	val_70	2008-04-09	11
+70	val_70	70	val_70	2008-04-09	11
+70	val_70	70	val_70	2008-04-09	11
+70	val_70	70	val_70	2008-04-08	11
 70	val_70	70	val_70	2008-04-08	11
+70	val_70	70	val_70	2008-04-08	11
+70	val_70	70	val_70	2008-04-09	12
 70	val_70	70	val_70	2008-04-09	12
+70	val_70	70	val_70	2008-04-09	12
+70	val_70	70	val_70	2008-04-08	11
 70	val_70	70	val_70	2008-04-08	11
+70	val_70	70	val_70	2008-04-08	11
+70	val_70	70	val_70	2008-04-09	12
 70	val_70	70	val_70	2008-04-09	12
+70	val_70	70	val_70	2008-04-09	12
+72	val_72	72	val_72	2008-04-09	12
 72	val_72	72	val_72	2008-04-09	12
 72	val_72	72	val_72	2008-04-08	12
 72	val_72	72	val_72	2008-04-08	12
-72	val_72	72	val_72	2008-04-09	11
-72	val_72	72	val_72	2008-04-08	11
-72	val_72	72	val_72	2008-04-09	12
-72	val_72	72	val_72	2008-04-08	11
-72	val_72	72	val_72	2008-04-09	11
-72	val_72	72	val_72	2008-04-09	12
 72	val_72	72	val_72	2008-04-08	12
 72	val_72	72	val_72	2008-04-08	12
 72	val_72	72	val_72	2008-04-09	11
+72	val_72	72	val_72	2008-04-09	11
+72	val_72	72	val_72	2008-04-08	11
 72	val_72	72	val_72	2008-04-08	11
 72	val_72	72	val_72	2008-04-09	12
+72	val_72	72	val_72	2008-04-09	12
+72	val_72	72	val_72	2008-04-08	11
 72	val_72	72	val_72	2008-04-08	11
 72	val_72	72	val_72	2008-04-09	11
+72	val_72	72	val_72	2008-04-09	11
 74	val_74	74	val_74	2008-04-09	11
 74	val_74	74	val_74	2008-04-08	12
 74	val_74	74	val_74	2008-04-09	12
 74	val_74	74	val_74	2008-04-08	11
 76	val_76	76	val_76	2008-04-08	11
+76	val_76	76	val_76	2008-04-08	11
 76	val_76	76	val_76	2008-04-08	12
 76	val_76	76	val_76	2008-04-08	12
-76	val_76	76	val_76	2008-04-08	11
-76	val_76	76	val_76	2008-04-09	12
-76	val_76	76	val_76	2008-04-09	12
-76	val_76	76	val_76	2008-04-09	11
-76	val_76	76	val_76	2008-04-09	11
-76	val_76	76	val_76	2008-04-08	11
 76	val_76	76	val_76	2008-04-08	12
 76	val_76	76	val_76	2008-04-08	12
 76	val_76	76	val_76	2008-04-08	11
+76	val_76	76	val_76	2008-04-08	11
+76	val_76	76	val_76	2008-04-09	12
 76	val_76	76	val_76	2008-04-09	12
 76	val_76	76	val_76	2008-04-09	12
+76	val_76	76	val_76	2008-04-09	12
+76	val_76	76	val_76	2008-04-09	11
+76	val_76	76	val_76	2008-04-09	11
 76	val_76	76	val_76	2008-04-09	11
 76	val_76	76	val_76	2008-04-09	11
 77	val_77	77	val_77	2008-04-08	12
@@ -3315,36 +3363,36 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 82	val_82	82	val_82	2008-04-08	11
 82	val_82	82	val_82	2008-04-09	12
 83	val_83	83	val_83	2008-04-08	12
+83	val_83	83	val_83	2008-04-08	12
 83	val_83	83	val_83	2008-04-09	12
-83	val_83	83	val_83	2008-04-09	11
 83	val_83	83	val_83	2008-04-09	12
-83	val_83	83	val_83	2008-04-08	11
-83	val_83	83	val_83	2008-04-08	12
 83	val_83	83	val_83	2008-04-09	11
-83	val_83	83	val_83	2008-04-08	11
-83	val_83	83	val_83	2008-04-08	12
-83	val_83	83	val_83	2008-04-09	12
 83	val_83	83	val_83	2008-04-09	11
 83	val_83	83	val_83	2008-04-09	12
+83	val_83	83	val_83	2008-04-09	12
+83	val_83	83	val_83	2008-04-08	11
 83	val_83	83	val_83	2008-04-08	11
 83	val_83	83	val_83	2008-04-08	12
+83	val_83	83	val_83	2008-04-08	12
+83	val_83	83	val_83	2008-04-09	11
 83	val_83	83	val_83	2008-04-09	11
 83	val_83	83	val_83	2008-04-08	11
+83	val_83	83	val_83	2008-04-08	11
+84	val_84	84	val_84	2008-04-09	12
 84	val_84	84	val_84	2008-04-09	12
 84	val_84	84	val_84	2008-04-08	11
 84	val_84	84	val_84	2008-04-08	11
-84	val_84	84	val_84	2008-04-09	12
-84	val_84	84	val_84	2008-04-08	12
-84	val_84	84	val_84	2008-04-09	11
-84	val_84	84	val_84	2008-04-09	11
-84	val_84	84	val_84	2008-04-08	12
-84	val_84	84	val_84	2008-04-09	12
 84	val_84	84	val_84	2008-04-08	11
 84	val_84	84	val_84	2008-04-08	11
 84	val_84	84	val_84	2008-04-09	12
+84	val_84	84	val_84	2008-04-09	12
+84	val_84	84	val_84	2008-04-08	12
 84	val_84	84	val_84	2008-04-08	12
 84	val_84	84	val_84	2008-04-09	11
 84	val_84	84	val_84	2008-04-09	11
+84	val_84	84	val_84	2008-04-09	11
+84	val_84	84	val_84	2008-04-09	11
+84	val_84	84	val_84	2008-04-08	12
 84	val_84	84	val_84	2008-04-08	12
 85	val_85	85	val_85	2008-04-09	12
 85	val_85	85	val_85	2008-04-09	11
@@ -3359,145 +3407,145 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 87	val_87	87	val_87	2008-04-08	12
 87	val_87	87	val_87	2008-04-09	11
 90	val_90	90	val_90	2008-04-09	12
-90	val_90	90	val_90	2008-04-08	11
 90	val_90	90	val_90	2008-04-09	12
-90	val_90	90	val_90	2008-04-09	11
-90	val_90	90	val_90	2008-04-08	12
-90	val_90	90	val_90	2008-04-09	11
 90	val_90	90	val_90	2008-04-09	12
-90	val_90	90	val_90	2008-04-08	12
-90	val_90	90	val_90	2008-04-08	12
 90	val_90	90	val_90	2008-04-08	11
 90	val_90	90	val_90	2008-04-08	11
-90	val_90	90	val_90	2008-04-09	11
-90	val_90	90	val_90	2008-04-09	12
 90	val_90	90	val_90	2008-04-08	11
 90	val_90	90	val_90	2008-04-09	12
+90	val_90	90	val_90	2008-04-09	12
+90	val_90	90	val_90	2008-04-09	12
+90	val_90	90	val_90	2008-04-09	11
 90	val_90	90	val_90	2008-04-09	11
-90	val_90	90	val_90	2008-04-08	12
 90	val_90	90	val_90	2008-04-09	11
-90	val_90	90	val_90	2008-04-09	12
 90	val_90	90	val_90	2008-04-08	12
 90	val_90	90	val_90	2008-04-08	12
-90	val_90	90	val_90	2008-04-08	11
-90	val_90	90	val_90	2008-04-08	11
+90	val_90	90	val_90	2008-04-08	12
 90	val_90	90	val_90	2008-04-09	11
-90	val_90	90	val_90	2008-04-09	12
-90	val_90	90	val_90	2008-04-08	11
-90	val_90	90	val_90	2008-04-09	12
 90	val_90	90	val_90	2008-04-09	11
-90	val_90	90	val_90	2008-04-08	12
 90	val_90	90	val_90	2008-04-09	11
 90	val_90	90	val_90	2008-04-09	12
+90	val_90	90	val_90	2008-04-09	12
+90	val_90	90	val_90	2008-04-09	12
+90	val_90	90	val_90	2008-04-08	12
+90	val_90	90	val_90	2008-04-08	12
+90	val_90	90	val_90	2008-04-08	12
 90	val_90	90	val_90	2008-04-08	12
 90	val_90	90	val_90	2008-04-08	12
+90	val_90	90	val_90	2008-04-08	12
+90	val_90	90	val_90	2008-04-08	11
+90	val_90	90	val_90	2008-04-08	11
+90	val_90	90	val_90	2008-04-08	11
 90	val_90	90	val_90	2008-04-08	11
 90	val_90	90	val_90	2008-04-08	11
+90	val_90	90	val_90	2008-04-08	11
+90	val_90	90	val_90	2008-04-09	11
+90	val_90	90	val_90	2008-04-09	11
 90	val_90	90	val_90	2008-04-09	11
 92	val_92	92	val_92	2008-04-09	11
 92	val_92	92	val_92	2008-04-09	12
 92	val_92	92	val_92	2008-04-08	12
 92	val_92	92	val_92	2008-04-08	11
 95	val_95	95	val_95	2008-04-08	11
+95	val_95	95	val_95	2008-04-08	11
+95	val_95	95	val_95	2008-04-09	12
 95	val_95	95	val_95	2008-04-09	12
 95	val_95	95	val_95	2008-04-08	12
-95	val_95	95	val_95	2008-04-09	11
 95	val_95	95	val_95	2008-04-08	12
 95	val_95	95	val_95	2008-04-09	11
-95	val_95	95	val_95	2008-04-09	12
-95	val_95	95	val_95	2008-04-08	11
-95	val_95	95	val_95	2008-04-08	11
-95	val_95	95	val_95	2008-04-09	12
-95	val_95	95	val_95	2008-04-08	12
 95	val_95	95	val_95	2008-04-09	11
 95	val_95	95	val_95	2008-04-08	12
+95	val_95	95	val_95	2008-04-08	12
 95	val_95	95	val_95	2008-04-09	11
+95	val_95	95	val_95	2008-04-09	11
+95	val_95	95	val_95	2008-04-09	12
 95	val_95	95	val_95	2008-04-09	12
 95	val_95	95	val_95	2008-04-08	11
+95	val_95	95	val_95	2008-04-08	11
 96	val_96	96	val_96	2008-04-09	12
 96	val_96	96	val_96	2008-04-08	11
 96	val_96	96	val_96	2008-04-08	12
 96	val_96	96	val_96	2008-04-09	11
 97	val_97	97	val_97	2008-04-09	12
 97	val_97	97	val_97	2008-04-09	12
+97	val_97	97	val_97	2008-04-09	12
+97	val_97	97	val_97	2008-04-09	12
+97	val_97	97	val_97	2008-04-09	11
+97	val_97	97	val_97	2008-04-09	11
 97	val_97	97	val_97	2008-04-09	11
 97	val_97	97	val_97	2008-04-09	11
 97	val_97	97	val_97	2008-04-08	12
 97	val_97	97	val_97	2008-04-08	12
-97	val_97	97	val_97	2008-04-08	11
-97	val_97	97	val_97	2008-04-08	11
-97	val_97	97	val_97	2008-04-09	12
-97	val_97	97	val_97	2008-04-09	12
-97	val_97	97	val_97	2008-04-09	11
-97	val_97	97	val_97	2008-04-09	11
 97	val_97	97	val_97	2008-04-08	12
 97	val_97	97	val_97	2008-04-08	12
 97	val_97	97	val_97	2008-04-08	11
 97	val_97	97	val_97	2008-04-08	11
+97	val_97	97	val_97	2008-04-08	11
+97	val_97	97	val_97	2008-04-08	11
 98	val_98	98	val_98	2008-04-08	11
 98	val_98	98	val_98	2008-04-08	11
-98	val_98	98	val_98	2008-04-08	12
-98	val_98	98	val_98	2008-04-09	12
-98	val_98	98	val_98	2008-04-09	11
-98	val_98	98	val_98	2008-04-09	11
-98	val_98	98	val_98	2008-04-08	12
-98	val_98	98	val_98	2008-04-09	12
 98	val_98	98	val_98	2008-04-08	11
 98	val_98	98	val_98	2008-04-08	11
 98	val_98	98	val_98	2008-04-08	12
+98	val_98	98	val_98	2008-04-08	12
 98	val_98	98	val_98	2008-04-09	12
+98	val_98	98	val_98	2008-04-09	12
+98	val_98	98	val_98	2008-04-09	11
 98	val_98	98	val_98	2008-04-09	11
 98	val_98	98	val_98	2008-04-09	11
+98	val_98	98	val_98	2008-04-09	11
+98	val_98	98	val_98	2008-04-08	12
 98	val_98	98	val_98	2008-04-08	12
 98	val_98	98	val_98	2008-04-09	12
+98	val_98	98	val_98	2008-04-09	12
+100	val_100	100	val_100	2008-04-09	11
 100	val_100	100	val_100	2008-04-09	11
 100	val_100	100	val_100	2008-04-08	11
+100	val_100	100	val_100	2008-04-08	11
+100	val_100	100	val_100	2008-04-09	12
 100	val_100	100	val_100	2008-04-09	12
 100	val_100	100	val_100	2008-04-08	12
 100	val_100	100	val_100	2008-04-08	12
-100	val_100	100	val_100	2008-04-09	12
-100	val_100	100	val_100	2008-04-08	11
-100	val_100	100	val_100	2008-04-09	11
-100	val_100	100	val_100	2008-04-09	11
-100	val_100	100	val_100	2008-04-08	11
-100	val_100	100	val_100	2008-04-09	12
 100	val_100	100	val_100	2008-04-08	12
 100	val_100	100	val_100	2008-04-08	12
 100	val_100	100	val_100	2008-04-09	12
+100	val_100	100	val_100	2008-04-09	12
+100	val_100	100	val_100	2008-04-08	11
 100	val_100	100	val_100	2008-04-08	11
 100	val_100	100	val_100	2008-04-09	11
+100	val_100	100	val_100	2008-04-09	11
 103	val_103	103	val_103	2008-04-08	11
-103	val_103	103	val_103	2008-04-09	12
-103	val_103	103	val_103	2008-04-09	11
 103	val_103	103	val_103	2008-04-08	11
-103	val_103	103	val_103	2008-04-09	11
-103	val_103	103	val_103	2008-04-08	12
-103	val_103	103	val_103	2008-04-08	12
 103	val_103	103	val_103	2008-04-09	12
-103	val_103	103	val_103	2008-04-08	11
 103	val_103	103	val_103	2008-04-09	12
 103	val_103	103	val_103	2008-04-09	11
+103	val_103	103	val_103	2008-04-09	11
 103	val_103	103	val_103	2008-04-08	11
+103	val_103	103	val_103	2008-04-08	11
+103	val_103	103	val_103	2008-04-09	11
 103	val_103	103	val_103	2008-04-09	11
 103	val_103	103	val_103	2008-04-08	12
 103	val_103	103	val_103	2008-04-08	12
+103	val_103	103	val_103	2008-04-08	12
+103	val_103	103	val_103	2008-04-08	12
+103	val_103	103	val_103	2008-04-09	12
 103	val_103	103	val_103	2008-04-09	12
 104	val_104	104	val_104	2008-04-08	11
-104	val_104	104	val_104	2008-04-09	12
-104	val_104	104	val_104	2008-04-09	11
-104	val_104	104	val_104	2008-04-08	12
 104	val_104	104	val_104	2008-04-08	11
 104	val_104	104	val_104	2008-04-09	12
-104	val_104	104	val_104	2008-04-08	12
-104	val_104	104	val_104	2008-04-09	11
-104	val_104	104	val_104	2008-04-08	11
 104	val_104	104	val_104	2008-04-09	12
 104	val_104	104	val_104	2008-04-09	11
+104	val_104	104	val_104	2008-04-09	11
 104	val_104	104	val_104	2008-04-08	12
+104	val_104	104	val_104	2008-04-08	12
+104	val_104	104	val_104	2008-04-08	11
 104	val_104	104	val_104	2008-04-08	11
 104	val_104	104	val_104	2008-04-09	12
+104	val_104	104	val_104	2008-04-09	12
+104	val_104	104	val_104	2008-04-08	12
 104	val_104	104	val_104	2008-04-08	12
 104	val_104	104	val_104	2008-04-09	11
+104	val_104	104	val_104	2008-04-09	11
 105	val_105	105	val_105	2008-04-09	12
 105	val_105	105	val_105	2008-04-09	11
 105	val_105	105	val_105	2008-04-08	11
@@ -3507,21 +3555,21 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 111	val_111	111	val_111	2008-04-09	12
 111	val_111	111	val_111	2008-04-09	11
 113	val_113	113	val_113	2008-04-09	12
+113	val_113	113	val_113	2008-04-09	12
+113	val_113	113	val_113	2008-04-08	11
 113	val_113	113	val_113	2008-04-08	11
 113	val_113	113	val_113	2008-04-08	12
 113	val_113	113	val_113	2008-04-08	12
-113	val_113	113	val_113	2008-04-09	11
-113	val_113	113	val_113	2008-04-09	11
-113	val_113	113	val_113	2008-04-08	11
-113	val_113	113	val_113	2008-04-09	12
-113	val_113	113	val_113	2008-04-09	12
-113	val_113	113	val_113	2008-04-08	11
 113	val_113	113	val_113	2008-04-08	12
 113	val_113	113	val_113	2008-04-08	12
 113	val_113	113	val_113	2008-04-09	11
 113	val_113	113	val_113	2008-04-09	11
+113	val_113	113	val_113	2008-04-09	11
+113	val_113	113	val_113	2008-04-09	11
+113	val_113	113	val_113	2008-04-08	11
 113	val_113	113	val_113	2008-04-08	11
 113	val_113	113	val_113	2008-04-09	12
+113	val_113	113	val_113	2008-04-09	12
 114	val_114	114	val_114	2008-04-09	11
 114	val_114	114	val_114	2008-04-09	12
 114	val_114	114	val_114	2008-04-08	12
@@ -3531,87 +3579,87 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 116	val_116	116	val_116	2008-04-08	11
 116	val_116	116	val_116	2008-04-09	12
 118	val_118	118	val_118	2008-04-09	12
-118	val_118	118	val_118	2008-04-08	11
-118	val_118	118	val_118	2008-04-09	11
 118	val_118	118	val_118	2008-04-09	12
 118	val_118	118	val_118	2008-04-08	11
-118	val_118	118	val_118	2008-04-08	12
-118	val_118	118	val_118	2008-04-08	12
-118	val_118	118	val_118	2008-04-09	11
-118	val_118	118	val_118	2008-04-09	12
 118	val_118	118	val_118	2008-04-08	11
 118	val_118	118	val_118	2008-04-09	11
+118	val_118	118	val_118	2008-04-09	11
 118	val_118	118	val_118	2008-04-09	12
+118	val_118	118	val_118	2008-04-09	12
+118	val_118	118	val_118	2008-04-08	11
 118	val_118	118	val_118	2008-04-08	11
 118	val_118	118	val_118	2008-04-08	12
 118	val_118	118	val_118	2008-04-08	12
+118	val_118	118	val_118	2008-04-08	12
+118	val_118	118	val_118	2008-04-08	12
 118	val_118	118	val_118	2008-04-09	11
+118	val_118	118	val_118	2008-04-09	11
+119	val_119	119	val_119	2008-04-09	12
+119	val_119	119	val_119	2008-04-09	12
 119	val_119	119	val_119	2008-04-09	12
 119	val_119	119	val_119	2008-04-08	11
-119	val_119	119	val_119	2008-04-09	11
-119	val_119	119	val_119	2008-04-08	12
-119	val_119	119	val_119	2008-04-08	12
-119	val_119	119	val_119	2008-04-08	12
+119	val_119	119	val_119	2008-04-08	11
 119	val_119	119	val_119	2008-04-08	11
 119	val_119	119	val_119	2008-04-09	11
 119	val_119	119	val_119	2008-04-09	11
-119	val_119	119	val_119	2008-04-09	12
-119	val_119	119	val_119	2008-04-08	11
-119	val_119	119	val_119	2008-04-09	12
-119	val_119	119	val_119	2008-04-09	12
-119	val_119	119	val_119	2008-04-08	11
 119	val_119	119	val_119	2008-04-09	11
 119	val_119	119	val_119	2008-04-08	12
 119	val_119	119	val_119	2008-04-08	12
 119	val_119	119	val_119	2008-04-08	12
+119	val_119	119	val_119	2008-04-08	12
+119	val_119	119	val_119	2008-04-08	12
+119	val_119	119	val_119	2008-04-08	12
+119	val_119	119	val_119	2008-04-08	12
+119	val_119	119	val_119	2008-04-08	12
+119	val_119	119	val_119	2008-04-08	12
+119	val_119	119	val_119	2008-04-08	11
 119	val_119	119	val_119	2008-04-08	11
+119	val_119	119	val_119	2008-04-08	11
+119	val_119	119	val_119	2008-04-09	11
+119	val_119	119	val_119	2008-04-09	11
+119	val_119	119	val_119	2008-04-09	11
+119	val_119	119	val_119	2008-04-09	11
 119	val_119	119	val_119	2008-04-09	11
 119	val_119	119	val_119	2008-04-09	11
 119	val_119	119	val_119	2008-04-09	12
-119	val_119	119	val_119	2008-04-08	11
 119	val_119	119	val_119	2008-04-09	12
 119	val_119	119	val_119	2008-04-09	12
 119	val_119	119	val_119	2008-04-08	11
-119	val_119	119	val_119	2008-04-09	11
-119	val_119	119	val_119	2008-04-08	12
-119	val_119	119	val_119	2008-04-08	12
-119	val_119	119	val_119	2008-04-08	12
 119	val_119	119	val_119	2008-04-08	11
-119	val_119	119	val_119	2008-04-09	11
-119	val_119	119	val_119	2008-04-09	11
-119	val_119	119	val_119	2008-04-09	12
 119	val_119	119	val_119	2008-04-08	11
 119	val_119	119	val_119	2008-04-09	12
+119	val_119	119	val_119	2008-04-09	12
+119	val_119	119	val_119	2008-04-09	12
+120	val_120	120	val_120	2008-04-09	11
 120	val_120	120	val_120	2008-04-09	11
 120	val_120	120	val_120	2008-04-08	11
+120	val_120	120	val_120	2008-04-08	11
 120	val_120	120	val_120	2008-04-09	12
-120	val_120	120	val_120	2008-04-08	12
 120	val_120	120	val_120	2008-04-09	12
 120	val_120	120	val_120	2008-04-08	12
-120	val_120	120	val_120	2008-04-08	11
-120	val_120	120	val_120	2008-04-09	11
-120	val_120	120	val_120	2008-04-09	11
-120	val_120	120	val_120	2008-04-08	11
-120	val_120	120	val_120	2008-04-09	12
 120	val_120	120	val_120	2008-04-08	12
 120	val_120	120	val_120	2008-04-09	12
+120	val_120	120	val_120	2008-04-09	12
 120	val_120	120	val_120	2008-04-08	12
+120	val_120	120	val_120	2008-04-08	12
+120	val_120	120	val_120	2008-04-08	11
 120	val_120	120	val_120	2008-04-08	11
 120	val_120	120	val_120	2008-04-09	11
+120	val_120	120	val_120	2008-04-09	11
+125	val_125	125	val_125	2008-04-09	12
 125	val_125	125	val_125	2008-04-09	12
 125	val_125	125	val_125	2008-04-08	11
-125	val_125	125	val_125	2008-04-09	11
 125	val_125	125	val_125	2008-04-08	11
-125	val_125	125	val_125	2008-04-09	12
 125	val_125	125	val_125	2008-04-09	11
-125	val_125	125	val_125	2008-04-08	12
-125	val_125	125	val_125	2008-04-08	12
-125	val_125	125	val_125	2008-04-09	12
-125	val_125	125	val_125	2008-04-08	11
 125	val_125	125	val_125	2008-04-09	11
 125	val_125	125	val_125	2008-04-08	11
+125	val_125	125	val_125	2008-04-08	11
+125	val_125	125	val_125	2008-04-09	12
 125	val_125	125	val_125	2008-04-09	12
 125	val_125	125	val_125	2008-04-09	11
+125	val_125	125	val_125	2008-04-09	11
+125	val_125	125	val_125	2008-04-08	12
+125	val_125	125	val_125	2008-04-08	12
 125	val_125	125	val_125	2008-04-08	12
 125	val_125	125	val_125	2008-04-08	12
 126	val_126	126	val_126	2008-04-08	11
@@ -3619,57 +3667,57 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 126	val_126	126	val_126	2008-04-09	12
 126	val_126	126	val_126	2008-04-09	11
 128	val_128	128	val_128	2008-04-09	12
+128	val_128	128	val_128	2008-04-09	12
+128	val_128	128	val_128	2008-04-09	12
+128	val_128	128	val_128	2008-04-09	11
+128	val_128	128	val_128	2008-04-09	11
 128	val_128	128	val_128	2008-04-09	11
 128	val_128	128	val_128	2008-04-08	11
 128	val_128	128	val_128	2008-04-08	11
-128	val_128	128	val_128	2008-04-08	12
-128	val_128	128	val_128	2008-04-09	11
-128	val_128	128	val_128	2008-04-09	12
 128	val_128	128	val_128	2008-04-08	11
-128	val_128	128	val_128	2008-04-09	11
-128	val_128	128	val_128	2008-04-09	12
-128	val_128	128	val_128	2008-04-08	12
-128	val_128	128	val_128	2008-04-08	12
-128	val_128	128	val_128	2008-04-09	12
-128	val_128	128	val_128	2008-04-09	11
 128	val_128	128	val_128	2008-04-08	11
 128	val_128	128	val_128	2008-04-08	11
+128	val_128	128	val_128	2008-04-08	11
+128	val_128	128	val_128	2008-04-08	12
+128	val_128	128	val_128	2008-04-08	12
 128	val_128	128	val_128	2008-04-08	12
 128	val_128	128	val_128	2008-04-09	11
-128	val_128	128	val_128	2008-04-09	12
-128	val_128	128	val_128	2008-04-08	11
+128	val_128	128	val_128	2008-04-09	11
 128	val_128	128	val_128	2008-04-09	11
 128	val_128	128	val_128	2008-04-09	12
-128	val_128	128	val_128	2008-04-08	12
-128	val_128	128	val_128	2008-04-08	12
 128	val_128	128	val_128	2008-04-09	12
-128	val_128	128	val_128	2008-04-09	11
+128	val_128	128	val_128	2008-04-09	12
 128	val_128	128	val_128	2008-04-08	11
 128	val_128	128	val_128	2008-04-08	11
-128	val_128	128	val_128	2008-04-08	12
-128	val_128	128	val_128	2008-04-09	11
-128	val_128	128	val_128	2008-04-09	12
 128	val_128	128	val_128	2008-04-08	11
 128	val_128	128	val_128	2008-04-09	11
+128	val_128	128	val_128	2008-04-09	11
+128	val_128	128	val_128	2008-04-09	11
+128	val_128	128	val_128	2008-04-09	12
 128	val_128	128	val_128	2008-04-09	12
+128	val_128	128	val_128	2008-04-09	12
+128	val_128	128	val_128	2008-04-08	12
+128	val_128	128	val_128	2008-04-08	12
+128	val_128	128	val_128	2008-04-08	12
+128	val_128	128	val_128	2008-04-08	12
 128	val_128	128	val_128	2008-04-08	12
 128	val_128	128	val_128	2008-04-08	12
 129	val_129	129	val_129	2008-04-09	12
-129	val_129	129	val_129	2008-04-08	12
 129	val_129	129	val_129	2008-04-09	12
 129	val_129	129	val_129	2008-04-08	12
-129	val_129	129	val_129	2008-04-09	11
-129	val_129	129	val_129	2008-04-08	11
-129	val_129	129	val_129	2008-04-09	11
-129	val_129	129	val_129	2008-04-08	11
-129	val_129	129	val_129	2008-04-09	12
 129	val_129	129	val_129	2008-04-08	12
 129	val_129	129	val_129	2008-04-09	12
+129	val_129	129	val_129	2008-04-09	12
 129	val_129	129	val_129	2008-04-08	12
+129	val_129	129	val_129	2008-04-08	12
+129	val_129	129	val_129	2008-04-09	11
 129	val_129	129	val_129	2008-04-09	11
 129	val_129	129	val_129	2008-04-08	11
+129	val_129	129	val_129	2008-04-08	11
+129	val_129	129	val_129	2008-04-09	11
 129	val_129	129	val_129	2008-04-09	11
 129	val_129	129	val_129	2008-04-08	11
+129	val_129	129	val_129	2008-04-08	11
 131	val_131	131	val_131	2008-04-08	12
 131	val_131	131	val_131	2008-04-09	12
 131	val_131	131	val_131	2008-04-09	11
@@ -3679,104 +3727,104 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 133	val_133	133	val_133	2008-04-09	11
 133	val_133	133	val_133	2008-04-09	12
 134	val_134	134	val_134	2008-04-08	12
+134	val_134	134	val_134	2008-04-08	12
 134	val_134	134	val_134	2008-04-09	11
-134	val_134	134	val_134	2008-04-08	11
 134	val_134	134	val_134	2008-04-09	11
-134	val_134	134	val_134	2008-04-09	12
-134	val_134	134	val_134	2008-04-08	12
-134	val_134	134	val_134	2008-04-09	12
 134	val_134	134	val_134	2008-04-08	11
-134	val_134	134	val_134	2008-04-08	12
-134	val_134	134	val_134	2008-04-09	11
 134	val_134	134	val_134	2008-04-08	11
 134	val_134	134	val_134	2008-04-09	11
+134	val_134	134	val_134	2008-04-09	11
+134	val_134	134	val_134	2008-04-09	12
 134	val_134	134	val_134	2008-04-09	12
 134	val_134	134	val_134	2008-04-08	12
+134	val_134	134	val_134	2008-04-08	12
+134	val_134	134	val_134	2008-04-09	12
 134	val_134	134	val_134	2008-04-09	12
 134	val_134	134	val_134	2008-04-08	11
+134	val_134	134	val_134	2008-04-08	11
 136	val_136	136	val_136	2008-04-09	12
 136	val_136	136	val_136	2008-04-08	12
 136	val_136	136	val_136	2008-04-08	11
 136	val_136	136	val_136	2008-04-09	11
 137	val_137	137	val_137	2008-04-08	11
+137	val_137	137	val_137	2008-04-08	11
+137	val_137	137	val_137	2008-04-09	12
 137	val_137	137	val_137	2008-04-09	12
 137	val_137	137	val_137	2008-04-09	11
 137	val_137	137	val_137	2008-04-09	11
-137	val_137	137	val_137	2008-04-09	12
-137	val_137	137	val_137	2008-04-08	12
-137	val_137	137	val_137	2008-04-08	11
-137	val_137	137	val_137	2008-04-08	12
-137	val_137	137	val_137	2008-04-08	11
-137	val_137	137	val_137	2008-04-09	12
 137	val_137	137	val_137	2008-04-09	11
 137	val_137	137	val_137	2008-04-09	11
 137	val_137	137	val_137	2008-04-09	12
+137	val_137	137	val_137	2008-04-09	12
 137	val_137	137	val_137	2008-04-08	12
+137	val_137	137	val_137	2008-04-08	12
+137	val_137	137	val_137	2008-04-08	11
 137	val_137	137	val_137	2008-04-08	11
 137	val_137	137	val_137	2008-04-08	12
+137	val_137	137	val_137	2008-04-08	12
+138	val_138	138	val_138	2008-04-09	12
 138	val_138	138	val_138	2008-04-09	12
 138	val_138	138	val_138	2008-04-09	12
 138	val_138	138	val_138	2008-04-09	12
-138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-08	12
-138	val_138	138	val_138	2008-04-08	11
 138	val_138	138	val_138	2008-04-09	12
-138	val_138	138	val_138	2008-04-08	12
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-08	12
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-08	12
 138	val_138	138	val_138	2008-04-09	12
 138	val_138	138	val_138	2008-04-09	12
 138	val_138	138	val_138	2008-04-09	12
-138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-08	12
-138	val_138	138	val_138	2008-04-08	11
 138	val_138	138	val_138	2008-04-09	12
-138	val_138	138	val_138	2008-04-08	12
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-08	12
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-08	12
 138	val_138	138	val_138	2008-04-09	12
 138	val_138	138	val_138	2008-04-09	12
 138	val_138	138	val_138	2008-04-09	12
 138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-09	11
 138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-08	12
 138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-09	12
-138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-09	11
 138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-08	12
 138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-08	12
-138	val_138	138	val_138	2008-04-09	12
-138	val_138	138	val_138	2008-04-09	12
-138	val_138	138	val_138	2008-04-09	12
-138	val_138	138	val_138	2008-04-08	11
 138	val_138	138	val_138	2008-04-09	11
 138	val_138	138	val_138	2008-04-09	11
 138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-08	12
 138	val_138	138	val_138	2008-04-08	11
-138	val_138	138	val_138	2008-04-09	12
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-09	12
+138	val_138	138	val_138	2008-04-09	12
+138	val_138	138	val_138	2008-04-09	12
+138	val_138	138	val_138	2008-04-09	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-08	12
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-09	11
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-08	11
+138	val_138	138	val_138	2008-04-08	12
 138	val_138	138	val_138	2008-04-08	12
-138	val_138	138	val_138	2008-04-09	11
 138	val_138	138	val_138	2008-04-08	12
-138	val_138	138	val_138	2008-04-09	11
-138	val_138	138	val_138	2008-04-08	11
 138	val_138	138	val_138	2008-04-08	12
 143	val_143	143	val_143	2008-04-09	12
 143	val_143	143	val_143	2008-04-08	11
@@ -3787,57 +3835,57 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 145	val_145	145	val_145	2008-04-08	12
 145	val_145	145	val_145	2008-04-09	12
 146	val_146	146	val_146	2008-04-08	11
-146	val_146	146	val_146	2008-04-09	11
-146	val_146	146	val_146	2008-04-08	12
 146	val_146	146	val_146	2008-04-08	11
-146	val_146	146	val_146	2008-04-09	12
-146	val_146	146	val_146	2008-04-09	12
 146	val_146	146	val_146	2008-04-09	11
-146	val_146	146	val_146	2008-04-08	12
-146	val_146	146	val_146	2008-04-08	11
 146	val_146	146	val_146	2008-04-09	11
 146	val_146	146	val_146	2008-04-08	12
+146	val_146	146	val_146	2008-04-08	12
 146	val_146	146	val_146	2008-04-08	11
+146	val_146	146	val_146	2008-04-08	11
+146	val_146	146	val_146	2008-04-09	12
 146	val_146	146	val_146	2008-04-09	12
 146	val_146	146	val_146	2008-04-09	12
+146	val_146	146	val_146	2008-04-09	12
+146	val_146	146	val_146	2008-04-09	11
 146	val_146	146	val_146	2008-04-09	11
 146	val_146	146	val_146	2008-04-08	12
+146	val_146	146	val_146	2008-04-08	12
+149	val_149	149	val_149	2008-04-08	12
 149	val_149	149	val_149	2008-04-08	12
 149	val_149	149	val_149	2008-04-09	12
 149	val_149	149	val_149	2008-04-09	12
-149	val_149	149	val_149	2008-04-09	11
-149	val_149	149	val_149	2008-04-09	11
-149	val_149	149	val_149	2008-04-08	11
-149	val_149	149	val_149	2008-04-08	11
-149	val_149	149	val_149	2008-04-08	12
-149	val_149	149	val_149	2008-04-08	12
 149	val_149	149	val_149	2008-04-09	12
 149	val_149	149	val_149	2008-04-09	12
 149	val_149	149	val_149	2008-04-09	11
 149	val_149	149	val_149	2008-04-09	11
+149	val_149	149	val_149	2008-04-09	11
+149	val_149	149	val_149	2008-04-09	11
+149	val_149	149	val_149	2008-04-08	11
+149	val_149	149	val_149	2008-04-08	11
 149	val_149	149	val_149	2008-04-08	11
 149	val_149	149	val_149	2008-04-08	11
 149	val_149	149	val_149	2008-04-08	12
+149	val_149	149	val_149	2008-04-08	12
 150	val_150	150	val_150	2008-04-09	11
 150	val_150	150	val_150	2008-04-09	12
 150	val_150	150	val_150	2008-04-08	11
 150	val_150	150	val_150	2008-04-08	12
 152	val_152	152	val_152	2008-04-08	11
-152	val_152	152	val_152	2008-04-08	12
-152	val_152	152	val_152	2008-04-09	11
 152	val_152	152	val_152	2008-04-08	11
-152	val_152	152	val_152	2008-04-09	12
-152	val_152	152	val_152	2008-04-09	11
-152	val_152	152	val_152	2008-04-09	12
 152	val_152	152	val_152	2008-04-08	12
-152	val_152	152	val_152	2008-04-08	11
 152	val_152	152	val_152	2008-04-08	12
 152	val_152	152	val_152	2008-04-09	11
+152	val_152	152	val_152	2008-04-09	11
 152	val_152	152	val_152	2008-04-08	11
+152	val_152	152	val_152	2008-04-08	11
+152	val_152	152	val_152	2008-04-09	12
 152	val_152	152	val_152	2008-04-09	12
 152	val_152	152	val_152	2008-04-09	11
+152	val_152	152	val_152	2008-04-09	11
+152	val_152	152	val_152	2008-04-09	12
 152	val_152	152	val_152	2008-04-09	12
 152	val_152	152	val_152	2008-04-08	12
+152	val_152	152	val_152	2008-04-08	12
 153	val_153	153	val_153	2008-04-09	11
 153	val_153	153	val_153	2008-04-08	11
 153	val_153	153	val_153	2008-04-08	12
@@ -3871,143 +3919,143 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 163	val_163	163	val_163	2008-04-08	11
 163	val_163	163	val_163	2008-04-08	12
 164	val_164	164	val_164	2008-04-08	11
-164	val_164	164	val_164	2008-04-09	11
 164	val_164	164	val_164	2008-04-08	11
-164	val_164	164	val_164	2008-04-09	12
 164	val_164	164	val_164	2008-04-09	11
-164	val_164	164	val_164	2008-04-09	12
-164	val_164	164	val_164	2008-04-08	12
-164	val_164	164	val_164	2008-04-08	12
-164	val_164	164	val_164	2008-04-08	11
 164	val_164	164	val_164	2008-04-09	11
 164	val_164	164	val_164	2008-04-08	11
+164	val_164	164	val_164	2008-04-08	11
 164	val_164	164	val_164	2008-04-09	12
+164	val_164	164	val_164	2008-04-09	12
+164	val_164	164	val_164	2008-04-09	11
 164	val_164	164	val_164	2008-04-09	11
 164	val_164	164	val_164	2008-04-09	12
+164	val_164	164	val_164	2008-04-09	12
+164	val_164	164	val_164	2008-04-08	12
+164	val_164	164	val_164	2008-04-08	12
 164	val_164	164	val_164	2008-04-08	12
 164	val_164	164	val_164	2008-04-08	12
 165	val_165	165	val_165	2008-04-08	11
-165	val_165	165	val_165	2008-04-09	11
-165	val_165	165	val_165	2008-04-09	12
-165	val_165	165	val_165	2008-04-08	12
-165	val_165	165	val_165	2008-04-09	12
-165	val_165	165	val_165	2008-04-08	12
 165	val_165	165	val_165	2008-04-08	11
 165	val_165	165	val_165	2008-04-09	11
-165	val_165	165	val_165	2008-04-08	11
 165	val_165	165	val_165	2008-04-09	11
 165	val_165	165	val_165	2008-04-09	12
+165	val_165	165	val_165	2008-04-09	12
 165	val_165	165	val_165	2008-04-08	12
+165	val_165	165	val_165	2008-04-08	12
+165	val_165	165	val_165	2008-04-09	12
 165	val_165	165	val_165	2008-04-09	12
 165	val_165	165	val_165	2008-04-08	12
+165	val_165	165	val_165	2008-04-08	12
+165	val_165	165	val_165	2008-04-08	11
 165	val_165	165	val_165	2008-04-08	11
 165	val_165	165	val_165	2008-04-09	11
+165	val_165	165	val_165	2008-04-09	11
 166	val_166	166	val_166	2008-04-08	12
 166	val_166	166	val_166	2008-04-08	11
 166	val_166	166	val_166	2008-04-09	12
 166	val_166	166	val_166	2008-04-09	11
 167	val_167	167	val_167	2008-04-09	11
-167	val_167	167	val_167	2008-04-08	11
 167	val_167	167	val_167	2008-04-09	11
-167	val_167	167	val_167	2008-04-08	12
-167	val_167	167	val_167	2008-04-08	11
-167	val_167	167	val_167	2008-04-08	12
 167	val_167	167	val_167	2008-04-09	11
-167	val_167	167	val_167	2008-04-09	12
 167	val_167	167	val_167	2008-04-08	11
-167	val_167	167	val_167	2008-04-09	12
-167	val_167	167	val_167	2008-04-09	12
-167	val_167	167	val_167	2008-04-08	12
-167	val_167	167	val_167	2008-04-09	11
 167	val_167	167	val_167	2008-04-08	11
+167	val_167	167	val_167	2008-04-08	11
+167	val_167	167	val_167	2008-04-09	11
 167	val_167	167	val_167	2008-04-09	11
+167	val_167	167	val_167	2008-04-09	11
+167	val_167	167	val_167	2008-04-08	12
 167	val_167	167	val_167	2008-04-08	12
+167	val_167	167	val_167	2008-04-08	12
+167	val_167	167	val_167	2008-04-08	11
 167	val_167	167	val_167	2008-04-08	11
+167	val_167	167	val_167	2008-04-08	11
+167	val_167	167	val_167	2008-04-08	12
 167	val_167	167	val_167	2008-04-08	12
+167	val_167	167	val_167	2008-04-08	12
+167	val_167	167	val_167	2008-04-09	11
+167	val_167	167	val_167	2008-04-09	11
 167	val_167	167	val_167	2008-04-09	11
 167	val_167	167	val_167	2008-04-09	12
-167	val_167	167	val_167	2008-04-08	11
 167	val_167	167	val_167	2008-04-09	12
 167	val_167	167	val_167	2008-04-09	12
-167	val_167	167	val_167	2008-04-08	12
-167	val_167	167	val_167	2008-04-09	11
 167	val_167	167	val_167	2008-04-08	11
-167	val_167	167	val_167	2008-04-09	11
-167	val_167	167	val_167	2008-04-08	12
 167	val_167	167	val_167	2008-04-08	11
-167	val_167	167	val_167	2008-04-08	12
-167	val_167	167	val_167	2008-04-09	11
-167	val_167	167	val_167	2008-04-09	12
 167	val_167	167	val_167	2008-04-08	11
 167	val_167	167	val_167	2008-04-09	12
 167	val_167	167	val_167	2008-04-09	12
+167	val_167	167	val_167	2008-04-09	12
+167	val_167	167	val_167	2008-04-09	12
+167	val_167	167	val_167	2008-04-09	12
+167	val_167	167	val_167	2008-04-09	12
+167	val_167	167	val_167	2008-04-08	12
+167	val_167	167	val_167	2008-04-08	12
 167	val_167	167	val_167	2008-04-08	12
 168	val_168	168	val_168	2008-04-08	11
 168	val_168	168	val_168	2008-04-08	12
 168	val_168	168	val_168	2008-04-09	11
 168	val_168	168	val_168	2008-04-09	12
 169	val_169	169	val_169	2008-04-09	12
-169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-09	12
 169	val_169	169	val_169	2008-04-09	12
 169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	11
-169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-09	11
+169	val_169	169	val_169	2008-04-09	11
+169	val_169	169	val_169	2008-04-08	12
 169	val_169	169	val_169	2008-04-08	12
 169	val_169	169	val_169	2008-04-08	12
 169	val_169	169	val_169	2008-04-08	12
-169	val_169	169	val_169	2008-04-09	11
 169	val_169	169	val_169	2008-04-09	12
-169	val_169	169	val_169	2008-04-08	11
-169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-09	12
-169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-09	12
 169	val_169	169	val_169	2008-04-09	12
 169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	11
-169	val_169	169	val_169	2008-04-09	12
-169	val_169	169	val_169	2008-04-08	12
-169	val_169	169	val_169	2008-04-08	12
-169	val_169	169	val_169	2008-04-08	12
 169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-09	11
+169	val_169	169	val_169	2008-04-08	11
+169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-08	11
-169	val_169	169	val_169	2008-04-09	12
 169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	12
-169	val_169	169	val_169	2008-04-09	12
 169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	11
-169	val_169	169	val_169	2008-04-09	12
-169	val_169	169	val_169	2008-04-08	12
-169	val_169	169	val_169	2008-04-08	12
-169	val_169	169	val_169	2008-04-08	12
 169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-09	12
 169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-08	11
-169	val_169	169	val_169	2008-04-09	12
-169	val_169	169	val_169	2008-04-09	11
-169	val_169	169	val_169	2008-04-08	12
-169	val_169	169	val_169	2008-04-09	12
-169	val_169	169	val_169	2008-04-09	11
 169	val_169	169	val_169	2008-04-08	11
-169	val_169	169	val_169	2008-04-09	11
 169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-08	12
 169	val_169	169	val_169	2008-04-08	12
 169	val_169	169	val_169	2008-04-08	12
 169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-08	12
+169	val_169	169	val_169	2008-04-09	11
+169	val_169	169	val_169	2008-04-09	11
+169	val_169	169	val_169	2008-04-09	11
 169	val_169	169	val_169	2008-04-09	11
 169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-09	12
+169	val_169	169	val_169	2008-04-08	11
+169	val_169	169	val_169	2008-04-08	11
+169	val_169	169	val_169	2008-04-08	11
+169	val_169	169	val_169	2008-04-08	11
+169	val_169	169	val_169	2008-04-08	11
+169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-08	11
 169	val_169	169	val_169	2008-04-08	11
 170	val_170	170	val_170	2008-04-09	11
@@ -4015,68 +4063,68 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 170	val_170	170	val_170	2008-04-08	11
 170	val_170	170	val_170	2008-04-08	12
 172	val_172	172	val_172	2008-04-08	11
-172	val_172	172	val_172	2008-04-09	11
-172	val_172	172	val_172	2008-04-08	12
-172	val_172	172	val_172	2008-04-09	12
 172	val_172	172	val_172	2008-04-08	11
-172	val_172	172	val_172	2008-04-08	12
-172	val_172	172	val_172	2008-04-09	12
 172	val_172	172	val_172	2008-04-09	11
-172	val_172	172	val_172	2008-04-08	11
 172	val_172	172	val_172	2008-04-09	11
 172	val_172	172	val_172	2008-04-08	12
+172	val_172	172	val_172	2008-04-08	12
 172	val_172	172	val_172	2008-04-09	12
+172	val_172	172	val_172	2008-04-09	12
+172	val_172	172	val_172	2008-04-08	11
 172	val_172	172	val_172	2008-04-08	11
 172	val_172	172	val_172	2008-04-08	12
+172	val_172	172	val_172	2008-04-08	12
+172	val_172	172	val_172	2008-04-09	12
 172	val_172	172	val_172	2008-04-09	12
 172	val_172	172	val_172	2008-04-09	11
+172	val_172	172	val_172	2008-04-09	11
+174	val_174	174	val_174	2008-04-08	12
 174	val_174	174	val_174	2008-04-08	12
 174	val_174	174	val_174	2008-04-09	12
 174	val_174	174	val_174	2008-04-09	12
-174	val_174	174	val_174	2008-04-08	11
-174	val_174	174	val_174	2008-04-08	11
-174	val_174	174	val_174	2008-04-08	12
-174	val_174	174	val_174	2008-04-09	11
-174	val_174	174	val_174	2008-04-09	11
-174	val_174	174	val_174	2008-04-08	12
 174	val_174	174	val_174	2008-04-09	12
 174	val_174	174	val_174	2008-04-09	12
 174	val_174	174	val_174	2008-04-08	11
 174	val_174	174	val_174	2008-04-08	11
+174	val_174	174	val_174	2008-04-08	11
+174	val_174	174	val_174	2008-04-08	11
 174	val_174	174	val_174	2008-04-08	12
+174	val_174	174	val_174	2008-04-08	12
+174	val_174	174	val_174	2008-04-09	11
+174	val_174	174	val_174	2008-04-09	11
 174	val_174	174	val_174	2008-04-09	11
 174	val_174	174	val_174	2008-04-09	11
 175	val_175	175	val_175	2008-04-09	12
-175	val_175	175	val_175	2008-04-08	11
 175	val_175	175	val_175	2008-04-09	12
 175	val_175	175	val_175	2008-04-08	11
-175	val_175	175	val_175	2008-04-09	11
-175	val_175	175	val_175	2008-04-09	11
-175	val_175	175	val_175	2008-04-08	12
-175	val_175	175	val_175	2008-04-08	12
-175	val_175	175	val_175	2008-04-09	12
 175	val_175	175	val_175	2008-04-08	11
 175	val_175	175	val_175	2008-04-09	12
+175	val_175	175	val_175	2008-04-09	12
 175	val_175	175	val_175	2008-04-08	11
+175	val_175	175	val_175	2008-04-08	11
+175	val_175	175	val_175	2008-04-09	11
 175	val_175	175	val_175	2008-04-09	11
 175	val_175	175	val_175	2008-04-09	11
+175	val_175	175	val_175	2008-04-09	11
+175	val_175	175	val_175	2008-04-08	12
 175	val_175	175	val_175	2008-04-08	12
 175	val_175	175	val_175	2008-04-08	12
+175	val_175	175	val_175	2008-04-08	12
+176	val_176	176	val_176	2008-04-08	11
 176	val_176	176	val_176	2008-04-08	11
 176	val_176	176	val_176	2008-04-09	12
-176	val_176	176	val_176	2008-04-08	12
 176	val_176	176	val_176	2008-04-09	12
-176	val_176	176	val_176	2008-04-08	11
-176	val_176	176	val_176	2008-04-09	11
-176	val_176	176	val_176	2008-04-09	11
 176	val_176	176	val_176	2008-04-08	12
-176	val_176	176	val_176	2008-04-08	11
-176	val_176	176	val_176	2008-04-09	12
 176	val_176	176	val_176	2008-04-08	12
 176	val_176	176	val_176	2008-04-09	12
+176	val_176	176	val_176	2008-04-09	12
+176	val_176	176	val_176	2008-04-08	11
 176	val_176	176	val_176	2008-04-08	11
 176	val_176	176	val_176	2008-04-09	11
 176	val_176	176	val_176	2008-04-09	11
+176	val_176	176	val_176	2008-04-09	11
+176	val_176	176	val_176	2008-04-09	11
+176	val_176	176	val_176	2008-04-08	12
 176	val_176	176	val_176	2008-04-08	12
 177	val_177	177	val_177	2008-04-08	12
 177	val_177	177	val_177	2008-04-08	11
@@ -4087,19 +4135,19 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 178	val_178	178	val_178	2008-04-08	11
 178	val_178	178	val_178	2008-04-09	12
 179	val_179	179	val_179	2008-04-08	12
-179	val_179	179	val_179	2008-04-09	12
 179	val_179	179	val_179	2008-04-08	12
-179	val_179	179	val_179	2008-04-09	11
 179	val_179	179	val_179	2008-04-09	12
-179	val_179	179	val_179	2008-04-09	11
-179	val_179	179	val_179	2008-04-08	11
-179	val_179	179	val_179	2008-04-08	11
-179	val_179	179	val_179	2008-04-08	12
 179	val_179	179	val_179	2008-04-09	12
 179	val_179	179	val_179	2008-04-08	12
+179	val_179	179	val_179	2008-04-08	12
 179	val_179	179	val_179	2008-04-09	11
+179	val_179	179	val_179	2008-04-09	11
+179	val_179	179	val_179	2008-04-09	12
 179	val_179	179	val_179	2008-04-09	12
 179	val_179	179	val_179	2008-04-09	11
+179	val_179	179	val_179	2008-04-09	11
+179	val_179	179	val_179	2008-04-08	11
+179	val_179	179	val_179	2008-04-08	11
 179	val_179	179	val_179	2008-04-08	11
 179	val_179	179	val_179	2008-04-08	11
 180	val_180	180	val_180	2008-04-09	11
@@ -4119,40 +4167,40 @@ POSTHOOK: Input: default@srcpart@ds=2008-04-09/hr=12
 186	val_186	186	val_186	2008-04-09	11
 186	val_186	186	val_186	2008-04-09	12
 187	val_187	187	val_187	2008-04-09	11
+187	val_187	187	val_187	2008-04-09	11
+187	val_187	187	val_187	2008-04-09	11
+187	val_187	187	val_187	2008-04-08	12
 187	val_187	187	val_187	2008-04-08	12
-187	val_187	187	val_187	2008-04-08	11
 187	val_187	187	val_187	2008-04-08	12
-187	val_187	187	val_187	2008-04-09	12
 187	val_187	187	val_187	2008-04-08	11
-187	val_187	187	val_187	2008-04-09	12
-187	val_187	187	val_187	2008-04-09	12
 187	val_187	187	val_187	2008-04-08	11
-187	val_187	187	val_187	2008-04-09	11
-187	val_187	187	val_187	2008-04-09	11
+187	val_187	187	val_187	2008-04-08	11
 187	val_187	187	val_187	2008-04-08	12
-187	val_187	187	val_187	2008-04-09	11
 187	val_187	187	val_187	2008-04-08	12
-187	val_187	187	val_187	2008-04-08	11
 187	val_187	187	val_187	2008-04-08	12
 187	val_187	187	val_187	2008-04-09	12
-187	val_187	187	val_187	2008-04-08	11
 187	val_187	187	val_187	2008-04-09	12
 187	val_187	187	val_187	2008-04-09	12
 187	val_187	187	val_187	2008-04-08	11
-187	val_187	187	val_187	2008-04-09	11
-187	val_187	187	val_187	2008-04-09	11
-187	val_187	187	val_187	2008-04-08	12
-187	val_187	187	val_187	2008-04-09	11
-187	val_187	187	val_187	2008-04-08	12
 187	val_187	187	val_187	2008-04-08	11
-187	val_187	187	val_187	2008-04-08	12
-187	val_187	187	val_187	2008-04-09	12
 187	val_187	187	val_187	2008-04-08	11
 187	val_187	187	val_187	2008-04-09	12
 187	val_187	187	val_187	2008-04-09	12
+187	val_187	187	val_187	2008-04-09	12
+187	val_187	187	val_187	2008-04-09	12
+187	val_187	187	val_187	2008-04-09	12
+187	val_187	187	val_187	2008-04-09	12
+187	val_187	187	val_187	2008-04-08	11
 187	val_187	187	val_187	2008-04-08	11
+187	val_187	187	val_187	2008-04-08	11
+18

<TRUNCATED>

[51/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)


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

Branch: refs/heads/master
Commit: 558876462d2589423d7131b51c24dbf61b8a22b9
Parents: dca389b
Author: Zoltan Haindrich <ki...@rxd.hu>
Authored: Mon Nov 12 10:03:28 2018 -0800
Committer: Jesus Camacho Rodriguez <jc...@apache.org>
Committed: Mon Nov 12 10:03:57 2018 -0800

----------------------------------------------------------------------
 .../results/positive/accumulo_queries.q.out     |   34 +-
 .../test/results/positive/hbase_queries.q.out   |   34 +-
 .../hive/jdbc/AbstractJdbcTriggersTest.java     |    5 +-
 .../jdbc/TestTriggersMoveWorkloadManager.java   |    9 +-
 .../jdbc/TestTriggersTezSessionPoolManager.java |   21 +-
 .../hadoop/hive/ql/parse/CalcitePlanner.java    |    2 +-
 .../bucket_mapjoin_mismatch1.q.out              |    4 +-
 .../clientpositive/allcolref_in_udf.q.out       |   28 +-
 .../annotate_stats_join_pkfk.q.out              |   40 +-
 .../results/clientpositive/auto_join13.q.out    |    6 +-
 .../results/clientpositive/auto_join19.q.out    |    4 +-
 .../clientpositive/auto_join19_inclause.q.out   |    4 +-
 .../results/clientpositive/auto_join2.q.out     |   24 +-
 .../results/clientpositive/auto_join32.q.out    |    6 +-
 .../results/clientpositive/auto_join9.q.out     |    4 +-
 .../clientpositive/auto_join_stats.q.out        |  122 +-
 .../clientpositive/auto_join_stats2.q.out       |   90 +-
 .../materialized_view_create_rewrite.q.out      |    8 +-
 .../clientpositive/bucket_map_join_spark1.q.out |    4 +-
 .../clientpositive/bucket_map_join_spark2.q.out |    4 +-
 .../clientpositive/bucket_map_join_spark3.q.out |    4 +-
 .../clientpositive/bucket_map_join_spark4.q.out |    4 +-
 .../bucketsortoptimize_insert_4.q.out           |    4 +-
 .../bucketsortoptimize_insert_5.q.out           |    4 +-
 .../bucketsortoptimize_insert_8.q.out           |    8 +-
 .../test/results/clientpositive/cbo_const.q.out |   82 +-
 .../results/clientpositive/cbo_rp_join1.q.out   |   80 +-
 .../clientpositive/cbo_rp_outer_join_ppr.q.out  |    8 +-
 .../constantPropagateForSubQuery.q.out          |   10 +-
 .../results/clientpositive/constprog2.q.out     |   16 +-
 .../clientpositive/constprog_partitioner.q.out  |    8 +-
 .../clientpositive/correlationoptimizer8.q.out  |   58 +-
 .../test/results/clientpositive/cte_mat_5.q.out |   18 +-
 .../results/clientpositive/deleteAnalyze.q.out  |   18 +-
 .../clientpositive/druid/druidmini_mv.q.out     |   16 +-
 .../encryption_join_unencrypted_tbl.q.out       |   76 +-
 .../clientpositive/filter_cond_pushdown.q.out   |   90 +-
 .../clientpositive/filter_join_breaktask.q.out  |   24 +-
 .../infer_bucket_sort_map_operators.q.out       |   24 +-
 .../clientpositive/infer_join_preds.q.out       |   22 +-
 .../results/clientpositive/innerjoin1.q.out     |   76 +-
 .../test/results/clientpositive/input23.q.out   |    8 +-
 .../results/clientpositive/interval_3.q.out     |   16 +-
 ql/src/test/results/clientpositive/join13.q.out |    8 +-
 ql/src/test/results/clientpositive/join2.q.out  |   32 +-
 ql/src/test/results/clientpositive/join26.q.out |    2 +-
 ql/src/test/results/clientpositive/join32.q.out |    2 +-
 ql/src/test/results/clientpositive/join33.q.out |    2 +-
 ql/src/test/results/clientpositive/join42.q.out |   28 +-
 ql/src/test/results/clientpositive/join45.q.out |  392 +-
 ql/src/test/results/clientpositive/join46.q.out |  290 +-
 ql/src/test/results/clientpositive/join47.q.out |  392 +-
 ql/src/test/results/clientpositive/join9.q.out  |    6 +-
 .../clientpositive/join_cond_pushdown_1.q.out   |   18 +-
 .../clientpositive/join_cond_pushdown_3.q.out   |   18 +-
 .../join_cond_pushdown_unqual1.q.out            |   18 +-
 .../join_cond_pushdown_unqual3.q.out            |   18 +-
 .../clientpositive/join_emit_interval.q.out     |   52 +-
 .../clientpositive/join_filters_overlap.q.out   |  338 +-
 .../results/clientpositive/join_merging.q.out   |  152 +-
 .../test/results/clientpositive/join_view.q.out |    4 +-
 .../clientpositive/llap/auto_join_filters.q.out |   60 +-
 .../llap/auto_sortmerge_join_6.q.out            |  174 +-
 .../llap/bucket_map_join_tez2.q.out             |  116 +-
 .../clientpositive/llap/bucketmapjoin1.q.out    |   20 +-
 .../clientpositive/llap/bucketmapjoin2.q.out    |    4 +-
 .../clientpositive/llap/bucketmapjoin3.q.out    |   16 +-
 .../llap/bucketsortoptimize_insert_2.q.out      |   24 +-
 .../llap/bucketsortoptimize_insert_6.q.out      |  301 +-
 .../llap/bucketsortoptimize_insert_7.q.out      |    8 +-
 .../clientpositive/llap/check_constraint.q.out  |   43 +-
 .../llap/constprog_semijoin.q.out               |   54 +-
 .../llap/constraints_optimization.q.out         |    8 +-
 .../llap/correlationoptimizer4.q.out            |  314 +-
 .../clientpositive/llap/cross_prod_1.q.out      |   26 +-
 .../results/clientpositive/llap/cte_mat_5.q.out |   12 +-
 .../clientpositive/llap/deleteAnalyze.q.out     |    8 +-
 .../llap/dynamic_partition_pruning.q.out        |  401 +-
 .../llap/dynamic_semijoin_reduction_2.q.out     |   12 +-
 .../clientpositive/llap/explainanalyze_2.q.out  |   64 +-
 .../clientpositive/llap/explainuser_1.q.out     |  306 +-
 .../clientpositive/llap/explainuser_2.q.out     |  166 +-
 .../clientpositive/llap/explainuser_4.q.out     |   34 +-
 .../llap/external_jdbc_table.q.out              |   20 +-
 .../llap/filter_join_breaktask.q.out            |   30 +-
 .../llap/hybridgrace_hashjoin_1.q.out           |    8 +-
 .../clientpositive/llap/join32_lessSize.q.out   |   16 +-
 .../results/clientpositive/llap/join46.q.out    |  338 +-
 .../llap/join_emit_interval.q.out               |   60 +-
 .../results/clientpositive/llap/lineage3.q.out  |    4 +-
 .../clientpositive/llap/llap_smb_ptf.q.out      |   36 +-
 .../results/clientpositive/llap/mapjoin46.q.out |  342 +-
 .../llap/mapjoin_emit_interval.q.out            |   52 +-
 .../clientpositive/llap/mapjoin_hint.q.out      |   32 +-
 .../llap/materialized_view_create_rewrite.q.out |   18 +-
 .../materialized_view_create_rewrite_3.q.out    |    4 +-
 .../materialized_view_create_rewrite_4.q.out    |    8 +-
 .../materialized_view_create_rewrite_5.q.out    |   12 +-
 ...materialized_view_create_rewrite_dummy.q.out |   18 +-
 ...ized_view_create_rewrite_rebuild_dummy.q.out |    4 +-
 ...alized_view_create_rewrite_time_window.q.out |    4 +-
 .../results/clientpositive/llap/mergejoin.q.out |    8 +-
 .../clientpositive/llap/multiMapJoin1.q.out     |   36 +-
 .../results/clientpositive/llap/orc_llap.q.out  |   32 +-
 .../llap/partition_shared_scan.q.out            |   22 +-
 .../clientpositive/llap/ppd_union_view.q.out    |   32 +-
 .../llap/q93_with_constraints.q.out             |    4 +-
 .../results/clientpositive/llap/reopt_dpp.q.out |   16 +-
 .../clientpositive/llap/reopt_semijoin.q.out    |    8 +-
 .../clientpositive/llap/sharedworkext.q.out     |    8 +-
 .../results/clientpositive/llap/stats11.q.out   |    4 +-
 .../clientpositive/llap/subquery_in.q.out       |  276 +-
 .../clientpositive/llap/subquery_notin.q.out    |   82 +-
 .../clientpositive/llap/subquery_scalar.q.out   |  128 +-
 .../clientpositive/llap/subquery_select.q.out   |  532 +--
 .../llap/table_access_keys_stats.q.out          |    4 +-
 .../llap/tez_dynpart_hashjoin_1.q.out           |   22 +-
 .../llap/tez_dynpart_hashjoin_2.q.out           |  114 +-
 .../llap/tez_dynpart_hashjoin_3.q.out           |  196 +-
 .../llap/tez_fixed_bucket_pruning.q.out         |   84 +-
 .../clientpositive/llap/tez_self_join.q.out     |   16 +-
 .../llap/tez_vector_dynpart_hashjoin_2.q.out    |  114 +-
 .../clientpositive/llap/unionDistinct_1.q.out   | 1946 +++++-----
 .../llap/vector_between_columns.q.out           |   24 +-
 .../llap/vector_char_mapjoin1.q.out             |   36 +-
 .../clientpositive/llap/vector_coalesce_3.q.out |   16 +-
 .../llap/vector_complex_join.q.out              |   28 +-
 .../clientpositive/llap/vector_inner_join.q.out |   43 +-
 .../llap/vector_join_filters.q.out              |   43 +-
 .../llap/vector_left_outer_join2.q.out          |  108 +-
 .../llap/vector_mapjoin_reduce.q.out            |    4 +-
 .../llap/vector_varchar_mapjoin1.q.out          |   24 +-
 .../llap/vector_windowing_rank.q.out            |   28 +-
 .../vectorized_dynamic_partition_pruning.q.out  |  341 +-
 .../clientpositive/llap/vectorized_join46.q.out |  276 +-
 .../llap/vectorized_multi_output_select.q.out   |    8 +-
 .../clientpositive/louter_join_ppr.q.out        |  112 +-
 .../test/results/clientpositive/mapjoin1.q.out  |   32 +-
 .../test/results/clientpositive/mapjoin46.q.out |  318 +-
 .../test/results/clientpositive/mapjoin47.q.out |  358 +-
 .../test/results/clientpositive/masking_1.q.out |   38 +-
 .../results/clientpositive/masking_12.q.out     |   56 +-
 .../test/results/clientpositive/masking_3.q.out | 3472 +++++++++---------
 .../test/results/clientpositive/masking_4.q.out |   56 +-
 .../test/results/clientpositive/mergejoin.q.out |    8 +-
 .../results/clientpositive/mergejoins.q.out     |   34 +-
 .../multi_insert_with_join2.q.out               |   16 +-
 .../results/clientpositive/outer_join_ppr.q.out |    8 +-
 ql/src/test/results/clientpositive/pcr.q.out    |  100 +-
 .../clientpositive/perf/spark/query1.q.out      |   10 +-
 .../clientpositive/perf/spark/query11.q.out     |  148 +-
 .../clientpositive/perf/spark/query12.q.out     |    4 +-
 .../clientpositive/perf/spark/query13.q.out     |  190 +-
 .../clientpositive/perf/spark/query15.q.out     |   32 +-
 .../clientpositive/perf/spark/query17.q.out     |   20 +-
 .../clientpositive/perf/spark/query18.q.out     |   68 +-
 .../clientpositive/perf/spark/query19.q.out     |   20 +-
 .../clientpositive/perf/spark/query2.q.out      |   24 +-
 .../clientpositive/perf/spark/query20.q.out     |    4 +-
 .../clientpositive/perf/spark/query21.q.out     |   14 +-
 .../clientpositive/perf/spark/query22.q.out     |    4 +-
 .../clientpositive/perf/spark/query23.q.out     |  202 +-
 .../clientpositive/perf/spark/query24.q.out     |   88 +-
 .../clientpositive/perf/spark/query25.q.out     |   22 +-
 .../clientpositive/perf/spark/query26.q.out     |    4 +-
 .../clientpositive/perf/spark/query27.q.out     |    8 +-
 .../clientpositive/perf/spark/query29.q.out     |   32 +-
 .../clientpositive/perf/spark/query3.q.out      |    4 +-
 .../clientpositive/perf/spark/query30.q.out     |   12 +-
 .../clientpositive/perf/spark/query31.q.out     |  310 +-
 .../clientpositive/perf/spark/query32.q.out     |   10 +-
 .../clientpositive/perf/spark/query33.q.out     |   42 +-
 .../clientpositive/perf/spark/query36.q.out     |    4 +-
 .../clientpositive/perf/spark/query38.q.out     |   12 +-
 .../clientpositive/perf/spark/query39.q.out     |   12 +-
 .../clientpositive/perf/spark/query4.q.out      |  308 +-
 .../clientpositive/perf/spark/query40.q.out     |   14 +-
 .../clientpositive/perf/spark/query42.q.out     |    4 +-
 .../clientpositive/perf/spark/query43.q.out     |   12 +-
 .../clientpositive/perf/spark/query46.q.out     |    4 +-
 .../clientpositive/perf/spark/query47.q.out     |   16 +-
 .../clientpositive/perf/spark/query48.q.out     |  148 +-
 .../clientpositive/perf/spark/query49.q.out     |  102 +-
 .../clientpositive/perf/spark/query5.q.out      |   12 +-
 .../clientpositive/perf/spark/query50.q.out     |   20 +-
 .../clientpositive/perf/spark/query52.q.out     |    4 +-
 .../clientpositive/perf/spark/query53.q.out     |   18 +-
 .../clientpositive/perf/spark/query54.q.out     |    4 +-
 .../clientpositive/perf/spark/query55.q.out     |    4 +-
 .../clientpositive/perf/spark/query56.q.out     |   42 +-
 .../clientpositive/perf/spark/query57.q.out     |   22 +-
 .../clientpositive/perf/spark/query58.q.out     |   48 +-
 .../clientpositive/perf/spark/query59.q.out     |   54 +-
 .../clientpositive/perf/spark/query6.q.out      |   14 +-
 .../clientpositive/perf/spark/query60.q.out     |   42 +-
 .../clientpositive/perf/spark/query61.q.out     |    8 +-
 .../clientpositive/perf/spark/query63.q.out     |   18 +-
 .../clientpositive/perf/spark/query65.q.out     |    6 +-
 .../clientpositive/perf/spark/query66.q.out     |   44 +-
 .../clientpositive/perf/spark/query67.q.out     |   56 +-
 .../clientpositive/perf/spark/query68.q.out     |    4 +-
 .../clientpositive/perf/spark/query7.q.out      |    4 +-
 .../clientpositive/perf/spark/query70.q.out     |    4 +-
 .../clientpositive/perf/spark/query71.q.out     |    4 +-
 .../clientpositive/perf/spark/query72.q.out     |   50 +-
 .../clientpositive/perf/spark/query74.q.out     |  150 +-
 .../clientpositive/perf/spark/query75.q.out     |   56 +-
 .../clientpositive/perf/spark/query76.q.out     |   42 +-
 .../clientpositive/perf/spark/query77.q.out     |   16 +-
 .../clientpositive/perf/spark/query78.q.out     |   30 +-
 .../clientpositive/perf/spark/query79.q.out     |   24 +-
 .../clientpositive/perf/spark/query8.q.out      |   16 +-
 .../clientpositive/perf/spark/query80.q.out     |   12 +-
 .../clientpositive/perf/spark/query81.q.out     |   20 +-
 .../clientpositive/perf/spark/query83.q.out     |   46 +-
 .../clientpositive/perf/spark/query84.q.out     |   16 +-
 .../clientpositive/perf/spark/query85.q.out     |  255 +-
 .../clientpositive/perf/spark/query86.q.out     |    4 +-
 .../clientpositive/perf/spark/query87.q.out     |   12 +-
 .../clientpositive/perf/spark/query89.q.out     |   10 +-
 .../clientpositive/perf/spark/query9.q.out      |   62 +-
 .../clientpositive/perf/spark/query91.q.out     |   12 +-
 .../clientpositive/perf/spark/query92.q.out     |   10 +-
 .../clientpositive/perf/spark/query93.q.out     |   18 +-
 .../clientpositive/perf/spark/query98.q.out     |    4 +-
 .../clientpositive/perf/spark/query99.q.out     |   58 +-
 .../clientpositive/perf/tez/cbo_query1.q.out    |    8 +-
 .../clientpositive/perf/tez/cbo_query10.q.out   |    6 +-
 .../clientpositive/perf/tez/cbo_query11.q.out   |   94 +-
 .../clientpositive/perf/tez/cbo_query12.q.out   |    2 +-
 .../clientpositive/perf/tez/cbo_query13.q.out   |   30 +-
 .../clientpositive/perf/tez/cbo_query14.q.out   |  102 +-
 .../clientpositive/perf/tez/cbo_query15.q.out   |   14 +-
 .../clientpositive/perf/tez/cbo_query17.q.out   |   20 +-
 .../clientpositive/perf/tez/cbo_query18.q.out   |   59 +-
 .../clientpositive/perf/tez/cbo_query19.q.out   |   16 +-
 .../clientpositive/perf/tez/cbo_query2.q.out    |   16 +-
 .../clientpositive/perf/tez/cbo_query20.q.out   |    2 +-
 .../clientpositive/perf/tez/cbo_query21.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query22.q.out   |    4 +-
 .../clientpositive/perf/tez/cbo_query23.q.out   |  216 +-
 .../clientpositive/perf/tez/cbo_query24.q.out   |   30 +-
 .../clientpositive/perf/tez/cbo_query25.q.out   |   18 +-
 .../clientpositive/perf/tez/cbo_query26.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query27.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query29.q.out   |   18 +-
 .../clientpositive/perf/tez/cbo_query3.q.out    |    8 +-
 .../clientpositive/perf/tez/cbo_query30.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query31.q.out   |   72 +-
 .../clientpositive/perf/tez/cbo_query32.q.out   |   12 +-
 .../clientpositive/perf/tez/cbo_query33.q.out   |   36 +-
 .../clientpositive/perf/tez/cbo_query34.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query35.q.out   |    6 +-
 .../clientpositive/perf/tez/cbo_query36.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query37.q.out   |   12 +-
 .../clientpositive/perf/tez/cbo_query38.q.out   |    6 +-
 .../clientpositive/perf/tez/cbo_query39.q.out   |   12 +-
 .../clientpositive/perf/tez/cbo_query4.q.out    |  122 +-
 .../clientpositive/perf/tez/cbo_query40.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query42.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query43.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query46.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query47.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query48.q.out   |   28 +-
 .../clientpositive/perf/tez/cbo_query49.q.out   |   81 +-
 .../clientpositive/perf/tez/cbo_query5.q.out    |   14 +-
 .../clientpositive/perf/tez/cbo_query50.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query51.q.out   |    4 +-
 .../clientpositive/perf/tez/cbo_query52.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query53.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query54.q.out   |    6 +-
 .../clientpositive/perf/tez/cbo_query55.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query56.q.out   |   36 +-
 .../clientpositive/perf/tez/cbo_query57.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query58.q.out   |   12 +-
 .../clientpositive/perf/tez/cbo_query59.q.out   |   20 +-
 .../clientpositive/perf/tez/cbo_query6.q.out    |    6 +-
 .../clientpositive/perf/tez/cbo_query60.q.out   |   36 +-
 .../clientpositive/perf/tez/cbo_query61.q.out   |   40 +-
 .../clientpositive/perf/tez/cbo_query63.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query64.q.out   |  114 +-
 .../clientpositive/perf/tez/cbo_query65.q.out   |    8 +-
 .../clientpositive/perf/tez/cbo_query66.q.out   |   34 +-
 .../clientpositive/perf/tez/cbo_query68.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query69.q.out   |    6 +-
 .../clientpositive/perf/tez/cbo_query7.q.out    |   10 +-
 .../clientpositive/perf/tez/cbo_query71.q.out   |   14 +-
 .../clientpositive/perf/tez/cbo_query72.q.out   |   26 +-
 .../clientpositive/perf/tez/cbo_query73.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query74.q.out   |   30 +-
 .../clientpositive/perf/tez/cbo_query75.q.out   |   48 +-
 .../clientpositive/perf/tez/cbo_query76.q.out   |   20 +-
 .../clientpositive/perf/tez/cbo_query77.q.out   |   16 +-
 .../clientpositive/perf/tez/cbo_query78.q.out   |   24 +-
 .../clientpositive/perf/tez/cbo_query79.q.out   |   16 +-
 .../clientpositive/perf/tez/cbo_query8.q.out    |   16 +-
 .../clientpositive/perf/tez/cbo_query80.q.out   |   42 +-
 .../clientpositive/perf/tez/cbo_query81.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query82.q.out   |   12 +-
 .../clientpositive/perf/tez/cbo_query83.q.out   |   12 +-
 .../clientpositive/perf/tez/cbo_query84.q.out   |   16 +-
 .../clientpositive/perf/tez/cbo_query85.q.out   |   44 +-
 .../clientpositive/perf/tez/cbo_query87.q.out   |    6 +-
 .../clientpositive/perf/tez/cbo_query88.q.out   |   80 +-
 .../clientpositive/perf/tez/cbo_query89.q.out   |    6 +-
 .../clientpositive/perf/tez/cbo_query9.q.out    |   12 +-
 .../clientpositive/perf/tez/cbo_query90.q.out   |   20 +-
 .../clientpositive/perf/tez/cbo_query91.q.out   |   18 +-
 .../clientpositive/perf/tez/cbo_query92.q.out   |   12 +-
 .../clientpositive/perf/tez/cbo_query93.q.out   |   12 +-
 .../clientpositive/perf/tez/cbo_query95.q.out   |   14 +-
 .../clientpositive/perf/tez/cbo_query96.q.out   |   10 +-
 .../clientpositive/perf/tez/cbo_query97.q.out   |    4 +-
 .../clientpositive/perf/tez/cbo_query98.q.out   |    2 +-
 .../clientpositive/perf/tez/cbo_query99.q.out   |   39 +-
 .../clientpositive/perf/tez/query1.q.out        |   10 +-
 .../clientpositive/perf/tez/query10.q.out       |    2 +-
 .../clientpositive/perf/tez/query11.q.out       |  412 +--
 .../clientpositive/perf/tez/query12.q.out       |    6 +-
 .../clientpositive/perf/tez/query13.q.out       |  166 +-
 .../clientpositive/perf/tez/query14.q.out       |   32 +-
 .../clientpositive/perf/tez/query15.q.out       |   38 +-
 .../clientpositive/perf/tez/query17.q.out       |   16 +-
 .../clientpositive/perf/tez/query18.q.out       |  266 +-
 .../clientpositive/perf/tez/query19.q.out       |   30 +-
 .../clientpositive/perf/tez/query2.q.out        |   18 +-
 .../clientpositive/perf/tez/query20.q.out       |    6 +-
 .../clientpositive/perf/tez/query21.q.out       |   20 +-
 .../clientpositive/perf/tez/query22.q.out       |    6 +-
 .../clientpositive/perf/tez/query23.q.out       |  564 ++-
 .../clientpositive/perf/tez/query24.q.out       |   50 +-
 .../clientpositive/perf/tez/query25.q.out       |   20 +-
 .../clientpositive/perf/tez/query26.q.out       |   12 +-
 .../clientpositive/perf/tez/query27.q.out       |    8 +-
 .../clientpositive/perf/tez/query29.q.out       |   28 +-
 .../clientpositive/perf/tez/query3.q.out        |    8 +-
 .../clientpositive/perf/tez/query30.q.out       |   14 +-
 .../clientpositive/perf/tez/query31.q.out       |  358 +-
 .../clientpositive/perf/tez/query32.q.out       |    8 +-
 .../clientpositive/perf/tez/query33.q.out       |   28 +-
 .../clientpositive/perf/tez/query34.q.out       |    6 +-
 .../clientpositive/perf/tez/query35.q.out       |    2 +-
 .../clientpositive/perf/tez/query36.q.out       |    6 +-
 .../clientpositive/perf/tez/query37.q.out       |    6 +-
 .../clientpositive/perf/tez/query38.q.out       |   14 +-
 .../clientpositive/perf/tez/query39.q.out       |   12 +-
 .../clientpositive/perf/tez/query4.q.out        |  610 ++-
 .../clientpositive/perf/tez/query40.q.out       |   22 +-
 .../clientpositive/perf/tez/query42.q.out       |    8 +-
 .../clientpositive/perf/tez/query43.q.out       |   20 +-
 .../clientpositive/perf/tez/query46.q.out       |   10 +-
 .../clientpositive/perf/tez/query47.q.out       |    8 +-
 .../clientpositive/perf/tez/query48.q.out       |  136 +-
 .../clientpositive/perf/tez/query49.q.out       |  370 +-
 .../clientpositive/perf/tez/query5.q.out        |   14 +-
 .../clientpositive/perf/tez/query50.q.out       |   12 +-
 .../clientpositive/perf/tez/query51.q.out       |    2 +-
 .../clientpositive/perf/tez/query52.q.out       |    8 +-
 .../clientpositive/perf/tez/query53.q.out       |   16 +-
 .../clientpositive/perf/tez/query54.q.out       |    8 +-
 .../clientpositive/perf/tez/query55.q.out       |    8 +-
 .../clientpositive/perf/tez/query56.q.out       |   28 +-
 .../clientpositive/perf/tez/query57.q.out       |   12 +-
 .../clientpositive/perf/tez/query58.q.out       |  414 ++-
 .../clientpositive/perf/tez/query59.q.out       |  122 +-
 .../clientpositive/perf/tez/query6.q.out        |    6 +-
 .../clientpositive/perf/tez/query60.q.out       |   28 +-
 .../clientpositive/perf/tez/query61.q.out       |   18 +-
 .../clientpositive/perf/tez/query63.q.out       |   16 +-
 .../clientpositive/perf/tez/query64.q.out       |  436 ++-
 .../clientpositive/perf/tez/query65.q.out       |    4 +-
 .../clientpositive/perf/tez/query66.q.out       |   52 +-
 .../clientpositive/perf/tez/query67.q.out       |  152 +-
 .../clientpositive/perf/tez/query68.q.out       |   10 +-
 .../clientpositive/perf/tez/query69.q.out       |    2 +-
 .../clientpositive/perf/tez/query7.q.out        |   12 +-
 .../clientpositive/perf/tez/query70.q.out       |    4 +-
 .../clientpositive/perf/tez/query71.q.out       |   14 +-
 .../clientpositive/perf/tez/query72.q.out       |   44 +-
 .../clientpositive/perf/tez/query73.q.out       |    6 +-
 .../clientpositive/perf/tez/query74.q.out       |  200 +-
 .../clientpositive/perf/tez/query75.q.out       |   36 +-
 .../clientpositive/perf/tez/query76.q.out       |   20 +-
 .../clientpositive/perf/tez/query77.q.out       |   18 +-
 .../clientpositive/perf/tez/query78.q.out       |   26 +-
 .../clientpositive/perf/tez/query79.q.out       |   24 +-
 .../clientpositive/perf/tez/query8.q.out        |   18 +-
 .../clientpositive/perf/tez/query80.q.out       |   12 +-
 .../clientpositive/perf/tez/query81.q.out       |   18 +-
 .../clientpositive/perf/tez/query82.q.out       |    6 +-
 .../clientpositive/perf/tez/query83.q.out       |  304 +-
 .../clientpositive/perf/tez/query84.q.out       |   20 +-
 .../clientpositive/perf/tez/query85.q.out       |  244 +-
 .../clientpositive/perf/tez/query86.q.out       |    4 +-
 .../clientpositive/perf/tez/query87.q.out       |   14 +-
 .../clientpositive/perf/tez/query88.q.out       |   20 +-
 .../clientpositive/perf/tez/query89.q.out       |   10 +-
 .../clientpositive/perf/tez/query9.q.out        |  292 +-
 .../clientpositive/perf/tez/query90.q.out       |    8 +-
 .../clientpositive/perf/tez/query91.q.out       |   14 +-
 .../clientpositive/perf/tez/query92.q.out       |    8 +-
 .../clientpositive/perf/tez/query93.q.out       |   22 +-
 .../clientpositive/perf/tez/query95.q.out       |    4 +-
 .../clientpositive/perf/tez/query96.q.out       |    6 +-
 .../clientpositive/perf/tez/query97.q.out       |    2 +-
 .../clientpositive/perf/tez/query98.q.out       |    6 +-
 .../clientpositive/perf/tez/query99.q.out       |  192 +-
 .../results/clientpositive/pointlookup2.q.out   |  328 +-
 .../results/clientpositive/pointlookup3.q.out   |  288 +-
 .../results/clientpositive/pointlookup5.q.out   |   48 +-
 .../clientpositive/position_alias_test_1.q.out  |   30 +-
 .../clientpositive/ppd_outer_join5.q.out        |   80 +-
 .../clientpositive/ppd_repeated_alias.q.out     |   28 +-
 .../results/clientpositive/ppd_udf_case.q.out   |   52 +-
 .../clientpositive/router_join_ppr.q.out        |  112 +-
 .../test/results/clientpositive/semijoin4.q.out |   16 +-
 .../results/clientpositive/skewjoinopt18.q.out  |   38 +-
 .../results/clientpositive/smb_mapjoin_46.q.out |  217 +-
 .../results/clientpositive/smb_mapjoin_47.q.out |   34 +-
 .../clientpositive/spark/auto_join13.q.out      |    6 +-
 .../clientpositive/spark/auto_join19.q.out      |    4 +-
 .../clientpositive/spark/auto_join2.q.out       |   24 +-
 .../clientpositive/spark/auto_join32.q.out      |    4 +-
 .../clientpositive/spark/auto_join9.q.out       |    4 +-
 .../spark/auto_join_filters.q.out               |   60 +-
 .../clientpositive/spark/auto_join_stats.q.out  |   82 +-
 .../clientpositive/spark/auto_join_stats2.q.out |   58 +-
 .../spark/auto_sortmerge_join_6.q.out           |   36 +-
 .../spark/bucket_map_join_spark1.q.out          |    4 +-
 .../spark/bucket_map_join_spark2.q.out          |    4 +-
 .../spark/bucket_map_join_spark3.q.out          |    4 +-
 .../spark/bucket_map_join_spark4.q.out          |    4 +-
 .../spark/bucket_map_join_tez1.q.out            |   96 +-
 .../spark/bucket_map_join_tez2.q.out            |   70 +-
 .../clientpositive/spark/bucketmapjoin1.q.out   |    8 +-
 .../clientpositive/spark/bucketmapjoin2.q.out   |    4 +-
 .../clientpositive/spark/bucketmapjoin3.q.out   |   16 +-
 .../spark/bucketsortoptimize_insert_2.q.out     |   12 +-
 .../spark/bucketsortoptimize_insert_4.q.out     |    4 +-
 .../spark/bucketsortoptimize_insert_6.q.out     |   28 +-
 .../spark/bucketsortoptimize_insert_7.q.out     |    4 +-
 .../spark/bucketsortoptimize_insert_8.q.out     |    8 +-
 .../spark/constprog_partitioner.q.out           |    8 +-
 .../spark/constprog_semijoin.q.out              |    4 +-
 .../spark/dynamic_rdd_cache.q.out               |   88 +-
 .../spark/filter_join_breaktask.q.out           |   18 +-
 .../spark/infer_bucket_sort_map_operators.q.out |   24 +-
 .../results/clientpositive/spark/join13.q.out   |    8 +-
 .../results/clientpositive/spark/join2.q.out    |   32 +-
 .../results/clientpositive/spark/join26.q.out   |    2 +-
 .../results/clientpositive/spark/join32.q.out   |    2 +-
 .../clientpositive/spark/join32_lessSize.q.out  |    6 +-
 .../results/clientpositive/spark/join33.q.out   |    2 +-
 .../results/clientpositive/spark/join9.q.out    |    6 +-
 .../spark/join_cond_pushdown_1.q.out            |   18 +-
 .../spark/join_cond_pushdown_3.q.out            |   18 +-
 .../spark/join_cond_pushdown_unqual1.q.out      |   18 +-
 .../spark/join_cond_pushdown_unqual3.q.out      |   18 +-
 .../spark/join_filters_overlap.q.out            |  338 +-
 .../clientpositive/spark/join_merging.q.out     |  182 +-
 .../clientpositive/spark/join_view.q.out        |    4 +-
 .../clientpositive/spark/louter_join_ppr.q.out  |  112 +-
 .../results/clientpositive/spark/mapjoin1.q.out |   32 +-
 .../clientpositive/spark/mergejoins.q.out       |   34 +-
 .../clientpositive/spark/outer_join_ppr.q.out   |    8 +-
 .../test/results/clientpositive/spark/pcr.q.out |   60 +-
 .../clientpositive/spark/ppd_outer_join5.q.out  |   80 +-
 .../clientpositive/spark/router_join_ppr.q.out  |  112 +-
 .../clientpositive/spark/skewjoinopt18.q.out    |   38 +-
 .../spark/spark_dynamic_partition_pruning.q.out |  370 +-
 .../spark_dynamic_partition_pruning_3.q.out     |   18 +-
 .../spark_dynamic_partition_pruning_4.q.out     |   10 +-
 .../spark/spark_explainuser_1.q.out             |  334 +-
 .../spark/spark_use_ts_stats_for_mapjoin.q.out  |   26 +-
 ...k_vectorized_dynamic_partition_pruning.q.out |  480 +--
 .../clientpositive/spark/subquery_in.q.out      |  238 +-
 .../clientpositive/spark/subquery_notin.q.out   |  104 +-
 .../clientpositive/spark/subquery_scalar.q.out  |   74 +-
 .../clientpositive/spark/subquery_select.q.out  |  444 ++-
 .../results/clientpositive/spark/union22.q.out  |   17 +-
 .../results/clientpositive/spark/union32.q.out  |   46 +-
 .../clientpositive/spark/union_remove_12.q.out  |    4 +-
 .../clientpositive/spark/union_remove_13.q.out  |    4 +-
 .../clientpositive/spark/union_remove_14.q.out  |    4 +-
 .../spark/vector_inner_join.q.out               |   33 +-
 .../clientpositive/subquery_notexists.q.out     |   30 +-
 .../results/clientpositive/tablevalues.q.out    |   12 +-
 .../clientpositive/tez/explainanalyze_4.q.out   |    4 +-
 .../clientpositive/tez/explainanalyze_5.q.out   |    4 +-
 .../tez/hybridgrace_hashjoin_1.q.out            |    8 +-
 .../results/clientpositive/tez/tez-tag.q.out    |    8 +-
 .../udf_case_column_pruning.q.out               |    9 +-
 .../test/results/clientpositive/union22.q.out   |   23 +-
 .../test/results/clientpositive/union32.q.out   |   46 +-
 .../clientpositive/union_remove_12.q.out        |    4 +-
 .../clientpositive/union_remove_13.q.out        |    4 +-
 .../clientpositive/union_remove_14.q.out        |    4 +-
 .../clientpositive/vector_between_columns.q.out |   30 +-
 .../clientpositive/vector_char_mapjoin1.q.out   |   40 +-
 .../clientpositive/vector_coalesce_3.q.out      |    7 +-
 .../vector_left_outer_join2.q.out               |   92 +-
 .../vector_varchar_mapjoin1.q.out               |   22 +-
 .../clientpositive/vectorized_join46_mr.q.out   |  252 +-
 503 files changed, 16838 insertions(+), 16161 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/accumulo-handler/src/test/results/positive/accumulo_queries.q.out
----------------------------------------------------------------------
diff --git a/accumulo-handler/src/test/results/positive/accumulo_queries.q.out b/accumulo-handler/src/test/results/positive/accumulo_queries.q.out
index 24c595d..b8a73f5 100644
--- a/accumulo-handler/src/test/results/positive/accumulo_queries.q.out
+++ b/accumulo-handler/src/test/results/positive/accumulo_queries.q.out
@@ -575,12 +575,16 @@ STAGE PLANS:
           mode: mergepartial
           outputColumnNames: _col0, _col1
           Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col1 (type: bigint), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -592,29 +596,29 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: key (type: int), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col2 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col2 (type: double)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                   value expressions: _col0 (type: int), _col1 (type: string)
           TableScan
             Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
+              key expressions: _col1 (type: double)
               sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Map-reduce partition columns: _col1 (type: double)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col1 (type: bigint)
+              value expressions: _col0 (type: bigint)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
+            0 _col2 (type: double)
+            1 _col1 (type: double)
           outputColumnNames: _col0, _col1, _col3
           Statistics: Num rows: 275 Data size: 2921 Basic stats: PARTIAL Column stats: NONE
           Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/hbase-handler/src/test/results/positive/hbase_queries.q.out
----------------------------------------------------------------------
diff --git a/hbase-handler/src/test/results/positive/hbase_queries.q.out b/hbase-handler/src/test/results/positive/hbase_queries.q.out
index aea7e7e..9a94625 100644
--- a/hbase-handler/src/test/results/positive/hbase_queries.q.out
+++ b/hbase-handler/src/test/results/positive/hbase_queries.q.out
@@ -576,12 +576,16 @@ STAGE PLANS:
           mode: mergepartial
           outputColumnNames: _col0, _col1
           Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col1 (type: bigint), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -593,29 +597,29 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: key (type: int), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col2 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col2 (type: double)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                   value expressions: _col0 (type: int), _col1 (type: string)
           TableScan
             Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
+              key expressions: _col1 (type: double)
               sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Map-reduce partition columns: _col1 (type: double)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col1 (type: bigint)
+              value expressions: _col0 (type: bigint)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
+            0 _col2 (type: double)
+            1 _col1 (type: double)
           outputColumnNames: _col0, _col1, _col3
           Statistics: Num rows: 275 Data size: 2921 Basic stats: PARTIAL Column stats: NONE
           Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/itests/hive-unit/src/test/java/org/apache/hive/jdbc/AbstractJdbcTriggersTest.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/AbstractJdbcTriggersTest.java b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/AbstractJdbcTriggersTest.java
index aa9893e..8889b62 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/AbstractJdbcTriggersTest.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/AbstractJdbcTriggersTest.java
@@ -43,12 +43,13 @@ import org.apache.hadoop.hive.metastore.api.WMTrigger;
 import org.apache.hadoop.hive.ql.wm.Trigger;
 import org.apache.hive.jdbc.miniHS2.MiniHS2;
 import org.apache.hive.jdbc.miniHS2.MiniHS2.MiniClusterType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public abstract class AbstractJdbcTriggersTest {
   private final Logger LOG = LoggerFactory.getLogger(getClass().getName());

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersMoveWorkloadManager.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersMoveWorkloadManager.java b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersMoveWorkloadManager.java
index ad5aa18..e722f74 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersMoveWorkloadManager.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersMoveWorkloadManager.java
@@ -42,6 +42,7 @@ import org.apache.hadoop.hive.ql.wm.Trigger;
 import org.apache.hive.common.util.RetryTestRunner;
 import org.apache.hive.jdbc.miniHS2.MiniHS2;
 import org.apache.hive.jdbc.miniHS2.MiniHS2.MiniClusterType;
+
 import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
@@ -102,7 +103,7 @@ public class TestTriggersMoveWorkloadManager extends AbstractJdbcTriggersTest {
     Trigger killTrigger = new ExecutionTrigger("slow_query_kill", killExpression,
       new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(moveTrigger), Lists.newArrayList(killTrigger));
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.tez.session.events.print.summary=json");
@@ -138,7 +139,7 @@ public class TestTriggersMoveWorkloadManager extends AbstractJdbcTriggersTest {
     Trigger killTrigger = new ExecutionTrigger("slow_query_kill", killExpression,
       new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(moveTrigger, killTrigger), Lists.newArrayList());
-    String query = "select sleep(t1.under_col, 1), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 1), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col==t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.tez.session.events.print.summary=json");
@@ -173,7 +174,7 @@ public class TestTriggersMoveWorkloadManager extends AbstractJdbcTriggersTest {
     Trigger killTrigger = new ExecutionTrigger("slow_query_kill", killExpression,
       new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(moveTrigger1, killTrigger), Lists.newArrayList(moveTrigger2));
-    String query = "select sleep(t1.under_col, 1), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 1), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.tez.session.events.print.summary=json");
@@ -251,7 +252,7 @@ public class TestTriggersMoveWorkloadManager extends AbstractJdbcTriggersTest {
     Trigger killTrigger = new ExecutionTrigger("kill_big_read", killExpression,
       new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(moveTrigger, killTrigger), Lists.newArrayList());
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.tez.session.events.print.summary=json");

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersTezSessionPoolManager.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersTezSessionPoolManager.java b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersTezSessionPoolManager.java
index faab11a..4372967 100644
--- a/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersTezSessionPoolManager.java
+++ b/itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestTriggersTezSessionPoolManager.java
@@ -28,6 +28,7 @@ import org.apache.hadoop.hive.ql.wm.ExecutionTrigger;
 import org.apache.hadoop.hive.ql.wm.Expression;
 import org.apache.hadoop.hive.ql.wm.ExpressionFactory;
 import org.apache.hadoop.hive.ql.wm.Trigger;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
@@ -48,7 +49,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression expression = ExpressionFactory.fromString("ELAPSED_TIME > 20000");
     Trigger trigger = new ExecutionTrigger("slow_query", expression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(trigger));
-    String query = "select sleep(t1.under_col, 500), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 500), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");
@@ -61,7 +62,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression expression = ExpressionFactory.fromString("ELAPSED_TIME > 100");
     Trigger trigger = new ExecutionTrigger("slow_query", expression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(trigger));
-    String query = "select sleep(t1.under_col, 500), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 500), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");
@@ -74,7 +75,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression expression = ExpressionFactory.fromString("EXECUTION_TIME > 1000");
     Trigger trigger = new ExecutionTrigger("slow_query", expression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(trigger));
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");
@@ -104,7 +105,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression expression = ExpressionFactory.fromString("HDFS_BYTES_READ > 100");
     Trigger trigger = new ExecutionTrigger("big_read", expression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(trigger));
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");
@@ -117,7 +118,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression expression = ExpressionFactory.fromString("FILE_BYTES_WRITTEN > 100");
     Trigger trigger = new ExecutionTrigger("big_write", expression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(trigger));
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");
@@ -130,7 +131,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression expression = ExpressionFactory.fromString("VERTEX_TOTAL_TASKS > 20");
     Trigger trigger = new ExecutionTrigger("highly_parallel", expression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(trigger));
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = getConfigs();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");
@@ -143,7 +144,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression expression = ExpressionFactory.fromString("DAG_TOTAL_TASKS > 50");
     Trigger trigger = new ExecutionTrigger("highly_parallel", expression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(trigger));
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = getConfigs();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");
@@ -156,7 +157,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression expression = ExpressionFactory.fromString("HDFS_READ_OPS > 50");
     Trigger trigger = new ExecutionTrigger("high_read_ops", expression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(trigger));
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = getConfigs();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");
@@ -351,7 +352,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression execTimeExpression = ExpressionFactory.fromString("EXECUTION_TIME > 1000");
     Trigger execTimeTrigger = new ExecutionTrigger("slow_query", execTimeExpression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(shuffleTrigger, execTimeTrigger));
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");
@@ -366,7 +367,7 @@ public class TestTriggersTezSessionPoolManager extends AbstractJdbcTriggersTest
     Expression execTimeExpression = ExpressionFactory.fromString("EXECUTION_TIME > 100000");
     Trigger execTimeTrigger = new ExecutionTrigger("slow_query", execTimeExpression, new Action(Action.Type.KILL_QUERY));
     setupTriggers(Lists.newArrayList(shuffleTrigger, execTimeTrigger));
-    String query = "select sleep(t1.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
+    String query = "select sleep(t1.under_col+t2.under_col, 5), t1.value from " + tableName + " t1 join " + tableName +
       " t2 on t1.under_col>=t2.under_col";
     List<String> setCmds = new ArrayList<>();
     setCmds.add("set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.PostExecWMEventsSummaryPrinter");

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
index 35f2b0a..6e9c68b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java
@@ -2069,9 +2069,9 @@ public class CalcitePlanner extends SemanticAnalyzer {
         rules.add(new HivePointLookupOptimizerRule.JoinCondition(minNumORClauses));
         rules.add(new HivePointLookupOptimizerRule.ProjectionExpressions(minNumORClauses));
       }
+      rules.add(HiveProjectJoinTransposeRule.INSTANCE);
       if (conf.getBoolVar(HiveConf.ConfVars.HIVE_OPTIMIZE_CONSTRAINTS_JOIN) &&
           profilesCBO.contains(ExtendedCBOProfile.REFERENTIAL_CONSTRAINTS)) {
-        rules.add(HiveProjectJoinTransposeRule.INSTANCE);
         rules.add(HiveJoinConstraintsRule.INSTANCE);
       }
       rules.add(HiveJoinAddNotNullRule.INSTANCE_JOIN);

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientnegative/bucket_mapjoin_mismatch1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientnegative/bucket_mapjoin_mismatch1.q.out b/ql/src/test/results/clientnegative/bucket_mapjoin_mismatch1.q.out
index 3c43278..264d7d4 100644
--- a/ql/src/test/results/clientnegative/bucket_mapjoin_mismatch1.q.out
+++ b/ql/src/test/results/clientnegative/bucket_mapjoin_mismatch1.q.out
@@ -143,10 +143,10 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col4
+          outputColumnNames: _col0, _col1, _col3
           Statistics: Num rows: 118 Data size: 46200 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col4 (type: string)
+            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: string)
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 118 Data size: 46200 Basic stats: PARTIAL Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/allcolref_in_udf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/allcolref_in_udf.q.out b/ql/src/test/results/clientpositive/allcolref_in_udf.q.out
index ded58bd..952fe48 100644
--- a/ql/src/test/results/clientpositive/allcolref_in_udf.q.out
+++ b/ql/src/test/results/clientpositive/allcolref_in_udf.q.out
@@ -93,15 +93,15 @@ STAGE PLANS:
               predicate: (UDFToDouble(key) < 100.0D) (type: boolean)
               Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), value (type: string), concat(key, value) (type: string), (UDFToDouble(key) + 1.0D) (type: double)
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: (UDFToDouble(_col0) + 1.0D) (type: double)
+                  key expressions: _col3 (type: double)
                   sort order: +
-                  Map-reduce partition columns: (UDFToDouble(_col0) + 1.0D) (type: double)
+                  Map-reduce partition columns: _col3 (type: double)
                   Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: string), _col1 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string)
           TableScan
             alias: b
             filterExpr: key is not null (type: boolean)
@@ -110,26 +110,26 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), value (type: string), concat(key, value) (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col3 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col3 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: string), _col1 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 (UDFToDouble(_col0) + 1.0D) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1, _col5, _col6
+            0 _col3 (type: double)
+            1 _col3 (type: double)
+          outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: 2 (type: int), concat(_col0, _col1, _col5, _col6) (type: string), concat(_col0, _col1) (type: string), concat(_col5, _col6) (type: string), concat(_col0, _col1, _col5) (type: string), concat(_col0, _col5, _col6) (type: string)
+            expressions: 2 (type: int), concat(_col0, _col1, _col4, _col5) (type: string), _col2 (type: string), _col6 (type: string), concat(_col0, _col1, _col4) (type: string), concat(_col0, _col4, _col5) (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
             UDTF Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/annotate_stats_join_pkfk.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/annotate_stats_join_pkfk.q.out b/ql/src/test/results/clientpositive/annotate_stats_join_pkfk.q.out
index a42452a..eafd49a 100644
--- a/ql/src/test/results/clientpositive/annotate_stats_join_pkfk.q.out
+++ b/ql/src/test/results/clientpositive/annotate_stats_join_pkfk.q.out
@@ -473,21 +473,21 @@ STAGE PLANS:
               predicate: ss_store_sk is not null (type: boolean)
               Statistics: Num rows: 964 Data size: 3720 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
-                expressions: ss_store_sk (type: int)
+                expressions: UDFToLong(ss_store_sk) (type: bigint)
                 outputColumnNames: _col0
-                Statistics: Num rows: 964 Data size: 3720 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 964 Data size: 7440 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
-                  key expressions: UDFToLong(_col0) (type: bigint)
+                  key expressions: _col0 (type: bigint)
                   sort order: +
-                  Map-reduce partition columns: UDFToLong(_col0) (type: bigint)
-                  Statistics: Num rows: 964 Data size: 3720 Basic stats: COMPLETE Column stats: COMPLETE
+                  Map-reduce partition columns: _col0 (type: bigint)
+                  Statistics: Num rows: 964 Data size: 7440 Basic stats: COMPLETE Column stats: COMPLETE
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
             0 _col0 (type: bigint)
-            1 UDFToLong(_col0) (type: bigint)
+            1 _col0 (type: bigint)
           outputColumnNames: _col0
           Statistics: Num rows: 964 Data size: 7712 Basic stats: COMPLETE Column stats: COMPLETE
           File Output Operator
@@ -605,12 +605,12 @@ STAGE PLANS:
               Select Operator
                 expressions: s_store_sk (type: int)
                 outputColumnNames: _col0
-                Statistics: Num rows: 12 Data size: 96 Basic stats: COMPLETE Column stats: PARTIAL
+                Statistics: Num rows: 12 Data size: 48 Basic stats: COMPLETE Column stats: PARTIAL
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 12 Data size: 96 Basic stats: COMPLETE Column stats: PARTIAL
+                  Statistics: Num rows: 12 Data size: 48 Basic stats: COMPLETE Column stats: PARTIAL
           TableScan
             alias: ss
             filterExpr: ((ss_quantity > 10) and ss_store_sk is not null) (type: boolean)
@@ -621,12 +621,12 @@ STAGE PLANS:
               Select Operator
                 expressions: ss_store_sk (type: int)
                 outputColumnNames: _col0
-                Statistics: Num rows: 321 Data size: 2468 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 321 Data size: 1240 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 321 Data size: 2468 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 321 Data size: 1240 Basic stats: COMPLETE Column stats: COMPLETE
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -678,12 +678,12 @@ STAGE PLANS:
               Select Operator
                 expressions: s_store_sk (type: int)
                 outputColumnNames: _col0
-                Statistics: Num rows: 12 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 12 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 12 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 12 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
           TableScan
             alias: ss
             filterExpr: ss_store_sk is not null (type: boolean)
@@ -767,12 +767,12 @@ STAGE PLANS:
               Select Operator
                 expressions: ss_store_sk (type: int)
                 outputColumnNames: _col0
-                Statistics: Num rows: 321 Data size: 2468 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 321 Data size: 1240 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 321 Data size: 2468 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 321 Data size: 1240 Basic stats: COMPLETE Column stats: COMPLETE
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1030,12 +1030,12 @@ STAGE PLANS:
               Select Operator
                 expressions: s_store_sk (type: int)
                 outputColumnNames: _col0
-                Statistics: Num rows: 12 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 12 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 12 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 12 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
           TableScan
             alias: s1
             filterExpr: s_store_sk is not null (type: boolean)
@@ -1109,12 +1109,12 @@ STAGE PLANS:
               Select Operator
                 expressions: ss_store_sk (type: int)
                 outputColumnNames: _col0
-                Statistics: Num rows: 321 Data size: 2468 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 321 Data size: 1240 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 321 Data size: 2468 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 321 Data size: 1240 Basic stats: COMPLETE Column stats: COMPLETE
           TableScan
             alias: s
             filterExpr: s_store_sk is not null (type: boolean)
@@ -1156,10 +1156,10 @@ STAGE PLANS:
             0 _col0 (type: int)
             1 _col0 (type: int)
             2 _col0 (type: int)
-          outputColumnNames: _col2
+          outputColumnNames: _col1
           Statistics: Num rows: 321 Data size: 1284 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: _col2 (type: int)
+            expressions: _col1 (type: int)
             outputColumnNames: _col0
             Statistics: Num rows: 321 Data size: 1284 Basic stats: COMPLETE Column stats: COMPLETE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/auto_join13.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join13.q.out b/ql/src/test/results/clientpositive/auto_join13.q.out
index 8b7dc4a..60c087d 100644
--- a/ql/src/test/results/clientpositive/auto_join13.q.out
+++ b/ql/src/test/results/clientpositive/auto_join13.q.out
@@ -49,13 +49,13 @@ STAGE PLANS:
               predicate: (UDFToDouble(key) < 200.0D) (type: boolean)
               Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
+                expressions: UDFToDouble(key) (type: double)
                 outputColumnNames: _col0
                 Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
                     0 (UDFToDouble(_col2) + UDFToDouble(_col0)) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
+                    1 _col0 (type: double)
         $hdt$_0:$hdt$_1:src 
           TableScan
             alias: src
@@ -100,7 +100,7 @@ STAGE PLANS:
                          Inner Join 0 to 1
                     keys:
                       0 (UDFToDouble(_col2) + UDFToDouble(_col0)) (type: double)
-                      1 UDFToDouble(_col0) (type: double)
+                      1 _col0 (type: double)
                     outputColumnNames: _col1, _col2
                     Statistics: Num rows: 200 Data size: 2132 Basic stats: COMPLETE Column stats: NONE
                     Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/auto_join19.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join19.q.out b/ql/src/test/results/clientpositive/auto_join19.q.out
index 295cc1a..be4e5c0 100644
--- a/ql/src/test/results/clientpositive/auto_join19.q.out
+++ b/ql/src/test/results/clientpositive/auto_join19.q.out
@@ -82,10 +82,10 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col4
+                  outputColumnNames: _col0, _col2
                   Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
+                    expressions: UDFToInteger(_col0) (type: int), _col2 (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/auto_join19_inclause.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join19_inclause.q.out b/ql/src/test/results/clientpositive/auto_join19_inclause.q.out
index 158f722..d680ec9 100644
--- a/ql/src/test/results/clientpositive/auto_join19_inclause.q.out
+++ b/ql/src/test/results/clientpositive/auto_join19_inclause.q.out
@@ -82,10 +82,10 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col4
+                  outputColumnNames: _col0, _col2
                   Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
+                    expressions: UDFToInteger(_col0) (type: int), _col2 (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/auto_join2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join2.q.out b/ql/src/test/results/clientpositive/auto_join2.q.out
index 6e4803a..8170f12 100644
--- a/ql/src/test/results/clientpositive/auto_join2.q.out
+++ b/ql/src/test/results/clientpositive/auto_join2.q.out
@@ -45,8 +45,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
@@ -61,13 +61,13 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
+                expressions: value (type: string), UDFToDouble(key) (type: double)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
-                    0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
+                    0 (_col1 + _col3) (type: double)
+                    1 _col1 (type: double)
 
   Stage: Stage-7
     Map Reduce
@@ -80,8 +80,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -89,18 +89,18 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col1
+                  outputColumnNames: _col0, _col1, _col3
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                   Map Join Operator
                     condition map:
                          Inner Join 0 to 1
                     keys:
-                      0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                      1 UDFToDouble(_col0) (type: double)
-                    outputColumnNames: _col0, _col3
+                      0 (_col1 + _col3) (type: double)
+                      1 _col1 (type: double)
+                    outputColumnNames: _col0, _col4
                     Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: UDFToInteger(_col0) (type: int), _col3 (type: string)
+                      expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
                       File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/auto_join32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join32.q.out b/ql/src/test/results/clientpositive/auto_join32.q.out
index 656654e..e63354a 100644
--- a/ql/src/test/results/clientpositive/auto_join32.q.out
+++ b/ql/src/test/results/clientpositive/auto_join32.q.out
@@ -447,10 +447,10 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col3
+                  outputColumnNames: _col0, _col2
                   Group By Operator
-                    aggregations: count(DISTINCT _col3)
-                    keys: _col0 (type: string), _col3 (type: string)
+                    aggregations: count(DISTINCT _col2)
+                    keys: _col0 (type: string), _col2 (type: string)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
                     Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/auto_join9.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join9.q.out b/ql/src/test/results/clientpositive/auto_join9.q.out
index 618429e..fb27842 100644
--- a/ql/src/test/results/clientpositive/auto_join9.q.out
+++ b/ql/src/test/results/clientpositive/auto_join9.q.out
@@ -74,10 +74,10 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col4
+                  outputColumnNames: _col0, _col2
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
+                    expressions: UDFToInteger(_col0) (type: int), _col2 (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator


[11/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query48.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query48.q.out b/ql/src/test/results/clientpositive/perf/tez/query48.q.out
index 76b4ce1..1f63e95 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query48.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query48.q.out
@@ -143,15 +143,15 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Map 7 <- Reducer 11 (BROADCAST_EDGE), Reducer 13 (BROADCAST_EDGE), Reducer 9 (BROADCAST_EDGE)
-Reducer 11 <- Map 10 (CUSTOM_SIMPLE_EDGE)
+Map 8 <- Reducer 10 (BROADCAST_EDGE), Reducer 13 (BROADCAST_EDGE), Reducer 7 (BROADCAST_EDGE)
+Reducer 10 <- Map 9 (CUSTOM_SIMPLE_EDGE)
 Reducer 13 <- Map 12 (CUSTOM_SIMPLE_EDGE)
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
-Reducer 3 <- Map 8 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Map 10 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
+Reducer 3 <- Map 9 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 11 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
 Reducer 5 <- Map 12 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
 Reducer 6 <- Reducer 5 (CUSTOM_SIMPLE_EDGE)
-Reducer 9 <- Map 8 (CUSTOM_SIMPLE_EDGE)
+Reducer 7 <- Map 1 (CUSTOM_SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
@@ -165,103 +165,103 @@ Stage-0
           PARTITION_ONLY_SHUFFLE [RS_30]
             Group By Operator [GBY_29] (rows=1 width=8)
               Output:["_col0"],aggregations:["sum(_col5)"]
-              Select Operator [SEL_28] (rows=25203 width=86)
+              Select Operator [SEL_28] (rows=20247 width=24)
                 Output:["_col5"]
-                Filter Operator [FIL_27] (rows=25203 width=86)
-                  predicate:(((_col14) IN ('KY', 'GA', 'NM') and _col7 BETWEEN 0 AND 2000) or ((_col14) IN ('MT', 'OR', 'IN') and _col7 BETWEEN 150 AND 3000) or ((_col14) IN ('WI', 'MO', 'WV') and _col7 BETWEEN 50 AND 25000))
-                  Merge Join Operator [MERGEJOIN_96] (rows=75613 width=86)
-                    Conds:RS_24._col3=RS_118._col0(Inner),Output:["_col5","_col7","_col14"]
+                Filter Operator [FIL_27] (rows=20247 width=24)
+                  predicate:((_col12 and _col6) or (_col13 and _col7) or (_col14 and _col8))
+                  Merge Join Operator [MERGEJOIN_96] (rows=26999 width=24)
+                    Conds:RS_24._col3=RS_115._col0(Inner),Output:["_col5","_col6","_col7","_col8","_col12","_col13","_col14"]
                   <-Map 12 [SIMPLE_EDGE] vectorized
-                    SHUFFLE [RS_118]
+                    SHUFFLE [RS_115]
                       PartitionCols:_col0
-                      Select Operator [SEL_117] (rows=3529412 width=187)
-                        Output:["_col0","_col1"]
-                        Filter Operator [FIL_116] (rows=3529412 width=187)
+                      Select Operator [SEL_114] (rows=3529412 width=16)
+                        Output:["_col0","_col1","_col2","_col3"]
+                        Filter Operator [FIL_113] (rows=3529412 width=187)
                           predicate:((ca_country = 'United States') and (ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is not null)
                           TableScan [TS_12] (rows=40000000 width=187)
                             default@customer_address,customer_address,Tbl:COMPLETE,Col:COMPLETE,Output:["ca_address_sk","ca_state","ca_country"]
                   <-Reducer 4 [SIMPLE_EDGE]
                     SHUFFLE [RS_24]
                       PartitionCols:_col3
-                      Merge Join Operator [MERGEJOIN_95] (rows=856941 width=0)
-                        Conds:RS_21._col2=RS_110._col0(Inner),Output:["_col3","_col5","_col7"]
-                      <-Map 10 [SIMPLE_EDGE] vectorized
-                        SHUFFLE [RS_110]
+                      Merge Join Operator [MERGEJOIN_95] (rows=305980 width=12)
+                        Conds:RS_21._col4=RS_126._col0(Inner),Output:["_col3","_col5","_col6","_col7","_col8"]
+                      <-Map 11 [SIMPLE_EDGE] vectorized
+                        SHUFFLE [RS_126]
                           PartitionCols:_col0
-                          Select Operator [SEL_109] (rows=29552 width=184)
+                          Select Operator [SEL_125] (rows=1704 width=4)
                             Output:["_col0"]
-                            Filter Operator [FIL_108] (rows=29552 width=183)
-                              predicate:((cd_education_status = '4 yr Degree') and (cd_marital_status = 'M') and cd_demo_sk is not null)
-                              TableScan [TS_9] (rows=1861800 width=183)
-                                default@customer_demographics,customer_demographics,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_marital_status","cd_education_status"]
+                            Filter Operator [FIL_124] (rows=1704 width=4)
+                              predicate:s_store_sk is not null
+                              TableScan [TS_9] (rows=1704 width=4)
+                                default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk"]
                       <-Reducer 3 [SIMPLE_EDGE]
                         SHUFFLE [RS_21]
-                          PartitionCols:_col2
-                          Merge Join Operator [MERGEJOIN_94] (rows=19008181 width=108)
-                            Conds:RS_18._col1=RS_102._col0(Inner),Output:["_col2","_col3","_col5","_col7"]
-                          <-Map 8 [SIMPLE_EDGE] vectorized
-                            PARTITION_ONLY_SHUFFLE [RS_102]
+                          PartitionCols:_col4
+                          Merge Join Operator [MERGEJOIN_94] (rows=305980 width=12)
+                            Conds:RS_18._col1=RS_107._col0(Inner),Output:["_col3","_col4","_col5","_col6","_col7","_col8"]
+                          <-Map 9 [SIMPLE_EDGE] vectorized
+                            SHUFFLE [RS_107]
                               PartitionCols:_col0
-                              Select Operator [SEL_101] (rows=652 width=8)
+                              Select Operator [SEL_106] (rows=652 width=4)
                                 Output:["_col0"]
-                                Filter Operator [FIL_100] (rows=652 width=8)
+                                Filter Operator [FIL_105] (rows=652 width=8)
                                   predicate:((d_year = 1998) and d_date_sk is not null)
                                   TableScan [TS_6] (rows=73049 width=8)
                                     default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
                           <-Reducer 2 [SIMPLE_EDGE]
                             SHUFFLE [RS_18]
                               PartitionCols:_col1
-                              Merge Join Operator [MERGEJOIN_93] (rows=53235296 width=122)
-                                Conds:RS_99._col0=RS_126._col3(Inner),Output:["_col1","_col2","_col3","_col5","_col7"]
+                              Merge Join Operator [MERGEJOIN_93] (rows=856943 width=12)
+                                Conds:RS_99._col0=RS_123._col1(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7","_col8"]
                               <-Map 1 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_99]
+                                PARTITION_ONLY_SHUFFLE [RS_99]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_98] (rows=1704 width=4)
+                                  Select Operator [SEL_98] (rows=29552 width=4)
                                     Output:["_col0"]
-                                    Filter Operator [FIL_97] (rows=1704 width=4)
-                                      predicate:s_store_sk is not null
-                                      TableScan [TS_0] (rows=1704 width=4)
-                                        default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk"]
-                              <-Map 7 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_126]
-                                  PartitionCols:_col3
-                                  Select Operator [SEL_125] (rows=53235296 width=233)
-                                    Output:["_col0","_col1","_col2","_col3","_col4","_col6"]
-                                    Filter Operator [FIL_124] (rows=53235296 width=233)
-                                      predicate:((ss_addr_sk BETWEEN DynamicValue(RS_25_customer_address_ca_address_sk_min) AND DynamicValue(RS_25_customer_address_ca_address_sk_max) and in_bloom_filter(ss_addr_sk, DynamicValue(RS_25_customer_address_ca_address_sk_bloom_filter))) and (ss_cdemo_sk BETWEEN DynamicValue(RS_22_customer_demographics_cd_demo_sk_min) AND DynamicValue(RS_22_customer_demographics_cd_demo_sk_max) and in_bloom_filter(ss_cdemo_sk, DynamicValue(RS_22_customer_demographics_cd_demo_sk_bloom_filter))) and (ss_net_profit BETWEEN 0 AND 2000 or ss_net_profit BETWEEN 150 AND 3000 or ss_net_profit BETWEEN 50 AND 25000) and (ss_sales_price BETWEEN 100 AND 150 or ss_sales_price BETWEEN 50 AND 100 or ss_sales_price BETWEEN 150 AND 200) and (ss_sold_date_sk BETWEEN DynamicValue(RS_19_date_dim_d_date_sk_min) AND DynamicValue(RS_19_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_19_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and 
 ss_cdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
+                                    Filter Operator [FIL_97] (rows=29552 width=183)
+                                      predicate:((cd_education_status = '4 yr Degree') and (cd_marital_status = 'M') and cd_demo_sk is not null)
+                                      TableScan [TS_0] (rows=1861800 width=183)
+                                        default@customer_demographics,customer_demographics,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_marital_status","cd_education_status"]
+                              <-Map 8 [SIMPLE_EDGE] vectorized
+                                SHUFFLE [RS_123]
+                                  PartitionCols:_col1
+                                  Select Operator [SEL_122] (rows=53235296 width=31)
+                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                                    Filter Operator [FIL_121] (rows=53235296 width=233)
+                                      predicate:((ss_addr_sk BETWEEN DynamicValue(RS_25_customer_address_ca_address_sk_min) AND DynamicValue(RS_25_customer_address_ca_address_sk_max) and in_bloom_filter(ss_addr_sk, DynamicValue(RS_25_customer_address_ca_address_sk_bloom_filter))) and (ss_cdemo_sk BETWEEN DynamicValue(RS_15_customer_demographics_cd_demo_sk_min) AND DynamicValue(RS_15_customer_demographics_cd_demo_sk_max) and in_bloom_filter(ss_cdemo_sk, DynamicValue(RS_15_customer_demographics_cd_demo_sk_bloom_filter))) and (ss_net_profit BETWEEN 0 AND 2000 or ss_net_profit BETWEEN 150 AND 3000 or ss_net_profit BETWEEN 50 AND 25000) and (ss_sales_price BETWEEN 100 AND 150 or ss_sales_price BETWEEN 50 AND 100 or ss_sales_price BETWEEN 150 AND 200) and (ss_sold_date_sk BETWEEN DynamicValue(RS_19_date_dim_d_date_sk_min) AND DynamicValue(RS_19_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_19_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and 
 ss_cdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
                                       TableScan [TS_3] (rows=575995635 width=233)
                                         default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_cdemo_sk","ss_addr_sk","ss_store_sk","ss_quantity","ss_sales_price","ss_net_profit"]
-                                      <-Reducer 11 [BROADCAST_EDGE] vectorized
-                                        BROADCAST [RS_115]
-                                          Group By Operator [GBY_114] (rows=1 width=12)
+                                      <-Reducer 10 [BROADCAST_EDGE] vectorized
+                                        BROADCAST [RS_112]
+                                          Group By Operator [GBY_111] (rows=1 width=12)
                                             Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                          <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_113]
-                                              Group By Operator [GBY_112] (rows=1 width=12)
+                                          <-Map 9 [CUSTOM_SIMPLE_EDGE] vectorized
+                                            SHUFFLE [RS_110]
+                                              Group By Operator [GBY_109] (rows=1 width=12)
                                                 Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                Select Operator [SEL_111] (rows=29552 width=4)
+                                                Select Operator [SEL_108] (rows=652 width=4)
                                                   Output:["_col0"]
-                                                   Please refer to the previous Select Operator [SEL_109]
+                                                   Please refer to the previous Select Operator [SEL_106]
                                       <-Reducer 13 [BROADCAST_EDGE] vectorized
-                                        BROADCAST [RS_123]
-                                          Group By Operator [GBY_122] (rows=1 width=12)
+                                        BROADCAST [RS_120]
+                                          Group By Operator [GBY_119] (rows=1 width=12)
                                             Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=3529412)"]
                                           <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_121]
-                                              Group By Operator [GBY_120] (rows=1 width=12)
+                                            SHUFFLE [RS_118]
+                                              Group By Operator [GBY_117] (rows=1 width=12)
                                                 Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=3529412)"]
-                                                Select Operator [SEL_119] (rows=3529412 width=4)
+                                                Select Operator [SEL_116] (rows=3529412 width=4)
                                                   Output:["_col0"]
-                                                   Please refer to the previous Select Operator [SEL_117]
-                                      <-Reducer 9 [BROADCAST_EDGE] vectorized
-                                        BROADCAST [RS_107]
-                                          Group By Operator [GBY_106] (rows=1 width=12)
+                                                   Please refer to the previous Select Operator [SEL_114]
+                                      <-Reducer 7 [BROADCAST_EDGE] vectorized
+                                        BROADCAST [RS_104]
+                                          Group By Operator [GBY_103] (rows=1 width=12)
                                             Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                          <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                            PARTITION_ONLY_SHUFFLE [RS_105]
-                                              Group By Operator [GBY_104] (rows=1 width=12)
+                                          <-Map 1 [CUSTOM_SIMPLE_EDGE] vectorized
+                                            PARTITION_ONLY_SHUFFLE [RS_102]
+                                              Group By Operator [GBY_101] (rows=1 width=12)
                                                 Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                Select Operator [SEL_103] (rows=652 width=4)
+                                                Select Operator [SEL_100] (rows=29552 width=4)
                                                   Output:["_col0"]
-                                                   Please refer to the previous Select Operator [SEL_101]
+                                                   Please refer to the previous Select Operator [SEL_98]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query49.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query49.q.out b/ql/src/test/results/clientpositive/perf/tez/query49.q.out
index 6fe8e9a..31c98a7 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query49.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query49.q.out
@@ -299,257 +299,251 @@ Stage-0
     limit:100
     Stage-1
       Reducer 11 vectorized
-      File Output Operator [FS_310]
-        Limit [LIM_309] (rows=100 width=215)
+      File Output Operator [FS_307]
+        Limit [LIM_306] (rows=100 width=215)
           Number of rows:100
-          Select Operator [SEL_308] (rows=3418 width=215)
+          Select Operator [SEL_305] (rows=3418 width=215)
             Output:["_col0","_col1","_col2","_col3","_col4"]
           <-Reducer 10 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_307]
-              Select Operator [SEL_306] (rows=3418 width=215)
+            SHUFFLE [RS_304]
+              Select Operator [SEL_303] (rows=3418 width=215)
                 Output:["_col0","_col1","_col2","_col3","_col4"]
-                Group By Operator [GBY_305] (rows=3418 width=215)
+                Group By Operator [GBY_302] (rows=3418 width=215)
                   Output:["_col0","_col1","_col2","_col3","_col4"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
                 <-Union 9 [SIMPLE_EDGE]
                   <-Reducer 24 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_351]
+                    Reduce Output Operator [RS_348]
                       PartitionCols:_col0, _col1, _col2, _col3, _col4
-                      Group By Operator [GBY_350] (rows=3418 width=215)
+                      Group By Operator [GBY_347] (rows=3418 width=215)
                         Output:["_col0","_col1","_col2","_col3","_col4"],keys:_col0, _col3, _col4, _col1, _col2
-                        Top N Key Operator [TNK_349] (rows=3418 width=214)
+                        Top N Key Operator [TNK_346] (rows=3418 width=214)
                           keys:_col0, _col3, _col4, _col1, _col2,sort order:+++++,top n:100
-                          Select Operator [SEL_348] (rows=1142 width=213)
+                          Select Operator [SEL_345] (rows=1142 width=213)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Filter Operator [FIL_347] (rows=1142 width=248)
+                            Filter Operator [FIL_344] (rows=1142 width=248)
                               predicate:((_col0 <= 10) or (rank_window_1 <= 10))
-                              PTF Operator [PTF_346] (rows=1714 width=248)
+                              PTF Operator [PTF_343] (rows=1714 width=248)
                                 Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col4 AS decimal(15,4)) / CAST( _col5 AS decimal(15,4))) ASC NULLS LAST","partition by:":"0"}]
-                                Select Operator [SEL_345] (rows=1714 width=248)
+                                Select Operator [SEL_342] (rows=1714 width=248)
                                   Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                 <-Reducer 23 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_344]
+                                  SHUFFLE [RS_341]
                                     PartitionCols:0
-                                    Select Operator [SEL_343] (rows=1714 width=244)
+                                    Select Operator [SEL_340] (rows=1714 width=244)
                                       Output:["rank_window_0","_col0","_col1","_col2","_col3","_col4"]
-                                      PTF Operator [PTF_342] (rows=1714 width=244)
+                                      PTF Operator [PTF_339] (rows=1714 width=244)
                                         Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col1 AS decimal(15,4)) / CAST( _col2 AS decimal(15,4))) ASC NULLS LAST","partition by:":"0"}]
-                                        Select Operator [SEL_341] (rows=1714 width=244)
+                                        Select Operator [SEL_338] (rows=1714 width=244)
                                           Output:["_col0","_col1","_col2","_col3","_col4"]
                                         <-Reducer 22 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_340]
+                                          SHUFFLE [RS_337]
                                             PartitionCols:0
-                                            Group By Operator [GBY_339] (rows=1714 width=244)
+                                            Group By Operator [GBY_336] (rows=1714 width=244)
                                               Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
                                             <-Reducer 21 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_89]
+                                              SHUFFLE [RS_86]
                                                 PartitionCols:_col0
-                                                Group By Operator [GBY_88] (rows=1714 width=244)
-                                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0
-                                                  Select Operator [SEL_86] (rows=1673571 width=73)
-                                                    Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                    Merge Join Operator [MERGEJOIN_237] (rows=1673571 width=73)
-                                                      Conds:RS_83._col1, _col2=RS_338._col0, _col1(Inner),Output:["_col1","_col3","_col4","_col11","_col12"]
-                                                    <-Map 30 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_338]
-                                                        PartitionCols:_col0, _col1
-                                                        Select Operator [SEL_337] (rows=19197050 width=119)
-                                                          Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_336] (rows=19197050 width=119)
-                                                            predicate:((sr_return_amt > 10000) and sr_item_sk is not null and sr_ticket_number is not null)
-                                                            TableScan [TS_77] (rows=57591150 width=119)
-                                                              default@store_returns,sr,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_item_sk","sr_ticket_number","sr_return_quantity","sr_return_amt"]
-                                                    <-Reducer 20 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_83]
-                                                        PartitionCols:_col1, _col2
-                                                        Merge Join Operator [MERGEJOIN_236] (rows=1673571 width=8)
-                                                          Conds:RS_335._col0=RS_272._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
-                                                        <-Map 12 [SIMPLE_EDGE] vectorized
-                                                          PARTITION_ONLY_SHUFFLE [RS_272]
-                                                            PartitionCols:_col0
-                                                            Select Operator [SEL_267] (rows=50 width=12)
-                                                              Output:["_col0"]
-                                                              Filter Operator [FIL_266] (rows=50 width=12)
-                                                                predicate:((d_moy = 12) and (d_year = 2000) and d_date_sk is not null)
-                                                                TableScan [TS_3] (rows=73049 width=12)
-                                                                  default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year","d_moy"]
-                                                        <-Map 29 [SIMPLE_EDGE] vectorized
-                                                          SHUFFLE [RS_335]
-                                                            PartitionCols:_col0
-                                                            Select Operator [SEL_334] (rows=61119617 width=229)
-                                                              Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                              Filter Operator [FIL_333] (rows=61119617 width=229)
-                                                                predicate:((ss_net_paid > 0) and (ss_net_profit > 1) and (ss_quantity > 0) and (ss_sold_date_sk BETWEEN DynamicValue(RS_81_date_dim_d_date_sk_min) AND DynamicValue(RS_81_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_81_date_dim_d_date_sk_bloom_filter))) and ss_item_sk is not null and ss_sold_date_sk is not null and ss_ticket_number is not null)
-                                                                TableScan [TS_71] (rows=575995635 width=229)
-                                                                  default@store_sales,sts,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_ticket_number","ss_quantity","ss_net_paid","ss_net_profit"]
-                                                                <-Reducer 25 [BROADCAST_EDGE] vectorized
-                                                                  BROADCAST [RS_332]
-                                                                    Group By Operator [GBY_331] (rows=1 width=12)
-                                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                    <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                      PARTITION_ONLY_SHUFFLE [RS_279]
-                                                                        Group By Operator [GBY_276] (rows=1 width=12)
-                                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                          Select Operator [SEL_273] (rows=50 width=4)
-                                                                            Output:["_col0"]
-                                                                             Please refer to the previous Select Operator [SEL_267]
+                                                Group By Operator [GBY_85] (rows=3428 width=244)
+                                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col8)","sum(_col3)","sum(_col9)","sum(_col4)"],keys:_col1
+                                                  Merge Join Operator [MERGEJOIN_234] (rows=1673571 width=236)
+                                                    Conds:RS_81._col1, _col2=RS_335._col0, _col1(Inner),Output:["_col1","_col3","_col4","_col8","_col9"]
+                                                  <-Map 30 [SIMPLE_EDGE] vectorized
+                                                    SHUFFLE [RS_335]
+                                                      PartitionCols:_col0, _col1
+                                                      Select Operator [SEL_334] (rows=19197050 width=124)
+                                                        Output:["_col0","_col1","_col2","_col3"]
+                                                        Filter Operator [FIL_333] (rows=19197050 width=119)
+                                                          predicate:((sr_return_amt > 10000) and sr_item_sk is not null and sr_ticket_number is not null)
+                                                          TableScan [TS_75] (rows=57591150 width=119)
+                                                            default@store_returns,sr,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_item_sk","sr_ticket_number","sr_return_quantity","sr_return_amt"]
+                                                  <-Reducer 20 [SIMPLE_EDGE]
+                                                    SHUFFLE [RS_81]
+                                                      PartitionCols:_col1, _col2
+                                                      Merge Join Operator [MERGEJOIN_233] (rows=1673571 width=124)
+                                                        Conds:RS_332._col0=RS_269._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
+                                                      <-Map 12 [SIMPLE_EDGE] vectorized
+                                                        PARTITION_ONLY_SHUFFLE [RS_269]
+                                                          PartitionCols:_col0
+                                                          Select Operator [SEL_264] (rows=50 width=4)
+                                                            Output:["_col0"]
+                                                            Filter Operator [FIL_263] (rows=50 width=12)
+                                                              predicate:((d_moy = 12) and (d_year = 2000) and d_date_sk is not null)
+                                                              TableScan [TS_3] (rows=73049 width=12)
+                                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year","d_moy"]
+                                                      <-Map 29 [SIMPLE_EDGE] vectorized
+                                                        SHUFFLE [RS_332]
+                                                          PartitionCols:_col0
+                                                          Select Operator [SEL_331] (rows=61119617 width=127)
+                                                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                            Filter Operator [FIL_330] (rows=61119617 width=229)
+                                                              predicate:((ss_net_paid > 0) and (ss_net_profit > 1) and (ss_quantity > 0) and (ss_sold_date_sk BETWEEN DynamicValue(RS_79_date_dim_d_date_sk_min) AND DynamicValue(RS_79_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_79_date_dim_d_date_sk_bloom_filter))) and ss_item_sk is not null and ss_sold_date_sk is not null and ss_ticket_number is not null)
+                                                              TableScan [TS_69] (rows=575995635 width=229)
+                                                                default@store_sales,sts,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_ticket_number","ss_quantity","ss_net_paid","ss_net_profit"]
+                                                              <-Reducer 25 [BROADCAST_EDGE] vectorized
+                                                                BROADCAST [RS_329]
+                                                                  Group By Operator [GBY_328] (rows=1 width=12)
+                                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                  <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                    PARTITION_ONLY_SHUFFLE [RS_276]
+                                                                      Group By Operator [GBY_273] (rows=1 width=12)
+                                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                        Select Operator [SEL_270] (rows=50 width=4)
+                                                                          Output:["_col0"]
+                                                                           Please refer to the previous Select Operator [SEL_264]
                   <-Reducer 8 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_304]
+                    Reduce Output Operator [RS_301]
                       PartitionCols:_col0, _col1, _col2, _col3, _col4
-                      Group By Operator [GBY_303] (rows=3418 width=215)
+                      Group By Operator [GBY_300] (rows=3418 width=215)
                         Output:["_col0","_col1","_col2","_col3","_col4"],keys:_col0, _col3, _col4, _col1, _col2
-                        Top N Key Operator [TNK_302] (rows=3418 width=214)
+                        Top N Key Operator [TNK_299] (rows=3418 width=214)
                           keys:_col0, _col3, _col4, _col1, _col2,sort order:+++++,top n:100
-                          Select Operator [SEL_301] (rows=2276 width=215)
+                          Select Operator [SEL_298] (rows=2276 width=215)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_300] (rows=2276 width=215)
+                            Group By Operator [GBY_297] (rows=2276 width=215)
                               Output:["_col0","_col1","_col2","_col3","_col4"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
                             <-Union 7 [SIMPLE_EDGE]
                               <-Reducer 18 [CONTAINS] vectorized
-                                Reduce Output Operator [RS_330]
+                                Reduce Output Operator [RS_327]
                                   PartitionCols:_col0, _col1, _col2, _col3, _col4
-                                  Group By Operator [GBY_329] (rows=2276 width=215)
+                                  Group By Operator [GBY_326] (rows=2276 width=215)
                                     Output:["_col0","_col1","_col2","_col3","_col4"],keys:_col0, _col3, _col4, _col1, _col2
-                                    Select Operator [SEL_328] (rows=1134 width=215)
+                                    Select Operator [SEL_325] (rows=1134 width=215)
                                       Output:["_col0","_col1","_col2","_col3","_col4"]
-                                      Filter Operator [FIL_327] (rows=1134 width=248)
+                                      Filter Operator [FIL_324] (rows=1134 width=248)
                                         predicate:((_col0 <= 10) or (rank_window_1 <= 10))
-                                        PTF Operator [PTF_326] (rows=1701 width=248)
+                                        PTF Operator [PTF_323] (rows=1701 width=248)
                                           Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col4 AS decimal(15,4)) / CAST( _col5 AS decimal(15,4))) ASC NULLS LAST","partition by:":"0"}]
-                                          Select Operator [SEL_325] (rows=1701 width=248)
+                                          Select Operator [SEL_322] (rows=1701 width=248)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                           <-Reducer 17 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_324]
+                                            SHUFFLE [RS_321]
                                               PartitionCols:0
-                                              Select Operator [SEL_323] (rows=1701 width=244)
+                                              Select Operator [SEL_320] (rows=1701 width=244)
                                                 Output:["rank_window_0","_col0","_col1","_col2","_col3","_col4"]
-                                                PTF Operator [PTF_322] (rows=1701 width=244)
+                                                PTF Operator [PTF_319] (rows=1701 width=244)
                                                   Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col1 AS decimal(15,4)) / CAST( _col2 AS decimal(15,4))) ASC NULLS LAST","partition by:":"0"}]
-                                                  Select Operator [SEL_321] (rows=1701 width=244)
+                                                  Select Operator [SEL_318] (rows=1701 width=244)
                                                     Output:["_col0","_col1","_col2","_col3","_col4"]
                                                   <-Reducer 16 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_320]
+                                                    SHUFFLE [RS_317]
                                                       PartitionCols:0
-                                                      Group By Operator [GBY_319] (rows=1701 width=244)
+                                                      Group By Operator [GBY_316] (rows=1701 width=244)
                                                         Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
                                                       <-Reducer 15 [SIMPLE_EDGE]
-                                                        SHUFFLE [RS_50]
+                                                        SHUFFLE [RS_48]
                                                           PartitionCols:_col0
-                                                          Group By Operator [GBY_49] (rows=1701 width=244)
-                                                            Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0
-                                                            Select Operator [SEL_47] (rows=865646 width=188)
-                                                              Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                              Merge Join Operator [MERGEJOIN_235] (rows=865646 width=188)
-                                                                Conds:RS_44._col1, _col2=RS_318._col0, _col1(Inner),Output:["_col1","_col3","_col4","_col11","_col12"]
-                                                              <-Map 28 [SIMPLE_EDGE] vectorized
-                                                                SHUFFLE [RS_318]
-                                                                  PartitionCols:_col0, _col1
-                                                                  Select Operator [SEL_317] (rows=9599627 width=121)
-                                                                    Output:["_col0","_col1","_col2","_col3"]
-                                                                    Filter Operator [FIL_316] (rows=9599627 width=121)
-                                                                      predicate:((cr_return_amount > 10000) and cr_item_sk is not null and cr_order_number is not null)
-                                                                      TableScan [TS_38] (rows=28798881 width=121)
-                                                                        default@catalog_returns,cr,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_item_sk","cr_order_number","cr_return_quantity","cr_return_amount"]
-                                                              <-Reducer 14 [SIMPLE_EDGE]
-                                                                SHUFFLE [RS_44]
-                                                                  PartitionCols:_col1, _col2
-                                                                  Merge Join Operator [MERGEJOIN_234] (rows=865646 width=102)
-                                                                    Conds:RS_315._col0=RS_270._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
-                                                                  <-Map 12 [SIMPLE_EDGE] vectorized
-                                                                    PARTITION_ONLY_SHUFFLE [RS_270]
-                                                                      PartitionCols:_col0
-                                                                       Please refer to the previous Select Operator [SEL_267]
-                                                                  <-Map 27 [SIMPLE_EDGE] vectorized
-                                                                    SHUFFLE [RS_315]
-                                                                      PartitionCols:_col0
-                                                                      Select Operator [SEL_314] (rows=31838858 width=239)
-                                                                        Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                                        Filter Operator [FIL_313] (rows=31838858 width=239)
-                                                                          predicate:((cs_net_paid > 0) and (cs_net_profit > 1) and (cs_quantity > 0) and (cs_sold_date_sk BETWEEN DynamicValue(RS_42_date_dim_d_date_sk_min) AND DynamicValue(RS_42_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_42_date_dim_d_date_sk_bloom_filter))) and cs_item_sk is not null and cs_order_number is not null and cs_sold_date_sk is not null)
-                                                                          TableScan [TS_32] (rows=287989836 width=239)
-                                                                            default@catalog_sales,cs,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_item_sk","cs_order_number","cs_quantity","cs_net_paid","cs_net_profit"]
-                                                                          <-Reducer 19 [BROADCAST_EDGE] vectorized
-                                                                            BROADCAST [RS_312]
-                                                                              Group By Operator [GBY_311] (rows=1 width=12)
-                                                                                Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                              <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                PARTITION_ONLY_SHUFFLE [RS_278]
-                                                                                  Group By Operator [GBY_275] (rows=1 width=12)
-                                                                                    Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                    Select Operator [SEL_271] (rows=50 width=4)
-                                                                                      Output:["_col0"]
-                                                                                       Please refer to the previous Select Operator [SEL_267]
+                                                          Group By Operator [GBY_47] (rows=1701 width=244)
+                                                            Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col8)","sum(_col3)","sum(_col9)","sum(_col4)"],keys:_col1
+                                                            Merge Join Operator [MERGEJOIN_232] (rows=865646 width=236)
+                                                              Conds:RS_43._col1, _col2=RS_315._col0, _col1(Inner),Output:["_col1","_col3","_col4","_col8","_col9"]
+                                                            <-Map 28 [SIMPLE_EDGE] vectorized
+                                                              SHUFFLE [RS_315]
+                                                                PartitionCols:_col0, _col1
+                                                                Select Operator [SEL_314] (rows=9599627 width=124)
+                                                                  Output:["_col0","_col1","_col2","_col3"]
+                                                                  Filter Operator [FIL_313] (rows=9599627 width=121)
+                                                                    predicate:((cr_return_amount > 10000) and cr_item_sk is not null and cr_order_number is not null)
+                                                                    TableScan [TS_37] (rows=28798881 width=121)
+                                                                      default@catalog_returns,cr,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_item_sk","cr_order_number","cr_return_quantity","cr_return_amount"]
+                                                            <-Reducer 14 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_43]
+                                                                PartitionCols:_col1, _col2
+                                                                Merge Join Operator [MERGEJOIN_231] (rows=865646 width=124)
+                                                                  Conds:RS_312._col0=RS_267._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
+                                                                <-Map 12 [SIMPLE_EDGE] vectorized
+                                                                  PARTITION_ONLY_SHUFFLE [RS_267]
+                                                                    PartitionCols:_col0
+                                                                     Please refer to the previous Select Operator [SEL_264]
+                                                                <-Map 27 [SIMPLE_EDGE] vectorized
+                                                                  SHUFFLE [RS_312]
+                                                                    PartitionCols:_col0
+                                                                    Select Operator [SEL_311] (rows=31838858 width=127)
+                                                                      Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                                      Filter Operator [FIL_310] (rows=31838858 width=239)
+                                                                        predicate:((cs_net_paid > 0) and (cs_net_profit > 1) and (cs_quantity > 0) and (cs_sold_date_sk BETWEEN DynamicValue(RS_41_date_dim_d_date_sk_min) AND DynamicValue(RS_41_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_41_date_dim_d_date_sk_bloom_filter))) and cs_item_sk is not null and cs_order_number is not null and cs_sold_date_sk is not null)
+                                                                        TableScan [TS_31] (rows=287989836 width=239)
+                                                                          default@catalog_sales,cs,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_item_sk","cs_order_number","cs_quantity","cs_net_paid","cs_net_profit"]
+                                                                        <-Reducer 19 [BROADCAST_EDGE] vectorized
+                                                                          BROADCAST [RS_309]
+                                                                            Group By Operator [GBY_308] (rows=1 width=12)
+                                                                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                            <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                              PARTITION_ONLY_SHUFFLE [RS_275]
+                                                                                Group By Operator [GBY_272] (rows=1 width=12)
+                                                                                  Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                                  Select Operator [SEL_268] (rows=50 width=4)
+                                                                                    Output:["_col0"]
+                                                                                     Please refer to the previous Select Operator [SEL_264]
                               <-Reducer 6 [CONTAINS] vectorized
-                                Reduce Output Operator [RS_299]
+                                Reduce Output Operator [RS_296]
                                   PartitionCols:_col0, _col1, _col2, _col3, _col4
-                                  Group By Operator [GBY_298] (rows=2276 width=215)
+                                  Group By Operator [GBY_295] (rows=2276 width=215)
                                     Output:["_col0","_col1","_col2","_col3","_col4"],keys:_col0, _col3, _col4, _col1, _col2
-                                    Select Operator [SEL_297] (rows=1142 width=211)
+                                    Select Operator [SEL_294] (rows=1142 width=211)
                                       Output:["_col0","_col1","_col2","_col3","_col4"]
-                                      Filter Operator [FIL_296] (rows=1142 width=248)
+                                      Filter Operator [FIL_293] (rows=1142 width=248)
                                         predicate:((_col0 <= 10) or (rank_window_1 <= 10))
-                                        PTF Operator [PTF_295] (rows=1714 width=248)
+                                        PTF Operator [PTF_292] (rows=1714 width=248)
                                           Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col4 AS decimal(15,4)) / CAST( _col5 AS decimal(15,4))) ASC NULLS LAST","partition by:":"0"}]
-                                          Select Operator [SEL_294] (rows=1714 width=248)
+                                          Select Operator [SEL_291] (rows=1714 width=248)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                           <-Reducer 5 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_293]
+                                            SHUFFLE [RS_290]
                                               PartitionCols:0
-                                              Select Operator [SEL_292] (rows=1714 width=244)
+                                              Select Operator [SEL_289] (rows=1714 width=244)
                                                 Output:["rank_window_0","_col0","_col1","_col2","_col3","_col4"]
-                                                PTF Operator [PTF_291] (rows=1714 width=244)
+                                                PTF Operator [PTF_288] (rows=1714 width=244)
                                                   Function definitions:[{},{"name:":"windowingtablefunction","order by:":"(CAST( _col1 AS decimal(15,4)) / CAST( _col2 AS decimal(15,4))) ASC NULLS LAST","partition by:":"0"}]
-                                                  Select Operator [SEL_290] (rows=1714 width=244)
+                                                  Select Operator [SEL_287] (rows=1714 width=244)
                                                     Output:["_col0","_col1","_col2","_col3","_col4"]
                                                   <-Reducer 4 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_289]
+                                                    SHUFFLE [RS_286]
                                                       PartitionCols:0
-                                                      Group By Operator [GBY_288] (rows=1714 width=244)
+                                                      Group By Operator [GBY_285] (rows=1714 width=244)
                                                         Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
                                                       <-Reducer 3 [SIMPLE_EDGE]
-                                                        SHUFFLE [RS_18]
+                                                        SHUFFLE [RS_17]
                                                           PartitionCols:_col0
-                                                          Group By Operator [GBY_17] (rows=1714 width=244)
-                                                            Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0
-                                                            Select Operator [SEL_15] (rows=438010 width=177)
-                                                              Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                              Merge Join Operator [MERGEJOIN_233] (rows=438010 width=177)
-                                                                Conds:RS_12._col1, _col2=RS_287._col0, _col1(Inner),Output:["_col1","_col3","_col4","_col11","_col12"]
-                                                              <-Map 26 [SIMPLE_EDGE] vectorized
-                                                                SHUFFLE [RS_287]
-                                                                  PartitionCols:_col0, _col1
-                                                                  Select Operator [SEL_286] (rows=4799489 width=118)
-                                                                    Output:["_col0","_col1","_col2","_col3"]
-                                                                    Filter Operator [FIL_285] (rows=4799489 width=118)
-                                                                      predicate:((wr_return_amt > 10000) and wr_item_sk is not null and wr_order_number is not null)
-                                                                      TableScan [TS_6] (rows=14398467 width=118)
-                                                                        default@web_returns,wr,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_item_sk","wr_order_number","wr_return_quantity","wr_return_amt"]
-                                                              <-Reducer 2 [SIMPLE_EDGE]
-                                                                SHUFFLE [RS_12]
-                                                                  PartitionCols:_col1, _col2
-                                                                  Merge Join Operator [MERGEJOIN_232] (rows=438010 width=122)
-                                                                    Conds:RS_284._col0=RS_268._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
-                                                                  <-Map 12 [SIMPLE_EDGE] vectorized
-                                                                    PARTITION_ONLY_SHUFFLE [RS_268]
-                                                                      PartitionCols:_col0
-                                                                       Please refer to the previous Select Operator [SEL_267]
-                                                                  <-Map 1 [SIMPLE_EDGE] vectorized
-                                                                    SHUFFLE [RS_284]
-                                                                      PartitionCols:_col0
-                                                                      Select Operator [SEL_283] (rows=15996318 width=239)
-                                                                        Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                                        Filter Operator [FIL_282] (rows=15996318 width=239)
-                                                                          predicate:((ws_net_paid > 0) and (ws_net_profit > 1) and (ws_quantity > 0) and (ws_sold_date_sk BETWEEN DynamicValue(RS_10_date_dim_d_date_sk_min) AND DynamicValue(RS_10_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_10_date_dim_d_date_sk_bloom_filter))) and ws_item_sk is not null and ws_order_number is not null and ws_sold_date_sk is not null)
-                                                                          TableScan [TS_0] (rows=144002668 width=239)
-                                                                            default@web_sales,ws,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_order_number","ws_quantity","ws_net_paid","ws_net_profit"]
-                                                                          <-Reducer 13 [BROADCAST_EDGE] vectorized
-                                                                            BROADCAST [RS_281]
-                                                                              Group By Operator [GBY_280] (rows=1 width=12)
-                                                                                Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                              <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                PARTITION_ONLY_SHUFFLE [RS_277]
-                                                                                  Group By Operator [GBY_274] (rows=1 width=12)
-                                                                                    Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                    Select Operator [SEL_269] (rows=50 width=4)
-                                                                                      Output:["_col0"]
-                                                                                       Please refer to the previous Select Operator [SEL_267]
+                                                          Group By Operator [GBY_16] (rows=1714 width=244)
+                                                            Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col8)","sum(_col3)","sum(_col9)","sum(_col4)"],keys:_col1
+                                                            Merge Join Operator [MERGEJOIN_230] (rows=438010 width=236)
+                                                              Conds:RS_12._col1, _col2=RS_284._col0, _col1(Inner),Output:["_col1","_col3","_col4","_col8","_col9"]
+                                                            <-Map 26 [SIMPLE_EDGE] vectorized
+                                                              SHUFFLE [RS_284]
+                                                                PartitionCols:_col0, _col1
+                                                                Select Operator [SEL_283] (rows=4799489 width=124)
+                                                                  Output:["_col0","_col1","_col2","_col3"]
+                                                                  Filter Operator [FIL_282] (rows=4799489 width=118)
+                                                                    predicate:((wr_return_amt > 10000) and wr_item_sk is not null and wr_order_number is not null)
+                                                                    TableScan [TS_6] (rows=14398467 width=118)
+                                                                      default@web_returns,wr,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_item_sk","wr_order_number","wr_return_quantity","wr_return_amt"]
+                                                            <-Reducer 2 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_12]
+                                                                PartitionCols:_col1, _col2
+                                                                Merge Join Operator [MERGEJOIN_229] (rows=438010 width=124)
+                                                                  Conds:RS_281._col0=RS_265._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
+                                                                <-Map 12 [SIMPLE_EDGE] vectorized
+                                                                  PARTITION_ONLY_SHUFFLE [RS_265]
+                                                                    PartitionCols:_col0
+                                                                     Please refer to the previous Select Operator [SEL_264]
+                                                                <-Map 1 [SIMPLE_EDGE] vectorized
+                                                                  SHUFFLE [RS_281]
+                                                                    PartitionCols:_col0
+                                                                    Select Operator [SEL_280] (rows=15996318 width=127)
+                                                                      Output:["_col0","_col1","_col2","_col3","_col4"]
+                                                                      Filter Operator [FIL_279] (rows=15996318 width=239)
+                                                                        predicate:((ws_net_paid > 0) and (ws_net_profit > 1) and (ws_quantity > 0) and (ws_sold_date_sk BETWEEN DynamicValue(RS_10_date_dim_d_date_sk_min) AND DynamicValue(RS_10_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_10_date_dim_d_date_sk_bloom_filter))) and ws_item_sk is not null and ws_order_number is not null and ws_sold_date_sk is not null)
+                                                                        TableScan [TS_0] (rows=144002668 width=239)
+                                                                          default@web_sales,ws,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_order_number","ws_quantity","ws_net_paid","ws_net_profit"]
+                                                                        <-Reducer 13 [BROADCAST_EDGE] vectorized
+                                                                          BROADCAST [RS_278]
+                                                                            Group By Operator [GBY_277] (rows=1 width=12)
+                                                                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                            <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                              PARTITION_ONLY_SHUFFLE [RS_274]
+                                                                                Group By Operator [GBY_271] (rows=1 width=12)
+                                                                                  Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                                  Select Operator [SEL_266] (rows=50 width=4)
+                                                                                    Output:["_col0"]
+                                                                                     Please refer to the previous Select Operator [SEL_264]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query5.q.out b/ql/src/test/results/clientpositive/perf/tez/query5.q.out
index 31afb0e..2ce689b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query5.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query5.q.out
@@ -330,9 +330,9 @@ Stage-0
                               SHUFFLE [RS_47]
                                 PartitionCols:_col0
                                 Group By Operator [GBY_46] (rows=46000 width=548)
-                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col9
+                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col8
                                   Merge Join Operator [MERGEJOIN_222] (rows=34813117 width=535)
-                                    Conds:RS_42._col0=RS_310._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col9"]
+                                    Conds:RS_42._col0=RS_310._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
                                   <-Map 24 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_310]
                                       PartitionCols:_col0
@@ -350,7 +350,7 @@ Stage-0
                                       <-Map 10 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_276]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_273] (rows=8116 width=98)
+                                          Select Operator [SEL_273] (rows=8116 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_272] (rows=8116 width=98)
                                               predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-08-18 00:00:00' and d_date_sk is not null)
@@ -401,9 +401,9 @@ Stage-0
                               SHUFFLE [RS_80]
                                 PartitionCols:_col0
                                 Group By Operator [GBY_79] (rows=84 width=548)
-                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col9
+                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col8
                                   Merge Join Operator [MERGEJOIN_224] (rows=30966059 width=543)
-                                    Conds:RS_75._col0=RS_318._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col9"]
+                                    Conds:RS_75._col0=RS_318._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
                                   <-Map 30 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_318]
                                       PartitionCols:_col0
@@ -483,9 +483,9 @@ Stage-0
                               SHUFFLE [RS_22]
                                 PartitionCols:_col0
                                 Group By Operator [GBY_21] (rows=1704 width=548)
-                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col9
+                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col8
                                   Merge Join Operator [MERGEJOIN_220] (rows=64325014 width=376)
-                                    Conds:RS_17._col0=RS_293._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col9"]
+                                    Conds:RS_17._col0=RS_293._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
                                   <-Map 20 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_293]
                                       PartitionCols:_col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query50.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query50.q.out b/ql/src/test/results/clientpositive/perf/tez/query50.q.out
index ae6781b..29b80b8 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query50.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query50.q.out
@@ -162,7 +162,7 @@ Stage-0
                       Select Operator [SEL_27] (rows=11945216 width=821)
                         Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14"]
                         Merge Join Operator [MERGEJOIN_120] (rows=11945216 width=821)
-                          Conds:RS_24._col10=RS_141._col0(Inner),Output:["_col0","_col7","_col14","_col15","_col16","_col17","_col18","_col19","_col20","_col21","_col22","_col23"]
+                          Conds:RS_24._col8=RS_141._col0(Inner),Output:["_col0","_col5","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col20","_col21"]
                         <-Map 14 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_141]
                             PartitionCols:_col0
@@ -174,9 +174,9 @@ Stage-0
                                   default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_name","s_company_id","s_street_number","s_street_name","s_street_type","s_suite_number","s_city","s_county","s_state","s_zip"]
                         <-Reducer 4 [SIMPLE_EDGE]
                           SHUFFLE [RS_24]
-                            PartitionCols:_col10
+                            PartitionCols:_col8
                             Merge Join Operator [MERGEJOIN_119] (rows=11945216 width=3)
-                              Conds:RS_21._col7=RS_138._col0(Inner),Output:["_col0","_col7","_col10"]
+                              Conds:RS_21._col5=RS_138._col0(Inner),Output:["_col0","_col5","_col8"]
                             <-Map 13 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_138]
                                 PartitionCols:_col0
@@ -188,9 +188,9 @@ Stage-0
                                       default@date_dim,d1,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk"]
                             <-Reducer 3 [SIMPLE_EDGE]
                               SHUFFLE [RS_21]
-                                PartitionCols:_col7
+                                PartitionCols:_col5
                                 Merge Join Operator [MERGEJOIN_118] (rows=11945216 width=3)
-                                  Conds:RS_18._col1, _col2, _col3=RS_135._col1, _col2, _col4(Inner),Output:["_col0","_col7","_col10"]
+                                  Conds:RS_18._col1, _col2, _col3=RS_135._col1, _col2, _col4(Inner),Output:["_col0","_col5","_col8"]
                                 <-Reducer 2 [SIMPLE_EDGE]
                                   PARTITION_ONLY_SHUFFLE [RS_18]
                                     PartitionCols:_col1, _col2, _col3
@@ -208,7 +208,7 @@ Stage-0
                                     <-Map 11 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_126]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_125] (rows=50 width=12)
+                                        Select Operator [SEL_125] (rows=50 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_124] (rows=50 width=12)
                                             predicate:((d_moy = 9) and (d_year = 2000) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query51.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query51.q.out b/ql/src/test/results/clientpositive/perf/tez/query51.q.out
index 23c23df..a872cde 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query51.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query51.q.out
@@ -153,7 +153,7 @@ Stage-0
                                       <-Map 7 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_92]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_89] (rows=317 width=102)
+                                          Select Operator [SEL_89] (rows=317 width=98)
                                             Output:["_col0","_col1"]
                                             Filter Operator [FIL_88] (rows=317 width=102)
                                               predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query52.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query52.q.out b/ql/src/test/results/clientpositive/perf/tez/query52.q.out
index bc932b2..30b39aa 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query52.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query52.q.out
@@ -79,13 +79,13 @@ Stage-0
                   SHUFFLE [RS_17]
                     PartitionCols:_col0, _col1
                     Group By Operator [GBY_16] (rows=7333 width=216)
-                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)"],keys:_col7, _col8
+                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)"],keys:_col5, _col6
                       Merge Join Operator [MERGEJOIN_54] (rows=2301098 width=104)
-                        Conds:RS_12._col1=RS_65._col0(Inner),Output:["_col2","_col7","_col8"]
+                        Conds:RS_12._col1=RS_65._col0(Inner),Output:["_col2","_col5","_col6"]
                       <-Map 8 [SIMPLE_EDGE] vectorized
                         PARTITION_ONLY_SHUFFLE [RS_65]
                           PartitionCols:_col0
-                          Select Operator [SEL_64] (rows=7333 width=111)
+                          Select Operator [SEL_64] (rows=7333 width=107)
                             Output:["_col0","_col1","_col2"]
                             Filter Operator [FIL_63] (rows=7333 width=111)
                               predicate:((i_manager_id = 1) and i_item_sk is not null)
@@ -99,7 +99,7 @@ Stage-0
                           <-Map 6 [SIMPLE_EDGE] vectorized
                             PARTITION_ONLY_SHUFFLE [RS_57]
                               PartitionCols:_col0
-                              Select Operator [SEL_56] (rows=50 width=12)
+                              Select Operator [SEL_56] (rows=50 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_55] (rows=50 width=12)
                                   predicate:((d_moy = 12) and (d_year = 1998) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query53.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query53.q.out b/ql/src/test/results/clientpositive/perf/tez/query53.q.out
index a174c21..3436071 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query53.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query53.q.out
@@ -102,9 +102,9 @@ Stage-0
                           SHUFFLE [RS_23]
                             PartitionCols:_col0
                             Group By Operator [GBY_22] (rows=50 width=120)
-                              Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col8, _col11
+                              Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col5, _col7
                               Merge Join Operator [MERGEJOIN_84] (rows=98800 width=8)
-                                Conds:RS_18._col2=RS_106._col0(Inner),Output:["_col3","_col8","_col11"]
+                                Conds:RS_18._col2=RS_106._col0(Inner),Output:["_col3","_col5","_col7"]
                               <-Map 11 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_106]
                                   PartitionCols:_col0
@@ -118,12 +118,12 @@ Stage-0
                                 SHUFFLE [RS_18]
                                   PartitionCols:_col2
                                   Merge Join Operator [MERGEJOIN_83] (rows=98800 width=8)
-                                    Conds:RS_15._col0=RS_95._col0(Inner),Output:["_col2","_col3","_col8","_col11"]
+                                    Conds:RS_15._col0=RS_95._col0(Inner),Output:["_col2","_col3","_col5","_col7"]
                                   <-Map 9 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_95]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_94] (rows=317 width=12)
-                                        Output:["_col0","_col2"]
+                                      Select Operator [SEL_94] (rows=317 width=8)
+                                        Output:["_col0","_col1"]
                                         Filter Operator [FIL_93] (rows=317 width=12)
                                           predicate:((d_month_seq) IN (1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223) and d_date_sk is not null)
                                           TableScan [TS_6] (rows=73049 width=12)
@@ -132,12 +132,12 @@ Stage-0
                                     SHUFFLE [RS_15]
                                       PartitionCols:_col0
                                       Merge Join Operator [MERGEJOIN_82] (rows=569118 width=4)
-                                        Conds:RS_103._col1=RS_87._col0(Inner),Output:["_col0","_col2","_col3","_col8"]
+                                        Conds:RS_103._col1=RS_87._col0(Inner),Output:["_col0","_col2","_col3","_col5"]
                                       <-Map 7 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_87]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_86] (rows=52 width=290)
-                                            Output:["_col0","_col4"]
+                                          Select Operator [SEL_86] (rows=52 width=8)
+                                            Output:["_col0","_col1"]
                                             Filter Operator [FIL_85] (rows=52 width=290)
                                               predicate:((((i_category) IN ('Books', 'Children', 'Electronics') and (i_class) IN ('personal', 'portable', 'reference', 'self-help') and (i_brand) IN ('scholaramalgamalg #14', 'scholaramalgamalg #7', 'exportiunivamalg #9', 'scholaramalgamalg #9')) or ((i_category) IN ('Women', 'Music', 'Men') and (i_class) IN ('accessories', 'classical', 'fragrances', 'pants') and (i_brand) IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'importoamalg #1'))) and (i_brand) IN ('scholaramalgamalg #14', 'scholaramalgamalg #7', 'exportiunivamalg #9', 'scholaramalgamalg #9', 'amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'importoamalg #1') and (i_category) IN ('Books', 'Children', 'Electronics', 'Women', 'Music', 'Men') and (i_class) IN ('personal', 'portable', 'reference', 'self-help', 'accessories', 'classical', 'fragrances', 'pants') and i_item_sk is not null)
                                               TableScan [TS_3] (rows=462000 width=289)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query54.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query54.q.out b/ql/src/test/results/clientpositive/perf/tez/query54.q.out
index a32f264..ddc1ed8 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query54.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query54.q.out
@@ -304,9 +304,9 @@ Stage-0
                                                               SHUFFLE [RS_63]
                                                                 PartitionCols:_col0, _col1
                                                                 Group By Operator [GBY_62] (rows=55046 width=8)
-                                                                  Output:["_col0","_col1"],keys:_col10, _col9
+                                                                  Output:["_col0","_col1"],keys:_col6, _col5
                                                                   Merge Join Operator [MERGEJOIN_267] (rows=110092 width=8)
-                                                                    Conds:RS_58._col1=RS_304._col0(Inner),Output:["_col9","_col10"]
+                                                                    Conds:RS_58._col1=RS_304._col0(Inner),Output:["_col5","_col6"]
                                                                   <-Map 27 [SIMPLE_EDGE] vectorized
                                                                     SHUFFLE [RS_304]
                                                                       PartitionCols:_col0
@@ -324,7 +324,7 @@ Stage-0
                                                                       <-Map 25 [SIMPLE_EDGE] vectorized
                                                                         PARTITION_ONLY_SHUFFLE [RS_298]
                                                                           PartitionCols:_col0
-                                                                          Select Operator [SEL_297] (rows=453 width=190)
+                                                                          Select Operator [SEL_297] (rows=453 width=4)
                                                                             Output:["_col0"]
                                                                             Filter Operator [FIL_296] (rows=453 width=186)
                                                                               predicate:((i_category = 'Jewelry') and (i_class = 'consignment') and i_item_sk is not null)
@@ -338,7 +338,7 @@ Stage-0
                                                                           <-Map 23 [SIMPLE_EDGE] vectorized
                                                                             PARTITION_ONLY_SHUFFLE [RS_292]
                                                                               PartitionCols:_col0
-                                                                              Select Operator [SEL_291] (rows=50 width=12)
+                                                                              Select Operator [SEL_291] (rows=50 width=4)
                                                                                 Output:["_col0"]
                                                                                 Filter Operator [FIL_290] (rows=50 width=12)
                                                                                   predicate:((d_moy = 3) and (d_year = 1999) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query55.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query55.q.out b/ql/src/test/results/clientpositive/perf/tez/query55.q.out
index ec30b92..0890946 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query55.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query55.q.out
@@ -63,13 +63,13 @@ Stage-0
                   SHUFFLE [RS_17]
                     PartitionCols:_col0, _col1
                     Group By Operator [GBY_16] (rows=7333 width=216)
-                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)"],keys:_col7, _col8
+                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)"],keys:_col5, _col6
                       Merge Join Operator [MERGEJOIN_54] (rows=2301098 width=104)
-                        Conds:RS_12._col1=RS_65._col0(Inner),Output:["_col2","_col7","_col8"]
+                        Conds:RS_12._col1=RS_65._col0(Inner),Output:["_col2","_col5","_col6"]
                       <-Map 8 [SIMPLE_EDGE] vectorized
                         PARTITION_ONLY_SHUFFLE [RS_65]
                           PartitionCols:_col0
-                          Select Operator [SEL_64] (rows=7333 width=111)
+                          Select Operator [SEL_64] (rows=7333 width=107)
                             Output:["_col0","_col1","_col2"]
                             Filter Operator [FIL_63] (rows=7333 width=111)
                               predicate:((i_manager_id = 36) and i_item_sk is not null)
@@ -83,7 +83,7 @@ Stage-0
                           <-Map 6 [SIMPLE_EDGE] vectorized
                             PARTITION_ONLY_SHUFFLE [RS_57]
                               PartitionCols:_col0
-                              Select Operator [SEL_56] (rows=50 width=12)
+                              Select Operator [SEL_56] (rows=50 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_55] (rows=50 width=12)
                                   predicate:((d_moy = 12) and (d_year = 2001) and d_date_sk is not null)


[23/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query85.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query85.q.out b/ql/src/test/results/clientpositive/perf/spark/query85.q.out
index 6bdbf7e..a7bf288 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query85.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query85.q.out
@@ -182,8 +182,7 @@ POSTHOOK: Input: default@web_sales
 #### A masked pattern was here ####
 STAGE DEPENDENCIES:
   Stage-2 is a root stage
-  Stage-3 depends on stages: Stage-2
-  Stage-1 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
@@ -191,47 +190,42 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 13 
+        Map 12 
             Map Operator Tree:
                 TableScan
-                  alias: reason
-                  filterExpr: r_reason_sk is not null (type: boolean)
-                  Statistics: Num rows: 72 Data size: 14400 Basic stats: COMPLETE Column stats: NONE
+                  alias: web_page
+                  filterExpr: wp_web_page_sk is not null (type: boolean)
+                  Statistics: Num rows: 4602 Data size: 2696178 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: r_reason_sk is not null (type: boolean)
-                    Statistics: Num rows: 72 Data size: 14400 Basic stats: COMPLETE Column stats: NONE
+                    predicate: wp_web_page_sk is not null (type: boolean)
+                    Statistics: Num rows: 4602 Data size: 2696178 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: r_reason_sk (type: int), r_reason_desc (type: string)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 72 Data size: 14400 Basic stats: COMPLETE Column stats: NONE
+                      expressions: wp_web_page_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 4602 Data size: 2696178 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col4 (type: int)
+                          0 _col10 (type: int)
                           1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
-
-  Stage: Stage-3
-    Spark
-#### A masked pattern was here ####
-      Vertices:
-        Map 11 
+        Map 13 
             Map Operator Tree:
                 TableScan
-                  alias: web_page
-                  filterExpr: wp_web_page_sk is not null (type: boolean)
-                  Statistics: Num rows: 4602 Data size: 2696178 Basic stats: COMPLETE Column stats: NONE
+                  alias: reason
+                  filterExpr: r_reason_sk is not null (type: boolean)
+                  Statistics: Num rows: 72 Data size: 14400 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: wp_web_page_sk is not null (type: boolean)
-                    Statistics: Num rows: 4602 Data size: 2696178 Basic stats: COMPLETE Column stats: NONE
+                    predicate: r_reason_sk is not null (type: boolean)
+                    Statistics: Num rows: 72 Data size: 14400 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: wp_web_page_sk (type: int)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 4602 Data size: 2696178 Basic stats: COMPLETE Column stats: NONE
+                      expressions: r_reason_sk (type: int), r_reason_desc (type: string)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 72 Data size: 14400 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col10 (type: int)
+                          0 _col4 (type: int)
                           1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
@@ -241,11 +235,11 @@ STAGE PLANS:
     Spark
       Edges:
         Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 28), Map 9 (PARTITION-LEVEL SORT, 28)
-        Reducer 3 <- Map 10 (PARTITION-LEVEL SORT, 178), Reducer 2 (PARTITION-LEVEL SORT, 178)
-        Reducer 4 <- Map 12 (PARTITION-LEVEL SORT, 65), Reducer 3 (PARTITION-LEVEL SORT, 65)
-        Reducer 5 <- Map 14 (PARTITION-LEVEL SORT, 83), Reducer 4 (PARTITION-LEVEL SORT, 83)
-        Reducer 6 <- Map 15 (PARTITION-LEVEL SORT, 13), Reducer 5 (PARTITION-LEVEL SORT, 13)
-        Reducer 7 <- Reducer 6 (GROUP, 7)
+        Reducer 3 <- Map 10 (PARTITION-LEVEL SORT, 25), Reducer 2 (PARTITION-LEVEL SORT, 25)
+        Reducer 4 <- Map 11 (PARTITION-LEVEL SORT, 21), Reducer 3 (PARTITION-LEVEL SORT, 21)
+        Reducer 5 <- Map 14 (PARTITION-LEVEL SORT, 186), Reducer 4 (PARTITION-LEVEL SORT, 186)
+        Reducer 6 <- Map 15 (PARTITION-LEVEL SORT, 29), Reducer 5 (PARTITION-LEVEL SORT, 29)
+        Reducer 7 <- Reducer 6 (GROUP, 10)
         Reducer 8 <- Reducer 7 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
@@ -272,24 +266,24 @@ STAGE PLANS:
         Map 10 
             Map Operator Tree:
                 TableScan
-                  alias: customer_address
-                  filterExpr: ((ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and (ca_country = 'United States') and ca_address_sk is not null) (type: boolean)
-                  Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
+                  alias: cd2
+                  filterExpr: ((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null) (type: boolean)
+                  Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((ca_country = 'United States') and (ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is not null) (type: boolean)
-                    Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
+                    predicate: ((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ca_address_sk (type: int), ca_state (type: string)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
+                      expressions: cd_demo_sk (type: int), cd_marital_status (type: string), cd_education_status (type: string)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
+                        Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string), _col2 (type: string)
             Execution mode: vectorized
-        Map 12 
+        Map 11 
             Map Operator Tree:
                 TableScan
                   alias: date_dim
@@ -311,41 +305,42 @@ STAGE PLANS:
         Map 14 
             Map Operator Tree:
                 TableScan
-                  alias: cd1
-                  filterExpr: ((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null) (type: boolean)
-                  Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
+                  alias: customer_address
+                  filterExpr: ((ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and (ca_country = 'United States') and ca_address_sk is not null) (type: boolean)
+                  Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
+                    predicate: ((ca_country = 'United States') and (ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is not null) (type: boolean)
+                    Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cd_demo_sk (type: int), cd_marital_status (type: string), cd_education_status (type: string)
-                      outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
+                      expressions: ca_address_sk (type: int), (ca_state) IN ('KY', 'GA', 'NM') (type: boolean), (ca_state) IN ('MT', 'OR', 'IN') (type: boolean), (ca_state) IN ('WI', 'MO', 'WV') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string), _col2 (type: string)
+                        Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean)
             Execution mode: vectorized
         Map 15 
             Map Operator Tree:
                 TableScan
-                  alias: cd2
+                  alias: cd1
                   filterExpr: ((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null) (type: boolean)
                   Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: ((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null) (type: boolean)
                     Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cd_demo_sk (type: int), cd_marital_status (type: string), cd_education_status (type: string)
-                      outputColumnNames: _col0, _col1, _col2
+                      expressions: cd_demo_sk (type: int), cd_marital_status (type: string), cd_education_status (type: string), (cd_marital_status = 'M') (type: boolean), (cd_education_status = '4 yr Degree') (type: boolean), (cd_marital_status = 'D') (type: boolean), (cd_education_status = 'Primary') (type: boolean), (cd_marital_status = 'U') (type: boolean), (cd_education_status = 'Advanced Degree') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                       Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string)
                         sort order: +++
                         Map-reduce partition columns: _col0 (type: int), _col1 (type: string), _col2 (type: string)
                         Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean)
             Execution mode: vectorized
         Map 9 
             Map Operator Tree:
@@ -357,15 +352,15 @@ STAGE PLANS:
                     predicate: ((ws_net_profit BETWEEN 100 AND 200 or ws_net_profit BETWEEN 150 AND 300 or ws_net_profit BETWEEN 50 AND 250) and (ws_sales_price BETWEEN 100 AND 150 or ws_sales_price BETWEEN 50 AND 100 or ws_sales_price BETWEEN 150 AND 200) and ws_item_sk is not null and ws_order_number is not null and ws_sold_date_sk is not null and ws_web_page_sk is not null) (type: boolean)
                     Statistics: Num rows: 16000296 Data size: 2175577518 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_item_sk (type: int), ws_web_page_sk (type: int), ws_order_number (type: int), ws_quantity (type: int), ws_sales_price (type: decimal(7,2)), ws_net_profit (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                      expressions: ws_sold_date_sk (type: int), ws_item_sk (type: int), ws_web_page_sk (type: int), ws_order_number (type: int), ws_quantity (type: int), ws_net_profit BETWEEN 100 AND 200 (type: boolean), ws_net_profit BETWEEN 150 AND 300 (type: boolean), ws_net_profit BETWEEN 50 AND 250 (type: boolean), ws_sales_price BETWEEN 100 AND 150 (type: boolean), ws_sales_price BETWEEN 50 AND 100 (type: boolean), ws_sales_price BETWEEN 150 AND 200 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                       Statistics: Num rows: 16000296 Data size: 2175577518 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col1 (type: int), _col3 (type: int)
                         sort order: ++
                         Map-reduce partition columns: _col1 (type: int), _col3 (type: int)
                         Statistics: Num rows: 16000296 Data size: 2175577518 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col2 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
+                        value expressions: _col0 (type: int), _col2 (type: int), _col4 (type: int), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean), _col10 (type: boolean)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -375,45 +370,30 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int), _col5 (type: int)
                   1 _col1 (type: int), _col3 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, _col8, _col10, _col12, _col13, _col14
+                outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, _col8, _col10, _col12, _col13, _col14, _col15, _col16, _col17, _col18
                 Statistics: Num rows: 17600325 Data size: 2393135321 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: int)
+                  key expressions: _col3 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col2 (type: int)
+                  Map-reduce partition columns: _col3 (type: int)
                   Statistics: Num rows: 17600325 Data size: 2393135321 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col3 (type: int), _col4 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col8 (type: int), _col10 (type: int), _col12 (type: int), _col13 (type: decimal(7,2)), _col14 (type: decimal(7,2))
+                  value expressions: _col1 (type: int), _col2 (type: int), _col4 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col8 (type: int), _col10 (type: int), _col12 (type: int), _col13 (type: boolean), _col14 (type: boolean), _col15 (type: boolean), _col16 (type: boolean), _col17 (type: boolean), _col18 (type: boolean)
         Reducer 3 
-            Local Work:
-              Map Reduce Local Work
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col2 (type: int)
+                  0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col6, _col7, _col8, _col10, _col12, _col13, _col14, _col16
-                Statistics: Num rows: 22000000 Data size: 22327357890 Basic stats: COMPLETE Column stats: NONE
-                Filter Operator
-                  predicate: (((_col16) IN ('KY', 'GA', 'NM') and _col14 BETWEEN 100 AND 200) or ((_col16) IN ('MT', 'OR', 'IN') and _col14 BETWEEN 150 AND 300) or ((_col16) IN ('WI', 'MO', 'WV') and _col14 BETWEEN 50 AND 250)) (type: boolean)
-                  Statistics: Num rows: 7333332 Data size: 7442451276 Basic stats: COMPLETE Column stats: NONE
-                  Map Join Operator
-                    condition map:
-                         Inner Join 0 to 1
-                    keys:
-                      0 _col10 (type: int)
-                      1 _col0 (type: int)
-                    outputColumnNames: _col1, _col3, _col4, _col6, _col7, _col8, _col12, _col13
-                    input vertices:
-                      1 Map 11
-                    Statistics: Num rows: 8066665 Data size: 8186696581 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col8 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col8 (type: int)
-                      Statistics: Num rows: 8066665 Data size: 8186696581 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int), _col3 (type: int), _col4 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col12 (type: int), _col13 (type: decimal(7,2))
+                outputColumnNames: _col1, _col2, _col4, _col6, _col7, _col8, _col10, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col20, _col21
+                Statistics: Num rows: 19360357 Data size: 2632448910 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col8 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col8 (type: int)
+                  Statistics: Num rows: 19360357 Data size: 2632448910 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: int), _col2 (type: int), _col4 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col10 (type: int), _col12 (type: int), _col13 (type: boolean), _col14 (type: boolean), _col15 (type: boolean), _col16 (type: boolean), _col17 (type: boolean), _col18 (type: boolean), _col20 (type: string), _col21 (type: string)
         Reducer 4 
             Local Work:
               Map Reduce Local Work
@@ -424,65 +404,82 @@ STAGE PLANS:
                 keys:
                   0 _col8 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col6, _col7, _col12, _col13
-                Statistics: Num rows: 8873331 Data size: 9005366434 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col1, _col2, _col4, _col6, _col7, _col10, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col20, _col21
+                Statistics: Num rows: 21296393 Data size: 2895693863 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
                   keys:
-                    0 _col4 (type: int)
+                    0 _col10 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col1, _col3, _col6, _col7, _col12, _col13, _col22
+                  outputColumnNames: _col1, _col2, _col4, _col6, _col7, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col20, _col21
                   input vertices:
-                    1 Map 13
-                  Statistics: Num rows: 9760664 Data size: 9905903292 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col1 (type: int)
-                    sort order: +
-                    Map-reduce partition columns: _col1 (type: int)
-                    Statistics: Num rows: 9760664 Data size: 9905903292 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col3 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col12 (type: int), _col13 (type: decimal(7,2)), _col22 (type: string)
+                    1 Map 12
+                  Statistics: Num rows: 23426032 Data size: 3185263318 Basic stats: COMPLETE Column stats: NONE
+                  Map Join Operator
+                    condition map:
+                         Inner Join 0 to 1
+                    keys:
+                      0 _col4 (type: int)
+                      1 _col0 (type: int)
+                    outputColumnNames: _col1, _col2, _col6, _col7, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col20, _col21, _col25
+                    input vertices:
+                      1 Map 13
+                    Statistics: Num rows: 25768635 Data size: 3503789725 Basic stats: COMPLETE Column stats: NONE
+                    Reduce Output Operator
+                      key expressions: _col2 (type: int)
+                      sort order: +
+                      Map-reduce partition columns: _col2 (type: int)
+                      Statistics: Num rows: 25768635 Data size: 3503789725 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col1 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col12 (type: int), _col13 (type: boolean), _col14 (type: boolean), _col15 (type: boolean), _col16 (type: boolean), _col17 (type: boolean), _col18 (type: boolean), _col20 (type: string), _col21 (type: string), _col25 (type: string)
         Reducer 5 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
+                  0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col6, _col7, _col12, _col13, _col22, _col24, _col25
-                Statistics: Num rows: 10736730 Data size: 10896493857 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col1, _col6, _col7, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col20, _col21, _col25, _col27, _col28, _col29
+                Statistics: Num rows: 28345499 Data size: 3854168781 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (((_col24 = 'D') and (_col25 = 'Primary') and _col13 BETWEEN 50 AND 100) or ((_col24 = 'M') and (_col25 = '4 yr Degree') and _col13 BETWEEN 100 AND 150) or ((_col24 = 'U') and (_col25 = 'Advanced Degree') and _col13 BETWEEN 150 AND 200)) (type: boolean)
-                  Statistics: Num rows: 894726 Data size: 908039632 Basic stats: COMPLETE Column stats: NONE
+                  predicate: ((_col27 and _col13) or (_col28 and _col14) or (_col29 and _col15)) (type: boolean)
+                  Statistics: Num rows: 21259122 Data size: 2890626279 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col3 (type: int), _col24 (type: string), _col25 (type: string)
+                    key expressions: _col1 (type: int), _col20 (type: string), _col21 (type: string)
                     sort order: +++
-                    Map-reduce partition columns: _col3 (type: int), _col24 (type: string), _col25 (type: string)
-                    Statistics: Num rows: 894726 Data size: 908039632 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col12 (type: int), _col22 (type: string)
+                    Map-reduce partition columns: _col1 (type: int), _col20 (type: string), _col21 (type: string)
+                    Statistics: Num rows: 21259122 Data size: 2890626279 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col12 (type: int), _col16 (type: boolean), _col17 (type: boolean), _col18 (type: boolean), _col25 (type: string)
         Reducer 6 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col3 (type: int), _col24 (type: string), _col25 (type: string)
+                  0 _col1 (type: int), _col20 (type: string), _col21 (type: string)
                   1 _col0 (type: int), _col1 (type: string), _col2 (type: string)
-                outputColumnNames: _col6, _col7, _col12, _col22
-                Statistics: Num rows: 2047980 Data size: 788904791 Basic stats: COMPLETE Column stats: NONE
-                Group By Operator
-                  aggregations: sum(_col12), count(_col12), sum(_col7), count(_col7), sum(_col6), count(_col6)
-                  keys: _col22 (type: string)
-                  mode: hash
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
-                  Statistics: Num rows: 2047980 Data size: 788904791 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 2047980 Data size: 788904791 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: bigint), _col2 (type: bigint), _col3 (type: decimal(17,2)), _col4 (type: bigint), _col5 (type: decimal(17,2)), _col6 (type: bigint)
+                outputColumnNames: _col6, _col7, _col12, _col16, _col17, _col18, _col25, _col33, _col34, _col35, _col36, _col37, _col38
+                Statistics: Num rows: 23385034 Data size: 3179688975 Basic stats: COMPLETE Column stats: NONE
+                Filter Operator
+                  predicate: ((_col33 and _col34 and _col16) or (_col35 and _col36 and _col17) or (_col37 and _col38 and _col18)) (type: boolean)
+                  Statistics: Num rows: 8769387 Data size: 1192383263 Basic stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col12 (type: int), _col25 (type: string)
+                    outputColumnNames: _col6, _col7, _col12, _col25
+                    Statistics: Num rows: 8769387 Data size: 1192383263 Basic stats: COMPLETE Column stats: NONE
+                    Group By Operator
+                      aggregations: sum(_col12), count(_col12), sum(_col7), count(_col7), sum(_col6), count(_col6)
+                      keys: _col25 (type: string)
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                      Statistics: Num rows: 8769387 Data size: 1192383263 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 8769387 Data size: 1192383263 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: bigint), _col2 (type: bigint), _col3 (type: decimal(17,2)), _col4 (type: bigint), _col5 (type: decimal(17,2)), _col6 (type: bigint)
         Reducer 7 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -491,15 +488,15 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
-                Statistics: Num rows: 1023990 Data size: 394452395 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 4384693 Data size: 596191563 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: (UDFToDouble(_col1) / _col2) (type: double), (_col3 / _col4) (type: decimal(37,22)), (_col5 / _col6) (type: decimal(37,22)), substr(_col0, 1, 20) (type: string)
                   outputColumnNames: _col4, _col5, _col6, _col7
-                  Statistics: Num rows: 1023990 Data size: 394452395 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 4384693 Data size: 596191563 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col7 (type: string), _col4 (type: double), _col5 (type: decimal(37,22)), _col6 (type: decimal(37,22))
                     sort order: ++++
-                    Statistics: Num rows: 1023990 Data size: 394452395 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 4384693 Data size: 596191563 Basic stats: COMPLETE Column stats: NONE
                     TopN Hash Memory Usage: 0.1
         Reducer 8 
             Execution mode: vectorized
@@ -507,13 +504,13 @@ STAGE PLANS:
               Select Operator
                 expressions: KEY.reducesinkkey0 (type: string), KEY.reducesinkkey1 (type: double), KEY.reducesinkkey2 (type: decimal(37,22)), KEY.reducesinkkey3 (type: decimal(37,22))
                 outputColumnNames: _col0, _col1, _col2, _col3
-                Statistics: Num rows: 1023990 Data size: 394452395 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 4384693 Data size: 596191563 Basic stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 100
-                  Statistics: Num rows: 100 Data size: 38500 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 100 Data size: 13500 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 100 Data size: 38500 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 100 Data size: 13500 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query86.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query86.q.out b/ql/src/test/results/clientpositive/perf/spark/query86.q.out
index 3892340..835ac5c 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query86.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query86.q.out
@@ -154,10 +154,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col6, _col7
+                outputColumnNames: _col2, _col5, _col6
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col7 (type: string), _col6 (type: string), _col2 (type: decimal(7,2))
+                  expressions: _col6 (type: string), _col5 (type: string), _col2 (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query87.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query87.q.out b/ql/src/test/results/clientpositive/perf/spark/query87.q.out
index daa725e..a74f1fa 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query87.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query87.q.out
@@ -198,10 +198,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col6, _col7
+                outputColumnNames: _col3, _col5, _col6
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  keys: _col7 (type: string), _col6 (type: string), _col3 (type: string)
+                  keys: _col6 (type: string), _col5 (type: string), _col3 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
@@ -272,10 +272,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col6, _col7
+                outputColumnNames: _col3, _col5, _col6
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  keys: _col7 (type: string), _col6 (type: string), _col3 (type: string)
+                  keys: _col6 (type: string), _col5 (type: string), _col3 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
@@ -346,10 +346,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col6, _col7
+                outputColumnNames: _col3, _col5, _col6
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  keys: _col7 (type: string), _col6 (type: string), _col3 (type: string)
+                  keys: _col6 (type: string), _col5 (type: string), _col3 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query89.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query89.q.out b/ql/src/test/results/clientpositive/perf/spark/query89.q.out
index 589dead..40a698a 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query89.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query89.q.out
@@ -154,14 +154,14 @@ STAGE PLANS:
                     Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_date_sk (type: int), d_moy (type: int)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: int)
+                        value expressions: _col1 (type: int)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -189,7 +189,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col5, _col6, _col7, _col10
+                outputColumnNames: _col2, _col3, _col5, _col6, _col7, _col9
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -197,13 +197,13 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col3, _col5, _col6, _col7, _col10, _col12, _col13
+                  outputColumnNames: _col3, _col5, _col6, _col7, _col9, _col11, _col12
                   input vertices:
                     1 Map 9
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col3)
-                    keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col10 (type: int), _col12 (type: string), _col13 (type: string)
+                    keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col9 (type: int), _col11 (type: string), _col12 (type: string)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                     Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query9.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query9.q.out b/ql/src/test/results/clientpositive/perf/spark/query9.q.out
index 6bb02a4..ce5e87a 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query9.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query9.q.out
@@ -524,10 +524,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                Spark HashTable Sink Operator
-                  keys:
-                    0 
-                    1 
+                Select Operator
+                  expressions: (_col0 > 7887297L) (type: boolean)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Spark HashTable Sink Operator
+                    keys:
+                      0 
+                      1 
         Reducer 17 
             Execution mode: vectorized
             Local Work:
@@ -574,10 +578,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                Spark HashTable Sink Operator
-                  keys:
-                    0 
-                    1 
+                Select Operator
+                  expressions: (_col0 > 10872978L) (type: boolean)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Spark HashTable Sink Operator
+                    keys:
+                      0 
+                      1 
         Reducer 23 
             Execution mode: vectorized
             Local Work:
@@ -624,10 +632,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                Spark HashTable Sink Operator
-                  keys:
-                    0 
-                    1 
+                Select Operator
+                  expressions: (_col0 > 43571537L) (type: boolean)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Spark HashTable Sink Operator
+                    keys:
+                      0 
+                      1 
         Reducer 29 
             Execution mode: vectorized
             Local Work:
@@ -656,10 +668,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                Spark HashTable Sink Operator
-                  keys:
-                    0 
-                    1 
+                Select Operator
+                  expressions: (_col0 > 409437L) (type: boolean)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Spark HashTable Sink Operator
+                    keys:
+                      0 
+                      1 
         Reducer 31 
             Execution mode: vectorized
             Local Work:
@@ -724,10 +740,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                Spark HashTable Sink Operator
-                  keys:
-                    0 
-                    1 
+                Select Operator
+                  expressions: (_col0 > 4595804L) (type: boolean)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Spark HashTable Sink Operator
+                    keys:
+                      0 
+                      1 
 
   Stage: Stage-1
     Spark
@@ -895,7 +915,7 @@ STAGE PLANS:
                                                       1 Reducer 31
                                                     Statistics: Num rows: 36 Data size: 52380 Basic stats: COMPLETE Column stats: NONE
                                                     Select Operator
-                                                      expressions: CASE WHEN ((_col1 > 409437L)) THEN (_col2) ELSE (_col3) END (type: decimal(37,22)), CASE WHEN ((_col4 > 4595804L)) THEN (_col5) ELSE (_col6) END (type: decimal(37,22)), CASE WHEN ((_col7 > 7887297L)) THEN (_col8) ELSE (_col9) END (type: decimal(37,22)), CASE WHEN ((_col10 > 10872978L)) THEN (_col11) ELSE (_col12) END (type: decimal(37,22)), CASE WHEN ((_col13 > 43571537L)) THEN (_col14) ELSE (_col15) END (type: decimal(37,22))
+                                                      expressions: CASE WHEN (_col1) THEN (_col2) ELSE (_col3) END (type: decimal(37,22)), CASE WHEN (_col4) THEN (_col5) ELSE (_col6) END (type: decimal(37,22)), CASE WHEN (_col7) THEN (_col8) ELSE (_col9) END (type: decimal(37,22)), CASE WHEN (_col10) THEN (_col11) ELSE (_col12) END (type: decimal(37,22)), CASE WHEN (_col13) THEN (_col14) ELSE (_col15) END (type: decimal(37,22))
                                                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                                                       Statistics: Num rows: 36 Data size: 52380 Basic stats: COMPLETE Column stats: NONE
                                                       File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query91.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query91.q.out b/ql/src/test/results/clientpositive/perf/spark/query91.q.out
index b9fa42f..be56486 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query91.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query91.q.out
@@ -258,7 +258,7 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col1, _col3, _col8, _col9, _col10
+                  outputColumnNames: _col1, _col3, _col6, _col7, _col8
                   input vertices:
                     1 Map 12
                   Statistics: Num rows: 34846646 Data size: 3699254122 Basic stats: COMPLETE Column stats: NONE
@@ -267,7 +267,7 @@ STAGE PLANS:
                     sort order: +
                     Map-reduce partition columns: _col1 (type: int)
                     Statistics: Num rows: 34846646 Data size: 3699254122 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col3 (type: decimal(7,2)), _col8 (type: string), _col9 (type: string), _col10 (type: string)
+                    value expressions: _col3 (type: decimal(7,2)), _col6 (type: string), _col7 (type: string), _col8 (type: string)
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -310,7 +310,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col2, _col5, _col6, _col12, _col17, _col18, _col19
+                outputColumnNames: _col2, _col5, _col6, _col11, _col14, _col15, _col16
                 Statistics: Num rows: 106480005 Data size: 91574956652 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -318,13 +318,13 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col5, _col6, _col12, _col17, _col18, _col19
+                  outputColumnNames: _col5, _col6, _col11, _col14, _col15, _col16
                   input vertices:
                     1 Map 13
                   Statistics: Num rows: 117128008 Data size: 100732454500 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
-                    aggregations: sum(_col12)
-                    keys: _col5 (type: string), _col6 (type: string), _col17 (type: string), _col18 (type: string), _col19 (type: string)
+                    aggregations: sum(_col11)
+                    keys: _col5 (type: string), _col6 (type: string), _col14 (type: string), _col15 (type: string), _col16 (type: string)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                     Statistics: Num rows: 117128008 Data size: 100732454500 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query92.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query92.q.out b/ql/src/test/results/clientpositive/perf/spark/query92.q.out
index c7179e0..9aa135e 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query92.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query92.q.out
@@ -228,10 +228,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col2 (type: int)
-                outputColumnNames: _col2, _col6
+                outputColumnNames: _col2, _col5
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (_col2 > CAST( (1.3 * _col6) AS decimal(14,7))) (type: boolean)
+                  predicate: (_col2 > _col5) (type: boolean)
                   Statistics: Num rows: 58081078 Data size: 7897346909 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: decimal(7,2))
@@ -290,7 +290,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 79201469 Data size: 10769109250 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), (_col1 / _col2) (type: decimal(37,22))
+                  expressions: _col0 (type: int), CAST( (1.3 * (_col1 / _col2)) AS decimal(14,7)) (type: decimal(14,7))
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 79201469 Data size: 10769109250 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
@@ -298,7 +298,7 @@ STAGE PLANS:
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 79201469 Data size: 10769109250 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: decimal(37,22))
+                    value expressions: _col1 (type: decimal(14,7))
         Reducer 8 
             Reduce Operator Tree:
               Join Operator
@@ -314,7 +314,7 @@ STAGE PLANS:
                   sort order: +
                   Map-reduce partition columns: _col2 (type: int)
                   Statistics: Num rows: 87121617 Data size: 11846020431 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: decimal(37,22))
+                  value expressions: _col1 (type: decimal(14,7))
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query93.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query93.q.out b/ql/src/test/results/clientpositive/perf/spark/query93.q.out
index 0263eb0..f393c13 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query93.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query93.q.out
@@ -89,8 +89,8 @@ STAGE PLANS:
                     predicate: (sr_item_sk is not null and sr_reason_sk is not null and sr_ticket_number is not null) (type: boolean)
                     Statistics: Num rows: 57591150 Data size: 4462194832 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: sr_item_sk (type: int), sr_reason_sk (type: int), sr_ticket_number (type: int), sr_return_quantity (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3
+                      expressions: sr_item_sk (type: int), sr_reason_sk (type: int), sr_ticket_number (type: int), sr_return_quantity (type: int), sr_return_quantity is not null (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 57591150 Data size: 4462194832 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -98,7 +98,7 @@ STAGE PLANS:
                         keys:
                           0 _col1 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col2, _col3
+                        outputColumnNames: _col0, _col2, _col3, _col4
                         input vertices:
                           1 Map 5
                         Statistics: Num rows: 63350266 Data size: 4908414421 Basic stats: COMPLETE Column stats: NONE
@@ -107,7 +107,7 @@ STAGE PLANS:
                           sort order: ++
                           Map-reduce partition columns: _col0 (type: int), _col2 (type: int)
                           Statistics: Num rows: 63350266 Data size: 4908414421 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col3 (type: int)
+                          value expressions: _col3 (type: int), _col4 (type: boolean)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -121,15 +121,15 @@ STAGE PLANS:
                     predicate: (ss_item_sk is not null and ss_ticket_number is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_item_sk (type: int), ss_customer_sk (type: int), ss_ticket_number (type: int), ss_quantity (type: int), ss_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                      expressions: ss_item_sk (type: int), ss_customer_sk (type: int), ss_ticket_number (type: int), ss_quantity (type: int), ss_sales_price (type: decimal(7,2)), (CAST( ss_quantity AS decimal(10,0)) * ss_sales_price) (type: decimal(18,2))
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int), _col2 (type: int)
                         sort order: ++
                         Map-reduce partition columns: _col0 (type: int), _col2 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col3 (type: int), _col4 (type: decimal(7,2)), _col5 (type: decimal(18,2))
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -139,10 +139,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int), _col2 (type: int)
                   1 _col0 (type: int), _col2 (type: int)
-                outputColumnNames: _col3, _col7, _col9, _col10
+                outputColumnNames: _col3, _col4, _col7, _col9, _col10, _col11
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col7 (type: int), CASE WHEN (_col3 is not null) THEN ((CAST( (_col9 - _col3) AS decimal(10,0)) * _col10)) ELSE ((CAST( _col9 AS decimal(10,0)) * _col10)) END (type: decimal(18,2))
+                  expressions: _col7 (type: int), CASE WHEN (_col4) THEN ((CAST( (_col9 - _col3) AS decimal(10,0)) * _col10)) ELSE (_col11) END (type: decimal(18,2))
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query98.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query98.q.out b/ql/src/test/results/clientpositive/perf/spark/query98.q.out
index 816da61..2931144 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query98.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query98.q.out
@@ -168,11 +168,11 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col6, _col7, _col8, _col9, _col10
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col10 (type: string), _col9 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: decimal(7,2))
+                  keys: _col9 (type: string), _col8 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: decimal(7,2))
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query99.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query99.q.out b/ql/src/test/results/clientpositive/perf/spark/query99.q.out
index 6e656d4..220aae5 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query99.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query99.q.out
@@ -103,7 +103,7 @@ STAGE PLANS:
                       Statistics: Num rows: 60 Data size: 122700 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col2 (type: int)
+                          0 _col1 (type: int)
                           1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
@@ -118,12 +118,12 @@ STAGE PLANS:
                     predicate: w_warehouse_sk is not null (type: boolean)
                     Statistics: Num rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: w_warehouse_sk (type: int), w_warehouse_name (type: string)
+                      expressions: w_warehouse_sk (type: int), substr(w_warehouse_name, 1, 20) (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 27 Data size: 27802 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col4 (type: int)
+                          0 _col3 (type: int)
                           1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
@@ -143,7 +143,7 @@ STAGE PLANS:
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col3 (type: int)
+                          0 _col2 (type: int)
                           1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
@@ -167,15 +167,15 @@ STAGE PLANS:
                     predicate: (cs_call_center_sk is not null and cs_ship_date_sk is not null and cs_ship_mode_sk is not null and cs_warehouse_sk is not null) (type: boolean)
                     Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), cs_ship_date_sk (type: int), cs_call_center_sk (type: int), cs_ship_mode_sk (type: int), cs_warehouse_sk (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                      expressions: cs_ship_date_sk (type: int), cs_call_center_sk (type: int), cs_ship_mode_sk (type: int), cs_warehouse_sk (type: int), CASE WHEN (((cs_ship_date_sk - cs_sold_date_sk) <= 30)) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((cs_ship_date_sk - cs_sold_date_sk) > 30) and ((cs_ship_date_sk - cs_sold_date_sk) <= 60))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((cs_ship_date_sk - cs_sold_date_sk) > 60) and ((cs_ship_date_sk - cs_sold_date_sk) <= 90))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((cs_ship_date_sk - cs_sold_date_sk) > 90) and ((cs_ship_date_sk - cs_sold_date_sk) <= 120))) THEN (1) ELSE (0) END (type: int), CASE WHEN (((cs_ship_date_sk - cs_sold_date_sk) > 120)) THEN (1) ELSE (0) END (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                       Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: int)
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: int), _col8 (type: int)
             Execution mode: vectorized
         Map 5 
             Map Operator Tree:
@@ -204,17 +204,17 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                 Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
                   keys:
-                    0 _col2 (type: int)
+                    0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col1, _col3, _col4, _col8
+                  outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col11
                   input vertices:
                     1 Map 6
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
@@ -222,9 +222,9 @@ STAGE PLANS:
                     condition map:
                          Inner Join 0 to 1
                     keys:
-                      0 _col4 (type: int)
+                      0 _col3 (type: int)
                       1 _col0 (type: int)
-                    outputColumnNames: _col0, _col1, _col3, _col8, _col10
+                    outputColumnNames: _col2, _col4, _col5, _col6, _col7, _col8, _col11, _col13
                     input vertices:
                       1 Map 7
                     Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
@@ -232,29 +232,25 @@ STAGE PLANS:
                       condition map:
                            Inner Join 0 to 1
                       keys:
-                        0 _col3 (type: int)
+                        0 _col2 (type: int)
                         1 _col0 (type: int)
-                      outputColumnNames: _col0, _col1, _col8, _col10, _col12
+                      outputColumnNames: _col4, _col5, _col6, _col7, _col8, _col11, _col13, _col15
                       input vertices:
                         1 Map 8
                       Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: PARTIAL Column stats: NONE
-                      Select Operator
-                        expressions: substr(_col10, 1, 20) (type: string), _col12 (type: string), _col8 (type: string), CASE WHEN (((_col1 - _col0) <= 30)) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col1 - _col0) > 30) and ((_col1 - _col0) <= 60))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col1 - _col0) > 60) and ((_col1 - _col0) <= 90))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col1 - _col0) > 90) and ((_col1 - _col0) <= 120))) THEN (1) ELSE (0) END (type: int), CASE WHEN (((_col1 - _col0) > 120)) THEN (1) ELSE (0) END (type: int)
+                      Group By Operator
+                        aggregations: sum(_col4), sum(_col5), sum(_col6), sum(_col7), sum(_col8)
+                        keys: _col13 (type: string), _col15 (type: string), _col11 (type: string)
+                        mode: hash
                         outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                         Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: PARTIAL Column stats: NONE
-                        Group By Operator
-                          aggregations: sum(_col3), sum(_col4), sum(_col5), sum(_col6), sum(_col7)
-                          keys: _col0 (type: string), _col1 (type: string), _col2 (type: string)
-                          mode: hash
-                          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                        Reduce Output Operator
+                          key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string)
+                          sort order: +++
+                          Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string)
                           Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: PARTIAL Column stats: NONE
-                          Reduce Output Operator
-                            key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string)
-                            sort order: +++
-                            Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string)
-                            Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: PARTIAL Column stats: NONE
-                            TopN Hash Memory Usage: 0.1
-                            value expressions: _col3 (type: bigint), _col4 (type: bigint), _col5 (type: bigint), _col6 (type: bigint), _col7 (type: bigint)
+                          TopN Hash Memory Usage: 0.1
+                          value expressions: _col3 (type: bigint), _col4 (type: bigint), _col5 (type: bigint), _col6 (type: bigint), _col7 (type: bigint)
         Reducer 3 
             Execution mode: vectorized
             Reduce Operator Tree:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query1.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query1.q.out
index 295ba99..9d0fa3a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query1.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query1.q.out
@@ -59,7 +59,7 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
   HiveProject(c_customer_id=[$1])
-    HiveJoin(condition=[AND(=($3, $8), >($4, $7))], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveJoin(condition=[AND(=($3, $7), >($4, $6))], joinType=[inner], algorithm=[none], cost=[not available])
       HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveProject(c_customer_sk=[$0], c_customer_id=[$1])
           HiveFilter(condition=[IS NOT NULL($0)])
@@ -71,10 +71,10 @@ HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
                 HiveProject(sr_returned_date_sk=[$0], sr_customer_sk=[$3], sr_store_sk=[$7], sr_fee=[$14])
                   HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($3))])
                     HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(=($6, 2000), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(s_store_sk=[$0], s_state=[CAST(_UTF-16LE'NM'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+          HiveProject(s_store_sk=[$0])
             HiveFilter(condition=[AND(=($24, _UTF-16LE'NM'), IS NOT NULL($0))])
               HiveTableScan(table=[[default, store]], table:alias=[store])
       HiveProject(_o__c0=[*(/($1, $2), 1.2)], ctr_store_sk=[$0])
@@ -85,7 +85,7 @@ HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
                 HiveProject(sr_returned_date_sk=[$0], sr_customer_sk=[$3], sr_store_sk=[$7], sr_fee=[$14])
                   HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                     HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(=($6, 2000), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query10.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query10.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query10.q.out
index b226905..ccad67d 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query10.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query10.q.out
@@ -154,7 +154,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$4], sort4=[$6], sort5=
                   HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3])
                     HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER], d_moy=[$8])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($6, 2002), BETWEEN(false, $8, 4, 7), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
             HiveProject(ws_bill_customer_sk0=[$0], $f1=[true])
@@ -163,7 +163,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$4], sort4=[$6], sort5=
                   HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4])
                     HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER], d_moy=[$8])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($6, 2002), BETWEEN(false, $8, 4, 7), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(cs_ship_customer_sk0=[$0], $f1=[true])
@@ -172,7 +172,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$4], sort4=[$6], sort5=
                 HiveProject(cs_sold_date_sk=[$0], cs_ship_customer_sk=[$7])
                   HiveFilter(condition=[AND(IS NOT NULL($7), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER], d_moy=[$8])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(=($6, 2002), BETWEEN(false, $8, 4, 7), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query11.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query11.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query11.q.out
index e09f7ec..de0783b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query11.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query11.q.out
@@ -159,65 +159,61 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
   HiveProject(c_preferred_cust_flag=[$1])
-    HiveJoin(condition=[AND(=($0, $5), CASE(CAST(IS NOT NULL($6)):BOOLEAN, CASE(CAST(IS NOT NULL($8)):BOOLEAN, >(/($4, $8), /($2, $6)), >(null, /($2, $6))), CASE(CAST(IS NOT NULL($8)):BOOLEAN, >(/($4, $8), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveJoin(condition=[AND(=($0, $5), CASE(CAST(IS NOT NULL($6)):BOOLEAN, CASE($9, >(/($4, $8), /($2, $6)), >(null, /($2, $6))), CASE($9, >(/($4, $8), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
       HiveProject($f0=[$0], $f4=[$3], $f9=[$7])
-        HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-          HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7], $f9=[-($11, $10)])
-            HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
-                HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
-                  HiveTableScan(table=[[default, customer]], table:alias=[customer])
-              HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_ext_discount_amt=[$14], ss_ext_list_price=[$17])
-                  HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                    HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
-                  HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
-                    HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+        HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
+          HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
+              HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
+                HiveTableScan(table=[[default, customer]], table:alias=[customer])
+            HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], -=[-($17, $14)])
+                HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
+                  HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+              HiveProject(d_date_sk=[$0])
+                HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
+                  HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
       HiveJoin(condition=[=($2, $4)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject($f0=[$0], $f8=[$7])
-            HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-              HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f6=[$7], $f8=[-($11, $10)])
-                HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
-                    HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
-                      HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                  HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], ws_ext_discount_amt=[$22], ws_ext_list_price=[$25])
-                      HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
-                        HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
-                      HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
-                        HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+            HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
+              HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
+                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
+                    HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], -=[-($25, $22)])
+                    HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
+                      HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
+                  HiveProject(d_date_sk=[$0])
+                    HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
+                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject($f0=[$0], $f9=[$7])
             HiveFilter(condition=[>($7, 0)])
-              HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-                HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7], $f9=[-($11, $10)])
-                  HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
-                      HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
-                        HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                    HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_ext_discount_amt=[$14], ss_ext_list_price=[$17])
-                        HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                          HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
-                        HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
-                          HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-        HiveProject($f0=[$0], $f8=[$7])
-          HiveFilter(condition=[>($7, 0)])
-            HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-              HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f6=[$7], $f8=[-($11, $10)])
+              HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
                 HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
                       HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                  HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], ws_ext_discount_amt=[$22], ws_ext_list_price=[$25])
-                      HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
-                        HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+                  HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], -=[-($17, $14)])
+                      HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
+                        HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+        HiveProject(customer_id=[$0], year_total=[$7], CAST=[CAST(IS NOT NULL($7)):BOOLEAN])
+          HiveFilter(condition=[>($7, 0)])
+            HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
+              HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
+                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
+                    HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], -=[-($25, $22)])
+                    HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
+                      HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
+                  HiveProject(d_date_sk=[$0])
+                    HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
+                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query12.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query12.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query12.q.out
index dbfe6e7..cda7aa3 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query12.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query12.q.out
@@ -83,7 +83,7 @@ HiveProject(i_item_desc=[$0], i_category=[$1], i_class=[$2], i_current_price=[$3
             HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_ext_sales_price=[$23])
               HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-            HiveProject(d_date_sk=[$0], d_date=[$2])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 2001-01-12 00:00:00, 2001-02-11 00:00:00), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 


[24/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query75.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query75.q.out b/ql/src/test/results/clientpositive/perf/spark/query75.q.out
index 85e6dca..553d11a 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query75.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query75.q.out
@@ -219,14 +219,14 @@ STAGE PLANS:
                     Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: i_item_sk (type: int), i_brand_id (type: int), i_class_id (type: int), i_category_id (type: int), i_manufact_id (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col5 (type: int)
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: int)
             Execution mode: vectorized
         Map 11 
             Map Operator Tree:
@@ -397,14 +397,14 @@ STAGE PLANS:
                     Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: i_item_sk (type: int), i_brand_id (type: int), i_class_id (type: int), i_category_id (type: int), i_manufact_id (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col5 (type: int)
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: int)
             Execution mode: vectorized
         Map 34 
             Map Operator Tree:
@@ -530,23 +530,23 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, _col10, _col12
+                outputColumnNames: _col1, _col2, _col3, _col4, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int)
+                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int)
         Reducer 15 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, _col15, _col16
+                outputColumnNames: _col3, _col4, _col7, _col8, _col9, _col10, _col13, _col14
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int), (_col3 - CASE WHEN (_col15 is not null) THEN (_col15) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col16 is not null) THEN (_col16) ELSE (0) END) (type: decimal(8,2))
+                  expressions: _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int), (_col3 - CASE WHEN (_col13 is not null) THEN (_col13) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col14 is not null) THEN (_col14) ELSE (0) END) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -599,23 +599,23 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, _col10, _col12
+                outputColumnNames: _col1, _col2, _col3, _col4, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int)
+                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int)
         Reducer 22 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, _col15, _col16
+                outputColumnNames: _col3, _col4, _col7, _col8, _col9, _col10, _col13, _col14
                 Statistics: Num rows: 191667562 Data size: 26061245514 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int), (_col3 - CASE WHEN (_col15 is not null) THEN (_col15) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col16 is not null) THEN (_col16) ELSE (0) END) (type: decimal(8,2))
+                  expressions: _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int), (_col3 - CASE WHEN (_col13 is not null) THEN (_col13) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col14 is not null) THEN (_col14) ELSE (0) END) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 191667562 Data size: 26061245514 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -652,23 +652,23 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, _col10, _col12
+                outputColumnNames: _col1, _col2, _col3, _col4, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int)
+                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int)
         Reducer 29 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, _col15, _col16
+                outputColumnNames: _col3, _col4, _col7, _col8, _col9, _col10, _col13, _col14
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int), (_col3 - CASE WHEN (_col15 is not null) THEN (_col15) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col16 is not null) THEN (_col16) ELSE (0) END) (type: decimal(8,2))
+                  expressions: _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int), (_col3 - CASE WHEN (_col13 is not null) THEN (_col13) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col14 is not null) THEN (_col14) ELSE (0) END) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -689,14 +689,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, _col10, _col12
+                outputColumnNames: _col1, _col2, _col3, _col4, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int)
+                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int)
         Reducer 30 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -759,23 +759,23 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, _col10, _col12
+                outputColumnNames: _col1, _col2, _col3, _col4, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int)
+                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int)
         Reducer 38 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, _col15, _col16
+                outputColumnNames: _col3, _col4, _col7, _col8, _col9, _col10, _col13, _col14
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int), (_col3 - CASE WHEN (_col15 is not null) THEN (_col15) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col16 is not null) THEN (_col16) ELSE (0) END) (type: decimal(8,2))
+                  expressions: _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int), (_col3 - CASE WHEN (_col13 is not null) THEN (_col13) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col14 is not null) THEN (_col14) ELSE (0) END) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -793,10 +793,10 @@ STAGE PLANS:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, _col15, _col16
+                outputColumnNames: _col3, _col4, _col7, _col8, _col9, _col10, _col13, _col14
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int), (_col3 - CASE WHEN (_col15 is not null) THEN (_col15) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col16 is not null) THEN (_col16) ELSE (0) END) (type: decimal(8,2))
+                  expressions: _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int), (_col3 - CASE WHEN (_col13 is not null) THEN (_col13) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col14 is not null) THEN (_col14) ELSE (0) END) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -833,23 +833,23 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col8, _col9, _col10, _col12
+                outputColumnNames: _col1, _col2, _col3, _col4, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int)
+                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int)
         Reducer 45 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Left Outer Join 0 to 1
-                outputColumnNames: _col3, _col4, _col8, _col9, _col10, _col12, _col15, _col16
+                outputColumnNames: _col3, _col4, _col7, _col8, _col9, _col10, _col13, _col14
                 Statistics: Num rows: 191667562 Data size: 26061245514 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col8 (type: int), _col9 (type: int), _col10 (type: int), _col12 (type: int), (_col3 - CASE WHEN (_col15 is not null) THEN (_col15) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col16 is not null) THEN (_col16) ELSE (0) END) (type: decimal(8,2))
+                  expressions: _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int), (_col3 - CASE WHEN (_col13 is not null) THEN (_col13) ELSE (0) END) (type: int), (_col4 - CASE WHEN (_col14 is not null) THEN (_col14) ELSE (0) END) (type: decimal(8,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 191667562 Data size: 26061245514 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query76.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query76.q.out b/ql/src/test/results/clientpositive/perf/spark/query76.q.out
index 593ea66..e65a5c9 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query76.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query76.q.out
@@ -145,14 +145,14 @@ STAGE PLANS:
                     Statistics: Num rows: 143994918 Data size: 19499804476 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: cs_sold_date_sk (type: int), cs_item_sk (type: int), cs_ext_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col2, _col3
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 143994918 Data size: 19499804476 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col2 (type: int)
+                        key expressions: _col1 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col2 (type: int)
+                        Map-reduce partition columns: _col1 (type: int)
                         Statistics: Num rows: 143994918 Data size: 19499804476 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col0 (type: int), _col2 (type: decimal(7,2))
             Execution mode: vectorized
         Map 16 
             Map Operator Tree:
@@ -205,14 +205,14 @@ STAGE PLANS:
                     Statistics: Num rows: 287997817 Data size: 25407250999 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ss_sold_date_sk (type: int), ss_item_sk (type: int), ss_ext_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col3
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 287997817 Data size: 25407250999 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col1 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col1 (type: int)
                         Statistics: Num rows: 287997817 Data size: 25407250999 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col0 (type: int), _col2 (type: decimal(7,2))
             Execution mode: vectorized
         Map 7 
             Map Operator Tree:
@@ -245,24 +245,24 @@ STAGE PLANS:
                     Statistics: Num rows: 72001334 Data size: 9790099106 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ws_sold_date_sk (type: int), ws_item_sk (type: int), ws_ext_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col3
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 72001334 Data size: 9790099106 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col1 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col1 (type: int)
                         Statistics: Num rows: 72001334 Data size: 9790099106 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col0 (type: int), _col2 (type: decimal(7,2))
             Execution mode: vectorized
         Reducer 10 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
-                outputColumnNames: _col3, _col5, _col7, _col8
+                outputColumnNames: _col2, _col4, _col6, _col7
                 Statistics: Num rows: 87121617 Data size: 11846020431 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: 'web' (type: string), 'ws_web_page_sk' (type: string), _col7 (type: int), _col8 (type: int), _col5 (type: string), _col3 (type: decimal(7,2))
+                  expressions: 'web' (type: string), 'ws_web_page_sk' (type: string), _col6 (type: int), _col7 (type: int), _col4 (type: string), _col2 (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 87121617 Data size: 11846020431 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -284,25 +284,25 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col2 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col3, _col5
+                outputColumnNames: _col0, _col2, _col4
                 Statistics: Num rows: 158394413 Data size: 21449785388 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 158394413 Data size: 21449785388 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: decimal(7,2)), _col5 (type: string)
+                  value expressions: _col2 (type: decimal(7,2)), _col4 (type: string)
         Reducer 15 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
-                outputColumnNames: _col3, _col5, _col7, _col8
+                outputColumnNames: _col2, _col4, _col6, _col7
                 Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: 'catalog' (type: string), 'cs_warehouse_sk' (type: string), _col7 (type: int), _col8 (type: int), _col5 (type: string), _col3 (type: decimal(7,2))
+                  expressions: 'catalog' (type: string), 'cs_warehouse_sk' (type: string), _col6 (type: int), _col7 (type: int), _col4 (type: string), _col2 (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -326,23 +326,23 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col1, _col2, _col5
+                outputColumnNames: _col1, _col2, _col4
                 Statistics: Num rows: 316797605 Data size: 27947976704 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col2 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col2 (type: int)
                   Statistics: Num rows: 316797605 Data size: 27947976704 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col5 (type: decimal(7,2))
+                  value expressions: _col1 (type: string), _col4 (type: decimal(7,2))
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
-                outputColumnNames: _col1, _col5, _col7, _col8
+                outputColumnNames: _col1, _col4, _col6, _col7
                 Statistics: Num rows: 348477373 Data size: 30742775040 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: 'store' (type: string), 'ss_addr_sk' (type: string), _col7 (type: int), _col8 (type: int), _col1 (type: string), _col5 (type: decimal(7,2))
+                  expressions: 'store' (type: string), 'ss_addr_sk' (type: string), _col6 (type: int), _col7 (type: int), _col1 (type: string), _col4 (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 348477373 Data size: 30742775040 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -398,14 +398,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col3, _col5
+                outputColumnNames: _col0, _col2, _col4
                 Statistics: Num rows: 79201469 Data size: 10769109250 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 79201469 Data size: 10769109250 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: decimal(7,2)), _col5 (type: string)
+                  value expressions: _col2 (type: decimal(7,2)), _col4 (type: string)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query77.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query77.q.out b/ql/src/test/results/clientpositive/perf/spark/query77.q.out
index 1ae664d..0484b15 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query77.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query77.q.out
@@ -660,13 +660,13 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col3, _col6
+                  outputColumnNames: _col2, _col3, _col5
                   input vertices:
                     1 Map 13
                   Statistics: Num rows: 69685294 Data size: 5399255980 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2), sum(_col3)
-                    keys: _col6 (type: int)
+                    keys: _col5 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 69685294 Data size: 5399255980 Basic stats: COMPLETE Column stats: NONE
@@ -747,13 +747,13 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col3, _col6
+                  outputColumnNames: _col2, _col3, _col5
                   input vertices:
                     1 Map 8
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2), sum(_col3)
-                    keys: _col6 (type: int)
+                    keys: _col5 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -781,13 +781,13 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col3, _col6
+                  outputColumnNames: _col2, _col3, _col5
                   input vertices:
                     1 Map 25
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2), sum(_col3)
-                    keys: _col6 (type: int)
+                    keys: _col5 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
@@ -854,13 +854,13 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col3, _col6
+                  outputColumnNames: _col2, _col3, _col5
                   input vertices:
                     1 Map 30
                   Statistics: Num rows: 17422145 Data size: 1603485031 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2), sum(_col3)
-                    keys: _col6 (type: int)
+                    keys: _col5 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 17422145 Data size: 1603485031 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query78.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query78.q.out b/ql/src/test/results/clientpositive/perf/spark/query78.q.out
index 03f7a6d..c121a34 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query78.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query78.q.out
@@ -301,11 +301,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col4, _col6, _col7, _col8
+                outputColumnNames: _col2, _col3, _col4, _col5, _col6
                 Statistics: Num rows: 87121617 Data size: 11846020431 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col6), sum(_col7), sum(_col8)
-                  keys: _col4 (type: int), _col3 (type: int)
+                  aggregations: sum(_col4), sum(_col5), sum(_col6)
+                  keys: _col3 (type: int), _col2 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 87121617 Data size: 11846020431 Basic stats: COMPLETE Column stats: NONE
@@ -349,14 +349,14 @@ STAGE PLANS:
                   Statistics: Num rows: 79201469 Data size: 10769109250 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
-                    outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                     Statistics: Num rows: 79201469 Data size: 10769109250 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
                       Statistics: Num rows: 79201469 Data size: 10769109250 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int), _col2 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
+                      value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
         Reducer 17 
             Reduce Operator Tree:
               Join Operator
@@ -365,11 +365,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col4, _col6, _col7, _col8
+                outputColumnNames: _col2, _col3, _col4, _col5, _col6
                 Statistics: Num rows: 87116928 Data size: 11797382144 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col6), sum(_col7), sum(_col8)
-                  keys: _col3 (type: int), _col4 (type: int)
+                  aggregations: sum(_col4), sum(_col5), sum(_col6)
+                  keys: _col2 (type: int), _col3 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 87116928 Data size: 11797382144 Basic stats: COMPLETE Column stats: NONE
@@ -406,11 +406,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col4, _col6, _col7, _col8
+                outputColumnNames: _col2, _col3, _col4, _col5, _col6
                 Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col6), sum(_col7), sum(_col8)
-                  keys: _col4 (type: int), _col3 (type: int)
+                  aggregations: sum(_col4), sum(_col5), sum(_col6)
+                  keys: _col3 (type: int), _col2 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
@@ -435,14 +435,14 @@ STAGE PLANS:
                   Statistics: Num rows: 79197206 Data size: 10724892626 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
-                    outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                     Statistics: Num rows: 79197206 Data size: 10724892626 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
                       Statistics: Num rows: 79197206 Data size: 10724892626 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int), _col2 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
+                      value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
         Reducer 3 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -535,14 +535,14 @@ STAGE PLANS:
                   Statistics: Num rows: 316797606 Data size: 27947976754 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
-                    outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                     Statistics: Num rows: 316797606 Data size: 27947976754 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
                       Statistics: Num rows: 316797606 Data size: 27947976754 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int), _col2 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
+                      value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query79.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query79.q.out b/ql/src/test/results/clientpositive/perf/spark/query79.q.out
index 943301e..a86625e 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query79.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query79.q.out
@@ -75,7 +75,7 @@ STAGE PLANS:
                     Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: s_store_sk (type: int), s_city (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -181,23 +181,23 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col5, _col6, _col7
+                outputColumnNames: _col1, _col2, _col3, _col5, _col6, _col7, _col8
                 Statistics: Num rows: 421657640 Data size: 37198759428 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col2 (type: string), _col1 (type: string), _col3 (type: int), _col6 (type: decimal(17,2)), _col7 (type: decimal(17,2)), substr(_col5, 1, 30) (type: string)
-                  outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6
+                  expressions: _col2 (type: string), _col1 (type: string), _col8 (type: string), _col3 (type: int), _col6 (type: decimal(17,2)), _col7 (type: decimal(17,2)), substr(_col5, 1, 30) (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                   Statistics: Num rows: 421657640 Data size: 37198759428 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: string), _col1 (type: string), _col6 (type: string), _col5 (type: decimal(17,2))
                     sort order: ++++
                     Statistics: Num rows: 421657640 Data size: 37198759428 Basic stats: COMPLETE Column stats: NONE
                     TopN Hash Memory Usage: 0.1
-                    value expressions: _col3 (type: int), _col4 (type: decimal(17,2))
+                    value expressions: _col2 (type: string), _col3 (type: int), _col4 (type: decimal(17,2))
         Reducer 3 
             Execution mode: vectorized
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey0 (type: string), KEY.reducesinkkey1 (type: string), KEY.reducesinkkey2 (type: string), VALUE._col0 (type: int), VALUE._col1 (type: decimal(17,2)), KEY.reducesinkkey3 (type: decimal(17,2))
+                expressions: KEY.reducesinkkey0 (type: string), KEY.reducesinkkey1 (type: string), VALUE._col0 (type: string), VALUE._col1 (type: int), VALUE._col2 (type: decimal(17,2)), KEY.reducesinkkey3 (type: decimal(17,2))
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                 Statistics: Num rows: 421657640 Data size: 37198759428 Basic stats: COMPLETE Column stats: NONE
                 Limit
@@ -228,7 +228,7 @@ STAGE PLANS:
                   keys:
                     0 _col4 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col1, _col2, _col3, _col5, _col6, _col7, _col13
+                  outputColumnNames: _col1, _col2, _col3, _col5, _col6, _col7, _col10
                   input vertices:
                     1 Map 8
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -238,13 +238,13 @@ STAGE PLANS:
                     keys:
                       0 _col2 (type: int)
                       1 _col0 (type: int)
-                    outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col13
+                    outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col10
                     input vertices:
                       1 Map 9
                     Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
                       aggregations: sum(_col6), sum(_col7)
-                      keys: _col1 (type: int), _col3 (type: int), _col5 (type: int), _col13 (type: string)
+                      keys: _col1 (type: int), _col3 (type: int), _col5 (type: int), _col10 (type: string)
                       mode: hash
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                       Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
@@ -264,15 +264,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                 Statistics: Num rows: 383325119 Data size: 33817053293 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col2 (type: int), _col0 (type: int), _col3 (type: string), _col4 (type: decimal(17,2)), _col5 (type: decimal(17,2))
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                  expressions: _col2 (type: int), _col0 (type: int), _col3 (type: string), _col4 (type: decimal(17,2)), _col5 (type: decimal(17,2)), substr(_col3, 1, 30) (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 383325119 Data size: 33817053293 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col1 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col1 (type: int)
                     Statistics: Num rows: 383325119 Data size: 33817053293 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: decimal(17,2)), _col4 (type: decimal(17,2))
+                    value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: decimal(17,2)), _col4 (type: decimal(17,2)), _col5 (type: string)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query8.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query8.q.out b/ql/src/test/results/clientpositive/perf/spark/query8.q.out
index 520ead3..7bce61e 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query8.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query8.q.out
@@ -413,13 +413,13 @@ STAGE PLANS:
                   predicate: (_col1 = 2L) (type: boolean)
                   Statistics: Num rows: 1 Data size: 1014 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col0 (type: string)
+                    expressions: substr(_col0, 1, 2) (type: string)
                     outputColumnNames: _col0
                     Statistics: Num rows: 1 Data size: 1014 Basic stats: COMPLETE Column stats: NONE
                     Spark HashTable Sink Operator
                       keys:
-                        0 substr(_col0, 1, 2) (type: string)
-                        1 substr(_col2, 1, 2) (type: string)
+                        0 _col0 (type: string)
+                        1 _col2 (type: string)
 
   Stage: Stage-2
     Spark
@@ -435,15 +435,15 @@ STAGE PLANS:
                     predicate: (s_store_sk is not null and substr(s_zip, 1, 2) is not null) (type: boolean)
                     Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int), s_store_name (type: string), s_zip (type: string)
+                      expressions: s_store_sk (type: int), s_store_name (type: string), substr(s_zip, 1, 2) (type: string)
                       outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 substr(_col0, 1, 2) (type: string)
-                          1 substr(_col2, 1, 2) (type: string)
+                          0 _col0 (type: string)
+                          1 _col2 (type: string)
                         outputColumnNames: _col1, _col2
                         input vertices:
                           0 Reducer 8
@@ -521,13 +521,13 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col1 (type: int)
-                  outputColumnNames: _col2, _col8
+                  outputColumnNames: _col2, _col6
                   input vertices:
                     1 Map 14
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2)
-                    keys: _col8 (type: string)
+                    keys: _col6 (type: string)
                     mode: hash
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query80.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query80.q.out b/ql/src/test/results/clientpositive/perf/spark/query80.q.out
index 6c5226c..8745af1 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query80.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query80.q.out
@@ -674,10 +674,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col5, _col6, _col9, _col10, _col18
+                outputColumnNames: _col5, _col6, _col9, _col10, _col15
                 Statistics: Num rows: 463810558 Data size: 62809267017 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col18 (type: string), _col5 (type: decimal(7,2)), CASE WHEN (_col9 is not null) THEN (_col9) ELSE (0) END (type: decimal(12,2)), (_col6 - CASE WHEN (_col10 is not null) THEN (_col10) ELSE (0) END) (type: decimal(13,2))
+                  expressions: _col15 (type: string), _col5 (type: decimal(7,2)), CASE WHEN (_col9 is not null) THEN (_col9) ELSE (0) END (type: decimal(12,2)), (_col6 - CASE WHEN (_col10 is not null) THEN (_col10) ELSE (0) END) (type: decimal(13,2))
                   outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 463810558 Data size: 62809267017 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -802,12 +802,12 @@ STAGE PLANS:
                     keys:
                       0 _col2 (type: int)
                       1 _col0 (type: int)
-                    outputColumnNames: _col5, _col6, _col9, _col10, _col18
+                    outputColumnNames: _col5, _col6, _col9, _col10, _col15
                     input vertices:
                       1 Map 30
                     Statistics: Num rows: 231917759 Data size: 31534108438 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col18 (type: string), _col5 (type: decimal(7,2)), CASE WHEN (_col9 is not null) THEN (_col9) ELSE (0) END (type: decimal(12,2)), (_col6 - CASE WHEN (_col10 is not null) THEN (_col10) ELSE (0) END) (type: decimal(13,2))
+                      expressions: _col15 (type: string), _col5 (type: decimal(7,2)), CASE WHEN (_col9 is not null) THEN (_col9) ELSE (0) END (type: decimal(12,2)), (_col6 - CASE WHEN (_col10 is not null) THEN (_col10) ELSE (0) END) (type: decimal(13,2))
                       outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 231917759 Data size: 31534108438 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
@@ -876,12 +876,12 @@ STAGE PLANS:
                     keys:
                       0 _col2 (type: int)
                       1 _col0 (type: int)
-                    outputColumnNames: _col5, _col6, _col9, _col10, _col18
+                    outputColumnNames: _col5, _col6, _col9, _col10, _col15
                     input vertices:
                       1 Map 11
                     Statistics: Num rows: 927646829 Data size: 81837272625 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col18 (type: string), _col5 (type: decimal(7,2)), CASE WHEN (_col9 is not null) THEN (_col9) ELSE (0) END (type: decimal(12,2)), (_col6 - CASE WHEN (_col10 is not null) THEN (_col10) ELSE (0) END) (type: decimal(13,2))
+                      expressions: _col15 (type: string), _col5 (type: decimal(7,2)), CASE WHEN (_col9 is not null) THEN (_col9) ELSE (0) END (type: decimal(12,2)), (_col6 - CASE WHEN (_col10 is not null) THEN (_col10) ELSE (0) END) (type: decimal(13,2))
                       outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 927646829 Data size: 81837272625 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query81.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query81.q.out b/ql/src/test/results/clientpositive/perf/spark/query81.q.out
index d507589..4abcdc6 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query81.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query81.q.out
@@ -217,14 +217,14 @@ STAGE PLANS:
                     Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ca_address_sk (type: int), ca_street_number (type: string), ca_street_name (type: string), ca_street_type (type: string), ca_suite_number (type: string), ca_city (type: string), ca_county (type: string), ca_zip (type: string), ca_country (type: string), ca_gmt_offset (type: decimal(5,2)), ca_location_type (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col8, _col9, _col10, _col11
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                       Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: decimal(5,2)), _col11 (type: string)
+                        value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: decimal(5,2)), _col10 (type: string)
             Execution mode: vectorized
         Map 6 
             Map Operator Tree:
@@ -293,11 +293,11 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col7
+                outputColumnNames: _col1, _col3, _col6
                 Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col3)
-                  keys: _col7 (type: string), _col1 (type: int)
+                  keys: _col6 (type: string), _col1 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
@@ -344,14 +344,14 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col7, _col8, _col9, _col10, _col11, _col12, _col14, _col15, _col16, _col17
+                outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
                 Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col14 (type: string), _col15 (type: string), _col16 (type: decimal(5,2)), _col17 (type: string)
+                  value expressions: _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: decimal(5,2)), _col16 (type: string)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -360,10 +360,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col5, _col7, _col8, _col9, _col10, _col11, _col12, _col14, _col15, _col16, _col17, _col20
+                outputColumnNames: _col1, _col3, _col4, _col5, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col19
                 Statistics: Num rows: 96800003 Data size: 83249958789 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col14 (type: string), _col15 (type: string), _col16 (type: decimal(5,2)), _col17 (type: string), _col20 (type: decimal(17,2))
+                  expressions: _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: decimal(5,2)), _col16 (type: string), _col19 (type: decimal(17,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
                   Statistics: Num rows: 96800003 Data size: 83249958789 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
@@ -416,11 +416,11 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col7
+                outputColumnNames: _col1, _col3, _col6
                 Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col3)
-                  keys: _col7 (type: string), _col1 (type: int)
+                  keys: _col6 (type: string), _col1 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query83.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query83.q.out b/ql/src/test/results/clientpositive/perf/spark/query83.q.out
index 52eebb9..36ea0d4 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query83.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query83.q.out
@@ -564,12 +564,16 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 34842647 Data size: 2699627990 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: bigint), UDFToDouble(_col1) (type: double)
+                  outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 34842647 Data size: 2699627990 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: bigint)
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 34842647 Data size: 2699627990 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: bigint), _col2 (type: double)
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -681,12 +685,16 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 8711072 Data size: 801742469 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: bigint), UDFToDouble(_col1) (type: double)
+                  outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 8711072 Data size: 801742469 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: bigint)
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 8711072 Data size: 801742469 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: bigint), _col2 (type: double)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -766,12 +774,16 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 17423323 Data size: 1849627061 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: bigint), UDFToDouble(_col1) (type: double)
+                  outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 17423323 Data size: 1849627061 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: bigint)
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 17423323 Data size: 1849627061 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: bigint), _col2 (type: double)
         Reducer 5 
             Reduce Operator Tree:
               Join Operator
@@ -782,10 +794,10 @@ STAGE PLANS:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
                   2 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col3, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col7, _col8
                 Statistics: Num rows: 76653825 Data size: 5939181706 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: string), _col3 (type: bigint), (((UDFToDouble(_col3) / UDFToDouble(((_col3 + _col1) + _col5))) / 3.0D) * 100.0D) (type: double), _col1 (type: bigint), (((UDFToDouble(_col1) / UDFToDouble(((_col3 + _col1) + _col5))) / 3.0D) * 100.0D) (type: double), _col5 (type: bigint), (((UDFToDouble(_col5) / UDFToDouble(((_col3 + _col1) + _col5))) / 3.0D) * 100.0D) (type: double), (CAST( ((_col3 + _col1) + _col5) AS decimal(19,0)) / 3) (type: decimal(25,6))
+                  expressions: _col0 (type: string), _col4 (type: bigint), (((_col5 / UDFToDouble(((_col4 + _col1) + _col7))) / 3.0D) * 100.0D) (type: double), _col1 (type: bigint), (((_col2 / UDFToDouble(((_col4 + _col1) + _col7))) / 3.0D) * 100.0D) (type: double), _col7 (type: bigint), (((_col8 / UDFToDouble(((_col4 + _col1) + _col7))) / 3.0D) * 100.0D) (type: double), (CAST( ((_col4 + _col1) + _col7) AS decimal(19,0)) / 3) (type: decimal(25,6))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 76653825 Data size: 5939181706 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query84.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query84.q.out b/ql/src/test/results/clientpositive/perf/spark/query84.q.out
index 921caee..c7935da 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query84.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query84.q.out
@@ -175,15 +175,15 @@ STAGE PLANS:
                     predicate: (c_current_addr_sk is not null and c_current_cdemo_sk is not null and c_current_hdemo_sk is not null) (type: boolean)
                     Statistics: Num rows: 80000000 Data size: 68801615852 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: c_customer_id (type: string), c_current_cdemo_sk (type: int), c_current_hdemo_sk (type: int), c_current_addr_sk (type: int), c_first_name (type: string), c_last_name (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      expressions: c_customer_id (type: string), c_current_cdemo_sk (type: int), c_current_hdemo_sk (type: int), c_current_addr_sk (type: int), concat(concat(c_last_name, ', '), c_first_name) (type: string)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 80000000 Data size: 68801615852 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col3 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col3 (type: int)
                         Statistics: Num rows: 80000000 Data size: 68801615852 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col1 (type: int), _col2 (type: int), _col4 (type: string), _col5 (type: string)
+                        value expressions: _col0 (type: string), _col1 (type: int), _col2 (type: int), _col4 (type: string)
             Execution mode: vectorized
         Map 7 
             Map Operator Tree:
@@ -214,10 +214,10 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                   2 _col1 (type: int)
-                outputColumnNames: _col2, _col6, _col7
+                outputColumnNames: _col2, _col6
                 Statistics: Num rows: 212960011 Data size: 183149913305 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: concat(concat(_col7, ', '), _col6) (type: string), _col2 (type: string)
+                  expressions: _col6 (type: string), _col2 (type: string)
                   outputColumnNames: _col1, _col2
                   Statistics: Num rows: 212960011 Data size: 183149913305 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
@@ -253,7 +253,7 @@ STAGE PLANS:
                 keys:
                   0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4
                 Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -261,7 +261,7 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col1, _col4, _col5
+                  outputColumnNames: _col0, _col1, _col4
                   input vertices:
                     1 Map 8
                   Statistics: Num rows: 96800003 Data size: 83249958789 Basic stats: COMPLETE Column stats: NONE
@@ -270,7 +270,7 @@ STAGE PLANS:
                     sort order: +
                     Map-reduce partition columns: _col1 (type: int)
                     Statistics: Num rows: 96800003 Data size: 83249958789 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col0 (type: string), _col4 (type: string), _col5 (type: string)
+                    value expressions: _col0 (type: string), _col4 (type: string)
 
   Stage: Stage-0
     Fetch Operator


[12/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query4.q.out b/ql/src/test/results/clientpositive/perf/tez/query4.q.out
index 27ce7b5..bb0d7ba 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query4.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query4.q.out
@@ -271,367 +271,355 @@ Stage-0
     limit:100
     Stage-1
       Reducer 10 vectorized
-      File Output Operator [FS_575]
-        Limit [LIM_574] (rows=100 width=85)
+      File Output Operator [FS_557]
+        Limit [LIM_556] (rows=100 width=85)
           Number of rows:100
-          Select Operator [SEL_573] (rows=7323197 width=85)
+          Select Operator [SEL_555] (rows=7323197 width=85)
             Output:["_col0"]
           <-Reducer 9 [SIMPLE_EDGE]
-            SHUFFLE [RS_147]
-              Select Operator [SEL_146] (rows=7323197 width=85)
+            SHUFFLE [RS_141]
+              Select Operator [SEL_140] (rows=7323197 width=85)
                 Output:["_col0"]
-                Filter Operator [FIL_145] (rows=7323197 width=533)
-                  predicate:CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col5 is not null) THEN (((_col9 / _col5) > (_col12 / _col3))) ELSE ((null > (_col12 / _col3))) END) ELSE (CASE WHEN (_col5 is not null) THEN (((_col9 / _col5) > null)) ELSE (null) END) END
-                  Merge Join Operator [MERGEJOIN_478] (rows=14646395 width=533)
-                    Conds:RS_142._col2=RS_572._col0(Inner),Output:["_col3","_col5","_col9","_col11","_col12"]
+                Filter Operator [FIL_139] (rows=7323197 width=537)
+                  predicate:CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col9) THEN (((_col11 / _col8) > (_col14 / _col3))) ELSE ((null > (_col14 / _col3))) END) ELSE (CASE WHEN (_col9) THEN (((_col11 / _col8) > null)) ELSE (null) END) END
+                  Merge Join Operator [MERGEJOIN_472] (rows=14646395 width=537)
+                    Conds:RS_136._col2=RS_554._col0(Inner),Output:["_col3","_col8","_col9","_col11","_col13","_col14"]
                   <-Reducer 30 [SIMPLE_EDGE] vectorized
-                    SHUFFLE [RS_572]
+                    SHUFFLE [RS_554]
                       PartitionCols:_col0
-                      Select Operator [SEL_571] (rows=80000000 width=297)
+                      Select Operator [SEL_553] (rows=80000000 width=297)
                         Output:["_col0","_col1","_col2"]
-                        Group By Operator [GBY_570] (rows=80000000 width=764)
+                        Group By Operator [GBY_552] (rows=80000000 width=764)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                         <-Reducer 29 [SIMPLE_EDGE]
-                          SHUFFLE [RS_126]
+                          SHUFFLE [RS_120]
                             PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                            Group By Operator [GBY_125] (rows=80000000 width=764)
-                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                              Select Operator [SEL_123] (rows=187573258 width=1043)
-                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                Merge Join Operator [MERGEJOIN_473] (rows=187573258 width=1043)
-                                  Conds:RS_120._col1=RS_518._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col9","_col10","_col11","_col12","_col13","_col14","_col15"]
-                                <-Map 38 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_518]
-                                    PartitionCols:_col0
-                                    Select Operator [SEL_517] (rows=80000000 width=656)
-                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                      Filter Operator [FIL_516] (rows=80000000 width=656)
-                                        predicate:(c_customer_id is not null and c_customer_sk is not null)
-                                        TableScan [TS_114] (rows=80000000 width=656)
-                                          default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk","c_customer_id","c_first_name","c_last_name","c_preferred_cust_flag","c_birth_country","c_login","c_email_address"]
-                                <-Reducer 28 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_120]
-                                    PartitionCols:_col1
-                                    Merge Join Operator [MERGEJOIN_472] (rows=187573258 width=395)
-                                      Conds:RS_569._col0=RS_487._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5"]
-                                    <-Map 31 [SIMPLE_EDGE] vectorized
-                                      PARTITION_ONLY_SHUFFLE [RS_487]
-                                        PartitionCols:_col0
-                                        Select Operator [SEL_483] (rows=652 width=8)
-                                          Output:["_col0"]
-                                          Filter Operator [FIL_479] (rows=652 width=8)
-                                            predicate:((d_year = 2002) and d_date_sk is not null)
-                                            TableScan [TS_111] (rows=73049 width=8)
-                                              default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                                    <-Map 27 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_569]
-                                        PartitionCols:_col0
-                                        Select Operator [SEL_568] (rows=525327388 width=435)
-                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                          Filter Operator [FIL_567] (rows=525327388 width=435)
-                                            predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_118_date_dim_d_date_sk_min) AND DynamicValue(RS_118_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_118_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
-                                            TableScan [TS_108] (rows=575995635 width=435)
-                                              default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_ext_discount_amt","ss_ext_sales_price","ss_ext_wholesale_cost","ss_ext_list_price"]
-                                            <-Reducer 32 [BROADCAST_EDGE] vectorized
-                                              BROADCAST [RS_566]
-                                                Group By Operator [GBY_565] (rows=1 width=12)
-                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                  PARTITION_ONLY_SHUFFLE [RS_505]
-                                                    Group By Operator [GBY_499] (rows=1 width=12)
-                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                      Select Operator [SEL_488] (rows=652 width=4)
-                                                        Output:["_col0"]
-                                                         Please refer to the previous Select Operator [SEL_483]
+                            Group By Operator [GBY_119] (rows=80000000 width=764)
+                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                              Merge Join Operator [MERGEJOIN_467] (rows=187573258 width=764)
+                                Conds:RS_115._col1=RS_510._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                              <-Map 38 [SIMPLE_EDGE] vectorized
+                                SHUFFLE [RS_510]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_509] (rows=80000000 width=656)
+                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                                    Filter Operator [FIL_508] (rows=80000000 width=656)
+                                      predicate:(c_customer_id is not null and c_customer_sk is not null)
+                                      TableScan [TS_109] (rows=80000000 width=656)
+                                        default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk","c_customer_id","c_first_name","c_last_name","c_preferred_cust_flag","c_birth_country","c_login","c_email_address"]
+                              <-Reducer 28 [SIMPLE_EDGE]
+                                SHUFFLE [RS_115]
+                                  PartitionCols:_col1
+                                  Merge Join Operator [MERGEJOIN_466] (rows=187573258 width=115)
+                                    Conds:RS_112._col0=RS_481._col0(Inner),Output:["_col1","_col2"]
+                                  <-Map 31 [SIMPLE_EDGE] vectorized
+                                    PARTITION_ONLY_SHUFFLE [RS_481]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_477] (rows=652 width=4)
+                                        Output:["_col0"]
+                                        Filter Operator [FIL_473] (rows=652 width=8)
+                                          predicate:((d_year = 2002) and d_date_sk is not null)
+                                          TableScan [TS_106] (rows=73049 width=8)
+                                            default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                  <-Map 27 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_112]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_105] (rows=525327388 width=119)
+                                        Output:["_col0","_col1","_col2"]
+                                        Filter Operator [FIL_250] (rows=525327388 width=435)
+                                          predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_113_date_dim_d_date_sk_min) AND DynamicValue(RS_113_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_113_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
+                                          TableScan [TS_103] (rows=575995635 width=435)
+                                            default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_ext_discount_amt","ss_ext_sales_price","ss_ext_wholesale_cost","ss_ext_list_price"]
+                                          <-Reducer 32 [BROADCAST_EDGE] vectorized
+                                            BROADCAST [RS_550]
+                                              Group By Operator [GBY_549] (rows=1 width=12)
+                                                Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                              <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                PARTITION_ONLY_SHUFFLE [RS_499]
+                                                  Group By Operator [GBY_493] (rows=1 width=12)
+                                                    Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                    Select Operator [SEL_482] (rows=652 width=4)
+                                                      Output:["_col0"]
+                                                       Please refer to the previous Select Operator [SEL_477]
                   <-Reducer 8 [ONE_TO_ONE_EDGE]
-                    FORWARD [RS_142]
+                    FORWARD [RS_136]
                       PartitionCols:_col2
-                      Filter Operator [FIL_141] (rows=12248093 width=660)
-                        predicate:CASE WHEN (_col7 is not null) THEN (CASE WHEN (_col5 is not null) THEN (((_col9 / _col5) > (_col1 / _col7))) ELSE ((null > (_col1 / _col7))) END) ELSE (CASE WHEN (_col5 is not null) THEN (((_col9 / _col5) > null)) ELSE (null) END) END
-                        Merge Join Operator [MERGEJOIN_477] (rows=24496186 width=660)
-                          Conds:RS_138._col2=RS_564._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col7","_col9"]
+                      Filter Operator [FIL_135] (rows=12248093 width=668)
+                        predicate:CASE WHEN (_col6) THEN (CASE WHEN (_col9) THEN (((_col11 / _col8) > (_col1 / _col5))) ELSE ((null > (_col1 / _col5))) END) ELSE (CASE WHEN (_col9) THEN (((_col11 / _col8) > null)) ELSE (null) END) END
+                        Merge Join Operator [MERGEJOIN_471] (rows=24496186 width=668)
+                          Conds:RS_132._col2=RS_548._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col8","_col9","_col11"]
                         <-Reducer 26 [SIMPLE_EDGE] vectorized
-                          SHUFFLE [RS_564]
+                          SHUFFLE [RS_548]
                             PartitionCols:_col0
-                            Select Operator [SEL_563] (rows=80000000 width=212)
+                            Select Operator [SEL_547] (rows=80000000 width=212)
                               Output:["_col0","_col1"]
-                              Group By Operator [GBY_562] (rows=80000000 width=764)
+                              Group By Operator [GBY_546] (rows=80000000 width=764)
                                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                               <-Reducer 25 [SIMPLE_EDGE]
-                                SHUFFLE [RS_105]
+                                SHUFFLE [RS_100]
                                   PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                  Group By Operator [GBY_104] (rows=80000000 width=764)
-                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                    Select Operator [SEL_102] (rows=101084444 width=1093)
-                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                      Merge Join Operator [MERGEJOIN_471] (rows=101084444 width=1093)
-                                        Conds:RS_99._col1=RS_519._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col9","_col10","_col11","_col12","_col13","_col14","_col15"]
-                                      <-Map 38 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_519]
-                                          PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_517]
-                                      <-Reducer 24 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_99]
-                                          PartitionCols:_col1
-                                          Merge Join Operator [MERGEJOIN_470] (rows=101084444 width=445)
-                                            Conds:RS_561._col0=RS_489._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5"]
-                                          <-Map 31 [SIMPLE_EDGE] vectorized
-                                            PARTITION_ONLY_SHUFFLE [RS_489]
-                                              PartitionCols:_col0
-                                               Please refer to the previous Select Operator [SEL_483]
-                                          <-Map 23 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_561]
-                                              PartitionCols:_col0
-                                              Select Operator [SEL_560] (rows=285117831 width=453)
-                                                Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                                Filter Operator [FIL_559] (rows=285117831 width=453)
-                                                  predicate:((cs_sold_date_sk BETWEEN DynamicValue(RS_97_date_dim_d_date_sk_min) AND DynamicValue(RS_97_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_97_date_dim_d_date_sk_bloom_filter))) and cs_bill_customer_sk is not null and cs_sold_date_sk is not null)
-                                                  TableScan [TS_87] (rows=287989836 width=453)
-                                                    default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_bill_customer_sk","cs_ext_discount_amt","cs_ext_sales_price","cs_ext_wholesale_cost","cs_ext_list_price"]
-                                                  <-Reducer 33 [BROADCAST_EDGE] vectorized
-                                                    BROADCAST [RS_558]
-                                                      Group By Operator [GBY_557] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                      <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                        PARTITION_ONLY_SHUFFLE [RS_506]
-                                                          Group By Operator [GBY_500] (rows=1 width=12)
-                                                            Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                            Select Operator [SEL_490] (rows=652 width=4)
-                                                              Output:["_col0"]
-                                                               Please refer to the previous Select Operator [SEL_483]
+                                  Group By Operator [GBY_99] (rows=80000000 width=764)
+                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                                    Merge Join Operator [MERGEJOIN_465] (rows=101084444 width=764)
+                                      Conds:RS_95._col1=RS_511._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                                    <-Map 38 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_511]
+                                        PartitionCols:_col0
+                                         Please refer to the previous Select Operator [SEL_509]
+                                    <-Reducer 24 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_95]
+                                        PartitionCols:_col1
+                                        Merge Join Operator [MERGEJOIN_464] (rows=101084444 width=115)
+                                          Conds:RS_92._col0=RS_483._col0(Inner),Output:["_col1","_col2"]
+                                        <-Map 31 [SIMPLE_EDGE] vectorized
+                                          PARTITION_ONLY_SHUFFLE [RS_483]
+                                            PartitionCols:_col0
+                                             Please refer to the previous Select Operator [SEL_477]
+                                        <-Map 23 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_92]
+                                            PartitionCols:_col0
+                                            Select Operator [SEL_85] (rows=285117831 width=119)
+                                              Output:["_col0","_col1","_col2"]
+                                              Filter Operator [FIL_247] (rows=285117831 width=453)
+                                                predicate:((cs_sold_date_sk BETWEEN DynamicValue(RS_93_date_dim_d_date_sk_min) AND DynamicValue(RS_93_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_93_date_dim_d_date_sk_bloom_filter))) and cs_bill_customer_sk is not null and cs_sold_date_sk is not null)
+                                                TableScan [TS_83] (rows=287989836 width=453)
+                                                  default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_bill_customer_sk","cs_ext_discount_amt","cs_ext_sales_price","cs_ext_wholesale_cost","cs_ext_list_price"]
+                                                <-Reducer 33 [BROADCAST_EDGE] vectorized
+                                                  BROADCAST [RS_544]
+                                                    Group By Operator [GBY_543] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                    <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                      PARTITION_ONLY_SHUFFLE [RS_500]
+                                                        Group By Operator [GBY_494] (rows=1 width=12)
+                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                          Select Operator [SEL_484] (rows=652 width=4)
+                                                            Output:["_col0"]
+                                                             Please refer to the previous Select Operator [SEL_477]
                         <-Reducer 7 [ONE_TO_ONE_EDGE]
-                          FORWARD [RS_138]
+                          FORWARD [RS_132]
                             PartitionCols:_col2
-                            Merge Join Operator [MERGEJOIN_476] (rows=20485011 width=548)
-                              Conds:RS_135._col2=RS_556._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col7"]
+                            Merge Join Operator [MERGEJOIN_470] (rows=20485011 width=556)
+                              Conds:RS_129._col2=RS_542._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col8","_col9"]
                             <-Reducer 22 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_556]
+                              SHUFFLE [RS_542]
                                 PartitionCols:_col0
-                                Select Operator [SEL_555] (rows=17130654 width=212)
-                                  Output:["_col0","_col1"]
-                                  Filter Operator [FIL_554] (rows=17130654 width=212)
+                                Select Operator [SEL_541] (rows=26666666 width=216)
+                                  Output:["_col0","_col1","_col2"]
+                                  Filter Operator [FIL_540] (rows=26666666 width=212)
                                     predicate:(_col7 > 0)
-                                    Select Operator [SEL_553] (rows=51391963 width=212)
+                                    Select Operator [SEL_539] (rows=80000000 width=212)
                                       Output:["_col0","_col7"]
-                                      Group By Operator [GBY_552] (rows=51391963 width=764)
+                                      Group By Operator [GBY_538] (rows=80000000 width=764)
                                         Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                                       <-Reducer 21 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_83]
+                                        SHUFFLE [RS_79]
                                           PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                          Group By Operator [GBY_82] (rows=51391963 width=764)
-                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                            Select Operator [SEL_80] (rows=51391963 width=1099)
-                                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                              Merge Join Operator [MERGEJOIN_469] (rows=51391963 width=1099)
-                                                Conds:RS_77._col1=RS_523._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col9","_col10","_col11","_col12","_col13","_col14","_col15"]
-                                              <-Map 38 [SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_523]
-                                                  PartitionCols:_col0
-                                                   Please refer to the previous Select Operator [SEL_517]
-                                              <-Reducer 20 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_77]
-                                                  PartitionCols:_col1
-                                                  Merge Join Operator [MERGEJOIN_468] (rows=51391963 width=451)
-                                                    Conds:RS_551._col0=RS_497._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5"]
-                                                  <-Map 31 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_497]
-                                                      PartitionCols:_col0
-                                                      Select Operator [SEL_486] (rows=652 width=8)
-                                                        Output:["_col0"]
-                                                        Filter Operator [FIL_482] (rows=652 width=8)
-                                                          predicate:((d_year = 2001) and d_date_sk is not null)
-                                                           Please refer to the previous TableScan [TS_111]
-                                                  <-Map 19 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_551]
-                                                      PartitionCols:_col0
-                                                      Select Operator [SEL_550] (rows=143930993 width=455)
-                                                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                                        Filter Operator [FIL_549] (rows=143930993 width=455)
-                                                          predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_75_date_dim_d_date_sk_min) AND DynamicValue(RS_75_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_75_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_sold_date_sk is not null)
-                                                          TableScan [TS_65] (rows=144002668 width=455)
-                                                            default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_customer_sk","ws_ext_discount_amt","ws_ext_sales_price","ws_ext_wholesale_cost","ws_ext_list_price"]
-                                                          <-Reducer 37 [BROADCAST_EDGE] vectorized
-                                                            BROADCAST [RS_548]
-                                                              Group By Operator [GBY_547] (rows=1 width=12)
-                                                                Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                              <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                PARTITION_ONLY_SHUFFLE [RS_510]
-                                                                  Group By Operator [GBY_504] (rows=1 width=12)
-                                                                    Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                    Select Operator [SEL_498] (rows=652 width=4)
-                                                                      Output:["_col0"]
-                                                                       Please refer to the previous Select Operator [SEL_486]
+                                          Group By Operator [GBY_78] (rows=80000000 width=764)
+                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                                            Merge Join Operator [MERGEJOIN_463] (rows=101084444 width=764)
+                                              Conds:RS_74._col1=RS_515._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                                            <-Map 38 [SIMPLE_EDGE] vectorized
+                                              SHUFFLE [RS_515]
+                                                PartitionCols:_col0
+                                                 Please refer to the previous Select Operator [SEL_509]
+                                            <-Reducer 20 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_74]
+                                                PartitionCols:_col1
+                                                Merge Join Operator [MERGEJOIN_462] (rows=101084444 width=115)
+                                                  Conds:RS_71._col0=RS_491._col0(Inner),Output:["_col1","_col2"]
+                                                <-Map 31 [SIMPLE_EDGE] vectorized
+                                                  PARTITION_ONLY_SHUFFLE [RS_491]
+                                                    PartitionCols:_col0
+                                                    Select Operator [SEL_480] (rows=652 width=4)
+                                                      Output:["_col0"]
+                                                      Filter Operator [FIL_476] (rows=652 width=8)
+                                                        predicate:((d_year = 2001) and d_date_sk is not null)
+                                                         Please refer to the previous TableScan [TS_106]
+                                                <-Map 19 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_71]
+                                                    PartitionCols:_col0
+                                                    Select Operator [SEL_64] (rows=285117831 width=119)
+                                                      Output:["_col0","_col1","_col2"]
+                                                      Filter Operator [FIL_244] (rows=285117831 width=453)
+                                                        predicate:((cs_sold_date_sk BETWEEN DynamicValue(RS_72_date_dim_d_date_sk_min) AND DynamicValue(RS_72_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_72_date_dim_d_date_sk_bloom_filter))) and cs_bill_customer_sk is not null and cs_sold_date_sk is not null)
+                                                        TableScan [TS_62] (rows=287989836 width=453)
+                                                          default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_bill_customer_sk","cs_ext_discount_amt","cs_ext_sales_price","cs_ext_wholesale_cost","cs_ext_list_price"]
+                                                        <-Reducer 37 [BROADCAST_EDGE] vectorized
+                                                          BROADCAST [RS_536]
+                                                            Group By Operator [GBY_535] (rows=1 width=12)
+                                                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                            <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                              PARTITION_ONLY_SHUFFLE [RS_504]
+                                                                Group By Operator [GBY_498] (rows=1 width=12)
+                                                                  Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                  Select Operator [SEL_492] (rows=652 width=4)
+                                                                    Output:["_col0"]
+                                                                     Please refer to the previous Select Operator [SEL_480]
                             <-Reducer 6 [ONE_TO_ONE_EDGE]
-                              FORWARD [RS_135]
+                              FORWARD [RS_129]
                                 PartitionCols:_col2
-                                Merge Join Operator [MERGEJOIN_475] (rows=31888273 width=436)
-                                  Conds:RS_132._col2=RS_546._col0(Inner),Output:["_col1","_col2","_col3","_col5"]
+                                Merge Join Operator [MERGEJOIN_469] (rows=20485011 width=440)
+                                  Conds:RS_126._col2=RS_534._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
                                 <-Reducer 18 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_546]
+                                  SHUFFLE [RS_534]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_545] (rows=26666666 width=212)
-                                      Output:["_col0","_col1"]
-                                      Filter Operator [FIL_544] (rows=26666666 width=212)
+                                    Select Operator [SEL_533] (rows=17130654 width=216)
+                                      Output:["_col0","_col1","_col2"]
+                                      Filter Operator [FIL_532] (rows=17130654 width=212)
                                         predicate:(_col7 > 0)
-                                        Select Operator [SEL_543] (rows=80000000 width=212)
+                                        Select Operator [SEL_531] (rows=51391963 width=212)
                                           Output:["_col0","_col7"]
-                                          Group By Operator [GBY_542] (rows=80000000 width=764)
+                                          Group By Operator [GBY_530] (rows=51391963 width=764)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                                           <-Reducer 17 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_61]
+                                            SHUFFLE [RS_58]
                                               PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                              Group By Operator [GBY_60] (rows=80000000 width=764)
-                                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                                Select Operator [SEL_58] (rows=101084444 width=1093)
-                                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                                  Merge Join Operator [MERGEJOIN_467] (rows=101084444 width=1093)
-                                                    Conds:RS_55._col1=RS_522._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col9","_col10","_col11","_col12","_col13","_col14","_col15"]
-                                                  <-Map 38 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_522]
-                                                      PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_517]
-                                                  <-Reducer 16 [SIMPLE_EDGE]
-                                                    SHUFFLE [RS_55]
-                                                      PartitionCols:_col1
-                                                      Merge Join Operator [MERGEJOIN_466] (rows=101084444 width=445)
-                                                        Conds:RS_541._col0=RS_495._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5"]
-                                                      <-Map 31 [SIMPLE_EDGE] vectorized
-                                                        PARTITION_ONLY_SHUFFLE [RS_495]
-                                                          PartitionCols:_col0
-                                                          Select Operator [SEL_485] (rows=652 width=8)
-                                                            Output:["_col0"]
-                                                            Filter Operator [FIL_481] (rows=652 width=8)
-                                                              predicate:((d_year = 2001) and d_date_sk is not null)
-                                                               Please refer to the previous TableScan [TS_111]
-                                                      <-Map 15 [SIMPLE_EDGE] vectorized
-                                                        SHUFFLE [RS_541]
-                                                          PartitionCols:_col0
-                                                          Select Operator [SEL_540] (rows=285117831 width=453)
-                                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                                            Filter Operator [FIL_539] (rows=285117831 width=453)
-                                                              predicate:((cs_sold_date_sk BETWEEN DynamicValue(RS_53_date_dim_d_date_sk_min) AND DynamicValue(RS_53_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_53_date_dim_d_date_sk_bloom_filter))) and cs_bill_customer_sk is not null and cs_sold_date_sk is not null)
-                                                              TableScan [TS_43] (rows=287989836 width=453)
-                                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_bill_customer_sk","cs_ext_discount_amt","cs_ext_sales_price","cs_ext_wholesale_cost","cs_ext_list_price"]
-                                                              <-Reducer 36 [BROADCAST_EDGE] vectorized
-                                                                BROADCAST [RS_538]
-                                                                  Group By Operator [GBY_537] (rows=1 width=12)
-                                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                  <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                    PARTITION_ONLY_SHUFFLE [RS_509]
-                                                                      Group By Operator [GBY_503] (rows=1 width=12)
-                                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                        Select Operator [SEL_496] (rows=652 width=4)
-                                                                          Output:["_col0"]
-                                                                           Please refer to the previous Select Operator [SEL_485]
+                                              Group By Operator [GBY_57] (rows=51391963 width=764)
+                                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                                                Merge Join Operator [MERGEJOIN_461] (rows=51391963 width=764)
+                                                  Conds:RS_53._col1=RS_514._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                                                <-Map 38 [SIMPLE_EDGE] vectorized
+                                                  SHUFFLE [RS_514]
+                                                    PartitionCols:_col0
+                                                     Please refer to the previous Select Operator [SEL_509]
+                                                <-Reducer 16 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_53]
+                                                    PartitionCols:_col1
+                                                    Merge Join Operator [MERGEJOIN_460] (rows=51391963 width=115)
+                                                      Conds:RS_50._col0=RS_489._col0(Inner),Output:["_col1","_col2"]
+                                                    <-Map 31 [SIMPLE_EDGE] vectorized
+                                                      PARTITION_ONLY_SHUFFLE [RS_489]
+                                                        PartitionCols:_col0
+                                                        Select Operator [SEL_479] (rows=652 width=4)
+                                                          Output:["_col0"]
+                                                          Filter Operator [FIL_475] (rows=652 width=8)
+                                                            predicate:((d_year = 2001) and d_date_sk is not null)
+                                                             Please refer to the previous TableScan [TS_106]
+                                                    <-Map 15 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_50]
+                                                        PartitionCols:_col0
+                                                        Select Operator [SEL_43] (rows=143930993 width=119)
+                                                          Output:["_col0","_col1","_col2"]
+                                                          Filter Operator [FIL_241] (rows=143930993 width=455)
+                                                            predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_51_date_dim_d_date_sk_min) AND DynamicValue(RS_51_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_51_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_sold_date_sk is not null)
+                                                            TableScan [TS_41] (rows=144002668 width=455)
+                                                              default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_customer_sk","ws_ext_discount_amt","ws_ext_sales_price","ws_ext_wholesale_cost","ws_ext_list_price"]
+                                                            <-Reducer 36 [BROADCAST_EDGE] vectorized
+                                                              BROADCAST [RS_528]
+                                                                Group By Operator [GBY_527] (rows=1 width=12)
+                                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                  PARTITION_ONLY_SHUFFLE [RS_503]
+                                                                    Group By Operator [GBY_497] (rows=1 width=12)
+                                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                      Select Operator [SEL_490] (rows=652 width=4)
+                                                                        Output:["_col0"]
+                                                                         Please refer to the previous Select Operator [SEL_479]
                                 <-Reducer 5 [ONE_TO_ONE_EDGE]
-                                  FORWARD [RS_132]
+                                  FORWARD [RS_126]
                                     PartitionCols:_col2
-                                    Merge Join Operator [MERGEJOIN_474] (rows=31888273 width=324)
-                                      Conds:RS_526._col0=RS_536._col0(Inner),Output:["_col1","_col2","_col3"]
+                                    Merge Join Operator [MERGEJOIN_468] (rows=31888273 width=324)
+                                      Conds:RS_518._col0=RS_526._col0(Inner),Output:["_col1","_col2","_col3"]
                                     <-Reducer 14 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_536]
+                                      SHUFFLE [RS_526]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_535] (rows=26666666 width=212)
+                                        Select Operator [SEL_525] (rows=26666666 width=212)
                                           Output:["_col0","_col1"]
-                                          Filter Operator [FIL_534] (rows=26666666 width=212)
+                                          Filter Operator [FIL_524] (rows=26666666 width=212)
                                             predicate:(_col7 > 0)
-                                            Select Operator [SEL_533] (rows=80000000 width=212)
+                                            Select Operator [SEL_523] (rows=80000000 width=212)
                                               Output:["_col0","_col7"]
-                                              Group By Operator [GBY_532] (rows=80000000 width=764)
+                                              Group By Operator [GBY_522] (rows=80000000 width=764)
                                                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                                               <-Reducer 13 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_39]
+                                                SHUFFLE [RS_37]
                                                   PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                                  Group By Operator [GBY_38] (rows=80000000 width=764)
-                                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                                    Select Operator [SEL_36] (rows=187573258 width=1043)
-                                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                                      Merge Join Operator [MERGEJOIN_465] (rows=187573258 width=1043)
-                                                        Conds:RS_33._col1=RS_521._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col9","_col10","_col11","_col12","_col13","_col14","_col15"]
-                                                      <-Map 38 [SIMPLE_EDGE] vectorized
-                                                        SHUFFLE [RS_521]
-                                                          PartitionCols:_col0
-                                                           Please refer to the previous Select Operator [SEL_517]
-                                                      <-Reducer 12 [SIMPLE_EDGE]
-                                                        SHUFFLE [RS_33]
-                                                          PartitionCols:_col1
-                                                          Merge Join Operator [MERGEJOIN_464] (rows=187573258 width=395)
-                                                            Conds:RS_531._col0=RS_493._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5"]
-                                                          <-Map 31 [SIMPLE_EDGE] vectorized
-                                                            PARTITION_ONLY_SHUFFLE [RS_493]
-                                                              PartitionCols:_col0
-                                                              Select Operator [SEL_484] (rows=652 width=8)
-                                                                Output:["_col0"]
-                                                                Filter Operator [FIL_480] (rows=652 width=8)
-                                                                  predicate:((d_year = 2001) and d_date_sk is not null)
-                                                                   Please refer to the previous TableScan [TS_111]
-                                                          <-Map 11 [SIMPLE_EDGE] vectorized
-                                                            SHUFFLE [RS_531]
-                                                              PartitionCols:_col0
-                                                              Select Operator [SEL_530] (rows=525327388 width=435)
-                                                                Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                                                Filter Operator [FIL_529] (rows=525327388 width=435)
-                                                                  predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_31_date_dim_d_date_sk_min) AND DynamicValue(RS_31_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_31_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
-                                                                  TableScan [TS_21] (rows=575995635 width=435)
-                                                                    default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_ext_discount_amt","ss_ext_sales_price","ss_ext_wholesale_cost","ss_ext_list_price"]
-                                                                  <-Reducer 35 [BROADCAST_EDGE] vectorized
-                                                                    BROADCAST [RS_528]
-                                                                      Group By Operator [GBY_527] (rows=1 width=12)
-                                                                        Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                      <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                        PARTITION_ONLY_SHUFFLE [RS_508]
-                                                                          Group By Operator [GBY_502] (rows=1 width=12)
-                                                                            Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                            Select Operator [SEL_494] (rows=652 width=4)
-                                                                              Output:["_col0"]
-                                                                               Please refer to the previous Select Operator [SEL_484]
+                                                  Group By Operator [GBY_36] (rows=80000000 width=764)
+                                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                                                    Merge Join Operator [MERGEJOIN_459] (rows=187573258 width=764)
+                                                      Conds:RS_32._col1=RS_513._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                                                    <-Map 38 [SIMPLE_EDGE] vectorized
+                                                      SHUFFLE [RS_513]
+                                                        PartitionCols:_col0
+                                                         Please refer to the previous Select Operator [SEL_509]
+                                                    <-Reducer 12 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_32]
+                                                        PartitionCols:_col1
+                                                        Merge Join Operator [MERGEJOIN_458] (rows=187573258 width=115)
+                                                          Conds:RS_29._col0=RS_487._col0(Inner),Output:["_col1","_col2"]
+                                                        <-Map 31 [SIMPLE_EDGE] vectorized
+                                                          PARTITION_ONLY_SHUFFLE [RS_487]
+                                                            PartitionCols:_col0
+                                                            Select Operator [SEL_478] (rows=652 width=4)
+                                                              Output:["_col0"]
+                                                              Filter Operator [FIL_474] (rows=652 width=8)
+                                                                predicate:((d_year = 2001) and d_date_sk is not null)
+                                                                 Please refer to the previous TableScan [TS_106]
+                                                        <-Map 11 [SIMPLE_EDGE]
+                                                          SHUFFLE [RS_29]
+                                                            PartitionCols:_col0
+                                                            Select Operator [SEL_22] (rows=525327388 width=119)
+                                                              Output:["_col0","_col1","_col2"]
+                                                              Filter Operator [FIL_238] (rows=525327388 width=435)
+                                                                predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_30_date_dim_d_date_sk_min) AND DynamicValue(RS_30_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_30_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
+                                                                TableScan [TS_20] (rows=575995635 width=435)
+                                                                  default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_ext_discount_amt","ss_ext_sales_price","ss_ext_wholesale_cost","ss_ext_list_price"]
+                                                                <-Reducer 35 [BROADCAST_EDGE] vectorized
+                                                                  BROADCAST [RS_520]
+                                                                    Group By Operator [GBY_519] (rows=1 width=12)
+                                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                    <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                      PARTITION_ONLY_SHUFFLE [RS_502]
+                                                                        Group By Operator [GBY_496] (rows=1 width=12)
+                                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                          Select Operator [SEL_488] (rows=652 width=4)
+                                                                            Output:["_col0"]
+                                                                             Please refer to the previous Select Operator [SEL_478]
                                     <-Reducer 4 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_526]
+                                      SHUFFLE [RS_518]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_525] (rows=51391963 width=212)
+                                        Select Operator [SEL_517] (rows=51391963 width=212)
                                           Output:["_col0","_col1"]
-                                          Group By Operator [GBY_524] (rows=51391963 width=764)
+                                          Group By Operator [GBY_516] (rows=51391963 width=764)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                                           <-Reducer 3 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_18]
+                                            SHUFFLE [RS_17]
                                               PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                              Group By Operator [GBY_17] (rows=51391963 width=764)
-                                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                                Select Operator [SEL_15] (rows=51391963 width=1099)
-                                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                                  Merge Join Operator [MERGEJOIN_463] (rows=51391963 width=1099)
-                                                    Conds:RS_12._col1=RS_520._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col9","_col10","_col11","_col12","_col13","_col14","_col15"]
-                                                  <-Map 38 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_520]
-                                                      PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_517]
-                                                  <-Reducer 2 [SIMPLE_EDGE]
-                                                    SHUFFLE [RS_12]
-                                                      PartitionCols:_col1
-                                                      Merge Join Operator [MERGEJOIN_462] (rows=51391963 width=451)
-                                                        Conds:RS_515._col0=RS_491._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5"]
-                                                      <-Map 31 [SIMPLE_EDGE] vectorized
-                                                        PARTITION_ONLY_SHUFFLE [RS_491]
-                                                          PartitionCols:_col0
-                                                           Please refer to the previous Select Operator [SEL_483]
-                                                      <-Map 1 [SIMPLE_EDGE] vectorized
-                                                        SHUFFLE [RS_515]
-                                                          PartitionCols:_col0
-                                                          Select Operator [SEL_514] (rows=143930993 width=455)
-                                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                                            Filter Operator [FIL_513] (rows=143930993 width=455)
-                                                              predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_10_date_dim_d_date_sk_min) AND DynamicValue(RS_10_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_10_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_sold_date_sk is not null)
-                                                              TableScan [TS_0] (rows=144002668 width=455)
-                                                                default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_customer_sk","ws_ext_discount_amt","ws_ext_sales_price","ws_ext_wholesale_cost","ws_ext_list_price"]
-                                                              <-Reducer 34 [BROADCAST_EDGE] vectorized
-                                                                BROADCAST [RS_512]
-                                                                  Group By Operator [GBY_511] (rows=1 width=12)
-                                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                  <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                    PARTITION_ONLY_SHUFFLE [RS_507]
-                                                                      Group By Operator [GBY_501] (rows=1 width=12)
-                                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                        Select Operator [SEL_492] (rows=652 width=4)
-                                                                          Output:["_col0"]
-                                                                           Please refer to the previous Select Operator [SEL_483]
+                                              Group By Operator [GBY_16] (rows=51391963 width=764)
+                                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                                                Merge Join Operator [MERGEJOIN_457] (rows=51391963 width=764)
+                                                  Conds:RS_12._col1=RS_512._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                                                <-Map 38 [SIMPLE_EDGE] vectorized
+                                                  SHUFFLE [RS_512]
+                                                    PartitionCols:_col0
+                                                     Please refer to the previous Select Operator [SEL_509]
+                                                <-Reducer 2 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_12]
+                                                    PartitionCols:_col1
+                                                    Merge Join Operator [MERGEJOIN_456] (rows=51391963 width=115)
+                                                      Conds:RS_9._col0=RS_485._col0(Inner),Output:["_col1","_col2"]
+                                                    <-Map 31 [SIMPLE_EDGE] vectorized
+                                                      PARTITION_ONLY_SHUFFLE [RS_485]
+                                                        PartitionCols:_col0
+                                                         Please refer to the previous Select Operator [SEL_477]
+                                                    <-Map 1 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_9]
+                                                        PartitionCols:_col0
+                                                        Select Operator [SEL_2] (rows=143930993 width=119)
+                                                          Output:["_col0","_col1","_col2"]
+                                                          Filter Operator [FIL_235] (rows=143930993 width=455)
+                                                            predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_10_date_dim_d_date_sk_min) AND DynamicValue(RS_10_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_10_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_sold_date_sk is not null)
+                                                            TableScan [TS_0] (rows=144002668 width=455)
+                                                              default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_customer_sk","ws_ext_discount_amt","ws_ext_sales_price","ws_ext_wholesale_cost","ws_ext_list_price"]
+                                                            <-Reducer 34 [BROADCAST_EDGE] vectorized
+                                                              BROADCAST [RS_506]
+                                                                Group By Operator [GBY_505] (rows=1 width=12)
+                                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                <-Map 31 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                  PARTITION_ONLY_SHUFFLE [RS_501]
+                                                                    Group By Operator [GBY_495] (rows=1 width=12)
+                                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                      Select Operator [SEL_486] (rows=652 width=4)
+                                                                        Output:["_col0"]
+                                                                         Please refer to the previous Select Operator [SEL_477]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query40.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query40.q.out b/ql/src/test/results/clientpositive/perf/tez/query40.q.out
index 1cca18d..6e566e1 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query40.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query40.q.out
@@ -96,12 +96,12 @@ Stage-0
                   PartitionCols:_col0, _col1
                   Group By Operator [GBY_29] (rows=5757278 width=410)
                     Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col0, _col1
-                    Top N Key Operator [TNK_55] (rows=5757278 width=364)
+                    Top N Key Operator [TNK_55] (rows=5757278 width=278)
                       keys:_col0, _col1,sort order:++,top n:100
-                      Select Operator [SEL_27] (rows=5757278 width=364)
+                      Select Operator [SEL_27] (rows=5757278 width=278)
                         Output:["_col0","_col1","_col2","_col3"]
-                        Merge Join Operator [MERGEJOIN_101] (rows=5757278 width=364)
-                          Conds:RS_24._col1=RS_126._col0(Inner),Output:["_col4","_col7","_col9","_col11","_col14"]
+                        Merge Join Operator [MERGEJOIN_101] (rows=5757278 width=278)
+                          Conds:RS_24._col1=RS_126._col0(Inner),Output:["_col4","_col7","_col9","_col10","_col12","_col14"]
                         <-Map 13 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_126]
                             PartitionCols:_col0
@@ -114,12 +114,12 @@ Stage-0
                         <-Reducer 4 [SIMPLE_EDGE]
                           SHUFFLE [RS_24]
                             PartitionCols:_col1
-                            Merge Join Operator [MERGEJOIN_100] (rows=5757278 width=281)
-                              Conds:RS_21._col2=RS_112._col0(Inner),Output:["_col1","_col4","_col7","_col9","_col11"]
+                            Merge Join Operator [MERGEJOIN_100] (rows=5757278 width=195)
+                              Conds:RS_21._col2=RS_112._col0(Inner),Output:["_col1","_col4","_col7","_col9","_col10","_col12"]
                             <-Map 11 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_112]
                                 PartitionCols:_col0
-                                Select Operator [SEL_111] (rows=51333 width=215)
+                                Select Operator [SEL_111] (rows=51333 width=104)
                                   Output:["_col0","_col1"]
                                   Filter Operator [FIL_110] (rows=51333 width=215)
                                     predicate:(i_current_price BETWEEN 0.99 AND 1.49 and i_item_sk is not null)
@@ -128,13 +128,13 @@ Stage-0
                             <-Reducer 3 [SIMPLE_EDGE]
                               SHUFFLE [RS_21]
                                 PartitionCols:_col2
-                                Merge Join Operator [MERGEJOIN_99] (rows=51815831 width=210)
-                                  Conds:RS_18._col0=RS_104._col0(Inner),Output:["_col1","_col2","_col4","_col7","_col9"]
+                                Merge Join Operator [MERGEJOIN_99] (rows=51815831 width=124)
+                                  Conds:RS_18._col0=RS_104._col0(Inner),Output:["_col1","_col2","_col4","_col7","_col9","_col10"]
                                 <-Map 9 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_104]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_103] (rows=8116 width=98)
-                                      Output:["_col0","_col1"]
+                                    Select Operator [SEL_103] (rows=8116 width=12)
+                                      Output:["_col0","_col1","_col2"]
                                       Filter Operator [FIL_102] (rows=8116 width=98)
                                         predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-03-09 00:00:00' AND TIMESTAMP'1998-05-08 00:00:00' and d_date_sk is not null)
                                         TableScan [TS_6] (rows=73049 width=98)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query42.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query42.q.out b/ql/src/test/results/clientpositive/perf/tez/query42.q.out
index a458f5e..0a01d71 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query42.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query42.q.out
@@ -79,13 +79,13 @@ Stage-0
                   SHUFFLE [RS_17]
                     PartitionCols:_col0, _col1
                     Group By Operator [GBY_16] (rows=120 width=206)
-                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)"],keys:_col7, _col8
+                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)"],keys:_col5, _col6
                       Merge Join Operator [MERGEJOIN_54] (rows=2301098 width=94)
-                        Conds:RS_12._col1=RS_65._col0(Inner),Output:["_col2","_col7","_col8"]
+                        Conds:RS_12._col1=RS_65._col0(Inner),Output:["_col2","_col5","_col6"]
                       <-Map 8 [SIMPLE_EDGE] vectorized
                         PARTITION_ONLY_SHUFFLE [RS_65]
                           PartitionCols:_col0
-                          Select Operator [SEL_64] (rows=7333 width=101)
+                          Select Operator [SEL_64] (rows=7333 width=97)
                             Output:["_col0","_col1","_col2"]
                             Filter Operator [FIL_63] (rows=7333 width=101)
                               predicate:((i_manager_id = 1) and i_item_sk is not null)
@@ -99,7 +99,7 @@ Stage-0
                           <-Map 6 [SIMPLE_EDGE] vectorized
                             PARTITION_ONLY_SHUFFLE [RS_57]
                               PartitionCols:_col0
-                              Select Operator [SEL_56] (rows=50 width=12)
+                              Select Operator [SEL_56] (rows=50 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_55] (rows=50 width=12)
                                   predicate:((d_moy = 12) and (d_year = 1998) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query43.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query43.q.out b/ql/src/test/results/clientpositive/perf/tez/query43.q.out
index f75929b..66ded7d 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query43.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query43.q.out
@@ -70,18 +70,18 @@ Stage-0
               <-Reducer 3 [SIMPLE_EDGE]
                 SHUFFLE [RS_18]
                   PartitionCols:_col0, _col1
-                  Group By Operator [GBY_17] (rows=176297 width=972)
+                  Group By Operator [GBY_17] (rows=142538 width=972)
                     Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)","sum(_col5)","sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col0, _col1
-                    Top N Key Operator [TNK_33] (rows=37536846 width=320)
+                    Top N Key Operator [TNK_33] (rows=37536846 width=257)
                       keys:_col0, _col1,sort order:++,top n:100
-                      Select Operator [SEL_15] (rows=37536846 width=320)
+                      Select Operator [SEL_15] (rows=37536846 width=257)
                         Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
-                        Merge Join Operator [MERGEJOIN_55] (rows=37536846 width=320)
-                          Conds:RS_12._col1=RS_66._col0(Inner),Output:["_col2","_col5","_col7","_col8"]
+                        Merge Join Operator [MERGEJOIN_55] (rows=37536846 width=257)
+                          Conds:RS_12._col1=RS_66._col0(Inner),Output:["_col2","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col12","_col13"]
                         <-Map 8 [SIMPLE_EDGE] vectorized
                           PARTITION_ONLY_SHUFFLE [RS_66]
                             PartitionCols:_col0
-                            Select Operator [SEL_65] (rows=341 width=304)
+                            Select Operator [SEL_65] (rows=341 width=192)
                               Output:["_col0","_col1","_col2"]
                               Filter Operator [FIL_64] (rows=341 width=303)
                                 predicate:((s_gmt_offset = -6) and s_store_sk is not null)
@@ -90,13 +90,13 @@ Stage-0
                         <-Reducer 2 [SIMPLE_EDGE]
                           SHUFFLE [RS_12]
                             PartitionCols:_col1
-                            Merge Join Operator [MERGEJOIN_54] (rows=187574154 width=192)
-                              Conds:RS_74._col0=RS_58._col0(Inner),Output:["_col1","_col2","_col5"]
+                            Merge Join Operator [MERGEJOIN_54] (rows=187574154 width=129)
+                              Conds:RS_74._col0=RS_58._col0(Inner),Output:["_col1","_col2","_col4","_col5","_col6","_col7","_col8","_col9","_col10"]
                             <-Map 6 [SIMPLE_EDGE] vectorized
                               PARTITION_ONLY_SHUFFLE [RS_58]
                                 PartitionCols:_col0
-                                Select Operator [SEL_57] (rows=652 width=99)
-                                  Output:["_col0","_col2"]
+                                Select Operator [SEL_57] (rows=652 width=32)
+                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
                                   Filter Operator [FIL_56] (rows=652 width=99)
                                     predicate:((d_year = 1998) and d_date_sk is not null)
                                     TableScan [TS_3] (rows=73049 width=99)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query46.q.out b/ql/src/test/results/clientpositive/perf/tez/query46.q.out
index 378741b..7b0d0a6 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query46.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query46.q.out
@@ -148,9 +148,9 @@ Stage-0
                           SHUFFLE [RS_35]
                             PartitionCols:_col0, _col1, _col2, _col3
                             Group By Operator [GBY_34] (rows=8380115 width=321)
-                              Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col6)","sum(_col7)"],keys:_col1, _col17, _col3, _col5
+                              Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col6)","sum(_col7)"],keys:_col1, _col12, _col3, _col5
                               Merge Join Operator [MERGEJOIN_144] (rows=8380115 width=97)
-                                Conds:RS_30._col3=RS_152._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col17"]
+                                Conds:RS_30._col3=RS_152._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col12"]
                               <-Map 5 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_152]
                                   PartitionCols:_col0
@@ -163,7 +163,7 @@ Stage-0
                                   <-Map 16 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_171]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_170] (rows=1855 width=12)
+                                      Select Operator [SEL_170] (rows=1855 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_169] (rows=1855 width=12)
                                           predicate:(((hd_dep_count = 2) or (hd_vehicle_count = 1)) and hd_demo_sk is not null)
@@ -177,7 +177,7 @@ Stage-0
                                       <-Map 14 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_163]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_162] (rows=35 width=97)
+                                          Select Operator [SEL_162] (rows=35 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_161] (rows=35 width=97)
                                               predicate:((s_city) IN ('Cedar Grove', 'Wildwood', 'Union', 'Salem', 'Highland Park') and s_store_sk is not null)
@@ -191,7 +191,7 @@ Stage-0
                                           <-Map 12 [SIMPLE_EDGE] vectorized
                                             SHUFFLE [RS_155]
                                               PartitionCols:_col0
-                                              Select Operator [SEL_154] (rows=783 width=12)
+                                              Select Operator [SEL_154] (rows=783 width=4)
                                                 Output:["_col0"]
                                                 Filter Operator [FIL_153] (rows=783 width=12)
                                                   predicate:((d_dow) IN (6, 0) and (d_year) IN (1998, 1999, 2000) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query47.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query47.q.out b/ql/src/test/results/clientpositive/perf/tez/query47.q.out
index 75ab317..04c64b4 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query47.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query47.q.out
@@ -139,10 +139,10 @@ Stage-0
               Select Operator [SEL_109] (rows=241454 width=658)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
                 Merge Join Operator [MERGEJOIN_278] (rows=241454 width=546)
-                  Conds:RS_106._col6, _col7, _col8, _col9, _col14=RS_306._col0, _col1, _col2, _col3, (_col5 - 1)(Inner),Output:["_col4","_col6","_col10","_col11","_col12","_col13","_col19"]
+                  Conds:RS_106._col6, _col7, _col8, _col9, _col14=RS_306._col0, _col1, _col2, _col3, _col5(Inner),Output:["_col4","_col6","_col10","_col11","_col12","_col13","_col19"]
                 <-Reducer 6 [SIMPLE_EDGE] vectorized
                   SHUFFLE [RS_306]
-                    PartitionCols:_col0, _col1, _col2, _col3, (_col5 - 1)
+                    PartitionCols:_col0, _col1, _col2, _col3, _col5
                     Select Operator [SEL_304] (rows=162257387 width=485)
                       Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                       Filter Operator [FIL_302] (rows=162257387 width=489)
@@ -224,10 +224,10 @@ Stage-0
                   FORWARD [RS_106]
                     PartitionCols:_col6, _col7, _col8, _col9, _col14
                     Merge Join Operator [MERGEJOIN_277] (rows=241454 width=717)
-                      Conds:RS_307._col0, _col1, _col2, _col3, (_col5 + 1)=RS_318._col0, _col1, _col2, _col3, _col8(Inner),Output:["_col4","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14"]
+                      Conds:RS_307._col0, _col1, _col2, _col3, _col5=RS_318._col0, _col1, _col2, _col3, _col8(Inner),Output:["_col4","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14"]
                     <-Reducer 6 [SIMPLE_EDGE] vectorized
                       SHUFFLE [RS_307]
-                        PartitionCols:_col0, _col1, _col2, _col3, (_col5 + 1)
+                        PartitionCols:_col0, _col1, _col2, _col3, _col5
                         Select Operator [SEL_305] (rows=162257387 width=485)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                           Filter Operator [FIL_303] (rows=162257387 width=489)


[20/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query38.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query38.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query38.q.out
index 9633df1..cbf9bca 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query38.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query38.q.out
@@ -75,7 +75,7 @@ HiveSortLimit(fetch=[100])
                             HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3])
                               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($3))])
                                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                            HiveProject(d_date_sk=[$0], d_date=[$2], d_month_seq=[$3])
+                            HiveProject(d_date_sk=[$0], d_date=[$2])
                               HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject(c_last_name=[$1], c_first_name=[$0], d_date=[$2], $f3=[$3])
@@ -90,7 +90,7 @@ HiveSortLimit(fetch=[100])
                             HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3])
                               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($3))])
                                 HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                            HiveProject(d_date_sk=[$0], d_date=[$2], d_month_seq=[$3])
+                            HiveProject(d_date_sk=[$0], d_date=[$2])
                               HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject(c_last_name=[$1], c_first_name=[$0], d_date=[$2], $f3=[$3])
@@ -105,7 +105,7 @@ HiveSortLimit(fetch=[100])
                             HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4])
                               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                            HiveProject(d_date_sk=[$0], d_date=[$2], d_month_seq=[$3])
+                            HiveProject(d_date_sk=[$0], d_date=[$2])
                               HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query39.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query39.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query39.q.out
index fd3038e..51bb901 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query39.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query39.q.out
@@ -68,8 +68,8 @@ HiveProject(w_warehouse_sk=[$0], i_item_sk=[$1], d_moy=[CAST(4):INTEGER], mean=[
         HiveProject(w_warehouse_sk=[$1], i_item_sk=[$2], mean=[/(CAST($6):DOUBLE, $5)], cov=[CASE(=(/(CAST($6):DOUBLE, $5), 0), null, /(POWER(/(-($3, /(*($4, $4), $5)), CASE(=($5, 1), null, -($5, 1))), 0.5), /(CAST($6):DOUBLE, $5)))])
           HiveFilter(condition=[CASE(=(/(CAST($6):DOUBLE, $5), 0), false, >(/(POWER(/(-($3, /(*($4, $4), $5)), CASE(=($5, 1), null, -($5, 1))), 0.5), /(CAST($6):DOUBLE, $5)), 1))])
             HiveAggregate(group=[{0, 1, 2}], agg#0=[sum($5)], agg#1=[sum($4)], agg#2=[count($3)], agg#3=[sum($3)])
-              HiveProject($f0=[$9], $f1=[$8], $f2=[$0], $f4=[$4], $f40=[CAST($4):DOUBLE], $f6=[*(CAST($4):DOUBLE, CAST($4):DOUBLE)])
-                HiveJoin(condition=[=($3, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveProject($f0=[$7], $f1=[$6], $f2=[$0], $f4=[$4], $f40=[CAST($4):DOUBLE], $f6=[*(CAST($4):DOUBLE, CAST($4):DOUBLE)])
+                HiveJoin(condition=[=($3, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(i_item_sk=[$0])
                       HiveFilter(condition=[IS NOT NULL($0)])
@@ -78,7 +78,7 @@ HiveProject(w_warehouse_sk=[$0], i_item_sk=[$1], d_moy=[CAST(4):INTEGER], mean=[
                       HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], inv_warehouse_sk=[$2], inv_quantity_on_hand=[$3])
                         HiveFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($2), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, inventory]], table:alias=[inventory])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(4):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), =($8, 4), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                   HiveProject(w_warehouse_sk=[$0], w_warehouse_name=[$2])
@@ -87,8 +87,8 @@ HiveProject(w_warehouse_sk=[$0], i_item_sk=[$1], d_moy=[CAST(4):INTEGER], mean=[
         HiveProject(w_warehouse_sk=[$1], i_item_sk=[$2], mean=[/(CAST($6):DOUBLE, $5)], cov=[CASE(=(/(CAST($6):DOUBLE, $5), 0), null, /(POWER(/(-($3, /(*($4, $4), $5)), CASE(=($5, 1), null, -($5, 1))), 0.5), /(CAST($6):DOUBLE, $5)))])
           HiveFilter(condition=[CASE(=(/(CAST($6):DOUBLE, $5), 0), false, >(/(POWER(/(-($3, /(*($4, $4), $5)), CASE(=($5, 1), null, -($5, 1))), 0.5), /(CAST($6):DOUBLE, $5)), 1))])
             HiveAggregate(group=[{0, 1, 2}], agg#0=[sum($5)], agg#1=[sum($4)], agg#2=[count($3)], agg#3=[sum($3)])
-              HiveProject($f0=[$9], $f1=[$8], $f2=[$0], $f4=[$4], $f40=[CAST($4):DOUBLE], $f6=[*(CAST($4):DOUBLE, CAST($4):DOUBLE)])
-                HiveJoin(condition=[=($3, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveProject($f0=[$7], $f1=[$6], $f2=[$0], $f4=[$4], $f40=[CAST($4):DOUBLE], $f6=[*(CAST($4):DOUBLE, CAST($4):DOUBLE)])
+                HiveJoin(condition=[=($3, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(i_item_sk=[$0])
                       HiveFilter(condition=[IS NOT NULL($0)])
@@ -97,7 +97,7 @@ HiveProject(w_warehouse_sk=[$0], i_item_sk=[$1], d_moy=[CAST(4):INTEGER], mean=[
                       HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], inv_warehouse_sk=[$2], inv_quantity_on_hand=[$3])
                         HiveFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($2), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, inventory]], table:alias=[inventory])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(5):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), =($8, 5), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                   HiveProject(w_warehouse_sk=[$0], w_warehouse_name=[$2])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query4.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query4.q.out
index d796f86..4b38865 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query4.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query4.q.out
@@ -229,96 +229,90 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
   HiveProject(customer_preferred_cust_flag=[$1])
-    HiveJoin(condition=[AND(=($0, $7), CASE(CAST(IS NOT NULL($8)):BOOLEAN, CASE(CAST(IS NOT NULL($10)):BOOLEAN, >(/($4, $10), /($2, $8)), >(null, /($2, $8))), CASE(CAST(IS NOT NULL($10)):BOOLEAN, >(/($4, $10), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveJoin(condition=[AND(=($0, $7), CASE(CAST(IS NOT NULL($8)):BOOLEAN, CASE($14, >(/($4, $13), /($2, $8)), >(null, /($2, $8))), CASE($14, >(/($4, $13), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
       HiveProject($f0=[$0], $f3=[$3], $f8=[$7])
-        HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-          HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f6=[$7], $f8=[/(+(-(-($13, $12), $10), $11), CAST(2):DECIMAL(10, 0))])
+        HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
+          HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
+              HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
+                HiveTableScan(table=[[default, customer]], table:alias=[customer])
+            HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), CAST(2):DECIMAL(10, 0))])
+                HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
+                  HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+              HiveProject(d_date_sk=[$0])
+                HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
+                  HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+      HiveJoin(condition=[AND(=($4, $0), CASE($8, CASE($11, >(/($1, $10), /($3, $7)), >(null, /($3, $7))), CASE($11, >(/($1, $10), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject($f0=[$0], $f8=[$7])
+          HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
             HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
                 HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
                   HiveTableScan(table=[[default, customer]], table:alias=[customer])
-              HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_ext_discount_amt=[$14], ss_ext_sales_price=[$15], ss_ext_wholesale_cost=[$16], ss_ext_list_price=[$17])
+              HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], /=[/(+(-(-($25, $24), $22), $23), CAST(2):DECIMAL(10, 0))])
                   HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                    HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
+                    HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-      HiveJoin(condition=[AND(=($4, $0), CASE(CAST(IS NOT NULL($9)):BOOLEAN, CASE(CAST(IS NOT NULL($7)):BOOLEAN, >(/($1, $7), /($3, $9)), >(null, /($3, $9))), CASE(CAST(IS NOT NULL($7)):BOOLEAN, >(/($1, $7), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveProject($f0=[$0], $f8=[$7])
-          HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-            HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f6=[$7], $f8=[/(+(-(-($13, $12), $10), $11), CAST(2):DECIMAL(10, 0))])
-              HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
-                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
-                    HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_ext_discount_amt=[$22], cs_ext_sales_price=[$23], cs_ext_wholesale_cost=[$24], cs_ext_list_price=[$25])
-                    HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                      HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
-                    HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
-                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-        HiveJoin(condition=[=($2, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[=($2, $7)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveJoin(condition=[=($2, $4)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject($f0=[$0], $f8=[$7])
-                HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-                  HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f6=[$7], $f8=[/(+(-(-($13, $12), $10), $11), CAST(2):DECIMAL(10, 0))])
-                    HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
-                        HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
-                          HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                      HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-                        HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], ws_ext_discount_amt=[$22], ws_ext_sales_price=[$23], ws_ext_wholesale_cost=[$24], ws_ext_list_price=[$25])
-                          HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
-                            HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                        HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
-                          HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
-                            HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+                HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
+                  HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
+                      HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
+                        HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                    HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], /=[/(+(-(-($25, $24), $22), $23), CAST(2):DECIMAL(10, 0))])
+                        HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
+                          HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
+                      HiveProject(d_date_sk=[$0])
+                        HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
+                          HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
               HiveProject($f0=[$0], $f8=[$7])
                 HiveFilter(condition=[>($7, 0)])
-                  HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-                    HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f6=[$7], $f8=[/(+(-(-($13, $12), $10), $11), CAST(2):DECIMAL(10, 0))])
-                      HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                        HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
-                          HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
-                            HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                        HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-                          HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_ext_discount_amt=[$14], ss_ext_sales_price=[$15], ss_ext_wholesale_cost=[$16], ss_ext_list_price=[$17])
-                            HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                              HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                          HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
-                            HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
-                              HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-            HiveProject($f0=[$0], $f8=[$7])
-              HiveFilter(condition=[>($7, 0)])
-                HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-                  HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f6=[$7], $f8=[/(+(-(-($13, $12), $10), $11), CAST(2):DECIMAL(10, 0))])
+                  HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
                     HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
                           HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                      HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-                        HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_ext_discount_amt=[$22], cs_ext_sales_price=[$23], cs_ext_wholesale_cost=[$24], cs_ext_list_price=[$25])
+                      HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], /=[/(+(-(-($17, $16), $14), $15), CAST(2):DECIMAL(10, 0))])
                           HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                            HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                        HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+                            HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                        HiveProject(d_date_sk=[$0])
                           HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject($f0=[$0], $f8=[$7])
-            HiveFilter(condition=[>($7, 0)])
-              HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], agg#0=[sum($7)])
-                HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f6=[$7], $f8=[/(+(-(-($13, $12), $10), $11), CAST(2):DECIMAL(10, 0))])
+            HiveProject(customer_id=[$0], year_total=[$7], CAST=[CAST(IS NOT NULL($7)):BOOLEAN])
+              HiveFilter(condition=[>($7, 0)])
+                HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
                   HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                    HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], ws_ext_discount_amt=[$22], ws_ext_sales_price=[$23], ws_ext_wholesale_cost=[$24], ws_ext_list_price=[$25])
+                    HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], /=[/(+(-(-($25, $24), $22), $23), CAST(2):DECIMAL(10, 0))])
                         HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+          HiveProject(customer_id=[$0], year_total=[$7], CAST=[CAST(IS NOT NULL($7)):BOOLEAN])
+            HiveFilter(condition=[>($7, 0)])
+              HiveAggregate(group=[{1, 2, 3, 4, 5, 6, 7}], agg#0=[sum($10)])
+                HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_country=[$14], c_login=[$15], c_email_address=[$16])
+                    HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
+                      HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                  HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], /=[/(+(-(-($25, $24), $22), $23), CAST(2):DECIMAL(10, 0))])
+                      HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
+                        HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
+                    HiveProject(d_date_sk=[$0])
+                      HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
+                        HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query40.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query40.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query40.q.out
index 7d8fc9b..1f834b5 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query40.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query40.q.out
@@ -68,12 +68,12 @@ CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
   HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3])
     HiveAggregate(group=[{0, 1}], agg#0=[sum($2)], agg#1=[sum($3)])
-      HiveProject($f0=[$1], $f1=[$13], $f2=[CASE(<(CAST($11):DATE, 1998-04-08), -($6, CASE(IS NOT NULL($9), $9, 0)), 0)], $f3=[CASE(>=(CAST($11):DATE, 1998-04-08), -($6, CASE(IS NOT NULL($9), $9, 0)), 0)])
+      HiveProject($f0=[$1], $f1=[$14], $f2=[CASE($11, -($6, CASE(IS NOT NULL($9), $9, 0)), 0)], $f3=[CASE($12, -($6, CASE(IS NOT NULL($9), $9, 0)), 0)])
         HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(w_warehouse_sk=[$0], w_state=[$10])
             HiveFilter(condition=[IS NOT NULL($0)])
               HiveTableScan(table=[[default, warehouse]], table:alias=[warehouse])
-          HiveJoin(condition=[=($10, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($11, $2)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($0, $8)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[AND(=($3, $6), =($2, $5))], joinType=[left], algorithm=[none], cost=[not available])
                 HiveProject(cs_sold_date_sk=[$0], cs_warehouse_sk=[$14], cs_item_sk=[$15], cs_order_number=[$17], cs_sales_price=[$21])
@@ -82,10 +82,10 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                 HiveProject(cr_item_sk=[$2], cr_order_number=[$16], cr_refunded_cash=[$23])
                   HiveFilter(condition=[IS NOT NULL($2)])
                     HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
-              HiveProject(d_date_sk=[$0], d_date=[$2])
+              HiveProject(d_date_sk=[$0], <=[<(CAST($2):DATE, 1998-04-08)], >==[>=(CAST($2):DATE, 1998-04-08)])
                 HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-03-09 00:00:00, 1998-05-08 00:00:00), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-            HiveProject(i_item_sk=[$0], i_item_id=[$1], i_current_price=[$5])
+            HiveProject(i_item_sk=[$0], i_item_id=[$1])
               HiveFilter(condition=[AND(BETWEEN(false, $5, 0.99, 1.49), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, item]], table:alias=[item])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query42.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query42.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query42.q.out
index ddb3223..0a7dac0 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query42.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query42.q.out
@@ -53,16 +53,16 @@ HiveSortLimit(fetch=[100])
   HiveProject(d_year=[CAST(1998):INTEGER], i_category_id=[$0], i_category=[$1], _o__c3=[$2])
     HiveSortLimit(sort0=[$3], sort1=[$0], sort2=[$1], dir0=[DESC-nulls-last], dir1=[ASC], dir2=[ASC])
       HiveProject(i_category_id=[$0], i_category=[$1], _o__c3=[$2], (tok_function sum (tok_table_or_col ss_ext_sales_price))=[$2])
-        HiveAggregate(group=[{7, 8}], agg#0=[sum($2)])
-          HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveAggregate(group=[{5, 6}], agg#0=[sum($2)])
+          HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ext_sales_price=[$15])
                 HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2))])
                   HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-              HiveProject(d_date_sk=[$0], d_year=[CAST(1998):INTEGER], d_moy=[CAST(12):INTEGER])
+              HiveProject(d_date_sk=[$0])
                 HiveFilter(condition=[AND(=($8, 12), =($6, 1998), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, date_dim]], table:alias=[dt])
-            HiveProject(i_item_sk=[$0], i_category_id=[$11], i_category=[$12], i_manager_id=[CAST(1):INTEGER])
+            HiveProject(i_item_sk=[$0], i_category_id=[$11], i_category=[$12])
               HiveFilter(condition=[AND(=($20, 1), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, item]], table:alias=[item])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query43.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query43.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query43.q.out
index f6eeae3..1d86c8b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query43.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query43.q.out
@@ -46,16 +46,16 @@ CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], sort5=[$5], sort6=[$6], sort7=[$7], sort8=[$8], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], dir4=[ASC], dir5=[ASC], dir6=[ASC], dir7=[ASC], dir8=[ASC], fetch=[100])
   HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7], $f8=[$8])
     HiveAggregate(group=[{0, 1}], agg#0=[sum($2)], agg#1=[sum($3)], agg#2=[sum($4)], agg#3=[sum($5)], agg#4=[sum($6)], agg#5=[sum($7)], agg#6=[sum($8)])
-      HiveProject($f0=[$8], $f1=[$7], $f2=[CASE(=($5, _UTF-16LE'Sunday'), $2, null)], $f3=[CASE(=($5, _UTF-16LE'Monday'), $2, null)], $f4=[CASE(=($5, _UTF-16LE'Tuesday'), $2, null)], $f5=[CASE(=($5, _UTF-16LE'Wednesday'), $2, null)], $f6=[CASE(=($5, _UTF-16LE'Thursday'), $2, null)], $f7=[CASE(=($5, _UTF-16LE'Friday'), $2, null)], $f8=[CASE(=($5, _UTF-16LE'Saturday'), $2, null)])
-        HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveProject($f0=[$13], $f1=[$12], $f2=[CASE($4, $2, null)], $f3=[CASE($5, $2, null)], $f4=[CASE($6, $2, null)], $f5=[CASE($7, $2, null)], $f6=[CASE($8, $2, null)], $f7=[CASE($9, $2, null)], $f8=[CASE($10, $2, null)])
+        HiveJoin(condition=[=($11, $1)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject(ss_sold_date_sk=[$0], ss_store_sk=[$7], ss_sales_price=[$13])
               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-            HiveProject(d_date_sk=[$0], d_year=[CAST(1998):INTEGER], d_day_name=[$14])
+            HiveProject(d_date_sk=[$0], ==[=($14, _UTF-16LE'Sunday')], =2=[=($14, _UTF-16LE'Monday')], =3=[=($14, _UTF-16LE'Tuesday')], =4=[=($14, _UTF-16LE'Wednesday')], =5=[=($14, _UTF-16LE'Thursday')], =6=[=($14, _UTF-16LE'Friday')], =7=[=($14, _UTF-16LE'Saturday')])
               HiveFilter(condition=[AND(=($6, 1998), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(s_store_sk=[$0], s_store_id=[$1], s_store_name=[$5], s_gmt_offset=[CAST(-6):DECIMAL(5, 2)])
+          HiveProject(s_store_sk=[$0], s_store_id=[$1], s_store_name=[$5])
             HiveFilter(condition=[AND(=($27, -6), IS NOT NULL($0))])
               HiveTableScan(table=[[default, store]], table:alias=[store])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query46.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query46.q.out
index 0728056..89218b8 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query46.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query46.q.out
@@ -97,19 +97,19 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], dir0=[
             HiveProject(ca_address_sk=[$0], ca_city=[$6])
               HiveFilter(condition=[IS NOT NULL($0)])
                 HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-            HiveJoin(condition=[=($2, $13)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($4, $11)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($2, $10)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($4, $9)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($0, $8)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_ticket_number=[$9], ss_coupon_amt=[$19], ss_net_profit=[$22])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($5), IS NOT NULL($6), IS NOT NULL($3))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[$6], d_dow=[$7])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(IN($7, 6, 0), IN($6, 1998, 1999, 2000), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                HiveProject(s_store_sk=[$0], s_city=[$22])
+                HiveProject(s_store_sk=[$0])
                   HiveFilter(condition=[AND(IN($22, _UTF-16LE'Cedar Grove', _UTF-16LE'Wildwood', _UTF-16LE'Union', _UTF-16LE'Salem', _UTF-16LE'Highland Park'), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store]], table:alias=[store])
-              HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+              HiveProject(hd_demo_sk=[$0])
                 HiveFilter(condition=[AND(OR(=($3, 2), =($4, 1)), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query47.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query47.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query47.q.out
index 11fd577..8dff467 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query47.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query47.q.out
@@ -112,8 +112,8 @@ CBO PLAN:
 HiveProject(i_category=[$0], d_year=[$1], d_moy=[$2], avg_monthly_sales=[$3], sum_sales=[$4], psum=[$5], nsum=[$6])
   HiveSortLimit(sort0=[$7], sort1=[$2], dir0=[ASC], dir1=[ASC], fetch=[100])
     HiveProject(i_category=[$12], d_year=[$16], d_moy=[$17], avg_monthly_sales=[$19], sum_sales=[$18], psum=[$10], nsum=[$4], (- (tok_table_or_col sum_sales) (tok_table_or_col avg_monthly_sales))=[-($18, $19)])
-      HiveJoin(condition=[AND(AND(AND(AND(=($12, $0), =($13, $1)), =($14, $2)), =($15, $3)), =($20, -($5, 1)))], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveProject((tok_table_or_col i_category)=[$0], (tok_table_or_col i_brand)=[$1], (tok_table_or_col s_store_name)=[$2], (tok_table_or_col s_company_name)=[$3], (tok_function sum (tok_table_or_col ss_sales_price))=[$4], rank_window_1=[$5])
+      HiveJoin(condition=[AND(AND(AND(AND(=($12, $0), =($13, $1)), =($14, $2)), =($15, $3)), =($20, $5))], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject((tok_table_or_col i_category)=[$0], (tok_table_or_col i_brand)=[$1], (tok_table_or_col s_store_name)=[$2], (tok_table_or_col s_company_name)=[$3], (tok_function sum (tok_table_or_col ss_sales_price))=[$4], -=[-($5, 1)])
           HiveFilter(condition=[IS NOT NULL($5)])
             HiveProject((tok_table_or_col i_category)=[$1], (tok_table_or_col i_brand)=[$0], (tok_table_or_col s_store_name)=[$4], (tok_table_or_col s_company_name)=[$5], (tok_function sum (tok_table_or_col ss_sales_price))=[$6], rank_window_1=[rank() OVER (PARTITION BY $1, $0, $4, $5 ORDER BY $2 NULLS LAST, $3 NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
               HiveProject(i_brand=[$0], i_category=[$1], d_year=[$2], d_moy=[$3], s_store_name=[$4], s_company_name=[$5], $f6=[$6])
@@ -133,8 +133,8 @@ HiveProject(i_category=[$0], d_year=[$1], d_moy=[$2], avg_monthly_sales=[$3], su
                     HiveProject(s_store_sk=[$0], s_store_name=[$5], s_company_name=[$17])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($5), IS NOT NULL($17))])
                         HiveTableScan(table=[[default, store]], table:alias=[store])
-        HiveJoin(condition=[AND(AND(AND(AND(=($6, $0), =($7, $1)), =($8, $2)), =($9, $3)), =($14, +($5, 1)))], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveProject((tok_table_or_col i_category)=[$0], (tok_table_or_col i_brand)=[$1], (tok_table_or_col s_store_name)=[$2], (tok_table_or_col s_company_name)=[$3], (tok_function sum (tok_table_or_col ss_sales_price))=[$4], rank_window_1=[$5])
+        HiveJoin(condition=[AND(AND(AND(AND(=($6, $0), =($7, $1)), =($8, $2)), =($9, $3)), =($14, $5))], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveProject((tok_table_or_col i_category)=[$0], (tok_table_or_col i_brand)=[$1], (tok_table_or_col s_store_name)=[$2], (tok_table_or_col s_company_name)=[$3], (tok_function sum (tok_table_or_col ss_sales_price))=[$4], +=[+($5, 1)])
             HiveFilter(condition=[IS NOT NULL($5)])
               HiveProject((tok_table_or_col i_category)=[$1], (tok_table_or_col i_brand)=[$0], (tok_table_or_col s_store_name)=[$4], (tok_table_or_col s_company_name)=[$5], (tok_function sum (tok_table_or_col ss_sales_price))=[$6], rank_window_1=[rank() OVER (PARTITION BY $1, $0, $4, $5 ORDER BY $2 NULLS LAST, $3 NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
                 HiveProject(i_brand=[$0], i_category=[$1], d_year=[$2], d_moy=[$3], s_store_name=[$4], s_company_name=[$5], $f6=[$6])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query48.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query48.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query48.q.out
index feb4012..079556e 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query48.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query48.q.out
@@ -141,24 +141,24 @@ POSTHOOK: Input: default@store
 POSTHOOK: Input: default@store_sales
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
-HiveAggregate(group=[{}], agg#0=[sum($13)])
-  HiveJoin(condition=[AND(=($11, $0), OR(AND(IN($1, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM'), BETWEEN(false, $15, 0, 2000)), AND(IN($1, _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN'), BETWEEN(false, $15, 150, 3000)), AND(IN($1, _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV'), BETWEEN(false, $15, 50, 25000))))], joinType=[inner], algorithm=[none], cost=[not available])
-    HiveProject(ca_address_sk=[$0], ca_state=[$8], ca_country=[CAST(_UTF-16LE'United States'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+HiveAggregate(group=[{}], agg#0=[sum($11)])
+  HiveJoin(condition=[AND(=($9, $0), OR(AND($1, $12), AND($2, $13), AND($3, $14)))], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveProject(ca_address_sk=[$0], IN=[IN($8, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM')], IN2=[IN($8, _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN')], IN3=[IN($8, _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV')])
       HiveFilter(condition=[AND(IN($8, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM', _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN', _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV'), =($10, _UTF-16LE'United States'), IS NOT NULL($0))])
         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-    HiveJoin(condition=[=($0, $7)], joinType=[inner], algorithm=[none], cost=[not available])
-      HiveProject(cd_demo_sk=[$0], cd_marital_status=[CAST(_UTF-16LE'M'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], cd_education_status=[CAST(_UTF-16LE'4 yr Degree'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
-        HiveFilter(condition=[AND(=($2, _UTF-16LE'M'), =($3, _UTF-16LE'4 yr Degree'), IS NOT NULL($0))])
-          HiveTableScan(table=[[default, customer_demographics]], table:alias=[customer_demographics])
-      HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveProject(d_date_sk=[$0], d_year=[CAST(1998):INTEGER])
+    HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveProject(s_store_sk=[$0])
+        HiveFilter(condition=[IS NOT NULL($0)])
+          HiveTableScan(table=[[default, store]], table:alias=[store])
+      HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject(d_date_sk=[$0])
           HiveFilter(condition=[AND(=($6, 1998), IS NOT NULL($0))])
             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-        HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveProject(s_store_sk=[$0])
-            HiveFilter(condition=[IS NOT NULL($0)])
-              HiveTableScan(table=[[default, store]], table:alias=[store])
-          HiveProject(ss_sold_date_sk=[$0], ss_cdemo_sk=[$4], ss_addr_sk=[$6], ss_store_sk=[$7], ss_quantity=[$10], ss_sales_price=[$13], ss_net_profit=[$22])
+        HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveProject(cd_demo_sk=[$0])
+            HiveFilter(condition=[AND(=($2, _UTF-16LE'M'), =($3, _UTF-16LE'4 yr Degree'), IS NOT NULL($0))])
+              HiveTableScan(table=[[default, customer_demographics]], table:alias=[customer_demographics])
+          HiveProject(ss_sold_date_sk=[$0], ss_cdemo_sk=[$4], ss_addr_sk=[$6], ss_store_sk=[$7], ss_quantity=[$10], BETWEEN=[BETWEEN(false, $22, 0, 2000)], BETWEEN6=[BETWEEN(false, $22, 150, 3000)], BETWEEN7=[BETWEEN(false, $22, 50, 25000)])
             HiveFilter(condition=[AND(OR(BETWEEN(false, $13, 100, 150), BETWEEN(false, $13, 50, 100), BETWEEN(false, $13, 150, 200)), OR(BETWEEN(false, $22, 0, 2000), BETWEEN(false, $22, 150, 3000), BETWEEN(false, $22, 50, 25000)), IS NOT NULL($7), IS NOT NULL($4), IS NOT NULL($6), IS NOT NULL($0))])
               HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query49.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query49.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query49.q.out
index 9c31d61..1300dd9 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query49.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query49.q.out
@@ -279,52 +279,49 @@ HiveSortLimit(sort0=[$0], sort1=[$3], sort2=[$4], dir0=[ASC], dir1=[ASC], dir2=[
                   HiveProject(channel=[_UTF-16LE'web'], item=[$0], return_ratio=[$1], return_rank=[$2], currency_rank=[$3])
                     HiveFilter(condition=[OR(<=($2, 10), <=($3, 10))])
                       HiveProject(item=[$0], return_ratio=[/(CAST($1):DECIMAL(15, 4), CAST($2):DECIMAL(15, 4))], rank_window_0=[rank() OVER (PARTITION BY 0 ORDER BY /(CAST($1):DECIMAL(15, 4), CAST($2):DECIMAL(15, 4)) NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)], rank_window_1=[rank() OVER (PARTITION BY 0 ORDER BY /(CAST($3):DECIMAL(15, 4), CAST($4):DECIMAL(15, 4)) NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
-                        HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4])
-                          HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)], agg#2=[sum($3)], agg#3=[sum($4)])
-                            HiveProject($f0=[$5], $f1=[CASE(IS NOT NULL($2), $2, 0)], $f2=[CASE(IS NOT NULL($7), $7, 0)], $f3=[CASE(IS NOT NULL($3), $3, 0)], $f4=[CASE(IS NOT NULL($8), $8, 0)])
-                              HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[inner], algorithm=[none], cost=[not available])
-                                HiveProject(wr_item_sk=[$2], wr_order_number=[$13], wr_return_quantity=[$14], wr_return_amt=[$15])
-                                  HiveFilter(condition=[AND(>($15, 10000), IS NOT NULL($13), IS NOT NULL($2))])
-                                    HiveTableScan(table=[[default, web_returns]], table:alias=[wr])
-                                HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-                                  HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_order_number=[$17], ws_quantity=[$18], ws_net_paid=[$29], ws_net_profit=[$33])
-                                    HiveFilter(condition=[AND(>($33, 1), >($29, 0), >($18, 0), IS NOT NULL($17), IS NOT NULL($3), IS NOT NULL($0))])
-                                      HiveTableScan(table=[[default, web_sales]], table:alias=[ws])
-                                  HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(12):INTEGER])
-                                    HiveFilter(condition=[AND(=($6, 2000), =($8, 12), IS NOT NULL($0))])
-                                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+                        HiveProject(ws_item_sk=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4])
+                          HiveAggregate(group=[{5}], agg#0=[sum($2)], agg#1=[sum($7)], agg#2=[sum($3)], agg#3=[sum($8)])
+                            HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[inner], algorithm=[none], cost=[not available])
+                              HiveProject(wr_item_sk=[$2], wr_order_number=[$13], CASE=[CASE(IS NOT NULL($14), $14, 0)], CASE3=[CASE(IS NOT NULL($15), $15, 0)])
+                                HiveFilter(condition=[AND(>($15, 10000), IS NOT NULL($13), IS NOT NULL($2))])
+                                  HiveTableScan(table=[[default, web_returns]], table:alias=[wr])
+                              HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_order_number=[$17], CASE=[CASE(IS NOT NULL($18), $18, 0)], CASE4=[CASE(IS NOT NULL($29), $29, 0)])
+                                  HiveFilter(condition=[AND(>($33, 1), >($29, 0), >($18, 0), IS NOT NULL($17), IS NOT NULL($3), IS NOT NULL($0))])
+                                    HiveTableScan(table=[[default, web_sales]], table:alias=[ws])
+                                HiveProject(d_date_sk=[$0])
+                                  HiveFilter(condition=[AND(=($6, 2000), =($8, 12), IS NOT NULL($0))])
+                                    HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                   HiveProject(channel=[_UTF-16LE'catalog'], item=[$0], return_ratio=[$1], return_rank=[$2], currency_rank=[$3])
                     HiveFilter(condition=[OR(<=($2, 10), <=($3, 10))])
                       HiveProject(item=[$0], return_ratio=[/(CAST($1):DECIMAL(15, 4), CAST($2):DECIMAL(15, 4))], rank_window_0=[rank() OVER (PARTITION BY 0 ORDER BY /(CAST($1):DECIMAL(15, 4), CAST($2):DECIMAL(15, 4)) NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)], rank_window_1=[rank() OVER (PARTITION BY 0 ORDER BY /(CAST($3):DECIMAL(15, 4), CAST($4):DECIMAL(15, 4)) NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
-                        HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4])
-                          HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)], agg#2=[sum($3)], agg#3=[sum($4)])
-                            HiveProject($f0=[$5], $f1=[CASE(IS NOT NULL($2), $2, 0)], $f2=[CASE(IS NOT NULL($7), $7, 0)], $f3=[CASE(IS NOT NULL($3), $3, 0)], $f4=[CASE(IS NOT NULL($8), $8, 0)])
-                              HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[inner], algorithm=[none], cost=[not available])
-                                HiveProject(cr_item_sk=[$2], cr_order_number=[$16], cr_return_quantity=[$17], cr_return_amount=[$18])
-                                  HiveFilter(condition=[AND(>($18, 10000), IS NOT NULL($16), IS NOT NULL($2))])
-                                    HiveTableScan(table=[[default, catalog_returns]], table:alias=[cr])
-                                HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-                                  HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15], cs_order_number=[$17], cs_quantity=[$18], cs_net_paid=[$29], cs_net_profit=[$33])
-                                    HiveFilter(condition=[AND(>($33, 1), >($29, 0), >($18, 0), IS NOT NULL($17), IS NOT NULL($15), IS NOT NULL($0))])
-                                      HiveTableScan(table=[[default, catalog_sales]], table:alias=[cs])
-                                  HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(12):INTEGER])
-                                    HiveFilter(condition=[AND(=($6, 2000), =($8, 12), IS NOT NULL($0))])
-                                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+                        HiveProject(cs_item_sk=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4])
+                          HiveAggregate(group=[{5}], agg#0=[sum($2)], agg#1=[sum($7)], agg#2=[sum($3)], agg#3=[sum($8)])
+                            HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[inner], algorithm=[none], cost=[not available])
+                              HiveProject(cr_item_sk=[$2], cr_order_number=[$16], CASE=[CASE(IS NOT NULL($17), $17, 0)], CASE3=[CASE(IS NOT NULL($18), $18, 0)])
+                                HiveFilter(condition=[AND(>($18, 10000), IS NOT NULL($16), IS NOT NULL($2))])
+                                  HiveTableScan(table=[[default, catalog_returns]], table:alias=[cr])
+                              HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15], cs_order_number=[$17], CASE=[CASE(IS NOT NULL($18), $18, 0)], CASE4=[CASE(IS NOT NULL($29), $29, 0)])
+                                  HiveFilter(condition=[AND(>($33, 1), >($29, 0), >($18, 0), IS NOT NULL($17), IS NOT NULL($15), IS NOT NULL($0))])
+                                    HiveTableScan(table=[[default, catalog_sales]], table:alias=[cs])
+                                HiveProject(d_date_sk=[$0])
+                                  HiveFilter(condition=[AND(=($6, 2000), =($8, 12), IS NOT NULL($0))])
+                                    HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(channel=[_UTF-16LE'store'], item=[$0], return_ratio=[$1], return_rank=[$2], currency_rank=[$3])
             HiveFilter(condition=[OR(<=($2, 10), <=($3, 10))])
               HiveProject(item=[$0], return_ratio=[/(CAST($1):DECIMAL(15, 4), CAST($2):DECIMAL(15, 4))], rank_window_0=[rank() OVER (PARTITION BY 0 ORDER BY /(CAST($1):DECIMAL(15, 4), CAST($2):DECIMAL(15, 4)) NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)], rank_window_1=[rank() OVER (PARTITION BY 0 ORDER BY /(CAST($3):DECIMAL(15, 4), CAST($4):DECIMAL(15, 4)) NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
-                HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4])
-                  HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)], agg#2=[sum($3)], agg#3=[sum($4)])
-                    HiveProject($f0=[$5], $f1=[CASE(IS NOT NULL($2), $2, 0)], $f2=[CASE(IS NOT NULL($7), $7, 0)], $f3=[CASE(IS NOT NULL($3), $3, 0)], $f4=[CASE(IS NOT NULL($8), $8, 0)])
-                      HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[inner], algorithm=[none], cost=[not available])
-                        HiveProject(sr_item_sk=[$2], sr_ticket_number=[$9], sr_return_quantity=[$10], sr_return_amt=[$11])
-                          HiveFilter(condition=[AND(>($11, 10000), IS NOT NULL($9), IS NOT NULL($2))])
-                            HiveTableScan(table=[[default, store_returns]], table:alias=[sr])
-                        HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-                          HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ticket_number=[$9], ss_quantity=[$10], ss_net_paid=[$20], ss_net_profit=[$22])
-                            HiveFilter(condition=[AND(>($22, 1), >($20, 0), >($10, 0), IS NOT NULL($9), IS NOT NULL($2), IS NOT NULL($0))])
-                              HiveTableScan(table=[[default, store_sales]], table:alias=[sts])
-                          HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(12):INTEGER])
-                            HiveFilter(condition=[AND(=($6, 2000), =($8, 12), IS NOT NULL($0))])
-                              HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+                HiveProject(ss_item_sk=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4])
+                  HiveAggregate(group=[{5}], agg#0=[sum($2)], agg#1=[sum($7)], agg#2=[sum($3)], agg#3=[sum($8)])
+                    HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveProject(sr_item_sk=[$2], sr_ticket_number=[$9], CASE=[CASE(IS NOT NULL($10), $10, 0)], CASE3=[CASE(IS NOT NULL($11), $11, 0)])
+                        HiveFilter(condition=[AND(>($11, 10000), IS NOT NULL($9), IS NOT NULL($2))])
+                          HiveTableScan(table=[[default, store_returns]], table:alias=[sr])
+                      HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ticket_number=[$9], CASE=[CASE(IS NOT NULL($10), $10, 0)], CASE4=[CASE(IS NOT NULL($20), $20, 0)])
+                          HiveFilter(condition=[AND(>($22, 1), >($20, 0), >($10, 0), IS NOT NULL($9), IS NOT NULL($2), IS NOT NULL($0))])
+                            HiveTableScan(table=[[default, store_sales]], table:alias=[sts])
+                        HiveProject(d_date_sk=[$0])
+                          HiveFilter(condition=[AND(=($6, 2000), =($8, 12), IS NOT NULL($0))])
+                            HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query5.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query5.q.out
index a82f011..e78c3e5 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query5.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query5.q.out
@@ -281,8 +281,8 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
       HiveProject(channel=[$0], id=[$1], sales=[$2], returns=[$3], profit=[$4])
         HiveUnion(all=[true])
           HiveProject(channel=[_UTF-16LE'store channel'], id=[||(_UTF-16LE'store', $0)], sales=[$1], returns=[$3], profit=[-($2, $4)])
-            HiveAggregate(group=[{9}], agg#0=[sum($2)], agg#1=[sum($3)], agg#2=[sum($4)], agg#3=[sum($5)])
-              HiveJoin(condition=[=($0, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{8}], agg#0=[sum($2)], agg#1=[sum($3)], agg#2=[sum($4)], agg#3=[sum($5)])
+              HiveJoin(condition=[=($0, $7)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(store_sk=[$0], date_sk=[$1], sales_price=[$2], profit=[$3], return_amt=[$4], net_loss=[$5])
                     HiveUnion(all=[true])
@@ -292,7 +292,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                       HiveProject(store_sk=[$7], date_sk=[$0], sales_price=[CAST(0):DECIMAL(7, 2)], profit=[CAST(0):DECIMAL(7, 2)], return_amt=[$11], net_loss=[$19])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                           HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                  HiveProject(d_date_sk=[$0], d_date=[$2])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-08-18 00:00:00), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject(s_store_sk=[$0], s_store_id=[$1])
@@ -313,12 +313,12 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                       HiveProject(page_sk=[$12], date_sk=[$0], sales_price=[CAST(0):DECIMAL(7, 2)], profit=[CAST(0):DECIMAL(7, 2)], return_amt=[$18], net_loss=[$26])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($12))])
                           HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
-                  HiveProject(d_date_sk=[$0], d_date=[$2])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-08-18 00:00:00), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(channel=[_UTF-16LE'web channel'], id=[||(_UTF-16LE'web_site', $0)], sales=[$1], returns=[$3], profit=[-($2, $4)])
-            HiveAggregate(group=[{9}], agg#0=[sum($2)], agg#1=[sum($3)], agg#2=[sum($4)], agg#3=[sum($5)])
-              HiveJoin(condition=[=($0, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{8}], agg#0=[sum($2)], agg#1=[sum($3)], agg#2=[sum($4)], agg#3=[sum($5)])
+              HiveJoin(condition=[=($0, $7)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(wsr_web_site_sk=[$0], date_sk=[$1], sales_price=[$2], profit=[$3], return_amt=[$4], net_loss=[$5])
                     HiveUnion(all=[true])
@@ -333,7 +333,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                           HiveProject(wr_returned_date_sk=[$0], wr_item_sk=[$2], wr_order_number=[$13], wr_return_amt=[$15], wr_net_loss=[$23])
                             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2), IS NOT NULL($13))])
                               HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
-                  HiveProject(d_date_sk=[$0], d_date=[$2])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-08-18 00:00:00), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject(web_site_sk=[$0], web_site_id=[$1])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query50.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query50.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query50.q.out
index 2be59c1..becffde 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query50.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query50.q.out
@@ -128,9 +128,9 @@ CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], sort5=[$5], sort6=[$6], sort7=[$7], sort8=[$8], sort9=[$9], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], dir4=[ASC], dir5=[ASC], dir6=[ASC], dir7=[ASC], dir8=[ASC], dir9=[ASC], fetch=[100])
   HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7], $f8=[$8], $f9=[$9], $f10=[$10], $f11=[$11], $f12=[$12], $f13=[$13], $f14=[$14])
     HiveAggregate(group=[{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}], agg#0=[sum($10)], agg#1=[sum($11)], agg#2=[sum($12)], agg#3=[sum($13)], agg#4=[sum($14)])
-      HiveProject($f0=[$14], $f1=[$15], $f2=[$16], $f3=[$17], $f4=[$18], $f5=[$19], $f6=[$20], $f7=[$21], $f8=[$22], $f9=[$23], $f10=[CASE(<=(-($5, $0), 30), 1, 0)], $f11=[CASE(AND(>(-($5, $0), 30), <=(-($5, $0), 60)), 1, 0)], $f12=[CASE(AND(>(-($5, $0), 60), <=(-($5, $0), 90)), 1, 0)], $f13=[CASE(AND(>(-($5, $0), 90), <=(-($5, $0), 120)), 1, 0)], $f14=[CASE(>(-($5, $0), 120), 1, 0)])
-        HiveJoin(condition=[=($3, $13)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveJoin(condition=[=($0, $12)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveProject($f0=[$12], $f1=[$13], $f2=[$14], $f3=[$15], $f4=[$16], $f5=[$17], $f6=[$18], $f7=[$19], $f8=[$20], $f9=[$21], $f10=[CASE(<=(-($5, $0), 30), 1, 0)], $f11=[CASE(AND(>(-($5, $0), 30), <=(-($5, $0), 60)), 1, 0)], $f12=[CASE(AND(>(-($5, $0), 60), <=(-($5, $0), 90)), 1, 0)], $f13=[CASE(AND(>(-($5, $0), 90), <=(-($5, $0), 120)), 1, 0)], $f14=[CASE(>(-($5, $0), 120), 1, 0)])
+        HiveJoin(condition=[=($3, $11)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($0, $10)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[AND(AND(=($4, $8), =($1, $6)), =($2, $7))], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_store_sk=[$7], ss_ticket_number=[$9])
                 HiveFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($2), IS NOT NULL($3), IS NOT NULL($7), IS NOT NULL($0))])
@@ -139,7 +139,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], sort5=
                 HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$2], sr_customer_sk=[$3], sr_ticket_number=[$9])
                   HiveFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($2), IS NOT NULL($3), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(9):INTEGER])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(=($6, 2000), =($8, 9), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[d2])
             HiveProject(d_date_sk=[$0])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query51.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query51.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query51.q.out
index fed8677..79c5f99 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query51.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query51.q.out
@@ -108,7 +108,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                     HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_sales_price=[$13])
                       HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(d_date_sk=[$0], d_date=[$2], d_month_seq=[$3])
+                    HiveProject(d_date_sk=[$0], d_date=[$2])
                       HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject((tok_table_or_col ws_item_sk)=[$0], (tok_table_or_col d_date)=[$1], sum_window_0=[$2])
@@ -119,7 +119,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                     HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_sales_price=[$21])
                       HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                    HiveProject(d_date_sk=[$0], d_date=[$2], d_month_seq=[$3])
+                    HiveProject(d_date_sk=[$0], d_date=[$2])
                       HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query52.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query52.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query52.q.out
index 627b8b0..27cb4eb 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query52.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query52.q.out
@@ -52,16 +52,16 @@ CBO PLAN:
 HiveProject(d_year=[CAST(1998):INTEGER], brand_id=[$0], brand=[$1], ext_price=[$2])
   HiveSortLimit(sort0=[$2], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC], fetch=[100])
     HiveProject(i_brand_id=[$0], i_brand=[$1], $f2=[$2])
-      HiveAggregate(group=[{7, 8}], agg#0=[sum($2)])
-        HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveAggregate(group=[{5, 6}], agg#0=[sum($2)])
+        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ext_sales_price=[$15])
               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2))])
                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-            HiveProject(d_date_sk=[$0], d_year=[CAST(1998):INTEGER], d_moy=[CAST(12):INTEGER])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(=($8, 12), =($6, 1998), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[dt])
-          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8], i_manager_id=[CAST(1):INTEGER])
+          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8])
             HiveFilter(condition=[AND(=($20, 1), IS NOT NULL($0))])
               HiveTableScan(table=[[default, item]], table:alias=[item])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query53.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query53.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query53.q.out
index 56b1ba2..9b42428 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query53.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query53.q.out
@@ -68,20 +68,20 @@ HiveSortLimit(sort0=[$2], sort1=[$1], sort2=[$0], dir0=[ASC], dir1=[ASC], dir2=[
     HiveFilter(condition=[CASE(>($2, 0), >(/(ABS(-($1, $2)), $2), 0.1), null)])
       HiveProject((tok_table_or_col i_manufact_id)=[$0], (tok_function sum (tok_table_or_col ss_sales_price))=[$2], avg_window_0=[avg($2) OVER (PARTITION BY $0 ORDER BY $0 NULLS FIRST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
         HiveProject(i_manufact_id=[$0], d_qoy=[$1], $f2=[$2])
-          HiveAggregate(group=[{9, 12}], agg#0=[sum($4)])
+          HiveAggregate(group=[{6, 8}], agg#0=[sum($4)])
             HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(s_store_sk=[$0])
                 HiveFilter(condition=[IS NOT NULL($0)])
                   HiveTableScan(table=[[default, store]], table:alias=[store])
-              HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_store_sk=[$7], ss_sales_price=[$13])
                     HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0), IS NOT NULL($7))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(i_item_sk=[$0], i_brand=[$8], i_class=[$10], i_category=[$12], i_manufact_id=[$13])
+                  HiveProject(i_item_sk=[$0], i_manufact_id=[$13])
                     HiveFilter(condition=[AND(IN($10, _UTF-16LE'personal', _UTF-16LE'portable', _UTF-16LE'reference', _UTF-16LE'self-help', _UTF-16LE'accessories', _UTF-16LE'classical', _UTF-16LE'fragrances', _UTF-16LE'pants'), IN($8, _UTF-16LE'scholaramalgamalg #14', _UTF-16LE'scholaramalgamalg #7', _UTF-16LE'exportiunivamalg #9', _UTF-16LE'scholaramalgamalg #9', _UTF-16LE'amalgimporto #1', _UTF-16LE'edu packscholar #1', _UTF-16LE'exportiimporto #1', _UTF-16LE'importoamalg #1'), IN($12, _UTF-16LE'Books', _UTF-16LE'Children', _UTF-16LE'Electronics', _UTF-16LE'Women', _UTF-16LE'Music', _UTF-16LE'Men'), OR(AND(IN($12, _UTF-16LE'Books', _UTF-16LE'Children', _UTF-16LE'Electronics'), IN($10, _UTF-16LE'personal', _UTF-16LE'portable', _UTF-16LE'reference', _UTF-16LE'self-help'), IN($8, _UTF-16LE'scholaramalgamalg #14', _UTF-16LE'scholaramalgamalg #7', _UTF-16LE'exportiunivamalg #9', _UTF-16LE'scholaramalgamalg #9')), AND(IN($12, _UTF-16LE'Women', _UTF-16LE'Music', _UTF-16LE'Men'), IN($10, 
 _UTF-16LE'accessories', _UTF-16LE'classical', _UTF-16LE'fragrances', _UTF-16LE'pants'), IN($8, _UTF-16LE'amalgimporto #1', _UTF-16LE'edu packscholar #1', _UTF-16LE'exportiimporto #1', _UTF-16LE'importoamalg #1'))), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(d_date_sk=[$0], d_month_seq=[$3], d_qoy=[$10])
+                HiveProject(d_date_sk=[$0], d_qoy=[$10])
                   HiveFilter(condition=[AND(IN($3, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query54.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query54.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query54.q.out
index eaf2536..6d3d037 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query54.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query54.q.out
@@ -165,7 +165,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                                   HiveProject(c_customer_sk=[$0], c_current_addr_sk=[$4])
                                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                                       HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                                  HiveJoin(condition=[=($2, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+                                  HiveJoin(condition=[=($2, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                                     HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                       HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$1], cs_item_sk=[$2])
                                         HiveUnion(all=[true])
@@ -175,10 +175,10 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                                           HiveProject(sold_date_sk=[$0], customer_sk=[$4], item_sk=[$3])
                                             HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0), IS NOT NULL($4))])
                                               HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(3):INTEGER])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(=($8, 3), =($6, 1999), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                                    HiveProject(i_item_sk=[$0], i_class=[CAST(_UTF-16LE'consignment'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], i_category=[CAST(_UTF-16LE'Jewelry'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                                    HiveProject(i_item_sk=[$0])
                                       HiveFilter(condition=[AND(=($12, _UTF-16LE'Jewelry'), =($10, _UTF-16LE'consignment'), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, item]], table:alias=[item])
                       HiveProject(cnt=[$0])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query55.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query55.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query55.q.out
index 4182de0..24c93f6 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query55.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query55.q.out
@@ -36,16 +36,16 @@ CBO PLAN:
 HiveProject(brand_id=[$0], brand=[$1], ext_price=[$2])
   HiveSortLimit(sort0=[$2], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC], fetch=[100])
     HiveProject(brand_id=[$0], brand=[$1], ext_price=[$2], (tok_table_or_col i_brand_id)=[$0])
-      HiveAggregate(group=[{7, 8}], agg#0=[sum($2)])
-        HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveAggregate(group=[{5, 6}], agg#0=[sum($2)])
+        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ext_sales_price=[$15])
               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2))])
                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-            HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER], d_moy=[CAST(12):INTEGER])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(=($8, 12), =($6, 2001), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8], i_manager_id=[CAST(36):INTEGER])
+          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8])
             HiveFilter(condition=[AND(=($20, 36), IS NOT NULL($0))])
               HiveTableScan(table=[[default, item]], table:alias=[item])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query56.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query56.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query56.q.out
index 579d06a..d01dbcd 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query56.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query56.q.out
@@ -153,8 +153,8 @@ HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
       HiveProject(i_item_id=[$0], $f1=[$1])
         HiveUnion(all=[true])
           HiveProject(i_item_id=[$0], $f1=[$1])
-            HiveAggregate(group=[{1}], agg#0=[sum($8)])
-              HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{1}], agg#0=[sum($7)])
+              HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(i_item_sk=[$0], i_item_id=[$1])
                     HiveFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($0))])
@@ -163,21 +163,21 @@ HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
                     HiveAggregate(group=[{1}])
                       HiveFilter(condition=[AND(IN($17, _UTF-16LE'orchid', _UTF-16LE'chiffon', _UTF-16LE'lace'), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ca_address_sk=[$0], ca_gmt_offset=[$1], ss_sold_date_sk=[$2], ss_item_sk=[$3], ss_addr_sk=[$4], ss_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8])
-                  HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-8):DECIMAL(5, 2)])
+                HiveProject(ca_address_sk=[$0], ss_sold_date_sk=[$1], ss_item_sk=[$2], ss_addr_sk=[$3], ss_ext_sales_price=[$4], d_date_sk=[$5])
+                  HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ca_address_sk=[$0])
                       HiveFilter(condition=[AND(=($11, -8), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_addr_sk=[$6], ss_ext_sales_price=[$15])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6), IS NOT NULL($2))])
                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(1):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 2000), =($8, 1), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(i_item_id=[$0], $f1=[$1])
-            HiveAggregate(group=[{1}], agg#0=[sum($8)])
-              HiveJoin(condition=[=($7, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{1}], agg#0=[sum($7)])
+              HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(i_item_sk=[$0], i_item_id=[$1])
                     HiveFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($0))])
@@ -186,21 +186,21 @@ HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
                     HiveAggregate(group=[{1}])
                       HiveFilter(condition=[AND(IN($17, _UTF-16LE'orchid', _UTF-16LE'chiffon', _UTF-16LE'lace'), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ca_address_sk=[$0], ca_gmt_offset=[$1], cs_sold_date_sk=[$2], cs_bill_addr_sk=[$3], cs_item_sk=[$4], cs_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8])
-                  HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-8):DECIMAL(5, 2)])
+                HiveProject(ca_address_sk=[$0], cs_sold_date_sk=[$1], cs_bill_addr_sk=[$2], cs_item_sk=[$3], cs_ext_sales_price=[$4], d_date_sk=[$5])
+                  HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ca_address_sk=[$0])
                       HiveFilter(condition=[AND(=($11, -8), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(cs_sold_date_sk=[$0], cs_bill_addr_sk=[$6], cs_item_sk=[$15], cs_ext_sales_price=[$23])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6), IS NOT NULL($15))])
                           HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(1):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 2000), =($8, 1), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(i_item_id=[$0], $f1=[$1])
-            HiveAggregate(group=[{1}], agg#0=[sum($8)])
-              HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{1}], agg#0=[sum($7)])
+              HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(i_item_sk=[$0], i_item_id=[$1])
                     HiveFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($0))])
@@ -209,16 +209,16 @@ HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
                     HiveAggregate(group=[{1}])
                       HiveFilter(condition=[AND(IN($17, _UTF-16LE'orchid', _UTF-16LE'chiffon', _UTF-16LE'lace'), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ca_address_sk=[$0], ca_gmt_offset=[$1], ws_sold_date_sk=[$2], ws_item_sk=[$3], ws_bill_addr_sk=[$4], ws_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8])
-                  HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-8):DECIMAL(5, 2)])
+                HiveProject(ca_address_sk=[$0], ws_sold_date_sk=[$1], ws_item_sk=[$2], ws_bill_addr_sk=[$3], ws_ext_sales_price=[$4], d_date_sk=[$5])
+                  HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ca_address_sk=[$0])
                       HiveFilter(condition=[AND(=($11, -8), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_bill_addr_sk=[$7], ws_ext_sales_price=[$23])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($3))])
                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(1):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 2000), =($8, 1), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query57.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query57.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query57.q.out
index e0480e4..6c8ef17 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query57.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query57.q.out
@@ -106,8 +106,8 @@ CBO PLAN:
 HiveProject(i_category=[$0], i_brand=[$1], d_year=[$2], d_moy=[$3], avg_monthly_sales=[$4], sum_sales=[$5], psum=[$6], nsum=[$7])
   HiveSortLimit(sort0=[$8], sort1=[$2], dir0=[ASC], dir1=[ASC], fetch=[100])
     HiveProject(i_category=[$10], i_brand=[$11], d_year=[$13], d_moy=[$14], avg_monthly_sales=[$16], sum_sales=[$15], psum=[$8], nsum=[$3], (- (tok_table_or_col sum_sales) (tok_table_or_col avg_monthly_sales))=[-($15, $16)])
-      HiveJoin(condition=[AND(AND(AND(=($10, $0), =($11, $1)), =($12, $2)), =($17, -($4, 1)))], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveProject((tok_table_or_col i_category)=[$0], (tok_table_or_col i_brand)=[$1], (tok_table_or_col cc_name)=[$2], (tok_function sum (tok_table_or_col cs_sales_price))=[$3], rank_window_1=[$4])
+      HiveJoin(condition=[AND(AND(AND(=($10, $0), =($11, $1)), =($12, $2)), =($17, $4))], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject((tok_table_or_col i_category)=[$0], (tok_table_or_col i_brand)=[$1], (tok_table_or_col cc_name)=[$2], (tok_function sum (tok_table_or_col cs_sales_price))=[$3], -=[-($4, 1)])
           HiveFilter(condition=[IS NOT NULL($4)])
             HiveProject((tok_table_or_col i_category)=[$1], (tok_table_or_col i_brand)=[$0], (tok_table_or_col cc_name)=[$4], (tok_function sum (tok_table_or_col cs_sales_price))=[$5], rank_window_1=[rank() OVER (PARTITION BY $1, $0, $4 ORDER BY $2 NULLS LAST, $3 NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
               HiveProject(i_brand=[$0], i_category=[$1], d_year=[$2], d_moy=[$3], cc_name=[$4], $f5=[$5])
@@ -127,8 +127,8 @@ HiveProject(i_category=[$0], i_brand=[$1], d_year=[$2], d_moy=[$3], avg_monthly_
                       HiveProject(cc_call_center_sk=[$0], cc_name=[$6])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6))])
                           HiveTableScan(table=[[default, call_center]], table:alias=[call_center])
-        HiveJoin(condition=[AND(AND(AND(=($5, $0), =($6, $1)), =($7, $2)), =($12, +($4, 1)))], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveProject((tok_table_or_col i_category)=[$0], (tok_table_or_col i_brand)=[$1], (tok_table_or_col cc_name)=[$2], (tok_function sum (tok_table_or_col cs_sales_price))=[$3], rank_window_1=[$4])
+        HiveJoin(condition=[AND(AND(AND(=($5, $0), =($6, $1)), =($7, $2)), =($12, $4))], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveProject((tok_table_or_col i_category)=[$0], (tok_table_or_col i_brand)=[$1], (tok_table_or_col cc_name)=[$2], (tok_function sum (tok_table_or_col cs_sales_price))=[$3], +=[+($4, 1)])
             HiveFilter(condition=[IS NOT NULL($4)])
               HiveProject((tok_table_or_col i_category)=[$1], (tok_table_or_col i_brand)=[$0], (tok_table_or_col cc_name)=[$4], (tok_function sum (tok_table_or_col cs_sales_price))=[$5], rank_window_1=[rank() OVER (PARTITION BY $1, $0, $4 ORDER BY $2 NULLS LAST, $3 NULLS LAST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
                 HiveProject(i_brand=[$0], i_category=[$1], d_year=[$2], d_moy=[$3], cc_name=[$4], $f5=[$5])


[09/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query64.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query64.q.out b/ql/src/test/results/clientpositive/perf/tez/query64.q.out
index f670c4f..7c77e9f 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query64.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query64.q.out
@@ -265,9 +265,9 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Map 37 <- Reducer 24 (BROADCAST_EDGE), Reducer 40 (BROADCAST_EDGE), Reducer 47 (BROADCAST_EDGE)
-Map 44 <- Reducer 40 (BROADCAST_EDGE)
-Map 55 <- Reducer 12 (BROADCAST_EDGE), Reducer 32 (BROADCAST_EDGE), Reducer 42 (BROADCAST_EDGE), Reducer 51 (BROADCAST_EDGE)
+Map 37 <- Reducer 24 (BROADCAST_EDGE), Reducer 40 (BROADCAST_EDGE), Reducer 46 (BROADCAST_EDGE)
+Map 43 <- Reducer 40 (BROADCAST_EDGE)
+Map 55 <- Reducer 12 (BROADCAST_EDGE), Reducer 32 (BROADCAST_EDGE), Reducer 42 (BROADCAST_EDGE), Reducer 50 (BROADCAST_EDGE)
 Map 56 <- Reducer 42 (BROADCAST_EDGE)
 Reducer 10 <- Reducer 15 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
 Reducer 11 <- Reducer 10 (SIMPLE_EDGE)
@@ -276,18 +276,18 @@ Reducer 13 <- Reducer 31 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE)
 Reducer 14 <- Map 54 (SIMPLE_EDGE), Reducer 13 (SIMPLE_EDGE)
 Reducer 15 <- Reducer 14 (SIMPLE_EDGE)
 Reducer 17 <- Map 16 (SIMPLE_EDGE), Reducer 38 (SIMPLE_EDGE)
-Reducer 18 <- Map 43 (SIMPLE_EDGE), Reducer 17 (SIMPLE_EDGE)
-Reducer 19 <- Reducer 18 (SIMPLE_EDGE), Reducer 34 (SIMPLE_EDGE)
+Reducer 18 <- Reducer 17 (SIMPLE_EDGE), Reducer 45 (ONE_TO_ONE_EDGE)
+Reducer 19 <- Map 51 (SIMPLE_EDGE), Reducer 18 (SIMPLE_EDGE)
 Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 16 (SIMPLE_EDGE)
-Reducer 20 <- Reducer 19 (SIMPLE_EDGE), Reducer 46 (ONE_TO_ONE_EDGE)
+Reducer 20 <- Reducer 19 (SIMPLE_EDGE), Reducer 34 (SIMPLE_EDGE)
 Reducer 21 <- Map 52 (SIMPLE_EDGE), Reducer 20 (SIMPLE_EDGE)
 Reducer 22 <- Map 36 (SIMPLE_EDGE), Reducer 21 (SIMPLE_EDGE)
 Reducer 23 <- Map 53 (SIMPLE_EDGE), Reducer 22 (SIMPLE_EDGE)
 Reducer 24 <- Map 16 (CUSTOM_SIMPLE_EDGE)
 Reducer 25 <- Map 16 (SIMPLE_EDGE), Reducer 41 (SIMPLE_EDGE)
-Reducer 26 <- Map 43 (SIMPLE_EDGE), Reducer 25 (SIMPLE_EDGE)
-Reducer 27 <- Reducer 26 (SIMPLE_EDGE), Reducer 34 (SIMPLE_EDGE)
-Reducer 28 <- Reducer 27 (SIMPLE_EDGE), Reducer 50 (ONE_TO_ONE_EDGE)
+Reducer 26 <- Reducer 25 (SIMPLE_EDGE), Reducer 49 (ONE_TO_ONE_EDGE)
+Reducer 27 <- Map 51 (SIMPLE_EDGE), Reducer 26 (SIMPLE_EDGE)
+Reducer 28 <- Reducer 27 (SIMPLE_EDGE), Reducer 34 (SIMPLE_EDGE)
 Reducer 29 <- Map 52 (SIMPLE_EDGE), Reducer 28 (SIMPLE_EDGE)
 Reducer 3 <- Map 16 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
 Reducer 30 <- Map 36 (SIMPLE_EDGE), Reducer 29 (SIMPLE_EDGE)
@@ -299,13 +299,13 @@ Reducer 4 <- Reducer 3 (SIMPLE_EDGE), Reducer 34 (SIMPLE_EDGE)
 Reducer 40 <- Map 39 (CUSTOM_SIMPLE_EDGE)
 Reducer 41 <- Map 39 (SIMPLE_EDGE), Map 55 (SIMPLE_EDGE)
 Reducer 42 <- Map 39 (CUSTOM_SIMPLE_EDGE)
-Reducer 45 <- Map 44 (SIMPLE_EDGE), Map 48 (SIMPLE_EDGE)
-Reducer 46 <- Reducer 45 (SIMPLE_EDGE)
-Reducer 47 <- Reducer 46 (CUSTOM_SIMPLE_EDGE)
-Reducer 49 <- Map 48 (SIMPLE_EDGE), Map 56 (SIMPLE_EDGE)
+Reducer 44 <- Map 43 (SIMPLE_EDGE), Map 47 (SIMPLE_EDGE)
+Reducer 45 <- Reducer 44 (SIMPLE_EDGE)
+Reducer 46 <- Reducer 45 (CUSTOM_SIMPLE_EDGE)
+Reducer 48 <- Map 47 (SIMPLE_EDGE), Map 56 (SIMPLE_EDGE)
+Reducer 49 <- Reducer 48 (SIMPLE_EDGE)
 Reducer 5 <- Map 36 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
-Reducer 50 <- Reducer 49 (SIMPLE_EDGE)
-Reducer 51 <- Reducer 50 (CUSTOM_SIMPLE_EDGE)
+Reducer 50 <- Reducer 49 (CUSTOM_SIMPLE_EDGE)
 Reducer 6 <- Map 54 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
 Reducer 7 <- Reducer 23 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE)
 Reducer 8 <- Map 54 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE)
@@ -320,10 +320,10 @@ Stage-0
         Select Operator [SEL_1200] (rows=2169965329 width=1702)
           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col20"]
         <-Reducer 10 [SIMPLE_EDGE]
-          SHUFFLE [RS_259]
-            Select Operator [SEL_258] (rows=2169965329 width=1694)
+          SHUFFLE [RS_257]
+            Select Operator [SEL_256] (rows=2169965329 width=1694)
               Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18"]
-              Filter Operator [FIL_257] (rows=2169965329 width=1694)
+              Filter Operator [FIL_255] (rows=2169965329 width=1694)
                 predicate:(_col19 <= _col12)
                 Merge Join Operator [MERGEJOIN_1087] (rows=6509895988 width=1694)
                   Conds:RS_1171._col2, _col1, _col3=RS_1199._col1, _col0, _col2(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col19","_col20","_col21","_col22"]
@@ -335,16 +335,16 @@ Stage-0
                       Group By Operator [GBY_1169] (rows=2299138 width=1362)
                         Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17"],aggregations:["count(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6, KEY._col7, KEY._col8, KEY._col9, KEY._col10, KEY._col11, KEY._col12, KEY._col13
                       <-Reducer 8 [SIMPLE_EDGE]
-                        SHUFFLE [RS_124]
+                        SHUFFLE [RS_123]
                           PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
-                          Group By Operator [GBY_123] (rows=2299138 width=1362)
-                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17"],aggregations:["count()","sum(_col43)","sum(_col44)","sum(_col45)"],keys:_col28, _col46, _col29, _col7, _col9, _col14, _col15, _col16, _col17, _col23, _col24, _col25, _col26, _col49
-                            Select Operator [SEL_122] (rows=2331650 width=1292)
-                              Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col23","_col24","_col25","_col26","_col28","_col29","_col43","_col44","_col45","_col46","_col49"]
-                              Filter Operator [FIL_121] (rows=2331650 width=1292)
-                                predicate:(_col56 <> _col19)
+                          Group By Operator [GBY_122] (rows=2299138 width=1362)
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17"],aggregations:["count()","sum(_col43)","sum(_col44)","sum(_col45)"],keys:_col28, _col46, _col29, _col7, _col9, _col14, _col15, _col16, _col17, _col23, _col24, _col25, _col26, _col47
+                            Select Operator [SEL_121] (rows=2331650 width=1292)
+                              Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col23","_col24","_col25","_col26","_col28","_col29","_col43","_col44","_col45","_col46","_col47"]
+                              Filter Operator [FIL_120] (rows=2331650 width=1292)
+                                predicate:(_col51 <> _col19)
                                 Merge Join Operator [MERGEJOIN_1068] (rows=2331650 width=1292)
-                                  Conds:RS_118._col37=RS_1120._col0(Inner),Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col19","_col23","_col24","_col25","_col26","_col28","_col29","_col43","_col44","_col45","_col46","_col49","_col56"]
+                                  Conds:RS_117._col37=RS_1120._col0(Inner),Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col19","_col23","_col24","_col25","_col26","_col28","_col29","_col43","_col44","_col45","_col46","_col47","_col51"]
                                 <-Map 54 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_1120]
                                     PartitionCols:_col0
@@ -352,27 +352,27 @@ Stage-0
                                       Output:["_col0","_col1"]
                                       Filter Operator [FIL_1118] (rows=1861800 width=89)
                                         predicate:cd_demo_sk is not null
-                                        TableScan [TS_97] (rows=1861800 width=89)
+                                        TableScan [TS_96] (rows=1861800 width=89)
                                           default@customer_demographics,cd1,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_marital_status"]
                                 <-Reducer 7 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_118]
+                                  SHUFFLE [RS_117]
                                     PartitionCols:_col37
                                     Merge Join Operator [MERGEJOIN_1067] (rows=2299138 width=1205)
-                                      Conds:RS_115._col0=RS_116._col16(Inner),Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col19","_col23","_col24","_col25","_col26","_col28","_col29","_col37","_col43","_col44","_col45","_col46","_col49"]
+                                      Conds:RS_114._col0=RS_115._col16(Inner),Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col19","_col23","_col24","_col25","_col26","_col28","_col29","_col37","_col43","_col44","_col45","_col46","_col47"]
                                     <-Reducer 6 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_115]
+                                      SHUFFLE [RS_114]
                                         PartitionCols:_col0
                                         Merge Join Operator [MERGEJOIN_1056] (rows=70357394 width=458)
-                                          Conds:RS_112._col1=RS_1121._col0(Inner),Output:["_col0","_col7","_col9","_col14","_col15","_col16","_col17","_col19"]
+                                          Conds:RS_111._col1=RS_1121._col0(Inner),Output:["_col0","_col7","_col9","_col14","_col15","_col16","_col17","_col19"]
                                         <-Map 54 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_1121]
                                             PartitionCols:_col0
                                              Please refer to the previous Select Operator [SEL_1119]
                                         <-Reducer 5 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_112]
+                                          SHUFFLE [RS_111]
                                             PartitionCols:_col1
                                             Merge Join Operator [MERGEJOIN_1055] (rows=69376329 width=376)
-                                              Conds:RS_109._col3=RS_1115._col0(Inner),Output:["_col0","_col1","_col7","_col9","_col14","_col15","_col16","_col17"]
+                                              Conds:RS_108._col3=RS_1115._col0(Inner),Output:["_col0","_col1","_col7","_col9","_col14","_col15","_col16","_col17"]
                                             <-Map 36 [SIMPLE_EDGE] vectorized
                                               SHUFFLE [RS_1115]
                                                 PartitionCols:_col0
@@ -383,12 +383,12 @@ Stage-0
                                                     TableScan [TS_19] (rows=40000000 width=365)
                                                       default@customer_address,ad2,Tbl:COMPLETE,Col:COMPLETE,Output:["ca_address_sk","ca_street_number","ca_street_name","ca_city","ca_zip"]
                                             <-Reducer 4 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_109]
+                                              SHUFFLE [RS_108]
                                                 PartitionCols:_col3
                                                 Merge Join Operator [MERGEJOIN_1054] (rows=69376329 width=19)
-                                                  Conds:RS_106._col2=RS_107._col0(Inner),Output:["_col0","_col1","_col3","_col7","_col9"]
+                                                  Conds:RS_105._col2=RS_106._col0(Inner),Output:["_col0","_col1","_col3","_col7","_col9"]
                                                 <-Reducer 34 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_107]
+                                                  SHUFFLE [RS_106]
                                                     PartitionCols:_col0
                                                     Merge Join Operator [MERGEJOIN_1053] (rows=7200 width=4)
                                                       Conds:RS_1109._col1=RS_1112._col0(Inner),Output:["_col0"]
@@ -411,10 +411,10 @@ Stage-0
                                                             TableScan [TS_12] (rows=20 width=4)
                                                               default@income_band,ib2,Tbl:COMPLETE,Col:COMPLETE,Output:["ib_income_band_sk"]
                                                 <-Reducer 3 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_106]
+                                                  SHUFFLE [RS_105]
                                                     PartitionCols:_col2
                                                     Merge Join Operator [MERGEJOIN_1052] (rows=69376329 width=23)
-                                                      Conds:RS_103._col4=RS_1098._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col7","_col9"]
+                                                      Conds:RS_102._col4=RS_1098._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col7","_col9"]
                                                     <-Map 16 [SIMPLE_EDGE] vectorized
                                                       PARTITION_ONLY_SHUFFLE [RS_1098]
                                                         PartitionCols:_col0
@@ -425,7 +425,7 @@ Stage-0
                                                             TableScan [TS_3] (rows=73049 width=8)
                                                               default@date_dim,d2,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
                                                     <-Reducer 2 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_103]
+                                                      SHUFFLE [RS_102]
                                                         PartitionCols:_col4
                                                         Merge Join Operator [MERGEJOIN_1051] (rows=69376329 width=23)
                                                           Conds:RS_1090._col5=RS_1097._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col7"]
@@ -443,12 +443,12 @@ Stage-0
                                                                 TableScan [TS_0] (rows=80000000 width=23)
                                                                   default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk","c_current_cdemo_sk","c_current_hdemo_sk","c_current_addr_sk","c_first_shipto_date_sk","c_first_sales_date_sk"]
                                     <-Reducer 23 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_116]
+                                      SHUFFLE [RS_115]
                                         PartitionCols:_col16
-                                        Select Operator [SEL_96] (rows=2651207 width=784)
-                                          Output:["_col3","_col4","_col5","_col6","_col8","_col9","_col16","_col17","_col23","_col24","_col25","_col26","_col29"]
+                                        Select Operator [SEL_95] (rows=2651207 width=784)
+                                          Output:["_col3","_col4","_col5","_col6","_col8","_col9","_col16","_col17","_col23","_col24","_col25","_col26","_col27"]
                                           Merge Join Operator [MERGEJOIN_1066] (rows=2651207 width=784)
-                                            Conds:RS_93._col5, _col12=RS_1167._col0, _col1(Inner),Output:["_col6","_col7","_col13","_col14","_col15","_col16","_col19","_col26","_col27","_col29","_col30","_col31","_col32"]
+                                            Conds:RS_92._col5, _col12=RS_1167._col0, _col1(Inner),Output:["_col6","_col7","_col13","_col14","_col15","_col16","_col17","_col21","_col22","_col24","_col25","_col26","_col27"]
                                           <-Map 53 [SIMPLE_EDGE] vectorized
                                             SHUFFLE [RS_1167]
                                               PartitionCols:_col0, _col1
@@ -456,22 +456,22 @@ Stage-0
                                                 Output:["_col0","_col1"]
                                                 Filter Operator [FIL_1165] (rows=57591150 width=8)
                                                   predicate:(sr_item_sk is not null and sr_ticket_number is not null)
-                                                  TableScan [TS_75] (rows=57591150 width=8)
+                                                  TableScan [TS_77] (rows=57591150 width=8)
                                                     default@store_returns,store_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_item_sk","sr_ticket_number"]
                                           <-Reducer 22 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_93]
+                                            SHUFFLE [RS_92]
                                               PartitionCols:_col5, _col12
                                               Merge Join Operator [MERGEJOIN_1065] (rows=1608052 width=657)
-                                                Conds:RS_90._col9=RS_1116._col0(Inner),Output:["_col5","_col6","_col7","_col12","_col13","_col14","_col15","_col16","_col19","_col26","_col27","_col29","_col30","_col31","_col32"]
+                                                Conds:RS_89._col9=RS_1116._col0(Inner),Output:["_col5","_col6","_col7","_col12","_col13","_col14","_col15","_col16","_col17","_col21","_col22","_col24","_col25","_col26","_col27"]
                                               <-Map 36 [SIMPLE_EDGE] vectorized
                                                 SHUFFLE [RS_1116]
                                                   PartitionCols:_col0
                                                    Please refer to the previous Select Operator [SEL_1114]
                                               <-Reducer 21 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_90]
+                                                SHUFFLE [RS_89]
                                                   PartitionCols:_col9
                                                   Merge Join Operator [MERGEJOIN_1064] (rows=1608052 width=296)
-                                                    Conds:RS_87._col10=RS_1163._col0(Inner),Output:["_col5","_col6","_col7","_col9","_col12","_col13","_col14","_col15","_col16","_col19","_col26","_col27"]
+                                                    Conds:RS_86._col10=RS_1163._col0(Inner),Output:["_col5","_col6","_col7","_col9","_col12","_col13","_col14","_col15","_col16","_col17","_col21","_col22"]
                                                   <-Map 52 [SIMPLE_EDGE] vectorized
                                                     SHUFFLE [RS_1163]
                                                       PartitionCols:_col0
@@ -479,108 +479,106 @@ Stage-0
                                                         Output:["_col0","_col1","_col2"]
                                                         Filter Operator [FIL_1161] (rows=1704 width=181)
                                                           predicate:(s_store_name is not null and s_store_sk is not null and s_zip is not null)
-                                                          TableScan [TS_69] (rows=1704 width=181)
+                                                          TableScan [TS_71] (rows=1704 width=181)
                                                             default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_name","s_zip"]
                                                   <-Reducer 20 [SIMPLE_EDGE]
-                                                    SHUFFLE [RS_87]
+                                                    SHUFFLE [RS_86]
                                                       PartitionCols:_col10
                                                       Merge Join Operator [MERGEJOIN_1063] (rows=1608052 width=119)
-                                                        Conds:RS_84._col5=RS_1148._col0(Inner),Output:["_col5","_col6","_col7","_col9","_col10","_col12","_col13","_col14","_col15","_col16","_col19"]
-                                                      <-Reducer 46 [ONE_TO_ONE_EDGE] vectorized
-                                                        PARTITION_ONLY_SHUFFLE [RS_1148]
+                                                        Conds:RS_83._col0=RS_84._col5(Inner),Output:["_col5","_col6","_col7","_col9","_col10","_col12","_col13","_col14","_col15","_col16","_col17"]
+                                                      <-Reducer 34 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_83]
                                                           PartitionCols:_col0
-                                                          Select Operator [SEL_1147] (rows=13257 width=228)
-                                                            Output:["_col0"]
-                                                            Filter Operator [FIL_1146] (rows=13257 width=228)
-                                                              predicate:(_col1 > (2 * _col2))
-                                                              Group By Operator [GBY_1145] (rows=39773 width=228)
-                                                                Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
-                                                              <-Reducer 45 [SIMPLE_EDGE]
-                                                                SHUFFLE [RS_65]
-                                                                  PartitionCols:_col0
-                                                                  Group By Operator [GBY_64] (rows=12806906 width=228)
-                                                                    Output:["_col0","_col1","_col2"],aggregations:["sum(_col1)","sum(_col2)"],keys:_col0
-                                                                    Select Operator [SEL_62] (rows=183085709 width=450)
-                                                                      Output:["_col0","_col1","_col2"]
-                                                                      Merge Join Operator [MERGEJOIN_1061] (rows=183085709 width=450)
-                                                                        Conds:RS_1140._col0, _col1=RS_1143._col0, _col1(Inner),Output:["_col0","_col2","_col5","_col6","_col7"]
-                                                                      <-Map 48 [SIMPLE_EDGE] vectorized
-                                                                        SHUFFLE [RS_1143]
-                                                                          PartitionCols:_col0, _col1
-                                                                          Select Operator [SEL_1142] (rows=28798881 width=337)
-                                                                            Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                                            Filter Operator [FIL_1141] (rows=28798881 width=337)
-                                                                              predicate:(cr_item_sk is not null and cr_order_number is not null)
-                                                                              TableScan [TS_56] (rows=28798881 width=337)
-                                                                                default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_item_sk","cr_order_number","cr_refunded_cash","cr_reversed_charge","cr_store_credit"]
-                                                                      <-Map 44 [SIMPLE_EDGE] vectorized
-                                                                        SHUFFLE [RS_1140]
-                                                                          PartitionCols:_col0, _col1
-                                                                          Select Operator [SEL_1139] (rows=287989836 width=119)
-                                                                            Output:["_col0","_col1","_col2"]
-                                                                            Filter Operator [FIL_1138] (rows=287989836 width=119)
-                                                                              predicate:((cs_item_sk BETWEEN DynamicValue(RS_44_item_i_item_sk_min) AND DynamicValue(RS_44_item_i_item_sk_max) and in_bloom_filter(cs_item_sk, DynamicValue(RS_44_item_i_item_sk_bloom_filter))) and cs_item_sk is not null and cs_order_number is not null)
-                                                                              TableScan [TS_53] (rows=287989836 width=119)
-                                                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_item_sk","cs_order_number","cs_ext_list_price"]
-                                                                              <-Reducer 40 [BROADCAST_EDGE] vectorized
-                                                                                BROADCAST [RS_1135]
-                                                                                  Group By Operator [GBY_1133] (rows=1 width=12)
-                                                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                                  <-Map 39 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                    PARTITION_ONLY_SHUFFLE [RS_1131]
-                                                                                      Group By Operator [GBY_1129] (rows=1 width=12)
-                                                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                        Select Operator [SEL_1126] (rows=518 width=4)
-                                                                                          Output:["_col0"]
-                                                                                          Select Operator [SEL_1124] (rows=518 width=312)
-                                                                                            Output:["_col0","_col3"]
-                                                                                            Filter Operator [FIL_1123] (rows=518 width=312)
-                                                                                              predicate:((i_color) IN ('maroon', 'burnished', 'dim', 'steel', 'navajo', 'chocolate') and i_current_price BETWEEN 35 AND 45 and i_current_price BETWEEN 36 AND 50 and i_item_sk is not null)
-                                                                                              TableScan [TS_34] (rows=462000 width=311)
-                                                                                                default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_current_price","i_color","i_product_name"]
+                                                           Please refer to the previous Merge Join Operator [MERGEJOIN_1053]
                                                       <-Reducer 19 [SIMPLE_EDGE]
                                                         SHUFFLE [RS_84]
                                                           PartitionCols:_col5
-                                                          Merge Join Operator [MERGEJOIN_1062] (rows=1608052 width=119)
-                                                            Conds:RS_81._col0=RS_82._col5(Inner),Output:["_col5","_col6","_col7","_col9","_col10","_col12","_col13","_col14","_col15","_col16","_col19"]
-                                                          <-Reducer 34 [SIMPLE_EDGE]
-                                                            SHUFFLE [RS_81]
-                                                              PartitionCols:_col0
-                                                               Please refer to the previous Merge Join Operator [MERGEJOIN_1053]
-                                                          <-Reducer 18 [SIMPLE_EDGE]
-                                                            SHUFFLE [RS_82]
-                                                              PartitionCols:_col5
-                                                              Select Operator [SEL_52] (rows=1608052 width=119)
-                                                                Output:["_col2","_col3","_col4","_col5","_col6","_col7","_col9","_col10","_col11","_col12","_col13","_col16"]
-                                                                Merge Join Operator [MERGEJOIN_1060] (rows=1608052 width=119)
-                                                                  Conds:RS_49._col7=RS_1159._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col8","_col9","_col10","_col11","_col12","_col15"]
-                                                                <-Map 43 [SIMPLE_EDGE] vectorized
-                                                                  SHUFFLE [RS_1159]
+                                                          Select Operator [SEL_70] (rows=1608052 width=119)
+                                                            Output:["_col2","_col3","_col4","_col5","_col6","_col7","_col9","_col10","_col11","_col12","_col13","_col14"]
+                                                            Merge Join Operator [MERGEJOIN_1062] (rows=1608052 width=119)
+                                                              Conds:RS_67._col7=RS_1159._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col8","_col9","_col10","_col11","_col12","_col13"]
+                                                            <-Map 51 [SIMPLE_EDGE] vectorized
+                                                              SHUFFLE [RS_1159]
+                                                                PartitionCols:_col0
+                                                                Select Operator [SEL_1158] (rows=2300 width=4)
+                                                                  Output:["_col0"]
+                                                                  Filter Operator [FIL_1157] (rows=2300 width=4)
+                                                                    predicate:p_promo_sk is not null
+                                                                    TableScan [TS_55] (rows=2300 width=4)
+                                                                      default@promotion,promotion,Tbl:COMPLETE,Col:COMPLETE,Output:["p_promo_sk"]
+                                                            <-Reducer 18 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_67]
+                                                                PartitionCols:_col7
+                                                                Merge Join Operator [MERGEJOIN_1061] (rows=1608052 width=119)
+                                                                  Conds:RS_64._col1=RS_1148._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
+                                                                <-Reducer 45 [ONE_TO_ONE_EDGE] vectorized
+                                                                  PARTITION_ONLY_SHUFFLE [RS_1148]
                                                                     PartitionCols:_col0
-                                                                    Select Operator [SEL_1158] (rows=2300 width=4)
+                                                                    Select Operator [SEL_1147] (rows=13257 width=4)
                                                                       Output:["_col0"]
-                                                                      Filter Operator [FIL_1157] (rows=2300 width=4)
-                                                                        predicate:p_promo_sk is not null
-                                                                        TableScan [TS_40] (rows=2300 width=4)
-                                                                          default@promotion,promotion,Tbl:COMPLETE,Col:COMPLETE,Output:["p_promo_sk"]
+                                                                      Filter Operator [FIL_1146] (rows=13257 width=228)
+                                                                        predicate:(_col1 > (2 * _col2))
+                                                                        Group By Operator [GBY_1145] (rows=39773 width=228)
+                                                                          Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
+                                                                        <-Reducer 44 [SIMPLE_EDGE]
+                                                                          SHUFFLE [RS_51]
+                                                                            PartitionCols:_col0
+                                                                            Group By Operator [GBY_50] (rows=6482999 width=228)
+                                                                              Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col5)"],keys:_col0
+                                                                              Merge Join Operator [MERGEJOIN_1060] (rows=183085709 width=227)
+                                                                                Conds:RS_1140._col0, _col1=RS_1143._col0, _col1(Inner),Output:["_col0","_col2","_col5"]
+                                                                              <-Map 47 [SIMPLE_EDGE] vectorized
+                                                                                SHUFFLE [RS_1143]
+                                                                                  PartitionCols:_col0, _col1
+                                                                                  Select Operator [SEL_1142] (rows=28798881 width=120)
+                                                                                    Output:["_col0","_col1","_col2"]
+                                                                                    Filter Operator [FIL_1141] (rows=28798881 width=337)
+                                                                                      predicate:(cr_item_sk is not null and cr_order_number is not null)
+                                                                                      TableScan [TS_43] (rows=28798881 width=337)
+                                                                                        default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_item_sk","cr_order_number","cr_refunded_cash","cr_reversed_charge","cr_store_credit"]
+                                                                              <-Map 43 [SIMPLE_EDGE] vectorized
+                                                                                SHUFFLE [RS_1140]
+                                                                                  PartitionCols:_col0, _col1
+                                                                                  Select Operator [SEL_1139] (rows=287989836 width=119)
+                                                                                    Output:["_col0","_col1","_col2"]
+                                                                                    Filter Operator [FIL_1138] (rows=287989836 width=119)
+                                                                                      predicate:((cs_item_sk BETWEEN DynamicValue(RS_59_item_i_item_sk_min) AND DynamicValue(RS_59_item_i_item_sk_max) and in_bloom_filter(cs_item_sk, DynamicValue(RS_59_item_i_item_sk_bloom_filter))) and cs_item_sk is not null and cs_order_number is not null)
+                                                                                      TableScan [TS_40] (rows=287989836 width=119)
+                                                                                        default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_item_sk","cs_order_number","cs_ext_list_price"]
+                                                                                      <-Reducer 40 [BROADCAST_EDGE] vectorized
+                                                                                        BROADCAST [RS_1135]
+                                                                                          Group By Operator [GBY_1133] (rows=1 width=12)
+                                                                                            Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                                          <-Map 39 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                                            PARTITION_ONLY_SHUFFLE [RS_1131]
+                                                                                              Group By Operator [GBY_1129] (rows=1 width=12)
+                                                                                                Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                                                Select Operator [SEL_1126] (rows=518 width=4)
+                                                                                                  Output:["_col0"]
+                                                                                                  Select Operator [SEL_1124] (rows=518 width=111)
+                                                                                                    Output:["_col0","_col1"]
+                                                                                                    Filter Operator [FIL_1123] (rows=518 width=312)
+                                                                                                      predicate:((i_color) IN ('maroon', 'burnished', 'dim', 'steel', 'navajo', 'chocolate') and i_current_price BETWEEN 35 AND 45 and i_current_price BETWEEN 36 AND 50 and i_item_sk is not null)
+                                                                                                      TableScan [TS_34] (rows=462000 width=311)
+                                                                                                        default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_current_price","i_color","i_product_name"]
                                                                 <-Reducer 17 [SIMPLE_EDGE]
-                                                                  SHUFFLE [RS_49]
-                                                                    PartitionCols:_col7
+                                                                  SHUFFLE [RS_64]
+                                                                    PartitionCols:_col1
                                                                     Merge Join Operator [MERGEJOIN_1059] (rows=1608052 width=119)
-                                                                      Conds:RS_46._col0=RS_1099._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col15"]
+                                                                      Conds:RS_61._col0=RS_1099._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
                                                                     <-Map 16 [SIMPLE_EDGE] vectorized
                                                                       PARTITION_ONLY_SHUFFLE [RS_1099]
                                                                         PartitionCols:_col0
-                                                                        Select Operator [SEL_1095] (rows=652 width=8)
+                                                                        Select Operator [SEL_1095] (rows=652 width=4)
                                                                           Output:["_col0"]
                                                                           Filter Operator [FIL_1092] (rows=652 width=8)
                                                                             predicate:((d_year = 2000) and d_date_sk is not null)
                                                                              Please refer to the previous TableScan [TS_3]
                                                                     <-Reducer 38 [SIMPLE_EDGE]
-                                                                      SHUFFLE [RS_46]
+                                                                      SHUFFLE [RS_61]
                                                                         PartitionCols:_col0
                                                                         Merge Join Operator [MERGEJOIN_1058] (rows=4503592 width=119)
-                                                                          Conds:RS_1156._col1=RS_1125._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col15"]
+                                                                          Conds:RS_1156._col1=RS_1125._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
                                                                         <-Map 39 [SIMPLE_EDGE] vectorized
                                                                           PARTITION_ONLY_SHUFFLE [RS_1125]
                                                                             PartitionCols:_col0
@@ -591,7 +589,7 @@ Stage-0
                                                                             Select Operator [SEL_1155] (rows=417313408 width=355)
                                                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
                                                                               Filter Operator [FIL_1154] (rows=417313408 width=355)
-                                                                                predicate:((ss_item_sk BETWEEN DynamicValue(RS_44_item_i_item_sk_min) AND DynamicValue(RS_44_item_i_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_44_item_i_item_sk_bloom_filter))) and (ss_item_sk BETWEEN DynamicValue(RS_85_catalog_sales_cs_item_sk_min) AND DynamicValue(RS_85_catalog_sales_cs_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_85_catalog_sales_cs_item_sk_bloom_filter))) and (ss_sold_date_sk BETWEEN DynamicValue(RS_47_d1_d_date_sk_min) AND DynamicValue(RS_47_d1_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_47_d1_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_cdemo_sk is not null and ss_customer_sk is not null and ss_hdemo_sk is not null and ss_item_sk is not null and ss_promo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null and ss_ticket_number is not null)
+                                                                                predicate:((ss_item_sk BETWEEN DynamicValue(RS_59_item_i_item_sk_min) AND DynamicValue(RS_59_item_i_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_59_item_i_item_sk_bloom_filter))) and (ss_item_sk BETWEEN DynamicValue(RS_65_catalog_sales_cs_item_sk_min) AND DynamicValue(RS_65_catalog_sales_cs_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_65_catalog_sales_cs_item_sk_bloom_filter))) and (ss_sold_date_sk BETWEEN DynamicValue(RS_62_d1_d_date_sk_min) AND DynamicValue(RS_62_d1_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_62_d1_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_cdemo_sk is not null and ss_customer_sk is not null and ss_hdemo_sk is not null and ss_item_sk is not null and ss_promo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null and ss_ticket_number is not null)
                                                                                 TableScan [TS_31] (rows=575995635 width=355)
                                                                                   default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_customer_sk","ss_cdemo_sk","ss_hdemo_sk","ss_addr_sk","ss_store_sk","ss_promo_sk","ss_ticket_number","ss_wholesale_cost","ss_list_price","ss_coupon_amt"]
                                                                                 <-Reducer 40 [BROADCAST_EDGE] vectorized
@@ -608,11 +606,11 @@ Stage-0
                                                                                           Select Operator [SEL_1100] (rows=652 width=4)
                                                                                             Output:["_col0"]
                                                                                              Please refer to the previous Select Operator [SEL_1095]
-                                                                                <-Reducer 47 [BROADCAST_EDGE] vectorized
+                                                                                <-Reducer 46 [BROADCAST_EDGE] vectorized
                                                                                   BROADCAST [RS_1153]
                                                                                     Group By Operator [GBY_1152] (rows=1 width=12)
                                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                                    <-Reducer 46 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                                    <-Reducer 45 [CUSTOM_SIMPLE_EDGE] vectorized
                                                                                       PARTITION_ONLY_SHUFFLE [RS_1151]
                                                                                         Group By Operator [GBY_1150] (rows=1 width=12)
                                                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
@@ -627,143 +625,141 @@ Stage-0
                       Group By Operator [GBY_1197] (rows=2299138 width=1362)
                         Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17"],aggregations:["count(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6, KEY._col7, KEY._col8, KEY._col9, KEY._col10, KEY._col11, KEY._col12, KEY._col13
                       <-Reducer 14 [SIMPLE_EDGE]
-                        SHUFFLE [RS_251]
+                        SHUFFLE [RS_249]
                           PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
-                          Group By Operator [GBY_250] (rows=2299138 width=1362)
-                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17"],aggregations:["count()","sum(_col43)","sum(_col44)","sum(_col45)"],keys:_col28, _col46, _col29, _col7, _col9, _col14, _col15, _col16, _col17, _col23, _col24, _col25, _col26, _col49
-                            Select Operator [SEL_249] (rows=2331650 width=1292)
-                              Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col23","_col24","_col25","_col26","_col28","_col29","_col43","_col44","_col45","_col46","_col49"]
-                              Filter Operator [FIL_248] (rows=2331650 width=1292)
-                                predicate:(_col56 <> _col19)
+                          Group By Operator [GBY_248] (rows=2299138 width=1362)
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17"],aggregations:["count()","sum(_col43)","sum(_col44)","sum(_col45)"],keys:_col28, _col46, _col29, _col7, _col9, _col14, _col15, _col16, _col17, _col23, _col24, _col25, _col26, _col47
+                            Select Operator [SEL_247] (rows=2331650 width=1292)
+                              Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col23","_col24","_col25","_col26","_col28","_col29","_col43","_col44","_col45","_col46","_col47"]
+                              Filter Operator [FIL_246] (rows=2331650 width=1292)
+                                predicate:(_col51 <> _col19)
                                 Merge Join Operator [MERGEJOIN_1086] (rows=2331650 width=1292)
-                                  Conds:RS_245._col37=RS_1122._col0(Inner),Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col19","_col23","_col24","_col25","_col26","_col28","_col29","_col43","_col44","_col45","_col46","_col49","_col56"]
+                                  Conds:RS_243._col37=RS_1122._col0(Inner),Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col19","_col23","_col24","_col25","_col26","_col28","_col29","_col43","_col44","_col45","_col46","_col47","_col51"]
                                 <-Map 54 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_1122]
                                     PartitionCols:_col0
                                      Please refer to the previous Select Operator [SEL_1119]
                                 <-Reducer 13 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_245]
+                                  SHUFFLE [RS_243]
                                     PartitionCols:_col37
                                     Merge Join Operator [MERGEJOIN_1085] (rows=2299138 width=1205)
-                                      Conds:RS_242._col0=RS_243._col16(Inner),Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col19","_col23","_col24","_col25","_col26","_col28","_col29","_col37","_col43","_col44","_col45","_col46","_col49"]
+                                      Conds:RS_240._col0=RS_241._col16(Inner),Output:["_col7","_col9","_col14","_col15","_col16","_col17","_col19","_col23","_col24","_col25","_col26","_col28","_col29","_col37","_col43","_col44","_col45","_col46","_col47"]
                                     <-Reducer 6 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_242]
+                                      SHUFFLE [RS_240]
                                         PartitionCols:_col0
                                          Please refer to the previous Merge Join Operator [MERGEJOIN_1056]
                                     <-Reducer 31 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_243]
+                                      SHUFFLE [RS_241]
                                         PartitionCols:_col16
-                                        Select Operator [SEL_223] (rows=2651207 width=784)
-                                          Output:["_col3","_col4","_col5","_col6","_col8","_col9","_col16","_col17","_col23","_col24","_col25","_col26","_col29"]
+                                        Select Operator [SEL_221] (rows=2651207 width=784)
+                                          Output:["_col3","_col4","_col5","_col6","_col8","_col9","_col16","_col17","_col23","_col24","_col25","_col26","_col27"]
                                           Merge Join Operator [MERGEJOIN_1084] (rows=2651207 width=784)
-                                            Conds:RS_220._col5, _col12=RS_1168._col0, _col1(Inner),Output:["_col6","_col7","_col13","_col14","_col15","_col16","_col19","_col26","_col27","_col29","_col30","_col31","_col32"]
+                                            Conds:RS_218._col5, _col12=RS_1168._col0, _col1(Inner),Output:["_col6","_col7","_col13","_col14","_col15","_col16","_col17","_col21","_col22","_col24","_col25","_col26","_col27"]
                                           <-Map 53 [SIMPLE_EDGE] vectorized
                                             SHUFFLE [RS_1168]
                                               PartitionCols:_col0, _col1
                                                Please refer to the previous Select Operator [SEL_1166]
                                           <-Reducer 30 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_220]
+                                            SHUFFLE [RS_218]
                                               PartitionCols:_col5, _col12
                                               Merge Join Operator [MERGEJOIN_1083] (rows=1608052 width=657)
-                                                Conds:RS_217._col9=RS_1117._col0(Inner),Output:["_col5","_col6","_col7","_col12","_col13","_col14","_col15","_col16","_col19","_col26","_col27","_col29","_col30","_col31","_col32"]
+                                                Conds:RS_215._col9=RS_1117._col0(Inner),Output:["_col5","_col6","_col7","_col12","_col13","_col14","_col15","_col16","_col17","_col21","_col22","_col24","_col25","_col26","_col27"]
                                               <-Map 36 [SIMPLE_EDGE] vectorized
                                                 SHUFFLE [RS_1117]
                                                   PartitionCols:_col0
                                                    Please refer to the previous Select Operator [SEL_1114]
                                               <-Reducer 29 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_217]
+                                                SHUFFLE [RS_215]
                                                   PartitionCols:_col9
                                                   Merge Join Operator [MERGEJOIN_1082] (rows=1608052 width=296)
-                                                    Conds:RS_214._col10=RS_1164._col0(Inner),Output:["_col5","_col6","_col7","_col9","_col12","_col13","_col14","_col15","_col16","_col19","_col26","_col27"]
+                                                    Conds:RS_212._col10=RS_1164._col0(Inner),Output:["_col5","_col6","_col7","_col9","_col12","_col13","_col14","_col15","_col16","_col17","_col21","_col22"]
                                                   <-Map 52 [SIMPLE_EDGE] vectorized
                                                     SHUFFLE [RS_1164]
                                                       PartitionCols:_col0
                                                        Please refer to the previous Select Operator [SEL_1162]
                                                   <-Reducer 28 [SIMPLE_EDGE]
-                                                    SHUFFLE [RS_214]
+                                                    SHUFFLE [RS_212]
                                                       PartitionCols:_col10
                                                       Merge Join Operator [MERGEJOIN_1081] (rows=1608052 width=119)
-                                                        Conds:RS_211._col5=RS_1186._col0(Inner),Output:["_col5","_col6","_col7","_col9","_col10","_col12","_col13","_col14","_col15","_col16","_col19"]
-                                                      <-Reducer 50 [ONE_TO_ONE_EDGE] vectorized
-                                                        PARTITION_ONLY_SHUFFLE [RS_1186]
+                                                        Conds:RS_209._col0=RS_210._col5(Inner),Output:["_col5","_col6","_col7","_col9","_col10","_col12","_col13","_col14","_col15","_col16","_col17"]
+                                                      <-Reducer 34 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_209]
                                                           PartitionCols:_col0
-                                                          Select Operator [SEL_1185] (rows=13257 width=228)
-                                                            Output:["_col0"]
-                                                            Filter Operator [FIL_1184] (rows=13257 width=228)
-                                                              predicate:(_col1 > (2 * _col2))
-                                                              Group By Operator [GBY_1183] (rows=39773 width=228)
-                                                                Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
-                                                              <-Reducer 49 [SIMPLE_EDGE]
-                                                                SHUFFLE [RS_192]
-                                                                  PartitionCols:_col0
-                                                                  Group By Operator [GBY_191] (rows=12806906 width=228)
-                                                                    Output:["_col0","_col1","_col2"],aggregations:["sum(_col1)","sum(_col2)"],keys:_col0
-                                                                    Select Operator [SEL_189] (rows=183085709 width=450)
-                                                                      Output:["_col0","_col1","_col2"]
-                                                                      Merge Join Operator [MERGEJOIN_1079] (rows=183085709 width=450)
-                                                                        Conds:RS_1182._col0, _col1=RS_1144._col0, _col1(Inner),Output:["_col0","_col2","_col5","_col6","_col7"]
-                                                                      <-Map 48 [SIMPLE_EDGE] vectorized
-                                                                        SHUFFLE [RS_1144]
-                                                                          PartitionCols:_col0, _col1
-                                                                           Please refer to the previous Select Operator [SEL_1142]
-                                                                      <-Map 56 [SIMPLE_EDGE] vectorized
-                                                                        SHUFFLE [RS_1182]
-                                                                          PartitionCols:_col0, _col1
-                                                                          Select Operator [SEL_1181] (rows=287989836 width=119)
-                                                                            Output:["_col0","_col1","_col2"]
-                                                                            Filter Operator [FIL_1180] (rows=287989836 width=119)
-                                                                              predicate:((cs_item_sk BETWEEN DynamicValue(RS_171_item_i_item_sk_min) AND DynamicValue(RS_171_item_i_item_sk_max) and in_bloom_filter(cs_item_sk, DynamicValue(RS_171_item_i_item_sk_bloom_filter))) and cs_item_sk is not null and cs_order_number is not null)
-                                                                              TableScan [TS_180] (rows=287989836 width=119)
-                                                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_item_sk","cs_order_number","cs_ext_list_price"]
-                                                                              <-Reducer 42 [BROADCAST_EDGE] vectorized
-                                                                                BROADCAST [RS_1177]
-                                                                                  Group By Operator [GBY_1175] (rows=1 width=12)
-                                                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                                  <-Map 39 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                    PARTITION_ONLY_SHUFFLE [RS_1132]
-                                                                                      Group By Operator [GBY_1130] (rows=1 width=12)
-                                                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                        Select Operator [SEL_1128] (rows=518 width=4)
-                                                                                          Output:["_col0"]
-                                                                                           Please refer to the previous Select Operator [SEL_1124]
+                                                           Please refer to the previous Merge Join Operator [MERGEJOIN_1053]
                                                       <-Reducer 27 [SIMPLE_EDGE]
-                                                        SHUFFLE [RS_211]
+                                                        SHUFFLE [RS_210]
                                                           PartitionCols:_col5
-                                                          Merge Join Operator [MERGEJOIN_1080] (rows=1608052 width=119)
-                                                            Conds:RS_208._col0=RS_209._col5(Inner),Output:["_col5","_col6","_col7","_col9","_col10","_col12","_col13","_col14","_col15","_col16","_col19"]
-                                                          <-Reducer 34 [SIMPLE_EDGE]
-                                                            SHUFFLE [RS_208]
-                                                              PartitionCols:_col0
-                                                               Please refer to the previous Merge Join Operator [MERGEJOIN_1053]
-                                                          <-Reducer 26 [SIMPLE_EDGE]
-                                                            SHUFFLE [RS_209]
-                                                              PartitionCols:_col5
-                                                              Select Operator [SEL_179] (rows=1608052 width=119)
-                                                                Output:["_col2","_col3","_col4","_col5","_col6","_col7","_col9","_col10","_col11","_col12","_col13","_col16"]
-                                                                Merge Join Operator [MERGEJOIN_1078] (rows=1608052 width=119)
-                                                                  Conds:RS_176._col7=RS_1160._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col8","_col9","_col10","_col11","_col12","_col15"]
-                                                                <-Map 43 [SIMPLE_EDGE] vectorized
-                                                                  SHUFFLE [RS_1160]
+                                                          Select Operator [SEL_196] (rows=1608052 width=119)
+                                                            Output:["_col2","_col3","_col4","_col5","_col6","_col7","_col9","_col10","_col11","_col12","_col13","_col14"]
+                                                            Merge Join Operator [MERGEJOIN_1080] (rows=1608052 width=119)
+                                                              Conds:RS_193._col7=RS_1160._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col8","_col9","_col10","_col11","_col12","_col13"]
+                                                            <-Map 51 [SIMPLE_EDGE] vectorized
+                                                              SHUFFLE [RS_1160]
+                                                                PartitionCols:_col0
+                                                                 Please refer to the previous Select Operator [SEL_1158]
+                                                            <-Reducer 26 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_193]
+                                                                PartitionCols:_col7
+                                                                Merge Join Operator [MERGEJOIN_1079] (rows=1608052 width=119)
+                                                                  Conds:RS_190._col1=RS_1186._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
+                                                                <-Reducer 49 [ONE_TO_ONE_EDGE] vectorized
+                                                                  PARTITION_ONLY_SHUFFLE [RS_1186]
                                                                     PartitionCols:_col0
-                                                                     Please refer to the previous Select Operator [SEL_1158]
+                                                                    Select Operator [SEL_1185] (rows=13257 width=4)
+                                                                      Output:["_col0"]
+                                                                      Filter Operator [FIL_1184] (rows=13257 width=228)
+                                                                        predicate:(_col1 > (2 * _col2))
+                                                                        Group By Operator [GBY_1183] (rows=39773 width=228)
+                                                                          Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
+                                                                        <-Reducer 48 [SIMPLE_EDGE]
+                                                                          SHUFFLE [RS_177]
+                                                                            PartitionCols:_col0
+                                                                            Group By Operator [GBY_176] (rows=6482999 width=228)
+                                                                              Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col5)"],keys:_col0
+                                                                              Merge Join Operator [MERGEJOIN_1078] (rows=183085709 width=227)
+                                                                                Conds:RS_1182._col0, _col1=RS_1144._col0, _col1(Inner),Output:["_col0","_col2","_col5"]
+                                                                              <-Map 47 [SIMPLE_EDGE] vectorized
+                                                                                SHUFFLE [RS_1144]
+                                                                                  PartitionCols:_col0, _col1
+                                                                                   Please refer to the previous Select Operator [SEL_1142]
+                                                                              <-Map 56 [SIMPLE_EDGE] vectorized
+                                                                                SHUFFLE [RS_1182]
+                                                                                  PartitionCols:_col0, _col1
+                                                                                  Select Operator [SEL_1181] (rows=287989836 width=119)
+                                                                                    Output:["_col0","_col1","_col2"]
+                                                                                    Filter Operator [FIL_1180] (rows=287989836 width=119)
+                                                                                      predicate:((cs_item_sk BETWEEN DynamicValue(RS_185_item_i_item_sk_min) AND DynamicValue(RS_185_item_i_item_sk_max) and in_bloom_filter(cs_item_sk, DynamicValue(RS_185_item_i_item_sk_bloom_filter))) and cs_item_sk is not null and cs_order_number is not null)
+                                                                                      TableScan [TS_166] (rows=287989836 width=119)
+                                                                                        default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_item_sk","cs_order_number","cs_ext_list_price"]
+                                                                                      <-Reducer 42 [BROADCAST_EDGE] vectorized
+                                                                                        BROADCAST [RS_1177]
+                                                                                          Group By Operator [GBY_1175] (rows=1 width=12)
+                                                                                            Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                                          <-Map 39 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                                            PARTITION_ONLY_SHUFFLE [RS_1132]
+                                                                                              Group By Operator [GBY_1130] (rows=1 width=12)
+                                                                                                Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                                                Select Operator [SEL_1128] (rows=518 width=4)
+                                                                                                  Output:["_col0"]
+                                                                                                   Please refer to the previous Select Operator [SEL_1124]
                                                                 <-Reducer 25 [SIMPLE_EDGE]
-                                                                  SHUFFLE [RS_176]
-                                                                    PartitionCols:_col7
+                                                                  SHUFFLE [RS_190]
+                                                                    PartitionCols:_col1
                                                                     Merge Join Operator [MERGEJOIN_1077] (rows=1608052 width=119)
-                                                                      Conds:RS_173._col0=RS_1101._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col15"]
+                                                                      Conds:RS_187._col0=RS_1101._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
                                                                     <-Map 16 [SIMPLE_EDGE] vectorized
                                                                       PARTITION_ONLY_SHUFFLE [RS_1101]
                                                                         PartitionCols:_col0
-                                                                        Select Operator [SEL_1096] (rows=652 width=8)
+                                                                        Select Operator [SEL_1096] (rows=652 width=4)
                                                                           Output:["_col0"]
                                                                           Filter Operator [FIL_1093] (rows=652 width=8)
                                                                             predicate:((d_year = 2001) and d_date_sk is not null)
                                                                              Please refer to the previous TableScan [TS_3]
                                                                     <-Reducer 41 [SIMPLE_EDGE]
-                                                                      SHUFFLE [RS_173]
+                                                                      SHUFFLE [RS_187]
                                                                         PartitionCols:_col0
                                                                         Merge Join Operator [MERGEJOIN_1076] (rows=4503592 width=119)
-                                                                          Conds:RS_1196._col1=RS_1127._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col15"]
+                                                                          Conds:RS_1196._col1=RS_1127._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
                                                                         <-Map 39 [SIMPLE_EDGE] vectorized
                                                                           PARTITION_ONLY_SHUFFLE [RS_1127]
                                                                             PartitionCols:_col0
@@ -774,8 +770,8 @@ Stage-0
                                                                             Select Operator [SEL_1195] (rows=417313408 width=355)
                                                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
                                                                               Filter Operator [FIL_1194] (rows=417313408 width=355)
-                                                                                predicate:((ss_item_sk BETWEEN DynamicValue(RS_171_item_i_item_sk_min) AND DynamicValue(RS_171_item_i_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_171_item_i_item_sk_bloom_filter))) and (ss_item_sk BETWEEN DynamicValue(RS_212_catalog_sales_cs_item_sk_min) AND DynamicValue(RS_212_catalog_sales_cs_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_212_catalog_sales_cs_item_sk_bloom_filter))) and (ss_item_sk BETWEEN DynamicValue(RS_254_item_i_item_sk_min) AND DynamicValue(RS_254_item_i_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_254_item_i_item_sk_bloom_filter))) and (ss_sold_date_sk BETWEEN DynamicValue(RS_174_d1_d_date_sk_min) AND DynamicValue(RS_174_d1_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_174_d1_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_cdemo_sk is not null and ss_customer_sk is not null and ss_hdemo_sk is not nul
 l and ss_item_sk is not null and ss_promo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null and ss_ticket_number is not null)
-                                                                                TableScan [TS_158] (rows=575995635 width=355)
+                                                                                predicate:((ss_item_sk BETWEEN DynamicValue(RS_185_item_i_item_sk_min) AND DynamicValue(RS_185_item_i_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_185_item_i_item_sk_bloom_filter))) and (ss_item_sk BETWEEN DynamicValue(RS_191_catalog_sales_cs_item_sk_min) AND DynamicValue(RS_191_catalog_sales_cs_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_191_catalog_sales_cs_item_sk_bloom_filter))) and (ss_item_sk BETWEEN DynamicValue(RS_252_item_i_item_sk_min) AND DynamicValue(RS_252_item_i_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_252_item_i_item_sk_bloom_filter))) and (ss_sold_date_sk BETWEEN DynamicValue(RS_188_d1_d_date_sk_min) AND DynamicValue(RS_188_d1_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_188_d1_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_cdemo_sk is not null and ss_customer_sk is not null and ss_hdemo_sk is not nul
 l and ss_item_sk is not null and ss_promo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null and ss_ticket_number is not null)
+                                                                                TableScan [TS_157] (rows=575995635 width=355)
                                                                                   default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_customer_sk","ss_cdemo_sk","ss_hdemo_sk","ss_addr_sk","ss_store_sk","ss_promo_sk","ss_ticket_number","ss_wholesale_cost","ss_list_price","ss_coupon_amt"]
                                                                                 <-Reducer 42 [BROADCAST_EDGE] vectorized
                                                                                   BROADCAST [RS_1176]
@@ -802,11 +798,11 @@ Stage-0
                                                                                           Select Operator [SEL_1102] (rows=652 width=4)
                                                                                             Output:["_col0"]
                                                                                              Please refer to the previous Select Operator [SEL_1096]
-                                                                                <-Reducer 51 [BROADCAST_EDGE] vectorized
+                                                                                <-Reducer 50 [BROADCAST_EDGE] vectorized
                                                                                   BROADCAST [RS_1191]
                                                                                     Group By Operator [GBY_1190] (rows=1 width=12)
                                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                                    <-Reducer 50 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                                    <-Reducer 49 [CUSTOM_SIMPLE_EDGE] vectorized
                                                                                       PARTITION_ONLY_SHUFFLE [RS_1189]
                                                                                         Group By Operator [GBY_1188] (rows=1 width=12)
                                                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query65.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query65.q.out b/ql/src/test/results/clientpositive/perf/tez/query65.q.out
index 4c3644b..fc2a6c9 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query65.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query65.q.out
@@ -124,7 +124,7 @@ Stage-0
                       FORWARD [RS_43]
                         PartitionCols:_col0
                         Filter Operator [FIL_42] (rows=65392 width=231)
-                          predicate:(_col2 <= (0.1 * _col4))
+                          predicate:(_col2 <= _col4)
                           Merge Join Operator [MERGEJOIN_134] (rows=196176 width=231)
                             Conds:RS_153._col0=RS_168._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
                           <-Reducer 3 [SIMPLE_EDGE] vectorized
@@ -142,7 +142,7 @@ Stage-0
                                     <-Map 9 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_139]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_138] (rows=317 width=8)
+                                        Select Operator [SEL_138] (rows=317 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_137] (rows=317 width=8)
                                             predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)


[47/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join47.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join47.q.out b/ql/src/test/results/clientpositive/join47.q.out
index 2892b8b..169244e 100644
--- a/ql/src/test/results/clientpositive/join47.q.out
+++ b/ql/src/test/results/clientpositive/join47.q.out
@@ -363,24 +363,24 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(value) BETWEEN 100.0D AND 102.0D (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: boolean)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(value) BETWEEN 100.0D AND 102.0D (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -388,19 +388,23 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
-          residual filter predicates: {((_col0 = _col2) or UDFToDouble(_col1) BETWEEN 100.0D AND 102.0D or UDFToDouble(_col3) BETWEEN 100.0D AND 102.0D)}
-          Statistics: Num rows: 9026 Data size: 173876 Basic stats: COMPLETE Column stats: NONE
-          Limit
-            Number of rows: 10
-            Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          residual filter predicates: {((_col0 = _col3) or _col2 or _col5)}
+          Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
+            Limit
+              Number of rows: 10
               Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -472,24 +476,24 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -497,19 +501,23 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
-          residual filter predicates: {((UDFToDouble(_col0) + UDFToDouble(_col2)) >= 100.0D)} {((UDFToDouble(_col0) + UDFToDouble(_col2)) <= 102.0D)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          residual filter predicates: {((_col2 + _col5) >= 100.0D)} {((_col2 + _col5) <= 102.0D)}
           Statistics: Num rows: 1388 Data size: 26738 Basic stats: COMPLETE Column stats: NONE
-          Limit
-            Number of rows: 10
-            Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            Statistics: Num rows: 1388 Data size: 26738 Basic stats: COMPLETE Column stats: NONE
+            Limit
+              Number of rows: 10
               Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -575,24 +583,24 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -600,19 +608,23 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
-          residual filter predicates: {(((UDFToDouble(_col0) + UDFToDouble(_col2)) >= 100.0D) or ((UDFToDouble(_col0) + UDFToDouble(_col2)) <= 102.0D))}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          residual filter predicates: {(((_col2 + _col5) >= 100.0D) or ((_col2 + _col5) <= 102.0D))}
           Statistics: Num rows: 8332 Data size: 160507 Basic stats: COMPLETE Column stats: NONE
-          Limit
-            Number of rows: 10
-            Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            Statistics: Num rows: 8332 Data size: 160507 Basic stats: COMPLETE Column stats: NONE
+            Limit
+              Number of rows: 10
               Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -680,24 +692,24 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -705,19 +717,23 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
-          residual filter predicates: {(struct(UDFToDouble(_col0),UDFToDouble(_col2))) IN (const struct(100.0D,100.0D), const struct(101.0D,101.0D), const struct(102.0D,102.0D))}
-          Statistics: Num rows: 6250 Data size: 120400 Basic stats: COMPLETE Column stats: NONE
-          Limit
-            Number of rows: 10
-            Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          residual filter predicates: {(struct(_col2,_col5)) IN (const struct(100.0D,100.0D), const struct(101.0D,101.0D), const struct(102.0D,102.0D))}
+          Statistics: Num rows: 9375 Data size: 180600 Basic stats: COMPLETE Column stats: NONE
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            Statistics: Num rows: 9375 Data size: 180600 Basic stats: COMPLETE Column stats: NONE
+            Limit
+              Number of rows: 10
               Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -776,15 +792,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: string)
                 sort order: +
                 Map-reduce partition columns: _col0 (type: string)
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: string)
+                value expressions: _col1 (type: string), _col2 (type: double)
           TableScan
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -805,7 +821,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -821,18 +837,18 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), _col3 (type: string), _col4 (type: string)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -840,11 +856,11 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {((UDFToDouble(_col4) + UDFToDouble(_col0)) >= 100.0D)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+          residual filter predicates: {((_col7 + _col2) >= 100.0D)}
           Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col0 (type: string), _col1 (type: string), _col4 (type: string), _col5 (type: string), _col2 (type: string), _col3 (type: string)
+            expressions: _col0 (type: string), _col1 (type: string), _col5 (type: string), _col6 (type: string), _col3 (type: string), _col4 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
             Limit
@@ -927,15 +943,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: string)
                 sort order: +
                 Map-reduce partition columns: _col0 (type: string)
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: string)
+                value expressions: _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -956,7 +972,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -972,18 +988,18 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), _col3 (type: string), _col4 (type: string)
           TableScan
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -991,19 +1007,23 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {((UDFToDouble(_col4) + UDFToDouble(_col0)) <= 102.0D)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+          residual filter predicates: {((_col7 + _col2) <= 102.0D)}
           Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
-          Limit
-            Number of rows: 10
-            Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+            Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
+            Limit
+              Number of rows: 10
               Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1040,7 +1060,7 @@ POSTHOOK: Input: default@src1
 35	val_35	NULL	NULL	66	val_66
 35	val_35	NULL	NULL	66	val_66
 35	val_35	NULL	NULL	66	val_66
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[6][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM src
@@ -1074,24 +1094,24 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1099,15 +1119,19 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
-          residual filter predicates: {((UDFToDouble(_col2) + UDFToDouble(_col0)) >= 100.0D)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          residual filter predicates: {((_col5 + _col2) >= 100.0D)}
           Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -1158,7 +1182,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[6][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT *
 FROM src
 JOIN src1 a ON (a.key+src.key >= 100)
@@ -1221,15 +1245,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: string)
                 sort order: +
                 Map-reduce partition columns: _col0 (type: string)
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: string)
+                value expressions: _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -1250,7 +1274,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -1266,18 +1290,18 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), _col3 (type: string), _col4 (type: string)
           TableScan
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1285,19 +1309,23 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {((UDFToDouble(_col4) + UDFToDouble(_col0)) <= 102.0D)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+          residual filter predicates: {((_col7 + _col2) <= 102.0D)}
           Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
-          Limit
-            Number of rows: 10
-            Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+            Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
+            Limit
+              Number of rows: 10
               Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1324,7 +1352,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Input: default@src1
 #### A masked pattern was here ####
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[6][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM src
@@ -1358,24 +1386,24 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1383,15 +1411,19 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
-          residual filter predicates: {((UDFToDouble(_col2) + UDFToDouble(_col0)) >= 100.0D)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          residual filter predicates: {((_col5 + _col2) >= 100.0D)}
           Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
+            Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -1442,7 +1474,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[6][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT *
 FROM src
 JOIN src1 a ON (a.key+src.key >= 100)
@@ -1505,15 +1537,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: string)
                 sort order: +
                 Map-reduce partition columns: _col0 (type: string)
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: string)
+                value expressions: _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -1534,7 +1566,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -1550,18 +1582,18 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), _col3 (type: string), _col4 (type: string)
           TableScan
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1569,19 +1601,23 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {((UDFToDouble(_col4) + UDFToDouble(_col0)) <= 102.0D)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+          residual filter predicates: {((_col7 + _col2) <= 102.0D)}
           Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
-          Limit
-            Number of rows: 10
-            Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+            Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
+            Limit
+              Number of rows: 10
               Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1698,18 +1734,18 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: t3
+            alias: t5
             Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
-              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+              expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string), (c_int = 42) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
               Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string), _col6 (type: boolean)
           TableScan
-            alias: t5
+            alias: t3
             Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
@@ -1746,11 +1782,11 @@ STAGE PLANS:
             1 
             2 
             3 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29
-          residual filter predicates: {((_col6 = _col24) or ((_col28 = _col16) and (_col8 = 42)))} {((_col12 = _col24) or ((_col27 = _col15) and (_col13 = _col25)))} {((_col0 = _col24) or ((_col1 = _col25) and (_col26 = _col20)))}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29, _col30
+          residual filter predicates: {((_col0 = _col25) or ((_col29 = _col17) and _col6))} {((_col13 = _col25) or ((_col28 = _col16) and (_col14 = _col26)))} {((_col7 = _col25) or ((_col8 = _col26) and (_col27 = _col21)))}
           Statistics: Num rows: 74250 Data size: 3964275 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col18 (type: string), _col19 (type: string), _col20 (type: int), _col21 (type: float), _col22 (type: boolean), _col23 (type: string), _col24 (type: string), _col25 (type: string), _col26 (type: int), _col27 (type: float), _col28 (type: boolean), _col29 (type: string), _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: float), _col16 (type: boolean), _col17 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: int), _col9 (type: float), _col10 (type: boolean), _col11 (type: string)
+            expressions: _col19 (type: string), _col20 (type: string), _col21 (type: int), _col22 (type: float), _col23 (type: boolean), _col24 (type: string), _col25 (type: string), _col26 (type: string), _col27 (type: int), _col28 (type: float), _col29 (type: boolean), _col30 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: int), _col10 (type: float), _col11 (type: boolean), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: int), _col16 (type: float), _col17 (type: boolean), _col18 (type: string), _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29
             Statistics: Num rows: 74250 Data size: 3964275 Basic stats: COMPLETE Column stats: NONE
             Limit

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join9.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join9.q.out b/ql/src/test/results/clientpositive/join9.q.out
index 8c2dead..1dc2e0b 100644
--- a/ql/src/test/results/clientpositive/join9.q.out
+++ b/ql/src/test/results/clientpositive/join9.q.out
@@ -23,7 +23,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 POSTHOOK: Output: default@dest1_n39
 OPTIMIZED SQL: SELECT `t0`.`key`, `t2`.`value`
-FROM (SELECT `key`, CAST('2008-04-08' AS STRING) AS `ds`, CAST('12' AS STRING) AS `hr`
+FROM (SELECT `key`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = '12' AND `key` IS NOT NULL) AS `t0`
 INNER JOIN (SELECT `key`, `value`
@@ -193,10 +193,10 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col4
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
+            expressions: UDFToInteger(_col0) (type: int), _col2 (type: string)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join_cond_pushdown_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join_cond_pushdown_1.q.out b/ql/src/test/results/clientpositive/join_cond_pushdown_1.q.out
index c968b38..352ae17 100644
--- a/ql/src/test/results/clientpositive/join_cond_pushdown_1.q.out
+++ b/ql/src/test/results/clientpositive/join_cond_pushdown_1.q.out
@@ -351,22 +351,22 @@ STAGE PLANS:
               Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                 Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: string)
+                  key expressions: _col0 (type: string)
                   sort order: +
-                  Map-reduce partition columns: _col1 (type: string)
+                  Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
             0 _col1 (type: string)
-            1 _col1 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17
+            1 _col0 (type: string)
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
           Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -382,7 +382,7 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string)
+              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string)
           TableScan
             alias: p1
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
@@ -401,10 +401,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25
           Statistics: Num rows: 728 Data size: 178830 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col18 (type: int), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: string), _col23 (type: int), _col24 (type: string), _col25 (type: double), _col26 (type: string), 1 (type: int), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+            expressions: _col17 (type: int), _col18 (type: string), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: int), _col23 (type: string), _col24 (type: double), _col25 (type: string), 1 (type: int), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
             Statistics: Num rows: 728 Data size: 178830 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join_cond_pushdown_3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join_cond_pushdown_3.q.out b/ql/src/test/results/clientpositive/join_cond_pushdown_3.q.out
index 871d318..d643d14 100644
--- a/ql/src/test/results/clientpositive/join_cond_pushdown_3.q.out
+++ b/ql/src/test/results/clientpositive/join_cond_pushdown_3.q.out
@@ -359,22 +359,22 @@ STAGE PLANS:
               Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                 Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: string)
+                  key expressions: _col0 (type: string)
                   sort order: +
-                  Map-reduce partition columns: _col1 (type: string)
+                  Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
             0 _col1 (type: string)
-            1 _col1 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17
+            1 _col0 (type: string)
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
           Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -390,7 +390,7 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string)
+              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string)
           TableScan
             alias: p1
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
@@ -409,10 +409,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25
           Statistics: Num rows: 728 Data size: 178830 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col18 (type: int), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: string), _col23 (type: int), _col24 (type: string), _col25 (type: double), _col26 (type: string), 1 (type: int), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+            expressions: _col17 (type: int), _col18 (type: string), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: int), _col23 (type: string), _col24 (type: double), _col25 (type: string), 1 (type: int), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
             Statistics: Num rows: 728 Data size: 178830 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join_cond_pushdown_unqual1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join_cond_pushdown_unqual1.q.out b/ql/src/test/results/clientpositive/join_cond_pushdown_unqual1.q.out
index 1d86613..3dcec7b 100644
--- a/ql/src/test/results/clientpositive/join_cond_pushdown_unqual1.q.out
+++ b/ql/src/test/results/clientpositive/join_cond_pushdown_unqual1.q.out
@@ -431,22 +431,22 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: p2_name (type: string), p2_mfgr (type: string), p2_brand (type: string), p2_type (type: string), p2_size (type: int), p2_container (type: string), p2_retailprice (type: double), p2_comment (type: string)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: string)
+                  key expressions: _col0 (type: string)
                   sort order: +
-                  Map-reduce partition columns: _col1 (type: string)
+                  Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
             0 _col1 (type: string)
-            1 _col1 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17
+            1 _col0 (type: string)
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
           File Output Operator
             compressed: false
@@ -462,7 +462,7 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string)
+              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string)
           TableScan
             alias: p1
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
@@ -481,10 +481,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25
           Statistics: Num rows: 26 Data size: 3173 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: _col18 (type: int), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: string), _col23 (type: int), _col24 (type: string), _col25 (type: double), _col26 (type: string), 1 (type: int), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+            expressions: _col17 (type: int), _col18 (type: string), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: int), _col23 (type: string), _col24 (type: double), _col25 (type: string), 1 (type: int), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
             Statistics: Num rows: 26 Data size: 3173 Basic stats: PARTIAL Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join_cond_pushdown_unqual3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join_cond_pushdown_unqual3.q.out b/ql/src/test/results/clientpositive/join_cond_pushdown_unqual3.q.out
index 8ffee7a..d9e2276 100644
--- a/ql/src/test/results/clientpositive/join_cond_pushdown_unqual3.q.out
+++ b/ql/src/test/results/clientpositive/join_cond_pushdown_unqual3.q.out
@@ -439,22 +439,22 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: p2_name (type: string), p2_mfgr (type: string), p2_brand (type: string), p2_type (type: string), p2_size (type: int), p2_container (type: string), p2_retailprice (type: double), p2_comment (type: string)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: string)
+                  key expressions: _col0 (type: string)
                   sort order: +
-                  Map-reduce partition columns: _col1 (type: string)
+                  Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
             0 _col1 (type: string)
-            1 _col1 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17
+            1 _col0 (type: string)
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
           File Output Operator
             compressed: false
@@ -470,7 +470,7 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string)
+              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string)
           TableScan
             alias: p1
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
@@ -489,10 +489,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25
           Statistics: Num rows: 26 Data size: 3173 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: _col18 (type: int), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: string), _col23 (type: int), _col24 (type: string), _col25 (type: double), _col26 (type: string), 1 (type: int), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+            expressions: _col17 (type: int), _col18 (type: string), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: int), _col23 (type: string), _col24 (type: double), _col25 (type: string), 1 (type: int), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
             Statistics: Num rows: 26 Data size: 3173 Basic stats: PARTIAL Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join_emit_interval.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join_emit_interval.q.out b/ql/src/test/results/clientpositive/join_emit_interval.q.out
index 44d69da..18be46f 100644
--- a/ql/src/test/results/clientpositive/join_emit_interval.q.out
+++ b/ql/src/test/results/clientpositive/join_emit_interval.q.out
@@ -68,15 +68,15 @@ STAGE PLANS:
             alias: test1_n7
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col1 (type: int)
                 sort order: +
                 Map-reduce partition columns: _col1 (type: int)
                 Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
           TableScan
             alias: test2_n4
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
@@ -95,20 +95,24 @@ STAGE PLANS:
           condition map:
                Left Outer Join 0 to 1
           filter predicates:
-            0 {VALUE._col0 BETWEEN 100 AND 102}
+            0 {VALUE._col2}
             1 
           keys:
             0 _col1 (type: int)
             1 _col1 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
           Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -166,13 +170,13 @@ STAGE PLANS:
             alias: test1_n7
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
           TableScan
             alias: test2_n4
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
@@ -189,20 +193,24 @@ STAGE PLANS:
           condition map:
                Left Outer Join 0 to 1
           filter predicates:
-            0 {VALUE._col0 BETWEEN 100 AND 102}
+            0 {VALUE._col3}
             1 
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
           Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator


[49/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/encrypted/encryption_join_unencrypted_tbl.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/encrypted/encryption_join_unencrypted_tbl.q.out b/ql/src/test/results/clientpositive/encrypted/encryption_join_unencrypted_tbl.q.out
index 1e195bc..b6d726e 100644
--- a/ql/src/test/results/clientpositive/encrypted/encryption_join_unencrypted_tbl.q.out
+++ b/ql/src/test/results/clientpositive/encrypted/encryption_join_unencrypted_tbl.q.out
@@ -542,13 +542,13 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@encrypted_table
 POSTHOOK: Input: default@src
 POSTHOOK: Output: hdfs://### HDFS PATH ###
-OPTIMIZED SQL: SELECT *
-FROM (SELECT `key`, `value`
+OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
+FROM (SELECT `key`, `value`, CAST(`key` AS DOUBLE) AS `CAST`
 FROM `default`.`src`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`
+INNER JOIN (SELECT `key`, `value`, CAST(`key` AS DOUBLE) AS `CAST`
 FROM `default`.`encrypted_table`
-WHERE `key` IS NOT NULL) AS `t2` ON CAST(`t0`.`key` AS DOUBLE) = CAST(`t2`.`key` AS DOUBLE)
+WHERE `key` IS NOT NULL) AS `t2` ON `t0`.`CAST` = `t2`.`CAST`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -567,14 +567,14 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col2 (type: double)
                   null sort order: a
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col2 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
                   value expressions: _col0 (type: string), _col1 (type: string)
@@ -589,14 +589,14 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: int), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col2 (type: double)
                   null sort order: a
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col2 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                   tag: 1
                   value expressions: _col0 (type: int), _col1 (type: string)
@@ -714,32 +714,36 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1, _col2, _col3
+            0 _col2 (type: double)
+            1 _col2 (type: double)
+          outputColumnNames: _col0, _col1, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            GlobalTableId: 0
-            directory: hdfs://### HDFS PATH ###
-            NumFilesPerFileSink: 1
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: int), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            Stats Publishing Key Prefix: hdfs://### HDFS PATH ###
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                properties:
-                  columns _col0,_col1,_col2,_col3
-                  columns.types string:string:int:string
-                  escape.delim \
-                  hive.serialization.extend.additional.nesting.levels true
-                  serialization.escape.crlf true
-                  serialization.format 1
-                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-            TotalFiles: 1
-            GatherStats: false
-            MultiFileSpray: false
+            File Output Operator
+              compressed: false
+              GlobalTableId: 0
+              directory: hdfs://### HDFS PATH ###
+              NumFilesPerFileSink: 1
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              Stats Publishing Key Prefix: hdfs://### HDFS PATH ###
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  properties:
+                    columns _col0,_col1,_col2,_col3
+                    columns.types string:string:int:string
+                    escape.delim \
+                    hive.serialization.extend.additional.nesting.levels true
+                    serialization.escape.crlf true
+                    serialization.format 1
+                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              TotalFiles: 1
+              GatherStats: false
+              MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out b/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
index 5209b44..28c13c1 100644
--- a/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
+++ b/ql/src/test/results/clientpositive/filter_cond_pushdown.q.out
@@ -29,15 +29,15 @@ STAGE PLANS:
               predicate: ((value <> '') and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), value (type: string), (value = '2008-04-08') (type: boolean)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: boolean)
           TableScan
             alias: f
             filterExpr: ((value) IN ('2008-04-08', '2008-04-09') and key is not null) (type: boolean)
@@ -46,15 +46,15 @@ STAGE PLANS:
               predicate: ((value) IN ('2008-04-08', '2008-04-09') and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), (value = '2008-04-08') (type: boolean), (value = '2008-04-09') (type: boolean)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col1 (type: boolean), _col2 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -62,10 +62,10 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col1, _col2, _col3
+          outputColumnNames: _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (((_col3 = '2008-04-08') and (_col1 = '2008-04-08')) or (_col3 = '2008-04-09')) (type: boolean)
+            predicate: ((_col4 and _col2) or _col5) (type: boolean)
             Statistics: Num rows: 412 Data size: 4376 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
@@ -83,7 +83,7 @@ STAGE PLANS:
               sort order: +
               Map-reduce partition columns: _col1 (type: string)
               Statistics: Num rows: 412 Data size: 4376 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col2 (type: string)
+              value expressions: _col3 (type: string)
           TableScan
             alias: g
             filterExpr: (value <> '') (type: boolean)
@@ -107,10 +107,10 @@ STAGE PLANS:
           keys:
             0 _col1 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col2, _col4
+          outputColumnNames: _col3, _col6
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col2 (type: string), _col4 (type: string)
+            expressions: _col3 (type: string), _col6 (type: string)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
@@ -158,15 +158,15 @@ STAGE PLANS:
               predicate: ((value <> '') and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), value (type: string), (value = '2008-04-08') (type: boolean)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: boolean)
           TableScan
             alias: f
             filterExpr: ((value) IN ('2008-04-08', '2008-04-10', '2008-04-09') and key is not null) (type: boolean)
@@ -175,15 +175,15 @@ STAGE PLANS:
               predicate: ((value) IN ('2008-04-08', '2008-04-10', '2008-04-09') and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), (value) IN ('2008-04-08', '2008-04-10') (type: boolean), (value = '2008-04-09') (type: boolean)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col1 (type: boolean), _col2 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -191,11 +191,11 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col1, _col2, _col3
+          outputColumnNames: _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (((_col3) IN ('2008-04-08', '2008-04-10') and (_col1 = '2008-04-08')) or (_col3 = '2008-04-09')) (type: boolean)
-            Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+            predicate: ((_col4 and _col2) or _col5) (type: boolean)
+            Statistics: Num rows: 412 Data size: 4376 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
               table:
@@ -211,8 +211,8 @@ STAGE PLANS:
               key expressions: _col1 (type: string)
               sort order: +
               Map-reduce partition columns: _col1 (type: string)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col2 (type: string)
+              Statistics: Num rows: 412 Data size: 4376 Basic stats: COMPLETE Column stats: NONE
+              value expressions: _col3 (type: string)
           TableScan
             alias: g
             filterExpr: (value <> '') (type: boolean)
@@ -236,15 +236,15 @@ STAGE PLANS:
           keys:
             0 _col1 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col2, _col4
-          Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
+          outputColumnNames: _col3, _col6
+          Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col2 (type: string), _col4 (type: string)
+            expressions: _col3 (type: string), _col6 (type: string)
             outputColumnNames: _col0, _col1
-            Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
               table:
                   input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -305,7 +305,7 @@ STAGE PLANS:
               predicate: (UDFToDouble(key) = 1.0D) (type: boolean)
               Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), c_int (type: int), c_float (type: float)
+                expressions: key (type: string), c_float (type: float), ((c_int + 1) > 2) (type: boolean)
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
@@ -313,7 +313,7 @@ STAGE PLANS:
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 10 Data size: 131 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col2 (type: float)
+                  value expressions: _col1 (type: float), _col2 (type: boolean)
           TableScan
             alias: t3
             filterExpr: ((c_int = 1) and (UDFToDouble(key) = 1.0D)) (type: boolean)
@@ -341,12 +341,12 @@ STAGE PLANS:
           outputColumnNames: _col0, _col1, _col2, _col4
           Statistics: Num rows: 11 Data size: 144 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (((_col1 + 1) > 2) or ((_col2 + _col4) > 2)) (type: boolean)
-            Statistics: Num rows: 6 Data size: 78 Basic stats: COMPLETE Column stats: NONE
+            predicate: (((_col1 + _col4) > 2) or _col2) (type: boolean)
+            Statistics: Num rows: 8 Data size: 104 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: _col0 (type: string)
               outputColumnNames: _col0
-              Statistics: Num rows: 6 Data size: 78 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 8 Data size: 104 Basic stats: COMPLETE Column stats: NONE
               File Output Operator
                 compressed: false
                 table:
@@ -378,7 +378,7 @@ STAGE PLANS:
               key expressions: _col0 (type: string)
               sort order: +
               Map-reduce partition columns: _col0 (type: string)
-              Statistics: Num rows: 6 Data size: 78 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 8 Data size: 104 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -432,15 +432,15 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), value (type: string), (value) IN ('2008-04-08', '2008-04-10') (type: boolean), (value) IN ('2008-04-08', '2008-04-09') (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: boolean), _col3 (type: boolean)
           TableScan
             alias: m
             filterExpr: ((value) IN ('2008-04-10', '2008-04-08') and (value <> '') and key is not null) (type: boolean)
@@ -449,15 +449,15 @@ STAGE PLANS:
               predicate: ((value <> '') and (value) IN ('2008-04-10', '2008-04-08') and key is not null) (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), value (type: string), (value = '2008-04-10') (type: boolean), (value = '2008-04-08') (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: boolean), _col3 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -465,18 +465,18 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col5, _col6, _col7
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (((_col1) IN ('2008-04-08', '2008-04-10') and (_col1) IN ('2008-04-08', '2008-04-09') and (_col3 = '2008-04-10')) or (_col3 = '2008-04-08')) (type: boolean)
-            Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+            predicate: ((_col2 and _col3 and _col6) or _col7) (type: boolean)
+            Statistics: Num rows: 343 Data size: 3643 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string)
+              expressions: _col0 (type: string), _col1 (type: string), _col5 (type: string)
               outputColumnNames: _col0, _col1, _col2
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 343 Data size: 3643 Basic stats: COMPLETE Column stats: NONE
               File Output Operator
                 compressed: false
-                Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 343 Data size: 3643 Basic stats: COMPLETE Column stats: NONE
                 table:
                     input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                     output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/filter_join_breaktask.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/filter_join_breaktask.q.out b/ql/src/test/results/clientpositive/filter_join_breaktask.q.out
index 849ca3f..daa018a 100644
--- a/ql/src/test/results/clientpositive/filter_join_breaktask.q.out
+++ b/ql/src/test/results/clientpositive/filter_join_breaktask.q.out
@@ -35,13 +35,13 @@ POSTHOOK: Input: default@filter_join_breaktask
 POSTHOOK: Input: default@filter_join_breaktask@ds=2008-04-08
 #### A masked pattern was here ####
 OPTIMIZED SQL: SELECT `t2`.`key`, `t0`.`value`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM (SELECT `value`
 FROM `default`.`filter_join_breaktask`
 WHERE `ds` = '2008-04-08' AND `value` <> '') AS `t0`
-INNER JOIN ((SELECT `key`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN ((SELECT `key`
 FROM `default`.`filter_join_breaktask`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`filter_join_breaktask`
 WHERE `ds` = '2008-04-08' AND `value` <> '' AND `key` IS NOT NULL) AS `t4` ON `t2`.`key` = `t4`.`key`) ON `t0`.`value` = `t4`.`value`
 STAGE DEPENDENCIES:
@@ -157,7 +157,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col3
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 27 Data size: 232 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -169,7 +169,7 @@ STAGE PLANS:
                 output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                 properties:
                   column.name.delimiter ,
-                  columns _col0,_col3
+                  columns _col0,_col2
                   columns.types int,string
                   escape.delim \
                   serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
@@ -184,10 +184,10 @@ STAGE PLANS:
           TableScan
             GatherStats: false
             Reduce Output Operator
-              key expressions: _col3 (type: string)
+              key expressions: _col2 (type: string)
               null sort order: a
               sort order: +
-              Map-reduce partition columns: _col3 (type: string)
+              Map-reduce partition columns: _col2 (type: string)
               Statistics: Num rows: 27 Data size: 232 Basic stats: COMPLETE Column stats: NONE
               tag: 0
               value expressions: _col0 (type: int)
@@ -223,7 +223,7 @@ STAGE PLANS:
             output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
             properties:
               column.name.delimiter ,
-              columns _col0,_col3
+              columns _col0,_col2
               columns.types int,string
               escape.delim \
               serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
@@ -233,7 +233,7 @@ STAGE PLANS:
               output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
               properties:
                 column.name.delimiter ,
-                columns _col0,_col3
+                columns _col0,_col2
                 columns.types int,string
                 escape.delim \
                 serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
@@ -295,12 +295,12 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 _col3 (type: string)
+            0 _col2 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col5
+          outputColumnNames: _col0, _col3
           Statistics: Num rows: 29 Data size: 255 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col5 (type: string)
+            expressions: _col0 (type: int), _col3 (type: string)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 29 Data size: 255 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/infer_bucket_sort_map_operators.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/infer_bucket_sort_map_operators.q.out b/ql/src/test/results/clientpositive/infer_bucket_sort_map_operators.q.out
index 786ce78..f31f363 100644
--- a/ql/src/test/results/clientpositive/infer_bucket_sort_map_operators.q.out
+++ b/ql/src/test/results/clientpositive/infer_bucket_sort_map_operators.q.out
@@ -287,12 +287,16 @@ STAGE PLANS:
                 Filter Operator
                   predicate: _col1 is not null (type: boolean)
                   Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: UDFToDouble(_col1) (type: double)
-                    sort order: +
-                    Map-reduce partition columns: UDFToDouble(_col1) (type: double)
+                  Select Operator
+                    expressions: _col0 (type: string), _col1 (type: bigint), UDFToDouble(_col1) (type: double)
+                    outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col0 (type: string), _col1 (type: bigint)
+                    Reduce Output Operator
+                      key expressions: _col2 (type: double)
+                      sort order: +
+                      Map-reduce partition columns: _col2 (type: double)
+                      Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col0 (type: string), _col1 (type: bigint)
           TableScan
             alias: src
             filterExpr: value is not null (type: boolean)
@@ -301,21 +305,21 @@ STAGE PLANS:
               predicate: value is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: value (type: string)
+                expressions: UDFToDouble(value) (type: double)
                 outputColumnNames: _col0
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col0 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col0 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col1) (type: double)
-            1 UDFToDouble(_col0) (type: double)
+            0 _col2 (type: double)
+            1 _col0 (type: double)
           outputColumnNames: _col0, _col1
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/infer_join_preds.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/infer_join_preds.q.out b/ql/src/test/results/clientpositive/infer_join_preds.q.out
index d08408e..48b3167 100644
--- a/ql/src/test/results/clientpositive/infer_join_preds.q.out
+++ b/ql/src/test/results/clientpositive/infer_join_preds.q.out
@@ -1178,15 +1178,15 @@ STAGE PLANS:
               predicate: prid is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: idp_warehouse_id (type: bigint), prid (type: bigint), prtimesheetid (type: bigint), prassignmentid (type: bigint), prchargecodeid (type: bigint), prtypecodeid (type: bigint), prsequence (type: bigint), prmodby (type: varchar(96)), prmodtime (type: timestamp), prrmexported (type: bigint), prrmckdel (type: bigint), slice_status (type: int), role_id (type: bigint), user_lov1 (type: varchar(30)), user_lov2 (type: varchar(30)), incident_id (type: bigint), incident_investment_id (type: bigint), odf_ss_actuals (type: bigint), practsum (type: decimal(38,20))
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18
+                expressions: idp_warehouse_id (type: bigint), prid (type: bigint), concat(CAST( prid AS STRING), ',', CASE WHEN (prtimesheetid is null) THEN (1) ELSE (prtimesheetid) END, ',', CASE WHEN (prassignmentid is null) THEN (1) ELSE (prassignmentid) END, ',', CASE WHEN (prchargecodeid is null) THEN (1) ELSE (prchargecodeid) END, ',', CASE WHEN (prtypecodeid is null) THEN ('') ELSE (prtypecodeid) END, ',', CASE WHEN (practsum is null) THEN (1) ELSE (practsum) END, ',', CASE WHEN (prsequence is null) THEN (1) ELSE (prsequence) END, ',', CASE WHEN (length(prmodby) is null) THEN ('') ELSE (prmodby) END, ',', CASE WHEN (prmodtime is null) THEN (TIMESTAMP'2017-12-08 00:00:00') ELSE (prmodtime) END, ',', CASE WHEN (prrmexported is null) THEN (1) ELSE (prrmexported) END, ',', CASE WHEN (prrmckdel is null) THEN (1) ELSE (prrmckdel) END, ',', CASE WHEN (slice_status is null) THEN (1) ELSE (slice_status) END, ',', CASE WHEN (role_id is null) THEN (1) ELSE (role_id) END, ',', CASE WHEN 
 (length(user_lov1) is null) THEN ('') ELSE (user_lov1) END, ',', CASE WHEN (length(user_lov2) is null) THEN ('') ELSE (user_lov2) END, ',', CASE WHEN (incident_id is null) THEN (1) ELSE (incident_id) END, ',', CASE WHEN (incident_investment_id is null) THEN (1) ELSE (incident_investment_id) END, ',', CASE WHEN (odf_ss_actuals is null) THEN (1) ELSE (odf_ss_actuals) END) (type: string)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: bigint)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: bigint)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col0 (type: bigint), _col2 (type: bigint), _col3 (type: bigint), _col4 (type: bigint), _col5 (type: bigint), _col6 (type: bigint), _col7 (type: varchar(96)), _col8 (type: timestamp), _col9 (type: bigint), _col10 (type: bigint), _col11 (type: int), _col12 (type: bigint), _col13 (type: varchar(30)), _col14 (type: varchar(30)), _col15 (type: bigint), _col16 (type: bigint), _col17 (type: bigint), _col18 (type: decimal(38,20))
+                  value expressions: _col0 (type: bigint), _col2 (type: string)
           TableScan
             alias: e
             filterExpr: prid is not null (type: boolean)
@@ -1211,15 +1211,15 @@ STAGE PLANS:
               predicate: prid is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: pruid (type: varchar(32)), prid (type: bigint), prtimesheetid (type: bigint), prassignmentid (type: bigint), prchargecodeid (type: bigint), prtypecodeid (type: bigint), prsequence (type: bigint), prmodby (type: varchar(96)), prmodtime (type: timestamp), prrmexported (type: bigint), prrmckdel (type: bigint), slice_status (type: int), role_id (type: bigint), user_lov1 (type: varchar(30)), user_lov2 (type: varchar(30)), incident_id (type: bigint), incident_investment_id (type: bigint), odf_ss_actuals (type: bigint), practsum (type: decimal(38,20))
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18
+                expressions: prid (type: bigint), concat(CASE WHEN (length(pruid) is null) THEN ('') ELSE (pruid) END, ',', prid, ',', CASE WHEN (prtimesheetid is null) THEN (1) ELSE (prtimesheetid) END, ',', CASE WHEN (prassignmentid is null) THEN (1) ELSE (prassignmentid) END, ',', CASE WHEN (prchargecodeid is null) THEN (1) ELSE (prchargecodeid) END, ',', CASE WHEN (prtypecodeid is null) THEN ('') ELSE (prtypecodeid) END, ',', CASE WHEN (practsum is null) THEN (1) ELSE (practsum) END, ',', CASE WHEN (prsequence is null) THEN (1) ELSE (prsequence) END, ',', CASE WHEN (length(prmodby) is null) THEN ('') ELSE (prmodby) END, ',', CASE WHEN (prmodtime is null) THEN (TIMESTAMP'2017-12-08 00:00:00') ELSE (prmodtime) END, ',', CASE WHEN (prrmexported is null) THEN (1) ELSE (prrmexported) END, ',', CASE WHEN (prrmckdel is null) THEN (1) ELSE (prrmckdel) END, ',', CASE WHEN (slice_status is null) THEN (1) ELSE (slice_status) END, ',', CASE WHEN (role_id is null) THEN (1) ELSE (role_id) END
 , ',', CASE WHEN (length(user_lov1) is null) THEN ('') ELSE (user_lov1) END, ',', CASE WHEN (length(user_lov2) is null) THEN ('') ELSE (user_lov2) END, ',', CASE WHEN (incident_id is null) THEN (1) ELSE (incident_id) END, ',', CASE WHEN (incident_investment_id is null) THEN (1) ELSE (incident_investment_id) END, ',', CASE WHEN (odf_ss_actuals is null) THEN (1) ELSE (odf_ss_actuals) END) (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: bigint)
+                  key expressions: _col0 (type: bigint)
                   sort order: +
-                  Map-reduce partition columns: _col1 (type: bigint)
+                  Map-reduce partition columns: _col0 (type: bigint)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col0 (type: varchar(32)), _col2 (type: bigint), _col3 (type: bigint), _col4 (type: bigint), _col5 (type: bigint), _col6 (type: bigint), _col7 (type: varchar(96)), _col8 (type: timestamp), _col9 (type: bigint), _col10 (type: bigint), _col11 (type: int), _col12 (type: bigint), _col13 (type: varchar(30)), _col14 (type: varchar(30)), _col15 (type: bigint), _col16 (type: bigint), _col17 (type: bigint), _col18 (type: decimal(38,20))
+                  value expressions: _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1228,11 +1228,11 @@ STAGE PLANS:
           keys:
             0 _col1 (type: bigint)
             1 _col0 (type: bigint)
-            2 _col1 (type: bigint)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29, _col30, _col31, _col32, _col33, _col34, _col35, _col36, _col37, _col38
+            2 _col0 (type: bigint)
+          outputColumnNames: _col0, _col2, _col5
           Statistics: Num rows: 2 Data size: 0 Basic stats: PARTIAL Column stats: NONE
           Filter Operator
-            predicate: (concat(CAST( _col1 AS STRING), ',', CASE WHEN (_col2 is null) THEN (1) ELSE (_col2) END, ',', CASE WHEN (_col3 is null) THEN (1) ELSE (_col3) END, ',', CASE WHEN (_col4 is null) THEN (1) ELSE (_col4) END, ',', CASE WHEN (_col5 is null) THEN ('') ELSE (_col5) END, ',', CASE WHEN (_col18 is null) THEN (1) ELSE (_col18) END, ',', CASE WHEN (_col6 is null) THEN (1) ELSE (_col6) END, ',', CASE WHEN (length(_col7) is null) THEN ('') ELSE (_col7) END, ',', CASE WHEN (_col8 is null) THEN (TIMESTAMP'2017-12-08 00:00:00') ELSE (_col8) END, ',', CASE WHEN (_col9 is null) THEN (1) ELSE (_col9) END, ',', CASE WHEN (_col10 is null) THEN (1) ELSE (_col10) END, ',', CASE WHEN (_col11 is null) THEN (1) ELSE (_col11) END, ',', CASE WHEN (_col12 is null) THEN (1) ELSE (_col12) END, ',', CASE WHEN (length(_col13) is null) THEN ('') ELSE (_col13) END, ',', CASE WHEN (length(_col14) is null) THEN ('') ELSE (_col14) END, ',', CASE WHEN (_col15 is null) THEN (1) ELSE (_col15) END, '
 ,', CASE WHEN (_col16 is null) THEN (1) ELSE (_col16) END, ',', CASE WHEN (_col17 is null) THEN (1) ELSE (_col17) END) <> concat(CASE WHEN (length(_col20) is null) THEN ('') ELSE (_col20) END, ',', _col21, ',', CASE WHEN (_col22 is null) THEN (1) ELSE (_col22) END, ',', CASE WHEN (_col23 is null) THEN (1) ELSE (_col23) END, ',', CASE WHEN (_col24 is null) THEN (1) ELSE (_col24) END, ',', CASE WHEN (_col25 is null) THEN ('') ELSE (_col25) END, ',', CASE WHEN (_col38 is null) THEN (1) ELSE (_col38) END, ',', CASE WHEN (_col26 is null) THEN (1) ELSE (_col26) END, ',', CASE WHEN (length(_col27) is null) THEN ('') ELSE (_col27) END, ',', CASE WHEN (_col28 is null) THEN (TIMESTAMP'2017-12-08 00:00:00') ELSE (_col28) END, ',', CASE WHEN (_col29 is null) THEN (1) ELSE (_col29) END, ',', CASE WHEN (_col30 is null) THEN (1) ELSE (_col30) END, ',', CASE WHEN (_col31 is null) THEN (1) ELSE (_col31) END, ',', CASE WHEN (_col32 is null) THEN (1) ELSE (_col32) END, ',', CASE WHEN (length(_col33) i
 s null) THEN ('') ELSE (_col33) END, ',', CASE WHEN (length(_col34) is null) THEN ('') ELSE (_col34) END, ',', CASE WHEN (_col35 is null) THEN (1) ELSE (_col35) END, ',', CASE WHEN (_col36 is null) THEN (1) ELSE (_col36) END, ',', CASE WHEN (_col37 is null) THEN (1) ELSE (_col37) END)) (type: boolean)
+            predicate: (_col2 <> _col5) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Select Operator
               expressions: _col0 (type: bigint)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/innerjoin1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/innerjoin1.q.out b/ql/src/test/results/clientpositive/innerjoin1.q.out
index e751a5c..0bde0c9 100644
--- a/ql/src/test/results/clientpositive/innerjoin1.q.out
+++ b/ql/src/test/results/clientpositive/innerjoin1.q.out
@@ -88,13 +88,13 @@ STAGE PLANS:
               predicate: CASE WHEN (a1 is not null) THEN (a1 is not null) ELSE (a2 is not null) END (type: boolean)
               Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: a1 (type: string), a2 (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: a1 (type: string), a2 (type: string), CASE WHEN (a1 is not null) THEN (a1) ELSE (a2) END (type: string)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
+                  key expressions: _col2 (type: string)
                   sort order: +
-                  Map-reduce partition columns: CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
+                  Map-reduce partition columns: _col2 (type: string)
                   Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string), _col1 (type: string)
           TableScan
@@ -105,13 +105,13 @@ STAGE PLANS:
               predicate: CASE WHEN (b1 is not null) THEN (b1 is not null) ELSE (b2 is not null) END (type: boolean)
               Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: b1 (type: string), b2 (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: b1 (type: string), b2 (type: string), CASE WHEN (b1 is not null) THEN (b1) ELSE (b2) END (type: string)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
+                  key expressions: _col2 (type: string)
                   sort order: +
-                  Map-reduce partition columns: CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
+                  Map-reduce partition columns: _col2 (type: string)
                   Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
@@ -119,17 +119,21 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
-            1 CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+            0 _col2 (type: string)
+            1 _col2 (type: string)
+          outputColumnNames: _col0, _col1, _col3, _col4
           Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
             Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -175,13 +179,13 @@ STAGE PLANS:
               predicate: CASE WHEN (a1 is not null) THEN (a1 is not null) ELSE (a2 is not null) END (type: boolean)
               Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: a1 (type: string), a2 (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: a1 (type: string), a2 (type: string), CASE WHEN (a1 is not null) THEN (a1) ELSE (a2) END (type: string)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
+                  key expressions: _col2 (type: string)
                   sort order: +
-                  Map-reduce partition columns: CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
+                  Map-reduce partition columns: _col2 (type: string)
                   Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string), _col1 (type: string)
           TableScan
@@ -192,13 +196,13 @@ STAGE PLANS:
               predicate: CASE WHEN (b1 is not null) THEN (b1 is not null) ELSE (b2 is not null) END (type: boolean)
               Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: b1 (type: string), b2 (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: b1 (type: string), b2 (type: string), CASE WHEN (b1 is not null) THEN (b1) ELSE (b2) END (type: string)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
+                  key expressions: _col2 (type: string)
                   sort order: +
-                  Map-reduce partition columns: CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
+                  Map-reduce partition columns: _col2 (type: string)
                   Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
@@ -206,17 +210,21 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
-            1 CASE WHEN (_col0 is not null) THEN (_col0) ELSE (_col1) END (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+            0 _col2 (type: string)
+            1 _col2 (type: string)
+          outputColumnNames: _col0, _col1, _col3, _col4
           Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
             Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/input23.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/input23.q.out b/ql/src/test/results/clientpositive/input23.q.out
index 6731320..4140b3c 100644
--- a/ql/src/test/results/clientpositive/input23.q.out
+++ b/ql/src/test/results/clientpositive/input23.q.out
@@ -12,10 +12,10 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 #### A masked pattern was here ####
 OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, CAST('2008-04-08' AS STRING) AS `ds`, CAST('11' AS STRING) AS `hr`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`, CAST('2008-04-08' AS STRING) AS `ds1`, CAST('14' AS STRING) AS `hr1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`, CAST('11' AS STRING) AS `hr`
+FROM (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = '11') AS `t0`,
-(SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`, CAST('14' AS STRING) AS `hr`
+(SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = '14') AS `t2`
 LIMIT 5
@@ -125,10 +125,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 500 Data size: 5812 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: _col0 (type: string), _col1 (type: string), '2008-04-08' (type: string), '11' (type: string), _col4 (type: string), _col5 (type: string), '2008-04-08' (type: string), '14' (type: string)
+            expressions: _col0 (type: string), _col1 (type: string), '2008-04-08' (type: string), '11' (type: string), _col2 (type: string), _col3 (type: string), '2008-04-08' (type: string), '14' (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
             Statistics: Num rows: 500 Data size: 5812 Basic stats: PARTIAL Column stats: NONE
             Limit

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/interval_3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/interval_3.q.out b/ql/src/test/results/clientpositive/interval_3.q.out
index e77c4a9..f1dae98 100644
--- a/ql/src/test/results/clientpositive/interval_3.q.out
+++ b/ql/src/test/results/clientpositive/interval_3.q.out
@@ -155,24 +155,24 @@ STAGE PLANS:
             alias: d1
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Select Operator
-              expressions: d_week_seq (type: int), d_date (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: d_week_seq (type: int), ((((((CAST( d_date AS DATE) + INTERVAL'1-0') + INTERVAL'0-2') + INTERVAL'5 00:00:00.000000000') + INTERVAL'0 04:00:00.000000000') + INTERVAL'0 00:10:00.000000000') + INTERVAL'0 00:00:09.000000000') (type: timestamp), (CAST( d_date AS DATE) + INTERVAL'1-2') (type: date)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: timestamp), _col2 (type: date)
           TableScan
             alias: d3
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Select Operator
-              expressions: d_date (type: string)
-              outputColumnNames: _col0
+              expressions: CAST( CAST( d_date AS DATE) AS TIMESTAMP) (type: timestamp), CAST( d_date AS DATE) (type: date)
+              outputColumnNames: _col0, _col1
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                value expressions: _col0 (type: string)
+                value expressions: _col0 (type: timestamp), _col1 (type: date)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -180,10 +180,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
           Filter Operator
-            predicate: ((CAST( CAST( _col2 AS DATE) AS TIMESTAMP) > ((((((CAST( _col1 AS DATE) + INTERVAL'1-0') + INTERVAL'0-2') + INTERVAL'5 00:00:00.000000000') + INTERVAL'0 04:00:00.000000000') + INTERVAL'0 00:10:00.000000000') + INTERVAL'0 00:00:09.000000000')) and (CAST( _col2 AS DATE) < (CAST( _col1 AS DATE) + INTERVAL'1-2'))) (type: boolean)
+            predicate: ((_col3 > _col1) and (_col4 < _col2)) (type: boolean)
             Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
             Select Operator
               expressions: _col0 (type: int)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join13.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join13.q.out b/ql/src/test/results/clientpositive/join13.q.out
index f9e84b9..426de83 100644
--- a/ql/src/test/results/clientpositive/join13.q.out
+++ b/ql/src/test/results/clientpositive/join13.q.out
@@ -100,13 +100,13 @@ STAGE PLANS:
               predicate: (UDFToDouble(key) < 200.0D) (type: boolean)
               Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
+                expressions: UDFToDouble(key) (type: double)
                 outputColumnNames: _col0
                 Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col0 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col0 (type: double)
                   Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
@@ -114,7 +114,7 @@ STAGE PLANS:
                Inner Join 0 to 1
           keys:
             0 (UDFToDouble(_col2) + UDFToDouble(_col0)) (type: double)
-            1 UDFToDouble(_col0) (type: double)
+            1 _col0 (type: double)
           outputColumnNames: _col1, _col2
           Statistics: Num rows: 200 Data size: 2132 Basic stats: COMPLETE Column stats: NONE
           Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join2.q.out b/ql/src/test/results/clientpositive/join2.q.out
index 4f6aeda..1462ecf 100644
--- a/ql/src/test/results/clientpositive/join2.q.out
+++ b/ql/src/test/results/clientpositive/join2.q.out
@@ -36,14 +36,15 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: double)
           TableScan
             alias: src2
             filterExpr: key is not null (type: boolean)
@@ -52,14 +53,15 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -67,7 +69,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1
+          outputColumnNames: _col0, _col1, _col3
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -81,9 +83,9 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             Reduce Output Operator
-              key expressions: (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
+              key expressions: (_col1 + _col3) (type: double)
               sort order: +
-              Map-reduce partition columns: (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
+              Map-reduce partition columns: (_col1 + _col3) (type: double)
               Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: string)
           TableScan
@@ -94,26 +96,26 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
+                expressions: value (type: string), UDFToDouble(key) (type: double)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col1 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col1 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col0 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col3
+            0 (_col1 + _col3) (type: double)
+            1 _col1 (type: double)
+          outputColumnNames: _col0, _col4
           Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: UDFToInteger(_col0) (type: int), _col3 (type: string)
+            expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join26.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join26.q.out b/ql/src/test/results/clientpositive/join26.q.out
index 3707d09..d167d70 100644
--- a/ql/src/test/results/clientpositive/join26.q.out
+++ b/ql/src/test/results/clientpositive/join26.q.out
@@ -29,7 +29,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j1_n10
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `key` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join32.q.out b/ql/src/test/results/clientpositive/join32.q.out
index 77060d9..b6e22ce 100644
--- a/ql/src/test/results/clientpositive/join32.q.out
+++ b/ql/src/test/results/clientpositive/join32.q.out
@@ -29,7 +29,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j1_n12
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join33.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join33.q.out b/ql/src/test/results/clientpositive/join33.q.out
index 321a9b7..bbf3cc5 100644
--- a/ql/src/test/results/clientpositive/join33.q.out
+++ b/ql/src/test/results/clientpositive/join33.q.out
@@ -29,7 +29,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j1_n7
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join42.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join42.q.out b/ql/src/test/results/clientpositive/join42.q.out
index 81ac363..f2985fe 100644
--- a/ql/src/test/results/clientpositive/join42.q.out
+++ b/ql/src/test/results/clientpositive/join42.q.out
@@ -211,9 +211,9 @@ STAGE PLANS:
               value expressions: _col1 (type: int), _col2 (type: int)
           TableScan
             Reduce Output Operator
-              key expressions: _col3 (type: int)
+              key expressions: _col2 (type: int)
               sort order: +
-              Map-reduce partition columns: _col3 (type: int)
+              Map-reduce partition columns: _col2 (type: int)
               Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
@@ -221,7 +221,7 @@ STAGE PLANS:
                Inner Join 0 to 1
           keys:
             0 _col0 (type: int)
-            1 _col3 (type: int)
+            1 _col2 (type: int)
           outputColumnNames: _col1, _col2
           Statistics: Num rows: 3 Data size: 63 Basic stats: COMPLETE Column stats: NONE
           Select Operator
@@ -248,14 +248,14 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 14 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: aid (type: int), pi_id (type: int)
-                outputColumnNames: _col1, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 14 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: int)
+                  key expressions: _col0 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col1 (type: int)
+                  Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 1 Data size: 14 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int)
+                  value expressions: _col1 (type: int)
           TableScan
             alias: a_n11
             filterExpr: id is not null (type: boolean)
@@ -277,9 +277,9 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 _col1 (type: int)
+            0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col2, _col3
+          outputColumnNames: _col1, _col2
           Statistics: Num rows: 1 Data size: 15 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -293,11 +293,11 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             Reduce Output Operator
-              key expressions: _col2 (type: int)
+              key expressions: _col1 (type: int)
               sort order: +
-              Map-reduce partition columns: _col2 (type: int)
+              Map-reduce partition columns: _col1 (type: int)
               Statistics: Num rows: 1 Data size: 15 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col3 (type: int)
+              value expressions: _col2 (type: int)
           TableScan
             alias: pi
             filterExpr: id is not null (type: boolean)
@@ -319,9 +319,9 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 _col2 (type: int)
+            0 _col1 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col3
+          outputColumnNames: _col2
           Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false


[03/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/smb_mapjoin_46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/smb_mapjoin_46.q.out b/ql/src/test/results/clientpositive/smb_mapjoin_46.q.out
index 98789d7..ddb436b 100644
--- a/ql/src/test/results/clientpositive/smb_mapjoin_46.q.out
+++ b/ql/src/test/results/clientpositive/smb_mapjoin_46.q.out
@@ -187,25 +187,28 @@ STAGE PLANS:
             alias: test1_n5
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Sorted Merge Bucket Map Join Operator
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {_col0 BETWEEN 100 AND 102}
+                  0 {_col3}
                   1 
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                File Output Operator
-                  compressed: false
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                  File Output Operator
+                    compressed: false
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -283,7 +286,7 @@ STAGE PLANS:
                 Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   filter predicates:
-                    0 {_col0 BETWEEN 100 AND 102}
+                    0 {_col3}
                     1 
                   keys:
                     0 
@@ -296,27 +299,31 @@ STAGE PLANS:
             alias: test1_n5
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {_col0 BETWEEN 100 AND 102}
+                  0 {_col3}
                   1 
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Execution mode: vectorized
       Local Work:
         Map Reduce Local Work
@@ -461,7 +468,7 @@ STAGE PLANS:
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 filter predicates:
-                  0 {_col0 BETWEEN 100 AND 102}
+                  0 {_col3}
                   1 
                 keys:
                   0 
@@ -474,27 +481,31 @@ STAGE PLANS:
             alias: test1_n5
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {_col0 BETWEEN 100 AND 102}
+                  0 {_col3}
                   1 
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Execution mode: vectorized
       Local Work:
         Map Reduce Local Work
@@ -586,8 +597,8 @@ STAGE PLANS:
             alias: test1_n5
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -595,16 +606,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col5) or _col3 or _col4 BETWEEN 100 AND 102)}
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -698,8 +713,8 @@ STAGE PLANS:
             alias: test1_n5
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -707,16 +722,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col5) or _col3)}
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -893,8 +912,8 @@ STAGE PLANS:
             alias: test1_n5
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Sorted Merge Bucket Map Join Operator
                 condition map:
@@ -902,14 +921,17 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                File Output Operator
-                  compressed: false
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                  File Output Operator
+                    compressed: false
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -996,8 +1018,8 @@ STAGE PLANS:
             alias: test2_n3
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -1005,16 +1027,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col6)}
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -1215,8 +1241,8 @@ STAGE PLANS:
             alias: test2_n3
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -1224,16 +1250,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col4) or _col6)}
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -1302,8 +1332,8 @@ STAGE PLANS:
             alias: test2_n3
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Sorted Merge Bucket Map Join Operator
                 condition map:
@@ -1311,14 +1341,17 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                File Output Operator
-                  compressed: false
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                  File Output Operator
+                    compressed: false
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/smb_mapjoin_47.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/smb_mapjoin_47.q.out b/ql/src/test/results/clientpositive/smb_mapjoin_47.q.out
index 42940d9..0276595 100644
--- a/ql/src/test/results/clientpositive/smb_mapjoin_47.q.out
+++ b/ql/src/test/results/clientpositive/smb_mapjoin_47.q.out
@@ -404,8 +404,8 @@ STAGE PLANS:
             alias: test2_n5
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -419,8 +419,8 @@ STAGE PLANS:
             alias: test1_n8
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -428,19 +428,23 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                residual filter predicates: {((_col1 = _col5) or _col3 or _col7)}
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                Limit
-                  Number of rows: 10
-                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                  Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                  Limit
+                    Number of rows: 10
                     Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/auto_join13.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join13.q.out b/ql/src/test/results/clientpositive/spark/auto_join13.q.out
index bade284..0a0bdd3 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join13.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join13.q.out
@@ -64,13 +64,13 @@ STAGE PLANS:
                     predicate: (UDFToDouble(key) < 200.0D) (type: boolean)
                     Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToDouble(key) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
                           0 (UDFToDouble(_col2) + UDFToDouble(_col0)) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          1 _col0 (type: double)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -109,7 +109,7 @@ STAGE PLANS:
                                Inner Join 0 to 1
                           keys:
                             0 (UDFToDouble(_col2) + UDFToDouble(_col0)) (type: double)
-                            1 UDFToDouble(_col0) (type: double)
+                            1 _col0 (type: double)
                           outputColumnNames: _col1, _col2
                           input vertices:
                             1 Map 4

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/auto_join19.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join19.q.out b/ql/src/test/results/clientpositive/spark/auto_join19.q.out
index b0d2552..9ab1b8b 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join19.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join19.q.out
@@ -85,12 +85,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col4
+                        outputColumnNames: _col0, _col2
                         input vertices:
                           1 Map 2
                         Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
+                          expressions: UDFToInteger(_col0) (type: int), _col2 (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
                           File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/auto_join2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join2.q.out b/ql/src/test/results/clientpositive/spark/auto_join2.q.out
index 32026e4..6aeadb5 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join2.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join2.q.out
@@ -39,8 +39,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -59,13 +59,13 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 (_col1 + _col3) (type: double)
+                          1 _col1 (type: double)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -84,8 +84,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -93,7 +93,7 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col1
+                        outputColumnNames: _col0, _col1, _col3
                         input vertices:
                           1 Map 2
                         Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
@@ -101,14 +101,14 @@ STAGE PLANS:
                           condition map:
                                Inner Join 0 to 1
                           keys:
-                            0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                            1 UDFToDouble(_col0) (type: double)
-                          outputColumnNames: _col0, _col3
+                            0 (_col1 + _col3) (type: double)
+                            1 _col1 (type: double)
+                          outputColumnNames: _col0, _col4
                           input vertices:
                             1 Map 3
                           Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
                           Select Operator
-                            expressions: UDFToInteger(_col0) (type: int), _col3 (type: string)
+                            expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
                             outputColumnNames: _col0, _col1
                             Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
                             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/auto_join32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join32.q.out b/ql/src/test/results/clientpositive/spark/auto_join32.q.out
index ed3dfbe..7f7b5e9 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join32.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join32.q.out
@@ -499,10 +499,10 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col3
+                        outputColumnNames: _col0, _col2
                         Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                         Group By Operator
-                          keys: _col0 (type: string), _col3 (type: string)
+                          keys: _col0 (type: string), _col2 (type: string)
                           mode: hash
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/auto_join9.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join9.q.out b/ql/src/test/results/clientpositive/spark/auto_join9.q.out
index ce0e92d..e14fb06 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join9.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join9.q.out
@@ -77,12 +77,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col4
+                        outputColumnNames: _col0, _col2
                         input vertices:
                           1 Map 2
                         Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
+                          expressions: UDFToInteger(_col0) (type: int), _col2 (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                           File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out b/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out
index 59cd394..b64241c 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join_filters.q.out
@@ -81,13 +81,13 @@ STAGE PLANS:
                   alias: a
                   Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       sort order: 
                       Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized
         Map 4 
             Map Operator Tree:
@@ -95,13 +95,13 @@ STAGE PLANS:
                   alias: b
                   Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       sort order: 
                       Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -109,15 +109,15 @@ STAGE PLANS:
                 condition map:
                      Full Outer Join 0 to 1
                 filter predicates:
-                  0 {(VALUE._col0 > 40)} {(VALUE._col1 > 50)} {(VALUE._col0 = VALUE._col1)}
-                  1 {(VALUE._col0 > 40)} {(VALUE._col1 > 50)} {(VALUE._col0 = VALUE._col1)}
+                  0 {VALUE._col2} {VALUE._col3} {VALUE._col4}
+                  1 {VALUE._col2} {VALUE._col3} {VALUE._col4}
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col5, _col6
                 Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+                  expressions: hash(_col0,_col1,_col5,_col6) (type: int)
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -331,15 +331,15 @@ STAGE PLANS:
                   alias: a
                   Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
                       Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int)
+                      value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized
         Map 4 
             Map Operator Tree:
@@ -347,15 +347,15 @@ STAGE PLANS:
                   alias: b
                   Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
                       Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int)
+                      value expressions: _col0 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -363,15 +363,15 @@ STAGE PLANS:
                 condition map:
                      Full Outer Join 0 to 1
                 filter predicates:
-                  0 {(KEY.reducesinkkey0 > 40)} {(VALUE._col0 > 50)} {(KEY.reducesinkkey0 = VALUE._col0)}
-                  1 {(VALUE._col0 > 40)} {(KEY.reducesinkkey0 > 50)} {(VALUE._col0 = KEY.reducesinkkey0)}
+                  0 {VALUE._col1} {VALUE._col2} {VALUE._col3}
+                  1 {VALUE._col1} {VALUE._col2} {VALUE._col3}
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col5, _col6
                 Statistics: Num rows: 1 Data size: 242 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+                  expressions: hash(_col0,_col1,_col5,_col6) (type: int)
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 242 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -763,15 +763,15 @@ STAGE PLANS:
                   alias: a
                   Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
                       Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int)
+                      value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized
         Map 4 
             Map Operator Tree:
@@ -779,15 +779,15 @@ STAGE PLANS:
                   alias: b
                   Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
                       Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int)
+                      value expressions: _col0 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -795,15 +795,15 @@ STAGE PLANS:
                 condition map:
                      Full Outer Join 0 to 1
                 filter predicates:
-                  0 {(KEY.reducesinkkey0 > 40)} {(VALUE._col0 > 50)} {(KEY.reducesinkkey0 = VALUE._col0)}
-                  1 {(VALUE._col0 > 40)} {(KEY.reducesinkkey0 > 50)} {(VALUE._col0 = KEY.reducesinkkey0)}
+                  0 {VALUE._col1} {VALUE._col2} {VALUE._col3}
+                  1 {VALUE._col1} {VALUE._col2} {VALUE._col3}
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col5, _col6
                 Statistics: Num rows: 1 Data size: 242 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+                  expressions: hash(_col0,_col1,_col5,_col6) (type: int)
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 242 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/auto_join_stats.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join_stats.q.out b/ql/src/test/results/clientpositive/spark/auto_join_stats.q.out
index e181ff2..a6d0922 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join_stats.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join_stats.q.out
@@ -52,13 +52,13 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 (_col1 + _col3) (type: double)
+                          1 _col1 (type: double)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -79,14 +79,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: double)
             Execution mode: vectorized
         Map 3 
             Map Operator Tree:
@@ -98,14 +99,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: double)
             Execution mode: vectorized
         Reducer 2 
             Local Work:
@@ -117,25 +119,29 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
                   keys:
-                    0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
-                  outputColumnNames: _col0, _col1, _col2
+                    0 (_col1 + _col3) (type: double)
+                    1 _col1 (type: double)
+                  outputColumnNames: _col0, _col2, _col4
                   input vertices:
                     1 Map 4
                   Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
+                  Select Operator
+                    expressions: _col0 (type: string), _col2 (type: string), _col4 (type: string)
+                    outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -211,14 +217,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToDouble(key) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
-                          2 UDFToDouble(_col0) (type: double)
+                          0 (_col1 + _col3) (type: double)
+                          1 _col0 (type: double)
+                          2 _col1 (type: double)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -232,14 +238,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
-                          2 UDFToDouble(_col0) (type: double)
+                          0 (_col1 + _col3) (type: double)
+                          1 _col0 (type: double)
+                          2 _col1 (type: double)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -260,14 +266,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: double)
             Execution mode: vectorized
         Map 3 
             Map Operator Tree:
@@ -279,14 +286,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: double)
             Execution mode: vectorized
         Reducer 2 
             Local Work:
@@ -298,23 +306,23 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
                        Inner Join 0 to 2
                   keys:
-                    0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
-                    2 UDFToDouble(_col0) (type: double)
-                  outputColumnNames: _col0, _col1, _col3
+                    0 (_col1 + _col3) (type: double)
+                    1 _col0 (type: double)
+                    2 _col1 (type: double)
+                  outputColumnNames: _col0, _col2, _col5
                   input vertices:
                     1 Map 4
                     2 Map 5
                   Statistics: Num rows: 1210 Data size: 12854 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string)
+                    expressions: _col0 (type: string), _col2 (type: string), _col5 (type: string)
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 1210 Data size: 12854 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/auto_join_stats2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_join_stats2.q.out b/ql/src/test/results/clientpositive/spark/auto_join_stats2.q.out
index 6fe4b10..fbcc489 100644
--- a/ql/src/test/results/clientpositive/spark/auto_join_stats2.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_join_stats2.q.out
@@ -45,8 +45,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -65,8 +65,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -90,8 +90,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -99,7 +99,7 @@ STAGE PLANS:
                         keys:
                           0 
                           1 
-                        outputColumnNames: _col0, _col1
+                        outputColumnNames: _col0, _col1, _col2, _col3
                         input vertices:
                           1 Map 2
                         Statistics: Num rows: 500 Data size: 155812 Basic stats: COMPLETE Column stats: NONE
@@ -109,15 +109,15 @@ STAGE PLANS:
                           keys:
                             0 _col0 (type: string)
                             1 _col0 (type: string)
-                          outputColumnNames: _col0, _col1, _col2
+                          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                           input vertices:
                             1 Map 3
                           Statistics: Num rows: 550 Data size: 171393 Basic stats: COMPLETE Column stats: NONE
                           Filter Operator
-                            predicate: ((UDFToDouble(_col2) + UDFToDouble(_col0)) = UDFToDouble(_col1)) (type: boolean)
+                            predicate: ((_col5 + _col1) = _col3) (type: boolean)
                             Statistics: Num rows: 275 Data size: 85696 Basic stats: COMPLETE Column stats: NONE
                             Select Operator
-                              expressions: _col2 (type: string), _col0 (type: string), _col1 (type: string)
+                              expressions: _col4 (type: string), _col0 (type: string), _col2 (type: string)
                               outputColumnNames: _col0, _col1, _col2
                               Statistics: Num rows: 275 Data size: 85696 Basic stats: COMPLETE Column stats: NONE
                               File Output Operator
@@ -206,8 +206,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -226,14 +226,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToDouble(key) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
-                          2 UDFToDouble(_col0) (type: double)
+                          0 (_col1 + _col3) (type: double)
+                          1 _col0 (type: double)
+                          2 _col1 (type: double)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -247,14 +247,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
-                          2 UDFToDouble(_col0) (type: double)
+                          0 (_col1 + _col3) (type: double)
+                          1 _col0 (type: double)
+                          2 _col1 (type: double)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -273,8 +273,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -282,7 +282,7 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col1
+                        outputColumnNames: _col0, _col1, _col2, _col3
                         input vertices:
                           1 Map 2
                         Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
@@ -291,16 +291,16 @@ STAGE PLANS:
                                Inner Join 0 to 1
                                Inner Join 0 to 2
                           keys:
-                            0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                            1 UDFToDouble(_col0) (type: double)
-                            2 UDFToDouble(_col0) (type: double)
-                          outputColumnNames: _col0, _col1, _col3
+                            0 (_col1 + _col3) (type: double)
+                            1 _col0 (type: double)
+                            2 _col1 (type: double)
+                          outputColumnNames: _col0, _col2, _col5
                           input vertices:
                             1 Map 3
                             2 Map 4
                           Statistics: Num rows: 1210 Data size: 12854 Basic stats: COMPLETE Column stats: NONE
                           Select Operator
-                            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string)
+                            expressions: _col0 (type: string), _col2 (type: string), _col5 (type: string)
                             outputColumnNames: _col0, _col1, _col2
                             Statistics: Num rows: 1210 Data size: 12854 Basic stats: COMPLETE Column stats: NONE
                             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/auto_sortmerge_join_6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/auto_sortmerge_join_6.q.out b/ql/src/test/results/clientpositive/spark/auto_sortmerge_join_6.q.out
index 7491c7b..6fe72d7 100644
--- a/ql/src/test/results/clientpositive/spark/auto_sortmerge_join_6.q.out
+++ b/ql/src/test/results/clientpositive/spark/auto_sortmerge_join_6.q.out
@@ -558,13 +558,13 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToDouble(key) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
         Map 5 
@@ -577,13 +577,13 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int)
-                      outputColumnNames: _col0
+                      expressions: key (type: int), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col1 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                        Map-reduce partition columns: _col1 (type: double)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int)
             Execution mode: vectorized
@@ -612,8 +612,8 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
+                  0 _col0 (type: double)
+                  1 _col1 (type: double)
                 outputColumnNames: _col1
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
@@ -1071,13 +1071,13 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToDouble(key) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
         Map 5 
@@ -1090,13 +1090,13 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int)
-                      outputColumnNames: _col0
+                      expressions: key (type: int), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col1 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                        Map-reduce partition columns: _col1 (type: double)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int)
             Execution mode: vectorized
@@ -1125,8 +1125,8 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
+                  0 _col0 (type: double)
+                  1 _col1 (type: double)
                 outputColumnNames: _col1
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucket_map_join_spark1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucket_map_join_spark1.q.out b/ql/src/test/results/clientpositive/spark/bucket_map_join_spark1.q.out
index 80eefef..b951591 100644
--- a/ql/src/test/results/clientpositive/spark/bucket_map_join_spark1.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucket_map_join_spark1.q.out
@@ -130,7 +130,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n19`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n16`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -461,7 +461,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n19`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n16`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucket_map_join_spark2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucket_map_join_spark2.q.out b/ql/src/test/results/clientpositive/spark/bucket_map_join_spark2.q.out
index 6f25359..7752b4c 100644
--- a/ql/src/test/results/clientpositive/spark/bucket_map_join_spark2.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucket_map_join_spark2.q.out
@@ -114,7 +114,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n12`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n10`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -445,7 +445,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n12`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n10`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucket_map_join_spark3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucket_map_join_spark3.q.out b/ql/src/test/results/clientpositive/spark/bucket_map_join_spark3.q.out
index e6bc741..fe81ef5 100644
--- a/ql/src/test/results/clientpositive/spark/bucket_map_join_spark3.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucket_map_join_spark3.q.out
@@ -114,7 +114,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n4`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n3`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -445,7 +445,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n4`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n3`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucket_map_join_spark4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucket_map_join_spark4.q.out b/ql/src/test/results/clientpositive/spark/bucket_map_join_spark4.q.out
index f072ab0..339fe44 100644
--- a/ql/src/test/results/clientpositive/spark/bucket_map_join_spark4.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucket_map_join_spark4.q.out
@@ -74,7 +74,7 @@ POSTHOOK: Input: default@tbl1_n0
 POSTHOOK: Input: default@tbl2_n0
 POSTHOOK: Input: default@tbl3
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value` AS `val1`, `t4`.`value` AS `val2`, `t2`.`value` AS `val3`
+OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t4`.`value` AS `value0`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`tbl1_n0`
 WHERE `key` IS NOT NULL AND `value` IS NOT NULL) AS `t0`
@@ -474,7 +474,7 @@ POSTHOOK: Input: default@tbl1_n0
 POSTHOOK: Input: default@tbl2_n0
 POSTHOOK: Input: default@tbl3
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value` AS `val1`, `t4`.`value` AS `val2`, `t2`.`value` AS `val3`
+OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t4`.`value` AS `value0`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`tbl1_n0`
 WHERE `key` IS NOT NULL AND `value` IS NOT NULL) AS `t0`


[21/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query23.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query23.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query23.q.out
index ace7cf5..b55f2c1 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query23.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query23.q.out
@@ -1,7 +1,7 @@
-Warning: Shuffle Join MERGEJOIN[593][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 29' is a cross product
-Warning: Shuffle Join MERGEJOIN[594][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 30' is a cross product
-Warning: Shuffle Join MERGEJOIN[596][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 33' is a cross product
-Warning: Shuffle Join MERGEJOIN[597][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 34' is a cross product
+Warning: Shuffle Join MERGEJOIN[583][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 29' is a cross product
+Warning: Shuffle Join MERGEJOIN[584][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 30' is a cross product
+Warning: Shuffle Join MERGEJOIN[586][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 33' is a cross product
+Warning: Shuffle Join MERGEJOIN[587][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 34' is a cross product
 PREHOOK: query: explain cbo
 with frequent_ss_items as 
  (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt
@@ -128,16 +128,15 @@ HiveSortLimit(fetch=[100])
             HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject($f0=[$0])
                 HiveJoin(condition=[>($1, *(0.95, $3))], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject($f0=[$0], $f1=[$1])
-                    HiveAggregate(group=[{0}], agg#0=[sum($1)])
-                      HiveProject($f0=[$3], $f1=[*(CAST($1):DECIMAL(10, 0), $2)])
-                        HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-                          HiveProject(ss_customer_sk=[$3], ss_quantity=[$10], ss_sales_price=[$13])
-                            HiveFilter(condition=[IS NOT NULL($3)])
-                              HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                          HiveProject(c_customer_sk=[$0])
-                            HiveFilter(condition=[IS NOT NULL($0)])
-                              HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                  HiveProject(c_customer_sk=[$0], $f1=[$1])
+                    HiveAggregate(group=[{2}], agg#0=[sum($1)])
+                      HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveProject(ss_customer_sk=[$3], *=[*(CAST($10):DECIMAL(10, 0), $13)])
+                          HiveFilter(condition=[IS NOT NULL($3)])
+                            HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                        HiveProject(c_customer_sk=[$0])
+                          HiveFilter(condition=[IS NOT NULL($0)])
+                            HiveTableScan(table=[[default, customer]], table:alias=[customer])
                   HiveJoin(condition=[true], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(cnt=[$0])
                       HiveFilter(condition=[<=(sq_count_check($0), 1)])
@@ -146,75 +145,71 @@ HiveSortLimit(fetch=[100])
                             HiveProject
                               HiveProject($f0=[$0])
                                 HiveAggregate(group=[{}], agg#0=[count($0)])
-                                  HiveProject($f0=[$0], $f1=[$1])
-                                    HiveAggregate(group=[{0}], agg#0=[sum($1)])
-                                      HiveProject($f0=[$0], $f1=[*(CAST($3):DECIMAL(10, 0), $4)])
-                                        HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                                          HiveProject(c_customer_sk=[$0])
-                                            HiveFilter(condition=[IS NOT NULL($0)])
-                                              HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                                          HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                                            HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_quantity=[$10], ss_sales_price=[$13])
-                                              HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                                                HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
-                                              HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
-                                                HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+                                  HiveProject(c_customer_sk=[$0], $f1=[$1])
+                                    HiveAggregate(group=[{0}], agg#0=[sum($3)])
+                                      HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                                        HiveProject(c_customer_sk=[$0])
+                                          HiveFilter(condition=[IS NOT NULL($0)])
+                                            HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                                        HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                                          HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], *=[*(CAST($10):DECIMAL(10, 0), $13)])
+                                            HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
+                                              HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                                          HiveProject(d_date_sk=[$0])
+                                            HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
+                                              HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                     HiveProject($f0=[$0])
                       HiveAggregate(group=[{}], agg#0=[max($1)])
-                        HiveProject($f0=[$0], $f1=[$1])
-                          HiveAggregate(group=[{0}], agg#0=[sum($1)])
-                            HiveProject($f0=[$0], $f1=[*(CAST($3):DECIMAL(10, 0), $4)])
-                              HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                                HiveProject(c_customer_sk=[$0])
-                                  HiveFilter(condition=[IS NOT NULL($0)])
-                                    HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                                HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                                  HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_quantity=[$10], ss_sales_price=[$13])
-                                    HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                                      HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                  HiveProject(d_date_sk=[$0], d_year=[$6])
-                                    HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
-                                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-              HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject($f1=[$0])
-                  HiveAggregate(group=[{1}])
-                    HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3])
-                      HiveFilter(condition=[>($3, 4)])
-                        HiveAggregate(group=[{0, 1, 2}], agg#0=[count()])
-                          HiveProject($f0=[substr($6, 1, 30)], $f1=[$5], $f2=[$3])
-                            HiveJoin(condition=[=($1, $5)], joinType=[inner], algorithm=[none], cost=[not available])
-                              HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-                                HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2])
-                                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2))])
+                        HiveProject(c_customer_sk=[$0], $f1=[$1])
+                          HiveAggregate(group=[{0}], agg#0=[sum($3)])
+                            HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                              HiveProject(c_customer_sk=[$0])
+                                HiveFilter(condition=[IS NOT NULL($0)])
+                                  HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                              HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], *=[*(CAST($10):DECIMAL(10, 0), $13)])
+                                  HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                HiveProject(d_date_sk=[$0], d_date=[$2], d_year=[$6])
+                                HiveProject(d_date_sk=[$0])
                                   HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
                                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                              HiveProject(i_item_sk=[$0], i_item_desc=[$4])
-                                HiveFilter(condition=[IS NOT NULL($0)])
-                                  HiveTableScan(table=[[default, item]], table:alias=[item])
+              HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(i_item_sk=[$0])
+                  HiveAggregate(group=[{1}])
+                    HiveFilter(condition=[>($3, 4)])
+                      HiveProject(substr=[$2], i_item_sk=[$1], d_date=[$0], $f3=[$3])
+                        HiveAggregate(group=[{3, 4, 5}], agg#0=[count()])
+                          HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                            HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+                              HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2])
+                                HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2))])
+                                  HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                              HiveProject(d_date_sk=[$0], d_date=[$2])
+                                HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
+                                  HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+                            HiveProject(i_item_sk=[$0], substr=[substr($4, 1, 30)])
+                              HiveFilter(condition=[IS NOT NULL($0)])
+                                HiveTableScan(table=[[default, item]], table:alias=[item])
                 HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_item_sk=[$15], cs_quantity=[$18], cs_list_price=[$20])
                     HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($3), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(1):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($6, 1999), =($8, 1), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(sales=[*(CAST($5):DECIMAL(10, 0), $6)])
             HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject($f0=[$0])
                 HiveJoin(condition=[>($1, *(0.95, $3))], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject($f0=[$0], $f1=[$1])
-                    HiveAggregate(group=[{0}], agg#0=[sum($1)])
-                      HiveProject($f0=[$3], $f1=[*(CAST($1):DECIMAL(10, 0), $2)])
-                        HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-                          HiveProject(ss_customer_sk=[$3], ss_quantity=[$10], ss_sales_price=[$13])
-                            HiveFilter(condition=[IS NOT NULL($3)])
-                              HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                          HiveProject(c_customer_sk=[$0])
-                            HiveFilter(condition=[IS NOT NULL($0)])
-                              HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                  HiveProject(c_customer_sk=[$0], $f1=[$1])
+                    HiveAggregate(group=[{2}], agg#0=[sum($1)])
+                      HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveProject(ss_customer_sk=[$3], *=[*(CAST($10):DECIMAL(10, 0), $13)])
+                          HiveFilter(condition=[IS NOT NULL($3)])
+                            HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                        HiveProject(c_customer_sk=[$0])
+                          HiveFilter(condition=[IS NOT NULL($0)])
+                            HiveTableScan(table=[[default, customer]], table:alias=[customer])
                   HiveJoin(condition=[true], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(cnt=[$0])
                       HiveFilter(condition=[<=(sq_count_check($0), 1)])
@@ -223,59 +218,56 @@ HiveSortLimit(fetch=[100])
                             HiveProject
                               HiveProject($f0=[$0])
                                 HiveAggregate(group=[{}], agg#0=[count($0)])
-                                  HiveProject($f0=[$0], $f1=[$1])
-                                    HiveAggregate(group=[{0}], agg#0=[sum($1)])
-                                      HiveProject($f0=[$0], $f1=[*(CAST($3):DECIMAL(10, 0), $4)])
-                                        HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                                          HiveProject(c_customer_sk=[$0])
-                                            HiveFilter(condition=[IS NOT NULL($0)])
-                                              HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                                          HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                                            HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_quantity=[$10], ss_sales_price=[$13])
-                                              HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                                                HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
-                                              HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
-                                                HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+                                  HiveProject(c_customer_sk=[$0], $f1=[$1])
+                                    HiveAggregate(group=[{0}], agg#0=[sum($3)])
+                                      HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                                        HiveProject(c_customer_sk=[$0])
+                                          HiveFilter(condition=[IS NOT NULL($0)])
+                                            HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                                        HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                                          HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], *=[*(CAST($10):DECIMAL(10, 0), $13)])
+                                            HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
+                                              HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                                          HiveProject(d_date_sk=[$0])
+                                            HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
+                                              HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                     HiveProject($f0=[$0])
                       HiveAggregate(group=[{}], agg#0=[max($1)])
-                        HiveProject($f0=[$0], $f1=[$1])
-                          HiveAggregate(group=[{0}], agg#0=[sum($1)])
-                            HiveProject($f0=[$0], $f1=[*(CAST($3):DECIMAL(10, 0), $4)])
-                              HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                                HiveProject(c_customer_sk=[$0])
-                                  HiveFilter(condition=[IS NOT NULL($0)])
-                                    HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                                HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                                  HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_quantity=[$10], ss_sales_price=[$13])
-                                    HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
-                                      HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                  HiveProject(d_date_sk=[$0], d_year=[$6])
-                                    HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
-                                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-              HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject($f1=[$0])
-                  HiveAggregate(group=[{1}])
-                    HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3])
-                      HiveFilter(condition=[>($3, 4)])
-                        HiveAggregate(group=[{0, 1, 2}], agg#0=[count()])
-                          HiveProject($f0=[substr($6, 1, 30)], $f1=[$5], $f2=[$3])
-                            HiveJoin(condition=[=($1, $5)], joinType=[inner], algorithm=[none], cost=[not available])
-                              HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-                                HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2])
-                                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2))])
+                        HiveProject(c_customer_sk=[$0], $f1=[$1])
+                          HiveAggregate(group=[{0}], agg#0=[sum($3)])
+                            HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                              HiveProject(c_customer_sk=[$0])
+                                HiveFilter(condition=[IS NOT NULL($0)])
+                                  HiveTableScan(table=[[default, customer]], table:alias=[customer])
+                              HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], *=[*(CAST($10):DECIMAL(10, 0), $13)])
+                                  HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                HiveProject(d_date_sk=[$0], d_date=[$2], d_year=[$6])
+                                HiveProject(d_date_sk=[$0])
                                   HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
                                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                              HiveProject(i_item_sk=[$0], i_item_desc=[$4])
-                                HiveFilter(condition=[IS NOT NULL($0)])
-                                  HiveTableScan(table=[[default, item]], table:alias=[item])
+              HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(i_item_sk=[$0])
+                  HiveAggregate(group=[{1}])
+                    HiveFilter(condition=[>($3, 4)])
+                      HiveProject(substr=[$2], i_item_sk=[$1], d_date=[$0], $f3=[$3])
+                        HiveAggregate(group=[{3, 4, 5}], agg#0=[count()])
+                          HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                            HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+                              HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2])
+                                HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2))])
+                                  HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                              HiveProject(d_date_sk=[$0], d_date=[$2])
+                                HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001, 2002), IS NOT NULL($0))])
+                                  HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+                            HiveProject(i_item_sk=[$0], substr=[substr($4, 1, 30)])
+                              HiveFilter(condition=[IS NOT NULL($0)])
+                                HiveTableScan(table=[[default, item]], table:alias=[item])
                 HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_bill_customer_sk=[$4], ws_quantity=[$18], ws_list_price=[$20])
                     HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($4), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(1):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($6, 1999), =($8, 1), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query24.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query24.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query24.q.out
index 1d005b8..3add88a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query24.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query24.q.out
@@ -119,50 +119,50 @@ HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3])
     HiveProject(c_last_name=[$1], c_first_name=[$0], s_store_name=[$2], $f3=[$3])
       HiveAggregate(group=[{4, 5, 7}], agg#0=[sum($9)])
         HiveProject(i_current_price=[$0], i_size=[$1], i_units=[$2], i_manager_id=[$3], c_first_name=[$4], c_last_name=[$5], ca_state=[$6], s_store_name=[$7], s_state=[$8], $f9=[$9])
-          HiveAggregate(group=[{8, 9, 11, 12, 15, 16, 19, 23, 25}], agg#0=[sum($6)])
+          HiveAggregate(group=[{8, 9, 10, 11, 14, 15, 18, 22, 23}], agg#0=[sum($6)])
             HiveJoin(condition=[AND(=($5, $1), =($2, $0))], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(sr_item_sk=[$2], sr_ticket_number=[$9])
                 HiveFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($2))])
                   HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-              HiveJoin(condition=[AND(=($1, $11), =($2, $20))], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[AND(=($1, $10), =($2, $19))], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_item_sk=[$2], ss_customer_sk=[$3], ss_store_sk=[$7], ss_ticket_number=[$9], ss_sales_price=[$13])
                     HiveFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($2), IS NOT NULL($7), IS NOT NULL($3))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(i_item_sk=[$0], i_current_price=[$5], i_size=[$15], i_color=[CAST(_UTF-16LE'orchid'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], i_units=[$18], i_manager_id=[$20])
+                  HiveProject(i_item_sk=[$0], i_current_price=[$5], i_size=[$15], i_units=[$18], i_manager_id=[$20])
                     HiveFilter(condition=[AND(=($17, _UTF-16LE'orchid'), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(c_customer_sk=[$0], c_current_addr_sk=[$1], c_first_name=[$2], c_last_name=[$3], c_birth_country=[$4], ca_address_sk=[$5], ca_state=[$6], ca_zip=[$7], ca_country=[$8], s_store_sk=[$9], s_store_name=[$10], s_market_id=[$11], s_state=[$12], s_zip=[$13])
-                  HiveJoin(condition=[AND(=($1, $5), <>($4, UPPER($8)))], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(c_customer_sk=[$0], c_current_addr_sk=[$1], c_first_name=[$2], c_last_name=[$3], c_birth_country=[$4], ca_address_sk=[$5], ca_state=[$6], ca_zip=[$7], UPPER=[$8], s_store_sk=[$9], s_store_name=[$10], s_state=[$11], s_zip=[$12])
+                  HiveJoin(condition=[AND(=($1, $5), <>($4, $8))], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(c_customer_sk=[$0], c_current_addr_sk=[$4], c_first_name=[$8], c_last_name=[$9], c_birth_country=[$14])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                         HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                    HiveJoin(condition=[=($8, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveProject(ca_address_sk=[$0], ca_state=[$8], ca_zip=[$9], ca_country=[$10])
+                    HiveJoin(condition=[=($7, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveProject(ca_address_sk=[$0], ca_state=[$8], ca_zip=[$9], UPPER=[UPPER($10)])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($9))])
                           HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-                      HiveProject(s_store_sk=[$0], s_store_name=[$5], s_market_id=[CAST(7):INTEGER], s_state=[$24], s_zip=[$25])
+                      HiveProject(s_store_sk=[$0], s_store_name=[$5], s_state=[$24], s_zip=[$25])
                         HiveFilter(condition=[AND(=($10, 7), IS NOT NULL($0), IS NOT NULL($25))])
                           HiveTableScan(table=[[default, store]], table:alias=[store])
     HiveProject(_o__c0=[*(0.05, /($0, $1))])
       HiveAggregate(group=[{}], agg#0=[sum($10)], agg#1=[count($10)])
         HiveProject(c_first_name=[$0], c_last_name=[$1], ca_state=[$2], s_store_name=[$3], s_state=[$4], i_current_price=[$5], i_size=[$6], i_color=[$7], i_units=[$8], i_manager_id=[$9], $f10=[$10])
-          HiveAggregate(group=[{7, 8, 11, 15, 17, 20, 21, 22, 23, 24}], agg#0=[sum($4)])
-            HiveJoin(condition=[AND(=($3, $26), =($0, $25))], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($0, $19)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveAggregate(group=[{7, 8, 11, 15, 16, 19, 20, 21, 22, 23}], agg#0=[sum($4)])
+            HiveJoin(condition=[AND(=($3, $25), =($0, $24))], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($0, $18)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[AND(=($1, $5), =($2, $14))], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_item_sk=[$2], ss_customer_sk=[$3], ss_store_sk=[$7], ss_ticket_number=[$9], ss_sales_price=[$13])
                     HiveFilter(condition=[AND(IS NOT NULL($9), IS NOT NULL($2), IS NOT NULL($7), IS NOT NULL($3))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveJoin(condition=[AND(=($1, $5), <>($4, UPPER($8)))], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveJoin(condition=[AND(=($1, $5), <>($4, $8))], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(c_customer_sk=[$0], c_current_addr_sk=[$4], c_first_name=[$8], c_last_name=[$9], c_birth_country=[$14])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                         HiveTableScan(table=[[default, customer]], table:alias=[customer])
-                    HiveJoin(condition=[=($8, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveProject(ca_address_sk=[$0], ca_state=[$8], ca_zip=[$9], ca_country=[$10])
+                    HiveJoin(condition=[=($7, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveProject(ca_address_sk=[$0], ca_state=[$8], ca_zip=[$9], UPPER=[UPPER($10)])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($9))])
                           HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-                      HiveProject(s_store_sk=[$0], s_store_name=[$5], s_market_id=[CAST(7):INTEGER], s_state=[$24], s_zip=[$25])
+                      HiveProject(s_store_sk=[$0], s_store_name=[$5], s_state=[$24], s_zip=[$25])
                         HiveFilter(condition=[AND(=($10, 7), IS NOT NULL($0), IS NOT NULL($25))])
                           HiveTableScan(table=[[default, store]], table:alias=[store])
                 HiveProject(i_item_sk=[$0], i_current_price=[$5], i_size=[$15], i_color=[$17], i_units=[$18], i_manager_id=[$20])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query25.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query25.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query25.q.out
index 88e0cf0..db13a5d 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query25.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query25.q.out
@@ -109,35 +109,35 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], fetch=[100])
   HiveProject(i_item_id=[$0], i_item_desc=[$1], s_store_id=[$2], s_store_name=[$3], $f4=[$4], $f5=[$5], $f6=[$6])
-    HiveAggregate(group=[{1, 2, 28, 29}], agg#0=[sum($8)], agg#1=[sum($23)], agg#2=[sum($15)])
-      HiveJoin(condition=[=($27, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveAggregate(group=[{1, 2, 22, 23}], agg#0=[sum($8)], agg#1=[sum($19)], agg#2=[sum($13)])
+      HiveJoin(condition=[=($21, $6)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(i_item_sk=[$0], i_item_id=[$1], i_item_desc=[$4])
             HiveFilter(condition=[IS NOT NULL($0)])
               HiveTableScan(table=[[default, item]], table:alias=[item])
-          HiveJoin(condition=[AND(AND(=($2, $18), =($1, $17)), =($4, $19))], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[AND(AND(=($2, $14), =($1, $13)), =($4, $15))], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_store_sk=[$7], ss_ticket_number=[$9], ss_net_profit=[$22])
                 HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($2), IS NOT NULL($9), IS NOT NULL($0), IS NOT NULL($7))])
                   HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-              HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(4):INTEGER])
+              HiveProject(d_date_sk=[$0])
                 HiveFilter(condition=[AND(=($8, 4), =($6, 2000), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
-            HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$1], cs_item_sk=[$2], cs_net_profit=[$3], d_date_sk=[$4], d_year=[$5], d_moy=[$6], sr_returned_date_sk=[$7], sr_item_sk=[$8], sr_customer_sk=[$9], sr_ticket_number=[$10], sr_net_loss=[$11], d_date_sk0=[$12], d_year0=[$13], d_moy0=[$14])
-              HiveJoin(condition=[AND(=($9, $1), =($8, $2))], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$1], cs_item_sk=[$2], cs_net_profit=[$3], d_date_sk=[$4], sr_returned_date_sk=[$5], sr_item_sk=[$6], sr_customer_sk=[$7], sr_ticket_number=[$8], sr_net_loss=[$9], d_date_sk0=[$10])
+              HiveJoin(condition=[AND(=($7, $1), =($6, $2))], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_item_sk=[$15], cs_net_profit=[$33])
                     HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($15), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[$8])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(BETWEEN(false, $8, 4, 10), =($6, 2000), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[d3])
-                HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$1], sr_customer_sk=[$2], sr_ticket_number=[$3], sr_net_loss=[$4], d_date_sk=[$5], d_year=[$6], d_moy=[$7])
+                HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$1], sr_customer_sk=[$2], sr_ticket_number=[$3], sr_net_loss=[$4], d_date_sk=[$5])
                   HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$2], sr_customer_sk=[$3], sr_ticket_number=[$9], sr_net_loss=[$19])
                       HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($2), IS NOT NULL($9), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[$8])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(BETWEEN(false, $8, 4, 10), =($6, 2000), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[d2])
         HiveProject(s_store_sk=[$0], s_store_id=[$1], s_store_name=[$5])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query26.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query26.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query26.q.out
index 8b36aed..9f51402 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query26.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query26.q.out
@@ -58,19 +58,19 @@ HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
         HiveProject(i_item_sk=[$0], i_item_id=[$1])
           HiveFilter(condition=[IS NOT NULL($0)])
             HiveTableScan(table=[[default, item]], table:alias=[item])
-        HiveJoin(condition=[=($3, $14)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveJoin(condition=[=($0, $12)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[=($3, $10)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($1, $8)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(cs_sold_date_sk=[$0], cs_bill_cdemo_sk=[$4], cs_item_sk=[$15], cs_promo_sk=[$16], cs_quantity=[$18], cs_list_price=[$20], cs_sales_price=[$21], cs_coupon_amt=[$27])
                 HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0), IS NOT NULL($15), IS NOT NULL($16))])
                   HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-              HiveProject(cd_demo_sk=[$0], cd_gender=[CAST(_UTF-16LE'F'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], cd_marital_status=[CAST(_UTF-16LE'W'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], cd_education_status=[CAST(_UTF-16LE'Primary'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+              HiveProject(cd_demo_sk=[$0])
                 HiveFilter(condition=[AND(=($1, _UTF-16LE'F'), =($2, _UTF-16LE'W'), =($3, _UTF-16LE'Primary'), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, customer_demographics]], table:alias=[customer_demographics])
-            HiveProject(d_date_sk=[$0], d_year=[CAST(1998):INTEGER])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(=($6, 1998), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(p_promo_sk=[$0], p_channel_email=[$9], p_channel_event=[$14])
+          HiveProject(p_promo_sk=[$0])
             HiveFilter(condition=[AND(OR(=($9, _UTF-16LE'N'), =($14, _UTF-16LE'N')), IS NOT NULL($0))])
               HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query27.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query27.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query27.q.out
index 9a6718a..e072692 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query27.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query27.q.out
@@ -58,21 +58,21 @@ CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
   HiveProject(i_item_id=[$0], s_state=[$1], g_state=[grouping($10, 0)], agg1=[/(CAST($2):DOUBLE, $3)], agg2=[/($4, $5)], agg3=[/($6, $7)], agg4=[/($8, $9)])
     HiveAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], agg#0=[sum($2)], agg#1=[count($2)], agg#2=[sum($3)], agg#3=[count($3)], agg#4=[sum($4)], agg#5=[count($4)], agg#6=[sum($5)], agg#7=[count($5)], GROUPING__ID=[GROUPING__ID()])
-      HiveProject($f0=[$1], $f1=[$17], $f2=[$6], $f3=[$7], $f4=[$9], $f5=[$8])
+      HiveProject($f0=[$1], $f1=[$13], $f2=[$6], $f3=[$7], $f4=[$9], $f5=[$8])
         HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(i_item_sk=[$0], i_item_id=[$1])
             HiveFilter(condition=[IS NOT NULL($0)])
               HiveTableScan(table=[[default, item]], table:alias=[item])
-          HiveJoin(condition=[=($3, $14)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveJoin(condition=[=($0, $12)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($3, $10)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($2, $8)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_cdemo_sk=[$4], ss_store_sk=[$7], ss_quantity=[$10], ss_list_price=[$12], ss_sales_price=[$13], ss_coupon_amt=[$19])
                   HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($2))])
                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                HiveProject(cd_demo_sk=[$0], cd_gender=[CAST(_UTF-16LE'M'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], cd_marital_status=[CAST(_UTF-16LE'U'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], cd_education_status=[CAST(_UTF-16LE'2 yr Degree'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                HiveProject(cd_demo_sk=[$0])
                   HiveFilter(condition=[AND(=($1, _UTF-16LE'M'), =($2, _UTF-16LE'U'), =($3, _UTF-16LE'2 yr Degree'), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, customer_demographics]], table:alias=[customer_demographics])
-              HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+              HiveProject(d_date_sk=[$0])
                 HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
             HiveProject(s_store_sk=[$0], s_state=[$24])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query29.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query29.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query29.q.out
index 9f9ffe5..82a914b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query29.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query29.q.out
@@ -107,35 +107,35 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], fetch=[100])
   HiveProject(i_item_id=[$0], i_item_desc=[$1], s_store_id=[$2], s_store_name=[$3], $f4=[$4], $f5=[$5], $f6=[$6])
-    HiveAggregate(group=[{7, 8, 27, 28}], agg#0=[sum($14)], agg#1=[sum($22)], agg#2=[sum($3)])
-      HiveJoin(condition=[AND(=($20, $1), =($19, $2))], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveAggregate(group=[{6, 7, 22, 23}], agg#0=[sum($13)], agg#1=[sum($19)], agg#2=[sum($3)])
+      HiveJoin(condition=[AND(=($17, $1), =($16, $2))], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_item_sk=[$15], cs_quantity=[$18])
             HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($15), IS NOT NULL($0))])
               HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-          HiveProject(d_date_sk=[$0], d_year=[$6])
+          HiveProject(d_date_sk=[$0])
             HiveFilter(condition=[AND(IN($6, 1999, 2000, 2001), IS NOT NULL($0))])
               HiveTableScan(table=[[default, date_dim]], table:alias=[d3])
-        HiveProject(i_item_sk=[$0], i_item_id=[$1], i_item_desc=[$2], ss_sold_date_sk=[$3], ss_item_sk=[$4], ss_customer_sk=[$5], ss_store_sk=[$6], ss_ticket_number=[$7], ss_quantity=[$8], d_date_sk=[$9], d_year=[$10], d_moy=[$11], sr_returned_date_sk=[$12], sr_item_sk=[$13], sr_customer_sk=[$14], sr_ticket_number=[$15], sr_return_quantity=[$16], d_date_sk0=[$17], d_year0=[$18], d_moy0=[$19], s_store_sk=[$20], s_store_id=[$21], s_store_name=[$22])
-          HiveJoin(condition=[=($20, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject(i_item_sk=[$0], i_item_id=[$1], i_item_desc=[$2], ss_sold_date_sk=[$3], ss_item_sk=[$4], ss_customer_sk=[$5], ss_store_sk=[$6], ss_ticket_number=[$7], ss_quantity=[$8], d_date_sk=[$9], sr_returned_date_sk=[$10], sr_item_sk=[$11], sr_customer_sk=[$12], sr_ticket_number=[$13], sr_return_quantity=[$14], d_date_sk0=[$15], s_store_sk=[$16], s_store_id=[$17], s_store_name=[$18])
+          HiveJoin(condition=[=($16, $6)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(i_item_sk=[$0], i_item_id=[$1], i_item_desc=[$4])
                 HiveFilter(condition=[IS NOT NULL($0)])
                   HiveTableScan(table=[[default, item]], table:alias=[item])
-              HiveJoin(condition=[AND(AND(=($2, $11), =($1, $10)), =($4, $12))], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[AND(AND(=($2, $9), =($1, $8)), =($4, $10))], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_store_sk=[$7], ss_ticket_number=[$9], ss_quantity=[$10])
                     HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($2), IS NOT NULL($9), IS NOT NULL($0), IS NOT NULL($7))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(4):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($8, 4), =($6, 1999), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
-                HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$1], sr_customer_sk=[$2], sr_ticket_number=[$3], sr_return_quantity=[$4], d_date_sk=[$5], d_year=[$6], d_moy=[$7])
+                HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$1], sr_customer_sk=[$2], sr_ticket_number=[$3], sr_return_quantity=[$4], d_date_sk=[$5])
                   HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$2], sr_customer_sk=[$3], sr_ticket_number=[$9], sr_return_quantity=[$10])
                       HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($2), IS NOT NULL($9), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[$8])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(BETWEEN(false, $8, 4, 7), =($6, 1999), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[d2])
             HiveProject(s_store_sk=[$0], s_store_id=[$1], s_store_name=[$5])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query3.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query3.q.out
index 09c9bb7..b3688f3 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query3.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query3.q.out
@@ -49,16 +49,16 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$3], sort2=[$1], dir0=[ASC], dir1=[DESC-nulls-last], dir2=[ASC], fetch=[100])
   HiveProject(d_year=[$2], i_brand_id=[$0], i_brand=[$1], $f3=[$3])
-    HiveAggregate(group=[{4, 5, 8}], agg#0=[sum($2)])
-      HiveJoin(condition=[=($7, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveAggregate(group=[{4, 5, 7}], agg#0=[sum($2)])
+      HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ext_sales_price=[$15])
             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2))])
               HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8], i_manufact_id=[CAST(436):INTEGER])
+          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8])
             HiveFilter(condition=[AND(=($13, 436), IS NOT NULL($0))])
               HiveTableScan(table=[[default, item]], table:alias=[item])
-        HiveProject(d_date_sk=[$0], d_year=[$6], d_moy=[CAST(12):INTEGER])
+        HiveProject(d_date_sk=[$0], d_year=[$6])
           HiveFilter(condition=[AND(=($8, 12), IS NOT NULL($0))])
             HiveTableScan(table=[[default, date_dim]], table:alias=[dt])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query30.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query30.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query30.q.out
index 067b2bc..02e26a7 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query30.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query30.q.out
@@ -70,13 +70,13 @@ POSTHOOK: Input: default@web_returns
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], sort5=[$5], sort6=[$6], sort7=[$7], sort8=[$8], sort9=[$9], sort10=[$10], sort11=[$11], sort12=[$12], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], dir4=[ASC], dir5=[ASC], dir6=[ASC], dir7=[ASC], dir8=[ASC], dir9=[ASC], dir10=[ASC], dir11=[ASC], dir12=[ASC], fetch=[100])
-  HiveProject(c_customer_id=[$1], c_salutation=[$3], c_first_name=[$4], c_last_name=[$5], c_preferred_cust_flag=[$6], c_birth_day=[$7], c_birth_month=[$8], c_birth_year=[$9], c_birth_country=[$10], c_login=[$11], c_email_address=[$12], c_last_review_date=[$13], ctr_total_return=[$18])
-    HiveJoin(condition=[=($16, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+  HiveProject(c_customer_id=[$1], c_salutation=[$3], c_first_name=[$4], c_last_name=[$5], c_preferred_cust_flag=[$6], c_birth_day=[$7], c_birth_month=[$8], c_birth_year=[$9], c_birth_country=[$10], c_login=[$11], c_email_address=[$12], c_last_review_date=[$13], ctr_total_return=[$17])
+    HiveJoin(condition=[=($15, $0)], joinType=[inner], algorithm=[none], cost=[not available])
       HiveJoin(condition=[=($14, $2)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_current_addr_sk=[$4], c_salutation=[$7], c_first_name=[$8], c_last_name=[$9], c_preferred_cust_flag=[$10], c_birth_day=[$11], c_birth_month=[$12], c_birth_year=[$13], c_birth_country=[$14], c_login=[$15], c_email_address=[$16], c_last_review_date=[$17])
           HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
             HiveTableScan(table=[[default, customer]], table:alias=[customer])
-        HiveProject(ca_address_sk=[$0], ca_state=[CAST(_UTF-16LE'IL'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+        HiveProject(ca_address_sk=[$0])
           HiveFilter(condition=[AND(=($8, _UTF-16LE'IL'), IS NOT NULL($0))])
             HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
       HiveProject(wr_returning_customer_sk=[$0], ca_state=[$1], $f2=[$2], _o__c0=[$3], ctr_state=[$4])
@@ -91,7 +91,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], sort5=
                   HiveProject(wr_returned_date_sk=[$0], wr_returning_customer_sk=[$7], wr_returning_addr_sk=[$10], wr_return_amt=[$15])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($10), IS NOT NULL($7))])
                       HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(_o__c0=[*(/($1, $2), 1.2)], ctr_state=[$0])
@@ -106,7 +106,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], sort5=
                       HiveProject(wr_returned_date_sk=[$0], wr_returning_customer_sk=[$7], wr_returning_addr_sk=[$10], wr_return_amt=[$15])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($10))])
                           HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query31.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query31.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query31.q.out
index 5143053..8907b8d 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query31.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query31.q.out
@@ -111,22 +111,22 @@ POSTHOOK: Input: default@store_sales
 POSTHOOK: Input: default@web_sales
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
-HiveProject(ca_county=[$0], d_year=[CAST(2000):INTEGER], web_q1_q2_increase=[/($9, $7)], store_q1_q2_increase=[/($1, $3)], web_q2_q3_increase=[/($11, $9)], store_q2_q3_increase=[/($5, $1)])
-  HiveJoin(condition=[AND(AND(=($0, $6), CASE(>($3, 0), CASE(>($7, 0), >(/($9, $7), /($1, $3)), >(null, /($1, $3))), CASE(>($7, 0), >(/($9, $7), null), null))), CASE(>($1, 0), CASE(>($9, 0), >(/($11, $9), /($5, $1)), >(null, /($5, $1))), CASE(>($9, 0), >(/($11, $9), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
-    HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-      HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveProject(ca_county=[$0], $f1=[$1])
+HiveProject(ca_county=[$8], d_year=[CAST(2000):INTEGER], web_q1_q2_increase=[/($6, $1)], store_q1_q2_increase=[/($9, $11)], web_q2_q3_increase=[/($4, $6)], store_q2_q3_increase=[/($13, $9)])
+  HiveJoin(condition=[AND(AND(=($8, $0), CASE(>($11, 0), CASE($2, >(/($6, $1), /($9, $11)), >(null, /($9, $11))), CASE($2, >(/($6, $1), null), null))), CASE(>($9, 0), CASE($7, >(/($4, $6), /($13, $9)), >(null, /($13, $9))), CASE($7, >(/($4, $6), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject($f0=[$0], $f3=[$1], >=[>($1, 0)])
           HiveAggregate(group=[{1}], agg#0=[sum($4)])
             HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(ca_address_sk=[$0], ca_county=[$7])
                 HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                   HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
               HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(ss_sold_date_sk=[$0], ss_addr_sk=[$6], ss_ext_sales_price=[$15])
-                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6))])
-                    HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_qoy=[CAST(2):INTEGER])
-                  HiveFilter(condition=[AND(=($10, 2), =($6, 2000), IS NOT NULL($0))])
+                HiveProject(ws_sold_date_sk=[$0], ws_bill_addr_sk=[$7], ws_ext_sales_price=[$23])
+                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
+                    HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
+                HiveProject(d_date_sk=[$0])
+                  HiveFilter(condition=[AND(=($10, 1), =($6, 2000), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
         HiveProject(ca_county=[$0], $f1=[$1])
           HiveAggregate(group=[{1}], agg#0=[sum($4)])
@@ -135,28 +135,28 @@ HiveProject(ca_county=[$0], d_year=[CAST(2000):INTEGER], web_q1_q2_increase=[/($
                 HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                   HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
               HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(ss_sold_date_sk=[$0], ss_addr_sk=[$6], ss_ext_sales_price=[$15])
-                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6))])
-                    HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_qoy=[CAST(1):INTEGER])
-                  HiveFilter(condition=[AND(=($10, 1), =($6, 2000), IS NOT NULL($0))])
+                HiveProject(ws_sold_date_sk=[$0], ws_bill_addr_sk=[$7], ws_ext_sales_price=[$23])
+                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
+                    HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
+                HiveProject(d_date_sk=[$0])
+                  HiveFilter(condition=[AND(=($10, 3), =($6, 2000), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-      HiveProject(ca_county=[$0], $f1=[$1])
+      HiveProject($f0=[$0], $f3=[$1], >=[>($1, 0)])
         HiveAggregate(group=[{1}], agg#0=[sum($4)])
           HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject(ca_address_sk=[$0], ca_county=[$7])
               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                 HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
             HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveProject(ss_sold_date_sk=[$0], ss_addr_sk=[$6], ss_ext_sales_price=[$15])
-                HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6))])
-                  HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-              HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_qoy=[CAST(3):INTEGER])
-                HiveFilter(condition=[AND(=($10, 3), =($6, 2000), IS NOT NULL($0))])
+              HiveProject(ws_sold_date_sk=[$0], ws_bill_addr_sk=[$7], ws_ext_sales_price=[$23])
+                HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
+                  HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
+              HiveProject(d_date_sk=[$0])
+                HiveFilter(condition=[AND(=($10, 2), =($6, 2000), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
     HiveProject(ca_county=[$0], $f1=[$1], ca_county0=[$2], $f10=[$3], ca_county1=[$4], $f11=[$5])
       HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(ca_county=[$0], $f1=[$1])
             HiveAggregate(group=[{1}], agg#0=[sum($4)])
               HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -164,11 +164,11 @@ HiveProject(ca_county=[$0], d_year=[CAST(2000):INTEGER], web_q1_q2_increase=[/($
                   HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                     HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                 HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject(ws_sold_date_sk=[$0], ws_bill_addr_sk=[$7], ws_ext_sales_price=[$23])
-                    HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
-                      HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_qoy=[CAST(1):INTEGER])
-                    HiveFilter(condition=[AND(=($10, 1), =($6, 2000), IS NOT NULL($0))])
+                  HiveProject(ss_sold_date_sk=[$0], ss_addr_sk=[$6], ss_ext_sales_price=[$15])
+                    HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6))])
+                      HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                  HiveProject(d_date_sk=[$0])
+                    HiveFilter(condition=[AND(=($10, 2), =($6, 2000), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(ca_county=[$0], $f1=[$1])
             HiveAggregate(group=[{1}], agg#0=[sum($4)])
@@ -177,11 +177,11 @@ HiveProject(ca_county=[$0], d_year=[CAST(2000):INTEGER], web_q1_q2_increase=[/($
                   HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                     HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                 HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject(ws_sold_date_sk=[$0], ws_bill_addr_sk=[$7], ws_ext_sales_price=[$23])
-                    HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
-                      HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_qoy=[CAST(2):INTEGER])
-                    HiveFilter(condition=[AND(=($10, 2), =($6, 2000), IS NOT NULL($0))])
+                  HiveProject(ss_sold_date_sk=[$0], ss_addr_sk=[$6], ss_ext_sales_price=[$15])
+                    HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6))])
+                      HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                  HiveProject(d_date_sk=[$0])
+                    HiveFilter(condition=[AND(=($10, 1), =($6, 2000), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
         HiveProject(ca_county=[$0], $f1=[$1])
           HiveAggregate(group=[{1}], agg#0=[sum($4)])
@@ -190,10 +190,10 @@ HiveProject(ca_county=[$0], d_year=[CAST(2000):INTEGER], web_q1_q2_increase=[/($
                 HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                   HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
               HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(ws_sold_date_sk=[$0], ws_bill_addr_sk=[$7], ws_ext_sales_price=[$23])
-                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
-                    HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_qoy=[CAST(3):INTEGER])
+                HiveProject(ss_sold_date_sk=[$0], ss_addr_sk=[$6], ss_ext_sales_price=[$15])
+                  HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6))])
+                    HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(=($10, 3), =($6, 2000), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query32.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query32.q.out
index 981d478..837a743 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query32.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query32.q.out
@@ -64,26 +64,26 @@ CBO PLAN:
 HiveSortLimit(fetch=[100])
   HiveProject($f0=[$0])
     HiveAggregate(group=[{}], agg#0=[sum($2)])
-      HiveJoin(condition=[AND(>($2, CAST(*(1.3, $6)):DECIMAL(14, 7)), =($7, $1))], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveJoin(condition=[AND(>($2, $5), =($6, $1))], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15], cs_ext_discount_amt=[$22])
             HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0))])
               HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-          HiveProject(d_date_sk=[$0], d_date=[$2])
+          HiveProject(d_date_sk=[$0])
             HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-03-18 00:00:00, 1998-06-16 00:00:00), IS NOT NULL($0))])
               HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-        HiveProject(cs_item_sk=[$0], $f1=[$1], i_item_sk=[$2], i_manufact_id=[$3])
+        HiveProject(cs_item_sk=[$0], CAST=[$1], i_item_sk=[$2])
           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveProject(cs_item_sk=[$0], $f1=[/($1, $2)])
+            HiveProject(cs_item_sk=[$0], CAST=[CAST(*(1.3, /($1, $2))):DECIMAL(14, 7)])
               HiveAggregate(group=[{1}], agg#0=[sum($2)], agg#1=[count($2)])
                 HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15], cs_ext_discount_amt=[$22])
                     HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                  HiveProject(d_date_sk=[$0], d_date=[$2])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-03-18 00:00:00, 1998-06-16 00:00:00), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-            HiveProject(i_item_sk=[$0], i_manufact_id=[CAST(269):INTEGER])
+            HiveProject(i_item_sk=[$0])
               HiveFilter(condition=[AND(=($13, 269), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, item]], table:alias=[item])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query33.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query33.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query33.q.out
index b5c7f11..8534997 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query33.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query33.q.out
@@ -167,8 +167,8 @@ HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
       HiveProject(i_manufact_id=[$0], $f1=[$1])
         HiveUnion(all=[true])
           HiveProject(i_manufact_id=[$0], $f1=[$1])
-            HiveAggregate(group=[{1}], agg#0=[sum($8)])
-              HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{1}], agg#0=[sum($7)])
+              HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(i_item_sk=[$0], i_manufact_id=[$13])
                     HiveFilter(condition=[AND(IS NOT NULL($13), IS NOT NULL($0))])
@@ -177,21 +177,21 @@ HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
                     HiveAggregate(group=[{13}])
                       HiveFilter(condition=[AND(=($12, _UTF-16LE'Books'), IS NOT NULL($13))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ca_address_sk=[$0], ca_gmt_offset=[$1], ss_sold_date_sk=[$2], ss_item_sk=[$3], ss_addr_sk=[$4], ss_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8])
-                  HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-6):DECIMAL(5, 2)])
+                HiveProject(ca_address_sk=[$0], ss_sold_date_sk=[$1], ss_item_sk=[$2], ss_addr_sk=[$3], ss_ext_sales_price=[$4], d_date_sk=[$5])
+                  HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ca_address_sk=[$0])
                       HiveFilter(condition=[AND(=($11, -6), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_addr_sk=[$6], ss_ext_sales_price=[$15])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6), IS NOT NULL($2))])
                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(3):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), =($8, 3), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(i_manufact_id=[$0], $f1=[$1])
-            HiveAggregate(group=[{1}], agg#0=[sum($8)])
-              HiveJoin(condition=[=($7, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{1}], agg#0=[sum($7)])
+              HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(i_item_sk=[$0], i_manufact_id=[$13])
                     HiveFilter(condition=[AND(IS NOT NULL($13), IS NOT NULL($0))])
@@ -200,21 +200,21 @@ HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
                     HiveAggregate(group=[{13}])
                       HiveFilter(condition=[AND(=($12, _UTF-16LE'Books'), IS NOT NULL($13))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ca_address_sk=[$0], ca_gmt_offset=[$1], cs_sold_date_sk=[$2], cs_bill_addr_sk=[$3], cs_item_sk=[$4], cs_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8])
-                  HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-6):DECIMAL(5, 2)])
+                HiveProject(ca_address_sk=[$0], cs_sold_date_sk=[$1], cs_bill_addr_sk=[$2], cs_item_sk=[$3], cs_ext_sales_price=[$4], d_date_sk=[$5])
+                  HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ca_address_sk=[$0])
                       HiveFilter(condition=[AND(=($11, -6), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(cs_sold_date_sk=[$0], cs_bill_addr_sk=[$6], cs_item_sk=[$15], cs_ext_sales_price=[$23])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6), IS NOT NULL($15))])
                           HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(3):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), =($8, 3), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(i_manufact_id=[$0], $f1=[$1])
-            HiveAggregate(group=[{1}], agg#0=[sum($8)])
-              HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{1}], agg#0=[sum($7)])
+              HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(i_item_sk=[$0], i_manufact_id=[$13])
                     HiveFilter(condition=[AND(IS NOT NULL($13), IS NOT NULL($0))])
@@ -223,16 +223,16 @@ HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
                     HiveAggregate(group=[{13}])
                       HiveFilter(condition=[AND(=($12, _UTF-16LE'Books'), IS NOT NULL($13))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ca_address_sk=[$0], ca_gmt_offset=[$1], ws_sold_date_sk=[$2], ws_item_sk=[$3], ws_bill_addr_sk=[$4], ws_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8])
-                  HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-6):DECIMAL(5, 2)])
+                HiveProject(ca_address_sk=[$0], ws_sold_date_sk=[$1], ws_item_sk=[$2], ws_bill_addr_sk=[$3], ws_ext_sales_price=[$4], d_date_sk=[$5])
+                  HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ca_address_sk=[$0])
                       HiveFilter(condition=[AND(=($11, -6), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_bill_addr_sk=[$7], ws_ext_sales_price=[$23])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($3))])
                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(3):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), =($8, 3), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query34.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query34.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query34.q.out
index 4e50a1c..9299409 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query34.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query34.q.out
@@ -81,19 +81,19 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
         HiveFilter(condition=[BETWEEN(false, $2, 15, 20)])
           HiveProject(ss_ticket_number=[$1], ss_customer_sk=[$0], $f2=[$2])
             HiveAggregate(group=[{1, 4}], agg#0=[count()])
-              HiveJoin(condition=[=($3, $12)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveJoin(condition=[=($2, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($3, $7)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveJoin(condition=[=($2, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_hdemo_sk=[$5], ss_store_sk=[$7], ss_ticket_number=[$9])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($5), IS NOT NULL($3))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[$6], d_dom=[$9])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(IN($6, 2000, 2001, 2002), OR(BETWEEN(false, $9, 1, 3), BETWEEN(false, $9, 25, 28)), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                  HiveProject(hd_demo_sk=[$0], hd_buy_potential=[$2], hd_dep_count=[$3], hd_vehicle_count=[$4])
+                  HiveProject(hd_demo_sk=[$0])
                     HiveFilter(condition=[AND(IN($2, _UTF-16LE'>10000', _UTF-16LE'unknown'), >($4, 0), CASE(>($4, 0), >(/(CAST($3):DOUBLE, CAST($4):DOUBLE), 1.2), null), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-                HiveProject(s_store_sk=[$0], s_county=[$23])
+                HiveProject(s_store_sk=[$0])
                   HiveFilter(condition=[AND(IN($23, _UTF-16LE'Mobile County', _UTF-16LE'Maverick County', _UTF-16LE'Huron County', _UTF-16LE'Kittitas County', _UTF-16LE'Fairfield County', _UTF-16LE'Jackson County', _UTF-16LE'Barrow County', _UTF-16LE'Pennington County'), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store]], table:alias=[store])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query35.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query35.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query35.q.out
index 2b8a453..f14a2bd 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query35.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query35.q.out
@@ -151,7 +151,7 @@ HiveProject(ca_state=[$0], cd_gender=[$1], cd_marital_status=[$2], cnt1=[$3], _o
                     HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3])
                       HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_qoy=[$10])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(=($6, 1999), <($10, 4), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
               HiveProject(ws_bill_customer_sk0=[$0], $f1=[true])
@@ -160,7 +160,7 @@ HiveProject(ca_state=[$0], cd_gender=[$1], cd_marital_status=[$2], cnt1=[$3], _o
                     HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4])
                       HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_qoy=[$10])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(=($6, 1999), <($10, 4), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
             HiveProject(cs_ship_customer_sk0=[$0], $f1=[true])
@@ -169,7 +169,7 @@ HiveProject(ca_state=[$0], cd_gender=[$1], cd_marital_status=[$2], cnt1=[$3], _o
                   HiveProject(cs_sold_date_sk=[$0], cs_ship_customer_sk=[$7])
                     HiveFilter(condition=[AND(IS NOT NULL($7), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_qoy=[$10])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($6, 1999), <($10, 4), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query36.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query36.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query36.q.out
index b2a713f..9a74bed 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query36.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query36.q.out
@@ -72,17 +72,17 @@ HiveProject(gross_margin=[$0], i_category=[$1], i_class=[$2], lochierarchy=[$3],
     HiveProject(gross_margin=[/($2, $3)], i_category=[$0], i_class=[$1], lochierarchy=[+(grouping($4, 1), grouping($4, 0))], rank_within_parent=[rank() OVER (PARTITION BY +(grouping($4, 1), grouping($4, 0)), CASE(=(grouping($4, 0), 0), $0, null) ORDER BY /($2, $3) NULLS FIRST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)], (tok_function when (= (tok_table_or_col lochierarchy) 0) (tok_table_or_col i_category))=[CASE(=(+(grouping($4, 1), grouping($4, 0)), 0), $0, null)])
       HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], GROUPING__ID=[$4])
         HiveAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {}]], agg#0=[sum($2)], agg#1=[sum($3)], GROUPING__ID=[GROUPING__ID()])
-          HiveProject($f0=[$11], $f1=[$10], $f2=[$4], $f3=[$3])
-            HiveJoin(condition=[=($9, $1)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($7, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveProject($f0=[$9], $f1=[$8], $f2=[$4], $f3=[$3])
+            HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($6, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_store_sk=[$7], ss_ext_sales_price=[$15], ss_net_profit=[$22])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2), IS NOT NULL($7))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($6, 1999), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
-                HiveProject(s_store_sk=[$0], s_state=[$24])
+                HiveProject(s_store_sk=[$0])
                   HiveFilter(condition=[AND(IN($24, _UTF-16LE'SD', _UTF-16LE'FL', _UTF-16LE'MI', _UTF-16LE'LA', _UTF-16LE'MO', _UTF-16LE'SC', _UTF-16LE'AL', _UTF-16LE'GA'), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store]], table:alias=[store])
               HiveProject(i_item_sk=[$0], i_class=[$10], i_category=[$12])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query37.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query37.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query37.q.out
index 0edc78b..07b9901 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query37.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query37.q.out
@@ -44,20 +44,20 @@ CBO PLAN:
 HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
   HiveProject(i_item_id=[$0], i_item_desc=[$1], i_current_price=[$2])
     HiveAggregate(group=[{2, 3, 4}])
-      HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($0, $1)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(cs_item_sk=[$15])
             HiveFilter(condition=[IS NOT NULL($15)])
               HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-          HiveProject(i_item_sk=[$0], i_item_id=[$1], i_item_desc=[$4], i_current_price=[$5], i_manufact_id=[$13])
+          HiveProject(i_item_sk=[$0], i_item_id=[$1], i_item_desc=[$4], i_current_price=[$5])
             HiveFilter(condition=[AND(IN($13, 678, 964, 918, 849), BETWEEN(false, $5, 22, 52), IS NOT NULL($0))])
               HiveTableScan(table=[[default, item]], table:alias=[item])
-        HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], inv_quantity_on_hand=[$2], d_date_sk=[$3], d_date=[$4])
-          HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], inv_quantity_on_hand=[$3])
+        HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], d_date_sk=[$2])
+          HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(inv_date_sk=[$0], inv_item_sk=[$1])
               HiveFilter(condition=[AND(BETWEEN(false, $3, 100, 500), IS NOT NULL($1), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, inventory]], table:alias=[inventory])
-            HiveProject(d_date_sk=[$0], d_date=[$2])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 2001-06-02 00:00:00, 2001-08-01 00:00:00), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 


[06/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query85.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query85.q.out b/ql/src/test/results/clientpositive/perf/tez/query85.q.out
index f5800b9..1ada394 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query85.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query85.q.out
@@ -183,15 +183,15 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Map 11 <- Reducer 15 (BROADCAST_EDGE)
+Map 11 <- Reducer 13 (BROADCAST_EDGE)
 Reducer 10 <- Reducer 9 (SIMPLE_EDGE)
-Reducer 15 <- Map 14 (CUSTOM_SIMPLE_EDGE)
+Reducer 13 <- Map 12 (CUSTOM_SIMPLE_EDGE)
 Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 11 (SIMPLE_EDGE)
-Reducer 3 <- Map 12 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Map 13 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 3 <- Map 17 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 12 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
 Reducer 5 <- Map 14 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
-Reducer 6 <- Map 16 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
-Reducer 7 <- Map 17 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE)
+Reducer 6 <- Map 15 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
+Reducer 7 <- Map 16 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE)
 Reducer 8 <- Map 17 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE)
 Reducer 9 <- Reducer 8 (SIMPLE_EDGE)
 
@@ -200,134 +200,138 @@ Stage-0
     limit:-1
     Stage-1
       Reducer 10 vectorized
-      File Output Operator [FS_239]
-        Limit [LIM_238] (rows=72 width=832)
+      File Output Operator [FS_240]
+        Limit [LIM_239] (rows=7 width=832)
           Number of rows:100
-          Select Operator [SEL_237] (rows=72 width=832)
+          Select Operator [SEL_238] (rows=7 width=832)
             Output:["_col0","_col1","_col2","_col3"]
           <-Reducer 9 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_236]
-              Select Operator [SEL_235] (rows=72 width=832)
+            SHUFFLE [RS_237]
+              Select Operator [SEL_236] (rows=7 width=832)
                 Output:["_col4","_col5","_col6","_col7"]
-                Group By Operator [GBY_234] (rows=72 width=353)
+                Group By Operator [GBY_235] (rows=7 width=353)
                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)","sum(VALUE._col2)","count(VALUE._col3)","sum(VALUE._col4)","count(VALUE._col5)"],keys:KEY._col0
                 <-Reducer 8 [SIMPLE_EDGE]
                   SHUFFLE [RS_49]
                     PartitionCols:_col0
-                    Group By Operator [GBY_48] (rows=72 width=353)
-                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col12)","count(_col12)","sum(_col7)","count(_col7)","sum(_col6)","count(_col6)"],keys:_col22
-                      Merge Join Operator [MERGEJOIN_206] (rows=8055 width=100)
-                        Conds:RS_44._col3, _col24, _col25=RS_232._col0, _col1, _col2(Inner),Output:["_col6","_col7","_col12","_col22"]
-                      <-Map 17 [SIMPLE_EDGE] vectorized
-                        SHUFFLE [RS_232]
-                          PartitionCols:_col0, _col1, _col2
-                          Select Operator [SEL_231] (rows=265971 width=183)
-                            Output:["_col0","_col1","_col2"]
-                            Filter Operator [FIL_230] (rows=265971 width=183)
-                              predicate:((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null)
-                              TableScan [TS_21] (rows=1861800 width=183)
-                                default@customer_demographics,cd2,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_marital_status","cd_education_status"]
-                      <-Reducer 7 [SIMPLE_EDGE]
-                        SHUFFLE [RS_44]
-                          PartitionCols:_col3, _col24, _col25
-                          Filter Operator [FIL_43] (rows=8055 width=390)
-                            predicate:(((_col24 = 'D') and (_col25 = 'Primary') and _col13 BETWEEN 50 AND 100) or ((_col24 = 'M') and (_col25 = '4 yr Degree') and _col13 BETWEEN 100 AND 150) or ((_col24 = 'U') and (_col25 = 'Advanced Degree') and _col13 BETWEEN 150 AND 200))
-                            Merge Join Operator [MERGEJOIN_205] (rows=24166 width=390)
-                              Conds:RS_40._col1=RS_233._col0(Inner),Output:["_col3","_col6","_col7","_col12","_col13","_col22","_col24","_col25"]
-                            <-Map 17 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_233]
-                                PartitionCols:_col0
-                                 Please refer to the previous Select Operator [SEL_231]
-                            <-Reducer 6 [SIMPLE_EDGE]
-                              SHUFFLE [RS_40]
-                                PartitionCols:_col1
-                                Merge Join Operator [MERGEJOIN_204] (rows=24166 width=211)
-                                  Conds:RS_37._col4=RS_229._col0(Inner),Output:["_col1","_col3","_col6","_col7","_col12","_col13","_col22"]
+                    Group By Operator [GBY_48] (rows=7 width=353)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col12)","count(_col12)","sum(_col7)","count(_col7)","sum(_col6)","count(_col6)"],keys:_col25
+                      Select Operator [SEL_47] (rows=16740 width=136)
+                        Output:["_col6","_col7","_col12","_col25"]
+                        Filter Operator [FIL_46] (rows=16740 width=136)
+                          predicate:((_col33 and _col34 and _col16) or (_col35 and _col36 and _col17) or (_col37 and _col38 and _col18))
+                          Merge Join Operator [MERGEJOIN_206] (rows=44640 width=136)
+                            Conds:RS_43._col1, _col20, _col21=RS_224._col0, _col1, _col2(Inner),Output:["_col6","_col7","_col12","_col16","_col17","_col18","_col25","_col33","_col34","_col35","_col36","_col37","_col38"]
+                          <-Map 17 [SIMPLE_EDGE] vectorized
+                            SHUFFLE [RS_224]
+                              PartitionCols:_col0, _col1, _col2
+                              Select Operator [SEL_222] (rows=265971 width=207)
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                                Filter Operator [FIL_221] (rows=265971 width=183)
+                                  predicate:((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null)
+                                  TableScan [TS_21] (rows=1861800 width=183)
+                                    default@customer_demographics,cd1,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_marital_status","cd_education_status"]
+                          <-Reducer 7 [SIMPLE_EDGE]
+                            SHUFFLE [RS_43]
+                              PartitionCols:_col1, _col20, _col21
+                              Filter Operator [FIL_42] (rows=44640 width=315)
+                                predicate:((_col27 and _col13) or (_col28 and _col14) or (_col29 and _col15))
+                                Merge Join Operator [MERGEJOIN_205] (rows=59520 width=315)
+                                  Conds:RS_39._col2=RS_234._col0(Inner),Output:["_col1","_col6","_col7","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col20","_col21","_col25","_col27","_col28","_col29"]
                                 <-Map 16 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_229]
+                                  SHUFFLE [RS_234]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_228] (rows=72 width=101)
-                                      Output:["_col0","_col1"]
-                                      Filter Operator [FIL_227] (rows=72 width=101)
-                                        predicate:r_reason_sk is not null
-                                        TableScan [TS_15] (rows=72 width=101)
-                                          default@reason,reason,Tbl:COMPLETE,Col:COMPLETE,Output:["r_reason_sk","r_reason_desc"]
-                                <-Reducer 5 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_37]
-                                    PartitionCols:_col4
-                                    Merge Join Operator [MERGEJOIN_203] (rows=24166 width=114)
-                                      Conds:RS_34._col8=RS_212._col0(Inner),Output:["_col1","_col3","_col4","_col6","_col7","_col12","_col13"]
-                                    <-Map 14 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_212]
+                                    Select Operator [SEL_233] (rows=3529412 width=16)
+                                      Output:["_col0","_col1","_col2","_col3"]
+                                      Filter Operator [FIL_232] (rows=3529412 width=187)
+                                        predicate:((ca_country = 'United States') and (ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is not null)
+                                        TableScan [TS_18] (rows=40000000 width=187)
+                                          default@customer_address,customer_address,Tbl:COMPLETE,Col:COMPLETE,Output:["ca_address_sk","ca_state","ca_country"]
+                                <-Reducer 6 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_39]
+                                    PartitionCols:_col2
+                                    Merge Join Operator [MERGEJOIN_204] (rows=674551 width=350)
+                                      Conds:RS_36._col4=RS_231._col0(Inner),Output:["_col1","_col2","_col6","_col7","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col20","_col21","_col25"]
+                                    <-Map 15 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_231]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_211] (rows=652 width=8)
-                                          Output:["_col0"]
-                                          Filter Operator [FIL_210] (rows=652 width=8)
-                                            predicate:((d_year = 1998) and d_date_sk is not null)
-                                            TableScan [TS_12] (rows=73049 width=8)
-                                              default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                                    <-Reducer 4 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_34]
-                                        PartitionCols:_col8
-                                        Merge Join Operator [MERGEJOIN_202] (rows=67680 width=244)
-                                          Conds:RS_31._col10=RS_226._col0(Inner),Output:["_col1","_col3","_col4","_col6","_col7","_col8","_col12","_col13"]
-                                        <-Map 13 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_226]
+                                        Select Operator [SEL_230] (rows=72 width=101)
+                                          Output:["_col0","_col1"]
+                                          Filter Operator [FIL_229] (rows=72 width=101)
+                                            predicate:r_reason_sk is not null
+                                            TableScan [TS_15] (rows=72 width=101)
+                                              default@reason,reason,Tbl:COMPLETE,Col:COMPLETE,Output:["r_reason_sk","r_reason_desc"]
+                                    <-Reducer 5 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_36]
+                                        PartitionCols:_col4
+                                        Merge Join Operator [MERGEJOIN_203] (rows=674551 width=254)
+                                          Conds:RS_33._col10=RS_228._col0(Inner),Output:["_col1","_col2","_col4","_col6","_col7","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col20","_col21"]
+                                        <-Map 14 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_228]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_225] (rows=4602 width=4)
+                                            Select Operator [SEL_227] (rows=4602 width=4)
                                               Output:["_col0"]
-                                              Filter Operator [FIL_224] (rows=4602 width=4)
+                                              Filter Operator [FIL_226] (rows=4602 width=4)
                                                 predicate:wp_web_page_sk is not null
-                                                TableScan [TS_9] (rows=4602 width=4)
+                                                TableScan [TS_12] (rows=4602 width=4)
                                                   default@web_page,web_page,Tbl:COMPLETE,Col:COMPLETE,Output:["wp_web_page_sk"]
-                                        <-Reducer 3 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_31]
+                                        <-Reducer 4 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_33]
                                             PartitionCols:_col10
-                                            Filter Operator [FIL_30] (rows=67680 width=446)
-                                              predicate:(((_col16) IN ('KY', 'GA', 'NM') and _col14 BETWEEN 100 AND 200) or ((_col16) IN ('MT', 'OR', 'IN') and _col14 BETWEEN 150 AND 300) or ((_col16) IN ('WI', 'MO', 'WV') and _col14 BETWEEN 50 AND 250))
-                                              Merge Join Operator [MERGEJOIN_201] (rows=1150579 width=446)
-                                                Conds:RS_27._col2=RS_223._col0(Inner),Output:["_col1","_col3","_col4","_col6","_col7","_col8","_col10","_col12","_col13","_col14","_col16"]
-                                              <-Map 12 [SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_223]
-                                                  PartitionCols:_col0
-                                                  Select Operator [SEL_222] (rows=3529412 width=187)
-                                                    Output:["_col0","_col1"]
-                                                    Filter Operator [FIL_221] (rows=3529412 width=187)
-                                                      predicate:((ca_country = 'United States') and (ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is not null)
-                                                      TableScan [TS_6] (rows=40000000 width=187)
-                                                        default@customer_address,customer_address,Tbl:COMPLETE,Col:COMPLETE,Output:["ca_address_sk","ca_state","ca_country"]
-                                              <-Reducer 2 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_27]
-                                                  PartitionCols:_col2
-                                                  Merge Join Operator [MERGEJOIN_200] (rows=13039884 width=466)
-                                                    Conds:RS_209._col0, _col5=RS_220._col1, _col3(Inner),Output:["_col1","_col2","_col3","_col4","_col6","_col7","_col8","_col10","_col12","_col13","_col14"]
-                                                  <-Map 1 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_209]
-                                                      PartitionCols:_col0, _col5
-                                                      Select Operator [SEL_208] (rows=11975292 width=237)
-                                                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                                        Filter Operator [FIL_207] (rows=11975292 width=237)
-                                                          predicate:(wr_item_sk is not null and wr_order_number is not null and wr_reason_sk is not null and wr_refunded_addr_sk is not null and wr_refunded_cdemo_sk is not null and wr_returning_cdemo_sk is not null)
-                                                          TableScan [TS_0] (rows=14398467 width=237)
-                                                            default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_item_sk","wr_refunded_cdemo_sk","wr_refunded_addr_sk","wr_returning_cdemo_sk","wr_reason_sk","wr_order_number","wr_fee","wr_refunded_cash"]
-                                                  <-Map 11 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_220]
-                                                      PartitionCols:_col1, _col3
-                                                      Select Operator [SEL_219] (rows=15992347 width=243)
-                                                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                        Filter Operator [FIL_218] (rows=15992347 width=243)
-                                                          predicate:((ws_net_profit BETWEEN 100 AND 200 or ws_net_profit BETWEEN 150 AND 300 or ws_net_profit BETWEEN 50 AND 250) and (ws_sales_price BETWEEN 100 AND 150 or ws_sales_price BETWEEN 50 AND 100 or ws_sales_price BETWEEN 150 AND 200) and (ws_sold_date_sk BETWEEN DynamicValue(RS_35_date_dim_d_date_sk_min) AND DynamicValue(RS_35_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_35_date_dim_d_date_sk_bloom_filter))) and ws_item_sk is not null and ws_order_number is not null and ws_sold_date_sk is not null and ws_web_page_sk is not null)
-                                                          TableScan [TS_3] (rows=144002668 width=243)
-                                                            default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_web_page_sk","ws_order_number","ws_quantity","ws_sales_price","ws_net_profit"]
-                                                          <-Reducer 15 [BROADCAST_EDGE] vectorized
-                                                            BROADCAST [RS_217]
-                                                              Group By Operator [GBY_216] (rows=1 width=12)
-                                                                Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                              <-Map 14 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                SHUFFLE [RS_215]
-                                                                  Group By Operator [GBY_214] (rows=1 width=12)
-                                                                    Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                    Select Operator [SEL_213] (rows=652 width=4)
-                                                                      Output:["_col0"]
-                                                                       Please refer to the previous Select Operator [SEL_211]
+                                            Merge Join Operator [MERGEJOIN_202] (rows=674551 width=258)
+                                              Conds:RS_30._col8=RS_212._col0(Inner),Output:["_col1","_col2","_col4","_col6","_col7","_col10","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col20","_col21"]
+                                            <-Map 12 [SIMPLE_EDGE] vectorized
+                                              SHUFFLE [RS_212]
+                                                PartitionCols:_col0
+                                                Select Operator [SEL_211] (rows=652 width=4)
+                                                  Output:["_col0"]
+                                                  Filter Operator [FIL_210] (rows=652 width=8)
+                                                    predicate:((d_year = 1998) and d_date_sk is not null)
+                                                    TableScan [TS_9] (rows=73049 width=8)
+                                                      default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                            <-Reducer 3 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_30]
+                                                PartitionCols:_col8
+                                                Merge Join Operator [MERGEJOIN_201] (rows=1889180 width=383)
+                                                  Conds:RS_27._col3=RS_225._col0(Inner),Output:["_col1","_col2","_col4","_col6","_col7","_col8","_col10","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col20","_col21"]
+                                                <-Map 17 [SIMPLE_EDGE] vectorized
+                                                  SHUFFLE [RS_225]
+                                                    PartitionCols:_col0
+                                                    Select Operator [SEL_223] (rows=265971 width=183)
+                                                      Output:["_col0","_col1","_col2"]
+                                                       Please refer to the previous Filter Operator [FIL_221]
+                                                <-Reducer 2 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_27]
+                                                    PartitionCols:_col3
+                                                    Merge Join Operator [MERGEJOIN_200] (rows=13039884 width=266)
+                                                      Conds:RS_209._col0, _col5=RS_220._col1, _col3(Inner),Output:["_col1","_col2","_col3","_col4","_col6","_col7","_col8","_col10","_col12","_col13","_col14","_col15","_col16","_col17","_col18"]
+                                                    <-Map 1 [SIMPLE_EDGE] vectorized
+                                                      SHUFFLE [RS_209]
+                                                        PartitionCols:_col0, _col5
+                                                        Select Operator [SEL_208] (rows=11975292 width=237)
+                                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                                                          Filter Operator [FIL_207] (rows=11975292 width=237)
+                                                            predicate:(wr_item_sk is not null and wr_order_number is not null and wr_reason_sk is not null and wr_refunded_addr_sk is not null and wr_refunded_cdemo_sk is not null and wr_returning_cdemo_sk is not null)
+                                                            TableScan [TS_0] (rows=14398467 width=237)
+                                                              default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_item_sk","wr_refunded_cdemo_sk","wr_refunded_addr_sk","wr_returning_cdemo_sk","wr_reason_sk","wr_order_number","wr_fee","wr_refunded_cash"]
+                                                    <-Map 11 [SIMPLE_EDGE] vectorized
+                                                      SHUFFLE [RS_220]
+                                                        PartitionCols:_col1, _col3
+                                                        Select Operator [SEL_219] (rows=15992347 width=43)
+                                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"]
+                                                          Filter Operator [FIL_218] (rows=15992347 width=243)
+                                                            predicate:((ws_net_profit BETWEEN 100 AND 200 or ws_net_profit BETWEEN 150 AND 300 or ws_net_profit BETWEEN 50 AND 250) and (ws_sales_price BETWEEN 100 AND 150 or ws_sales_price BETWEEN 50 AND 100 or ws_sales_price BETWEEN 150 AND 200) and (ws_sold_date_sk BETWEEN DynamicValue(RS_31_date_dim_d_date_sk_min) AND DynamicValue(RS_31_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_31_date_dim_d_date_sk_bloom_filter))) and ws_item_sk is not null and ws_order_number is not null and ws_sold_date_sk is not null and ws_web_page_sk is not null)
+                                                            TableScan [TS_3] (rows=144002668 width=243)
+                                                              default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_web_page_sk","ws_order_number","ws_quantity","ws_sales_price","ws_net_profit"]
+                                                            <-Reducer 13 [BROADCAST_EDGE] vectorized
+                                                              BROADCAST [RS_217]
+                                                                Group By Operator [GBY_216] (rows=1 width=12)
+                                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                  SHUFFLE [RS_215]
+                                                                    Group By Operator [GBY_214] (rows=1 width=12)
+                                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                      Select Operator [SEL_213] (rows=652 width=4)
+                                                                        Output:["_col0"]
+                                                                         Please refer to the previous Select Operator [SEL_211]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query86.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query86.q.out b/ql/src/test/results/clientpositive/perf/tez/query86.q.out
index 22d494b..2d6d545 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query86.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query86.q.out
@@ -100,7 +100,7 @@ Stage-0
                               Select Operator [SEL_15] (rows=24992810 width=293)
                                 Output:["_col0","_col1","_col2"]
                                 Merge Join Operator [MERGEJOIN_60] (rows=24992810 width=293)
-                                  Conds:RS_12._col1=RS_74._col0(Inner),Output:["_col2","_col6","_col7"]
+                                  Conds:RS_12._col1=RS_74._col0(Inner),Output:["_col2","_col5","_col6"]
                                 <-Map 9 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_74]
                                     PartitionCols:_col0
@@ -118,7 +118,7 @@ Stage-0
                                     <-Map 7 [SIMPLE_EDGE] vectorized
                                       PARTITION_ONLY_SHUFFLE [RS_63]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_62] (rows=317 width=8)
+                                        Select Operator [SEL_62] (rows=317 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_61] (rows=317 width=8)
                                             predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query87.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query87.q.out b/ql/src/test/results/clientpositive/perf/tez/query87.q.out
index 4006cfb..5b59116 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query87.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query87.q.out
@@ -113,9 +113,9 @@ Stage-0
                                       SHUFFLE [RS_80]
                                         PartitionCols:_col0, _col1, _col2
                                         Group By Operator [GBY_79] (rows=24986582 width=274)
-                                          Output:["_col0","_col1","_col2"],keys:_col7, _col6, _col3
+                                          Output:["_col0","_col1","_col2"],keys:_col6, _col5, _col3
                                           Merge Join Operator [MERGEJOIN_192] (rows=24986582 width=274)
-                                            Conds:RS_75._col1=RS_249._col0(Inner),Output:["_col3","_col6","_col7"]
+                                            Conds:RS_75._col1=RS_249._col0(Inner),Output:["_col3","_col5","_col6"]
                                           <-Map 20 [SIMPLE_EDGE] vectorized
                                             SHUFFLE [RS_249]
                                               PartitionCols:_col0
@@ -133,7 +133,7 @@ Stage-0
                                               <-Map 10 [SIMPLE_EDGE] vectorized
                                                 SHUFFLE [RS_232]
                                                   PartitionCols:_col0
-                                                  Select Operator [SEL_227] (rows=317 width=102)
+                                                  Select Operator [SEL_227] (rows=317 width=98)
                                                     Output:["_col0","_col1"]
                                                     Filter Operator [FIL_226] (rows=317 width=102)
                                                       predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)
@@ -196,9 +196,9 @@ Stage-0
                                                         SHUFFLE [RS_42]
                                                           PartitionCols:_col0, _col1, _col2
                                                           Group By Operator [GBY_41] (rows=49146883 width=274)
-                                                            Output:["_col0","_col1","_col2"],keys:_col7, _col6, _col3
+                                                            Output:["_col0","_col1","_col2"],keys:_col6, _col5, _col3
                                                             Merge Join Operator [MERGEJOIN_190] (rows=49146883 width=274)
-                                                              Conds:RS_37._col1=RS_248._col0(Inner),Output:["_col3","_col6","_col7"]
+                                                              Conds:RS_37._col1=RS_248._col0(Inner),Output:["_col3","_col5","_col6"]
                                                             <-Map 20 [SIMPLE_EDGE] vectorized
                                                               SHUFFLE [RS_248]
                                                                 PartitionCols:_col0
@@ -251,9 +251,9 @@ Stage-0
                                                         SHUFFLE [RS_17]
                                                           PartitionCols:_col0, _col1, _col2
                                                           Group By Operator [GBY_16] (rows=91197425 width=274)
-                                                            Output:["_col0","_col1","_col2"],keys:_col7, _col6, _col3
+                                                            Output:["_col0","_col1","_col2"],keys:_col6, _col5, _col3
                                                             Merge Join Operator [MERGEJOIN_188] (rows=91197425 width=274)
-                                                              Conds:RS_12._col1=RS_247._col0(Inner),Output:["_col3","_col6","_col7"]
+                                                              Conds:RS_12._col1=RS_247._col0(Inner),Output:["_col3","_col5","_col6"]
                                                             <-Map 20 [SIMPLE_EDGE] vectorized
                                                               SHUFFLE [RS_247]
                                                                 PartitionCols:_col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query88.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query88.q.out b/ql/src/test/results/clientpositive/perf/tez/query88.q.out
index 28a9707..249f7e3 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query88.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query88.q.out
@@ -305,7 +305,7 @@ Stage-0
                             <-Map 59 [SIMPLE_EDGE] vectorized
                               PARTITION_ONLY_SHUFFLE [RS_704]
                                 PartitionCols:_col0
-                                Select Operator [SEL_693] (rows=155 width=91)
+                                Select Operator [SEL_693] (rows=155 width=4)
                                   Output:["_col0"]
                                   Filter Operator [FIL_692] (rows=155 width=92)
                                     predicate:((s_store_name = 'ese') and s_store_sk is not null)
@@ -319,7 +319,7 @@ Stage-0
                                 <-Map 50 [SIMPLE_EDGE] vectorized
                                   PARTITION_ONLY_SHUFFLE [RS_668]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_655] (rows=1515 width=12)
+                                    Select Operator [SEL_655] (rows=1515 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_647] (rows=1515 width=12)
                                         predicate:((t_hour = 10) and (t_minute < 30) and t_time_sk is not null)
@@ -333,7 +333,7 @@ Stage-0
                                     <-Map 13 [SIMPLE_EDGE] vectorized
                                       PARTITION_ONLY_SHUFFLE [RS_618]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_607] (rows=817 width=12)
+                                        Select Operator [SEL_607] (rows=817 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_606] (rows=817 width=12)
                                             predicate:((((hd_dep_count = 3) and hd_vehicle_count is not null) or ((hd_dep_count = 0) and (hd_vehicle_count <= 2)) or ((hd_dep_count = 1) and (hd_vehicle_count <= 3))) and (hd_dep_count) IN (3, 0, 1) and (hd_vehicle_count <= 5) and hd_demo_sk is not null)
@@ -407,7 +407,7 @@ Stage-0
                                     <-Map 50 [SIMPLE_EDGE] vectorized
                                       PARTITION_ONLY_SHUFFLE [RS_666]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_654] (rows=1515 width=12)
+                                        Select Operator [SEL_654] (rows=1515 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_646] (rows=1515 width=12)
                                             predicate:((t_hour = 10) and (t_minute >= 30) and t_time_sk is not null)
@@ -489,7 +489,7 @@ Stage-0
                                         <-Map 50 [SIMPLE_EDGE] vectorized
                                           PARTITION_ONLY_SHUFFLE [RS_664]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_653] (rows=1515 width=12)
+                                            Select Operator [SEL_653] (rows=1515 width=4)
                                               Output:["_col0"]
                                               Filter Operator [FIL_645] (rows=1515 width=12)
                                                 predicate:((t_hour = 11) and (t_minute < 30) and t_time_sk is not null)
@@ -571,7 +571,7 @@ Stage-0
                                             <-Map 50 [SIMPLE_EDGE] vectorized
                                               PARTITION_ONLY_SHUFFLE [RS_662]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_652] (rows=1515 width=12)
+                                                Select Operator [SEL_652] (rows=1515 width=4)
                                                   Output:["_col0"]
                                                   Filter Operator [FIL_644] (rows=1515 width=12)
                                                     predicate:((t_hour = 11) and (t_minute >= 30) and t_time_sk is not null)
@@ -653,7 +653,7 @@ Stage-0
                                                 <-Map 50 [SIMPLE_EDGE] vectorized
                                                   PARTITION_ONLY_SHUFFLE [RS_660]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_651] (rows=1515 width=12)
+                                                    Select Operator [SEL_651] (rows=1515 width=4)
                                                       Output:["_col0"]
                                                       Filter Operator [FIL_643] (rows=1515 width=12)
                                                         predicate:((t_hour = 12) and (t_minute < 30) and t_time_sk is not null)
@@ -731,7 +731,7 @@ Stage-0
                                                 <-Map 50 [SIMPLE_EDGE] vectorized
                                                   PARTITION_ONLY_SHUFFLE [RS_658]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_650] (rows=1515 width=12)
+                                                    Select Operator [SEL_650] (rows=1515 width=4)
                                                       Output:["_col0"]
                                                       Filter Operator [FIL_642] (rows=1515 width=12)
                                                         predicate:((t_hour = 8) and (t_minute >= 30) and t_time_sk is not null)
@@ -809,7 +809,7 @@ Stage-0
                             <-Map 50 [SIMPLE_EDGE] vectorized
                               PARTITION_ONLY_SHUFFLE [RS_670]
                                 PartitionCols:_col0
-                                Select Operator [SEL_656] (rows=1515 width=12)
+                                Select Operator [SEL_656] (rows=1515 width=4)
                                   Output:["_col0"]
                                   Filter Operator [FIL_648] (rows=1515 width=12)
                                     predicate:((t_hour = 9) and (t_minute >= 30) and t_time_sk is not null)
@@ -887,7 +887,7 @@ Stage-0
                         <-Map 50 [SIMPLE_EDGE] vectorized
                           PARTITION_ONLY_SHUFFLE [RS_672]
                             PartitionCols:_col0
-                            Select Operator [SEL_657] (rows=1515 width=12)
+                            Select Operator [SEL_657] (rows=1515 width=4)
                               Output:["_col0"]
                               Filter Operator [FIL_649] (rows=1515 width=12)
                                 predicate:((t_hour = 9) and (t_minute < 30) and t_time_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query89.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query89.q.out b/ql/src/test/results/clientpositive/perf/tez/query89.q.out
index 0844ca7..e79b9dd 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query89.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query89.q.out
@@ -106,9 +106,9 @@ Stage-0
                             SHUFFLE [RS_23]
                               PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
                               Group By Operator [GBY_22] (rows=27308180 width=577)
-                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col7, _col10, _col12, _col13
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col7, _col9, _col11, _col12
                                 Merge Join Operator [MERGEJOIN_84] (rows=27308180 width=480)
-                                  Conds:RS_18._col2=RS_106._col0(Inner),Output:["_col3","_col5","_col6","_col7","_col10","_col12","_col13"]
+                                  Conds:RS_18._col2=RS_106._col0(Inner),Output:["_col3","_col5","_col6","_col7","_col9","_col11","_col12"]
                                 <-Map 12 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_106]
                                     PartitionCols:_col0
@@ -122,12 +122,12 @@ Stage-0
                                   SHUFFLE [RS_18]
                                     PartitionCols:_col2
                                     Merge Join Operator [MERGEJOIN_83] (rows=27308180 width=301)
-                                      Conds:RS_15._col0=RS_95._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col7","_col10"]
+                                      Conds:RS_15._col0=RS_95._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col7","_col9"]
                                     <-Map 10 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_95]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_94] (rows=652 width=12)
-                                          Output:["_col0","_col2"]
+                                        Select Operator [SEL_94] (rows=652 width=8)
+                                          Output:["_col0","_col1"]
                                           Filter Operator [FIL_93] (rows=652 width=12)
                                             predicate:((d_year = 2000) and d_date_sk is not null)
                                             TableScan [TS_6] (rows=73049 width=12)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query9.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query9.q.out b/ql/src/test/results/clientpositive/perf/tez/query9.q.out
index eb1d3a5..ff156b5 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query9.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query9.q.out
@@ -159,150 +159,154 @@ Stage-0
       File Output Operator [FS_154]
         Select Operator [SEL_153] (rows=2 width=560)
           Output:["_col0","_col1","_col2","_col3","_col4"]
-          Merge Join Operator [MERGEJOIN_185] (rows=2 width=1160)
+          Merge Join Operator [MERGEJOIN_185] (rows=2 width=1140)
             Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15"]
           <-Reducer 15 [CUSTOM_SIMPLE_EDGE]
             PARTITION_ONLY_SHUFFLE [RS_150]
-              Merge Join Operator [MERGEJOIN_184] (rows=2 width=1048)
+              Merge Join Operator [MERGEJOIN_184] (rows=2 width=1028)
                 Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14"]
               <-Reducer 14 [CUSTOM_SIMPLE_EDGE]
                 PARTITION_ONLY_SHUFFLE [RS_147]
-                  Merge Join Operator [MERGEJOIN_183] (rows=2 width=936)
+                  Merge Join Operator [MERGEJOIN_183] (rows=2 width=916)
                     Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
                   <-Reducer 13 [CUSTOM_SIMPLE_EDGE]
                     PARTITION_ONLY_SHUFFLE [RS_144]
-                      Merge Join Operator [MERGEJOIN_182] (rows=2 width=928)
+                      Merge Join Operator [MERGEJOIN_182] (rows=2 width=912)
                         Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12"]
                       <-Reducer 12 [CUSTOM_SIMPLE_EDGE]
                         PARTITION_ONLY_SHUFFLE [RS_141]
-                          Merge Join Operator [MERGEJOIN_181] (rows=2 width=816)
+                          Merge Join Operator [MERGEJOIN_181] (rows=2 width=800)
                             Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
                           <-Reducer 11 [CUSTOM_SIMPLE_EDGE]
                             PARTITION_ONLY_SHUFFLE [RS_138]
-                              Merge Join Operator [MERGEJOIN_180] (rows=2 width=704)
+                              Merge Join Operator [MERGEJOIN_180] (rows=2 width=688)
                                 Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"]
                               <-Reducer 10 [CUSTOM_SIMPLE_EDGE]
                                 PARTITION_ONLY_SHUFFLE [RS_135]
-                                  Merge Join Operator [MERGEJOIN_179] (rows=2 width=696)
+                                  Merge Join Operator [MERGEJOIN_179] (rows=2 width=684)
                                     Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
                                   <-Reducer 34 [CUSTOM_SIMPLE_EDGE] vectorized
-                                    PARTITION_ONLY_SHUFFLE [RS_272]
-                                      Select Operator [SEL_271] (rows=1 width=112)
+                                    PARTITION_ONLY_SHUFFLE [RS_275]
+                                      Select Operator [SEL_274] (rows=1 width=112)
                                         Output:["_col0"]
-                                        Group By Operator [GBY_270] (rows=1 width=120)
+                                        Group By Operator [GBY_273] (rows=1 width=120)
                                           Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                         <-Map 29 [CUSTOM_SIMPLE_EDGE] vectorized
-                                          PARTITION_ONLY_SHUFFLE [RS_253]
-                                            Group By Operator [GBY_248] (rows=1 width=120)
+                                          PARTITION_ONLY_SHUFFLE [RS_254]
+                                            Group By Operator [GBY_249] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(ss_net_paid_inc_tax)","count(ss_net_paid_inc_tax)"]
-                                              Select Operator [SEL_243] (rows=182855757 width=110)
+                                              Select Operator [SEL_244] (rows=182855757 width=110)
                                                 Output:["ss_net_paid_inc_tax"]
-                                                Filter Operator [FIL_238] (rows=182855757 width=110)
+                                                Filter Operator [FIL_239] (rows=182855757 width=110)
                                                   predicate:ss_quantity BETWEEN 41 AND 60
                                                   TableScan [TS_80] (rows=575995635 width=110)
                                                     default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_quantity","ss_net_paid_inc_tax"]
                                   <-Reducer 9 [CUSTOM_SIMPLE_EDGE]
                                     PARTITION_ONLY_SHUFFLE [RS_132]
-                                      Merge Join Operator [MERGEJOIN_178] (rows=2 width=584)
+                                      Merge Join Operator [MERGEJOIN_178] (rows=2 width=572)
                                         Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
                                       <-Reducer 28 [CUSTOM_SIMPLE_EDGE] vectorized
-                                        PARTITION_ONLY_SHUFFLE [RS_269]
-                                          Select Operator [SEL_268] (rows=1 width=112)
+                                        PARTITION_ONLY_SHUFFLE [RS_272]
+                                          Select Operator [SEL_271] (rows=1 width=112)
                                             Output:["_col0"]
-                                            Group By Operator [GBY_267] (rows=1 width=120)
+                                            Group By Operator [GBY_270] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                             <-Map 23 [CUSTOM_SIMPLE_EDGE] vectorized
-                                              PARTITION_ONLY_SHUFFLE [RS_230]
-                                                Group By Operator [GBY_225] (rows=1 width=120)
+                                              PARTITION_ONLY_SHUFFLE [RS_231]
+                                                Group By Operator [GBY_226] (rows=1 width=120)
                                                   Output:["_col0","_col1"],aggregations:["sum(ss_ext_list_price)","count(ss_ext_list_price)"]
-                                                  Select Operator [SEL_220] (rows=182855757 width=110)
+                                                  Select Operator [SEL_221] (rows=182855757 width=110)
                                                     Output:["ss_ext_list_price"]
-                                                    Filter Operator [FIL_215] (rows=182855757 width=110)
+                                                    Filter Operator [FIL_216] (rows=182855757 width=110)
                                                       predicate:ss_quantity BETWEEN 41 AND 60
                                                       TableScan [TS_73] (rows=575995635 width=110)
                                                         default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_quantity","ss_ext_list_price"]
                                       <-Reducer 8 [CUSTOM_SIMPLE_EDGE]
                                         PARTITION_ONLY_SHUFFLE [RS_129]
-                                          Merge Join Operator [MERGEJOIN_177] (rows=2 width=472)
+                                          Merge Join Operator [MERGEJOIN_177] (rows=2 width=460)
                                             Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
                                           <-Reducer 22 [CUSTOM_SIMPLE_EDGE] vectorized
-                                            PARTITION_ONLY_SHUFFLE [RS_266]
-                                              Group By Operator [GBY_265] (rows=1 width=8)
-                                                Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                                              <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                PARTITION_ONLY_SHUFFLE [RS_208]
-                                                  Group By Operator [GBY_203] (rows=1 width=8)
-                                                    Output:["_col0"],aggregations:["count()"]
-                                                    Select Operator [SEL_198] (rows=182855757 width=3)
-                                                      Filter Operator [FIL_193] (rows=182855757 width=3)
-                                                        predicate:ss_quantity BETWEEN 41 AND 60
-                                                        TableScan [TS_66] (rows=575995635 width=3)
-                                                          default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_quantity"]
+                                            PARTITION_ONLY_SHUFFLE [RS_269]
+                                              Select Operator [SEL_268] (rows=1 width=4)
+                                                Output:["_col0"]
+                                                Group By Operator [GBY_267] (rows=1 width=8)
+                                                  Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                                <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                  PARTITION_ONLY_SHUFFLE [RS_208]
+                                                    Group By Operator [GBY_203] (rows=1 width=8)
+                                                      Output:["_col0"],aggregations:["count()"]
+                                                      Select Operator [SEL_198] (rows=182855757 width=3)
+                                                        Filter Operator [FIL_193] (rows=182855757 width=3)
+                                                          predicate:ss_quantity BETWEEN 41 AND 60
+                                                          TableScan [TS_66] (rows=575995635 width=3)
+                                                            default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_quantity"]
                                           <-Reducer 7 [CUSTOM_SIMPLE_EDGE]
                                             PARTITION_ONLY_SHUFFLE [RS_126]
-                                              Merge Join Operator [MERGEJOIN_176] (rows=2 width=464)
+                                              Merge Join Operator [MERGEJOIN_176] (rows=2 width=456)
                                                 Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5","_col6"]
                                               <-Reducer 33 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                PARTITION_ONLY_SHUFFLE [RS_264]
-                                                  Select Operator [SEL_263] (rows=1 width=112)
+                                                PARTITION_ONLY_SHUFFLE [RS_266]
+                                                  Select Operator [SEL_265] (rows=1 width=112)
                                                     Output:["_col0"]
-                                                    Group By Operator [GBY_262] (rows=1 width=120)
+                                                    Group By Operator [GBY_264] (rows=1 width=120)
                                                       Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                                     <-Map 29 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                      PARTITION_ONLY_SHUFFLE [RS_252]
-                                                        Group By Operator [GBY_247] (rows=1 width=120)
+                                                      PARTITION_ONLY_SHUFFLE [RS_253]
+                                                        Group By Operator [GBY_248] (rows=1 width=120)
                                                           Output:["_col0","_col1"],aggregations:["sum(ss_net_paid_inc_tax)","count(ss_net_paid_inc_tax)"]
-                                                          Select Operator [SEL_242] (rows=182855757 width=110)
+                                                          Select Operator [SEL_243] (rows=182855757 width=110)
                                                             Output:["ss_net_paid_inc_tax"]
-                                                            Filter Operator [FIL_237] (rows=182855757 width=110)
+                                                            Filter Operator [FIL_238] (rows=182855757 width=110)
                                                               predicate:ss_quantity BETWEEN 21 AND 40
                                                                Please refer to the previous TableScan [TS_80]
                                               <-Reducer 6 [CUSTOM_SIMPLE_EDGE]
                                                 PARTITION_ONLY_SHUFFLE [RS_123]
-                                                  Merge Join Operator [MERGEJOIN_175] (rows=2 width=352)
+                                                  Merge Join Operator [MERGEJOIN_175] (rows=2 width=344)
                                                     Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4","_col5"]
                                                   <-Reducer 27 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_261]
-                                                      Select Operator [SEL_260] (rows=1 width=112)
+                                                    PARTITION_ONLY_SHUFFLE [RS_263]
+                                                      Select Operator [SEL_262] (rows=1 width=112)
                                                         Output:["_col0"]
-                                                        Group By Operator [GBY_259] (rows=1 width=120)
+                                                        Group By Operator [GBY_261] (rows=1 width=120)
                                                           Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                                         <-Map 23 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                          PARTITION_ONLY_SHUFFLE [RS_229]
-                                                            Group By Operator [GBY_224] (rows=1 width=120)
+                                                          PARTITION_ONLY_SHUFFLE [RS_230]
+                                                            Group By Operator [GBY_225] (rows=1 width=120)
                                                               Output:["_col0","_col1"],aggregations:["sum(ss_ext_list_price)","count(ss_ext_list_price)"]
-                                                              Select Operator [SEL_219] (rows=182855757 width=110)
+                                                              Select Operator [SEL_220] (rows=182855757 width=110)
                                                                 Output:["ss_ext_list_price"]
-                                                                Filter Operator [FIL_214] (rows=182855757 width=110)
+                                                                Filter Operator [FIL_215] (rows=182855757 width=110)
                                                                   predicate:ss_quantity BETWEEN 21 AND 40
                                                                    Please refer to the previous TableScan [TS_73]
                                                   <-Reducer 5 [CUSTOM_SIMPLE_EDGE]
                                                     PARTITION_ONLY_SHUFFLE [RS_120]
-                                                      Merge Join Operator [MERGEJOIN_174] (rows=2 width=240)
+                                                      Merge Join Operator [MERGEJOIN_174] (rows=2 width=232)
                                                         Conds:(Left Outer),Output:["_col1","_col2","_col3","_col4"]
                                                       <-Reducer 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                        PARTITION_ONLY_SHUFFLE [RS_258]
-                                                          Group By Operator [GBY_257] (rows=1 width=8)
-                                                            Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                                                          <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                            PARTITION_ONLY_SHUFFLE [RS_207]
-                                                              Group By Operator [GBY_202] (rows=1 width=8)
-                                                                Output:["_col0"],aggregations:["count()"]
-                                                                Select Operator [SEL_197] (rows=182855757 width=3)
-                                                                  Filter Operator [FIL_192] (rows=182855757 width=3)
-                                                                    predicate:ss_quantity BETWEEN 21 AND 40
-                                                                     Please refer to the previous TableScan [TS_66]
+                                                        PARTITION_ONLY_SHUFFLE [RS_260]
+                                                          Select Operator [SEL_259] (rows=1 width=4)
+                                                            Output:["_col0"]
+                                                            Group By Operator [GBY_258] (rows=1 width=8)
+                                                              Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                                            <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                              PARTITION_ONLY_SHUFFLE [RS_207]
+                                                                Group By Operator [GBY_202] (rows=1 width=8)
+                                                                  Output:["_col0"],aggregations:["count()"]
+                                                                  Select Operator [SEL_197] (rows=182855757 width=3)
+                                                                    Filter Operator [FIL_192] (rows=182855757 width=3)
+                                                                      predicate:ss_quantity BETWEEN 21 AND 40
+                                                                       Please refer to the previous TableScan [TS_66]
                                                       <-Reducer 4 [CUSTOM_SIMPLE_EDGE]
                                                         PARTITION_ONLY_SHUFFLE [RS_117]
-                                                          Merge Join Operator [MERGEJOIN_173] (rows=2 width=232)
+                                                          Merge Join Operator [MERGEJOIN_173] (rows=2 width=228)
                                                             Conds:(Left Outer),Output:["_col1","_col2","_col3"]
                                                           <-Reducer 3 [CUSTOM_SIMPLE_EDGE]
                                                             PARTITION_ONLY_SHUFFLE [RS_114]
-                                                              Merge Join Operator [MERGEJOIN_172] (rows=2 width=120)
+                                                              Merge Join Operator [MERGEJOIN_172] (rows=2 width=116)
                                                                 Conds:(Left Outer),Output:["_col1","_col2"]
                                                               <-Reducer 2 [CUSTOM_SIMPLE_EDGE]
                                                                 PARTITION_ONLY_SHUFFLE [RS_111]
-                                                                  Merge Join Operator [MERGEJOIN_171] (rows=2 width=8)
+                                                                  Merge Join Operator [MERGEJOIN_171] (rows=2 width=4)
                                                                     Conds:(Left Outer),Output:["_col1"]
                                                                   <-Map 1 [CUSTOM_SIMPLE_EDGE] vectorized
                                                                     PARTITION_ONLY_SHUFFLE [RS_188]
@@ -312,129 +316,135 @@ Stage-0
                                                                           TableScan [TS_0] (rows=72 width=4)
                                                                             default@reason,reason,Tbl:COMPLETE,Col:COMPLETE,Output:["r_reason_sk"]
                                                                   <-Reducer 20 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                    PARTITION_ONLY_SHUFFLE [RS_210]
-                                                                      Group By Operator [GBY_209] (rows=1 width=8)
-                                                                        Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                                                                      <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                        PARTITION_ONLY_SHUFFLE [RS_206]
-                                                                          Group By Operator [GBY_201] (rows=1 width=8)
-                                                                            Output:["_col0"],aggregations:["count()"]
-                                                                            Select Operator [SEL_196] (rows=182855757 width=3)
-                                                                              Filter Operator [FIL_191] (rows=182855757 width=3)
-                                                                                predicate:ss_quantity BETWEEN 1 AND 20
-                                                                                 Please refer to the previous TableScan [TS_66]
+                                                                    PARTITION_ONLY_SHUFFLE [RS_211]
+                                                                      Select Operator [SEL_210] (rows=1 width=4)
+                                                                        Output:["_col0"]
+                                                                        Group By Operator [GBY_209] (rows=1 width=8)
+                                                                          Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                                                        <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                          PARTITION_ONLY_SHUFFLE [RS_206]
+                                                                            Group By Operator [GBY_201] (rows=1 width=8)
+                                                                              Output:["_col0"],aggregations:["count()"]
+                                                                              Select Operator [SEL_196] (rows=182855757 width=3)
+                                                                                Filter Operator [FIL_191] (rows=182855757 width=3)
+                                                                                  predicate:ss_quantity BETWEEN 1 AND 20
+                                                                                   Please refer to the previous TableScan [TS_66]
                                                               <-Reducer 26 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                PARTITION_ONLY_SHUFFLE [RS_233]
-                                                                  Select Operator [SEL_232] (rows=1 width=112)
+                                                                PARTITION_ONLY_SHUFFLE [RS_234]
+                                                                  Select Operator [SEL_233] (rows=1 width=112)
                                                                     Output:["_col0"]
-                                                                    Group By Operator [GBY_231] (rows=1 width=120)
+                                                                    Group By Operator [GBY_232] (rows=1 width=120)
                                                                       Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                                                     <-Map 23 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                      PARTITION_ONLY_SHUFFLE [RS_228]
-                                                                        Group By Operator [GBY_223] (rows=1 width=120)
+                                                                      PARTITION_ONLY_SHUFFLE [RS_229]
+                                                                        Group By Operator [GBY_224] (rows=1 width=120)
                                                                           Output:["_col0","_col1"],aggregations:["sum(ss_ext_list_price)","count(ss_ext_list_price)"]
-                                                                          Select Operator [SEL_218] (rows=182855757 width=110)
+                                                                          Select Operator [SEL_219] (rows=182855757 width=110)
                                                                             Output:["ss_ext_list_price"]
-                                                                            Filter Operator [FIL_213] (rows=182855757 width=110)
+                                                                            Filter Operator [FIL_214] (rows=182855757 width=110)
                                                                               predicate:ss_quantity BETWEEN 1 AND 20
                                                                                Please refer to the previous TableScan [TS_73]
                                                           <-Reducer 32 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                            PARTITION_ONLY_SHUFFLE [RS_256]
-                                                              Select Operator [SEL_255] (rows=1 width=112)
+                                                            PARTITION_ONLY_SHUFFLE [RS_257]
+                                                              Select Operator [SEL_256] (rows=1 width=112)
                                                                 Output:["_col0"]
-                                                                Group By Operator [GBY_254] (rows=1 width=120)
+                                                                Group By Operator [GBY_255] (rows=1 width=120)
                                                                   Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                                                 <-Map 29 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  PARTITION_ONLY_SHUFFLE [RS_251]
-                                                                    Group By Operator [GBY_246] (rows=1 width=120)
+                                                                  PARTITION_ONLY_SHUFFLE [RS_252]
+                                                                    Group By Operator [GBY_247] (rows=1 width=120)
                                                                       Output:["_col0","_col1"],aggregations:["sum(ss_net_paid_inc_tax)","count(ss_net_paid_inc_tax)"]
-                                                                      Select Operator [SEL_241] (rows=182855757 width=110)
+                                                                      Select Operator [SEL_242] (rows=182855757 width=110)
                                                                         Output:["ss_net_paid_inc_tax"]
-                                                                        Filter Operator [FIL_236] (rows=182855757 width=110)
+                                                                        Filter Operator [FIL_237] (rows=182855757 width=110)
                                                                           predicate:ss_quantity BETWEEN 1 AND 20
                                                                            Please refer to the previous TableScan [TS_80]
                               <-Reducer 18 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_274]
-                                  Group By Operator [GBY_273] (rows=1 width=8)
-                                    Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                                  <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
-                                    PARTITION_ONLY_SHUFFLE [RS_204]
-                                      Group By Operator [GBY_199] (rows=1 width=8)
-                                        Output:["_col0"],aggregations:["count()"]
-                                        Select Operator [SEL_194] (rows=182855757 width=3)
-                                          Filter Operator [FIL_189] (rows=182855757 width=3)
-                                            predicate:ss_quantity BETWEEN 61 AND 80
-                                             Please refer to the previous TableScan [TS_66]
+                                PARTITION_ONLY_SHUFFLE [RS_278]
+                                  Select Operator [SEL_277] (rows=1 width=4)
+                                    Output:["_col0"]
+                                    Group By Operator [GBY_276] (rows=1 width=8)
+                                      Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                    <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
+                                      PARTITION_ONLY_SHUFFLE [RS_204]
+                                        Group By Operator [GBY_199] (rows=1 width=8)
+                                          Output:["_col0"],aggregations:["count()"]
+                                          Select Operator [SEL_194] (rows=182855757 width=3)
+                                            Filter Operator [FIL_189] (rows=182855757 width=3)
+                                              predicate:ss_quantity BETWEEN 61 AND 80
+                                               Please refer to the previous TableScan [TS_66]
                           <-Reducer 24 [CUSTOM_SIMPLE_EDGE] vectorized
-                            PARTITION_ONLY_SHUFFLE [RS_277]
-                              Select Operator [SEL_276] (rows=1 width=112)
+                            PARTITION_ONLY_SHUFFLE [RS_281]
+                              Select Operator [SEL_280] (rows=1 width=112)
                                 Output:["_col0"]
-                                Group By Operator [GBY_275] (rows=1 width=120)
+                                Group By Operator [GBY_279] (rows=1 width=120)
                                   Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                 <-Map 23 [CUSTOM_SIMPLE_EDGE] vectorized
-                                  PARTITION_ONLY_SHUFFLE [RS_226]
-                                    Group By Operator [GBY_221] (rows=1 width=120)
+                                  PARTITION_ONLY_SHUFFLE [RS_227]
+                                    Group By Operator [GBY_222] (rows=1 width=120)
                                       Output:["_col0","_col1"],aggregations:["sum(ss_ext_list_price)","count(ss_ext_list_price)"]
-                                      Select Operator [SEL_216] (rows=182855757 width=110)
+                                      Select Operator [SEL_217] (rows=182855757 width=110)
                                         Output:["ss_ext_list_price"]
-                                        Filter Operator [FIL_211] (rows=182855757 width=110)
+                                        Filter Operator [FIL_212] (rows=182855757 width=110)
                                           predicate:ss_quantity BETWEEN 61 AND 80
                                            Please refer to the previous TableScan [TS_73]
                       <-Reducer 30 [CUSTOM_SIMPLE_EDGE] vectorized
-                        PARTITION_ONLY_SHUFFLE [RS_280]
-                          Select Operator [SEL_279] (rows=1 width=112)
+                        PARTITION_ONLY_SHUFFLE [RS_284]
+                          Select Operator [SEL_283] (rows=1 width=112)
                             Output:["_col0"]
-                            Group By Operator [GBY_278] (rows=1 width=120)
+                            Group By Operator [GBY_282] (rows=1 width=120)
                               Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                             <-Map 29 [CUSTOM_SIMPLE_EDGE] vectorized
-                              PARTITION_ONLY_SHUFFLE [RS_249]
-                                Group By Operator [GBY_244] (rows=1 width=120)
+                              PARTITION_ONLY_SHUFFLE [RS_250]
+                                Group By Operator [GBY_245] (rows=1 width=120)
                                   Output:["_col0","_col1"],aggregations:["sum(ss_net_paid_inc_tax)","count(ss_net_paid_inc_tax)"]
-                                  Select Operator [SEL_239] (rows=182855757 width=110)
+                                  Select Operator [SEL_240] (rows=182855757 width=110)
                                     Output:["ss_net_paid_inc_tax"]
-                                    Filter Operator [FIL_234] (rows=182855757 width=110)
+                                    Filter Operator [FIL_235] (rows=182855757 width=110)
                                       predicate:ss_quantity BETWEEN 61 AND 80
                                        Please refer to the previous TableScan [TS_80]
                   <-Reducer 19 [CUSTOM_SIMPLE_EDGE] vectorized
-                    PARTITION_ONLY_SHUFFLE [RS_282]
-                      Group By Operator [GBY_281] (rows=1 width=8)
-                        Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                      <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
-                        PARTITION_ONLY_SHUFFLE [RS_205]
-                          Group By Operator [GBY_200] (rows=1 width=8)
-                            Output:["_col0"],aggregations:["count()"]
-                            Select Operator [SEL_195] (rows=182855757 width=3)
-                              Filter Operator [FIL_190] (rows=182855757 width=3)
-                                predicate:ss_quantity BETWEEN 81 AND 100
-                                 Please refer to the previous TableScan [TS_66]
+                    PARTITION_ONLY_SHUFFLE [RS_287]
+                      Select Operator [SEL_286] (rows=1 width=4)
+                        Output:["_col0"]
+                        Group By Operator [GBY_285] (rows=1 width=8)
+                          Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                        <-Map 17 [CUSTOM_SIMPLE_EDGE] vectorized
+                          PARTITION_ONLY_SHUFFLE [RS_205]
+                            Group By Operator [GBY_200] (rows=1 width=8)
+                              Output:["_col0"],aggregations:["count()"]
+                              Select Operator [SEL_195] (rows=182855757 width=3)
+                                Filter Operator [FIL_190] (rows=182855757 width=3)
+                                  predicate:ss_quantity BETWEEN 81 AND 100
+                                   Please refer to the previous TableScan [TS_66]
               <-Reducer 25 [CUSTOM_SIMPLE_EDGE] vectorized
-                PARTITION_ONLY_SHUFFLE [RS_285]
-                  Select Operator [SEL_284] (rows=1 width=112)
+                PARTITION_ONLY_SHUFFLE [RS_290]
+                  Select Operator [SEL_289] (rows=1 width=112)
                     Output:["_col0"]
-                    Group By Operator [GBY_283] (rows=1 width=120)
+                    Group By Operator [GBY_288] (rows=1 width=120)
                       Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                     <-Map 23 [CUSTOM_SIMPLE_EDGE] vectorized
-                      PARTITION_ONLY_SHUFFLE [RS_227]
-                        Group By Operator [GBY_222] (rows=1 width=120)
+                      PARTITION_ONLY_SHUFFLE [RS_228]
+                        Group By Operator [GBY_223] (rows=1 width=120)
                           Output:["_col0","_col1"],aggregations:["sum(ss_ext_list_price)","count(ss_ext_list_price)"]
-                          Select Operator [SEL_217] (rows=182855757 width=110)
+                          Select Operator [SEL_218] (rows=182855757 width=110)
                             Output:["ss_ext_list_price"]
-                            Filter Operator [FIL_212] (rows=182855757 width=110)
+                            Filter Operator [FIL_213] (rows=182855757 width=110)
                               predicate:ss_quantity BETWEEN 81 AND 100
                                Please refer to the previous TableScan [TS_73]
           <-Reducer 31 [CUSTOM_SIMPLE_EDGE] vectorized
-            PARTITION_ONLY_SHUFFLE [RS_288]
-              Select Operator [SEL_287] (rows=1 width=112)
+            PARTITION_ONLY_SHUFFLE [RS_293]
+              Select Operator [SEL_292] (rows=1 width=112)
                 Output:["_col0"]
-                Group By Operator [GBY_286] (rows=1 width=120)
+                Group By Operator [GBY_291] (rows=1 width=120)
                   Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                 <-Map 29 [CUSTOM_SIMPLE_EDGE] vectorized
-                  PARTITION_ONLY_SHUFFLE [RS_250]
-                    Group By Operator [GBY_245] (rows=1 width=120)
+                  PARTITION_ONLY_SHUFFLE [RS_251]
+                    Group By Operator [GBY_246] (rows=1 width=120)
                       Output:["_col0","_col1"],aggregations:["sum(ss_net_paid_inc_tax)","count(ss_net_paid_inc_tax)"]
-                      Select Operator [SEL_240] (rows=182855757 width=110)
+                      Select Operator [SEL_241] (rows=182855757 width=110)
                         Output:["ss_net_paid_inc_tax"]
-                        Filter Operator [FIL_235] (rows=182855757 width=110)
+                        Filter Operator [FIL_236] (rows=182855757 width=110)
                           predicate:ss_quantity BETWEEN 81 AND 100
                            Please refer to the previous TableScan [TS_80]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query90.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query90.q.out b/ql/src/test/results/clientpositive/perf/tez/query90.q.out
index 653ce1a..916a232 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query90.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query90.q.out
@@ -102,7 +102,7 @@ Stage-0
                           <-Map 18 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_183]
                               PartitionCols:_col0
-                              Select Operator [SEL_180] (rows=655 width=8)
+                              Select Operator [SEL_180] (rows=655 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_179] (rows=655 width=8)
                                   predicate:((hd_dep_count = 8) and hd_demo_sk is not null)
@@ -116,7 +116,7 @@ Stage-0
                               <-Map 15 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_171]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_168] (rows=9095 width=8)
+                                  Select Operator [SEL_168] (rows=9095 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_166] (rows=9095 width=8)
                                       predicate:(t_hour BETWEEN 14 AND 15 and t_time_sk is not null)
@@ -130,7 +130,7 @@ Stage-0
                                   <-Map 8 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_157]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_154] (rows=511 width=7)
+                                      Select Operator [SEL_154] (rows=511 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_153] (rows=511 width=7)
                                           predicate:(wp_char_count BETWEEN 5000 AND 5200 and wp_web_page_sk is not null)
@@ -200,7 +200,7 @@ Stage-0
                               <-Map 15 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_169]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_167] (rows=9095 width=8)
+                                  Select Operator [SEL_167] (rows=9095 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_165] (rows=9095 width=8)
                                       predicate:(t_hour BETWEEN 6 AND 7 and t_time_sk is not null)


[25/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query66.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query66.q.out b/ql/src/test/results/clientpositive/perf/spark/query66.q.out
index e8ef1dc..80723d8 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query66.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query66.q.out
@@ -624,8 +624,8 @@ STAGE PLANS:
                     predicate: (ws_ship_mode_sk is not null and ws_sold_date_sk is not null and ws_sold_time_sk is not null and ws_warehouse_sk is not null) (type: boolean)
                     Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_sold_time_sk (type: int), ws_ship_mode_sk (type: int), ws_warehouse_sk (type: int), ws_quantity (type: int), ws_sales_price (type: decimal(7,2)), ws_net_paid_inc_tax (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                      expressions: ws_sold_date_sk (type: int), ws_sold_time_sk (type: int), ws_ship_mode_sk (type: int), ws_warehouse_sk (type: int), (ws_sales_price * CAST( ws_quantity AS decimal(10,0))) (type: decimal(18,2)), (ws_net_paid_inc_tax * CAST( ws_quantity AS decimal(10,0))) (type: decimal(18,2))
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                       Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -633,7 +633,7 @@ STAGE PLANS:
                         keys:
                           0 _col1 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6
+                        outputColumnNames: _col0, _col2, _col3, _col4, _col5
                         input vertices:
                           1 Map 6
                         Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
@@ -642,7 +642,7 @@ STAGE PLANS:
                           sort order: +
                           Map-reduce partition columns: _col0 (type: int)
                           Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col2 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
+                          value expressions: _col2 (type: int), _col3 (type: int), _col4 (type: decimal(18,2)), _col5 (type: decimal(18,2))
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -656,8 +656,8 @@ STAGE PLANS:
                     predicate: (cs_ship_mode_sk is not null and cs_sold_date_sk is not null and cs_sold_time_sk is not null and cs_warehouse_sk is not null) (type: boolean)
                     Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), cs_sold_time_sk (type: int), cs_ship_mode_sk (type: int), cs_warehouse_sk (type: int), cs_quantity (type: int), cs_ext_sales_price (type: decimal(7,2)), cs_net_paid_inc_ship_tax (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                      expressions: cs_sold_date_sk (type: int), cs_sold_time_sk (type: int), cs_ship_mode_sk (type: int), cs_warehouse_sk (type: int), (cs_ext_sales_price * CAST( cs_quantity AS decimal(10,0))) (type: decimal(18,2)), (cs_net_paid_inc_ship_tax * CAST( cs_quantity AS decimal(10,0))) (type: decimal(18,2))
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                       Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -665,7 +665,7 @@ STAGE PLANS:
                         keys:
                           0 _col1 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6
+                        outputColumnNames: _col0, _col2, _col3, _col4, _col5
                         input vertices:
                           1 Map 13
                         Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
@@ -674,7 +674,7 @@ STAGE PLANS:
                           sort order: +
                           Map-reduce partition columns: _col0 (type: int)
                           Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col2 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2))
+                          value expressions: _col2 (type: int), _col3 (type: int), _col4 (type: decimal(18,2)), _col5 (type: decimal(18,2))
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -688,15 +688,15 @@ STAGE PLANS:
                     predicate: ((d_year = 2002) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_moy (type: int)
-                      outputColumnNames: _col0, _col2
+                      expressions: d_date_sk (type: int), (d_moy = 1) (type: boolean), (d_moy = 2) (type: boolean), (d_moy = 3) (type: boolean), (d_moy = 4) (type: boolean), (d_moy = 5) (type: boolean), (d_moy = 6) (type: boolean), (d_moy = 7) (type: boolean), (d_moy = 8) (type: boolean), (d_moy = 9) (type: boolean), (d_moy = 10) (type: boolean), (d_moy = 11) (type: boolean), (d_moy = 12) (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
                       Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: int)
+                        value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean)
             Execution mode: vectorized
         Map 7 
             Map Operator Tree:
@@ -708,15 +708,15 @@ STAGE PLANS:
                     predicate: ((d_year = 2002) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_moy (type: int)
-                      outputColumnNames: _col0, _col2
+                      expressions: d_date_sk (type: int), (d_moy = 1) (type: boolean), (d_moy = 2) (type: boolean), (d_moy = 3) (type: boolean), (d_moy = 4) (type: boolean), (d_moy = 5) (type: boolean), (d_moy = 6) (type: boolean), (d_moy = 7) (type: boolean), (d_moy = 8) (type: boolean), (d_moy = 9) (type: boolean), (d_moy = 10) (type: boolean), (d_moy = 11) (type: boolean), (d_moy = 12) (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
                       Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: int)
+                        value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: boolean), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean)
             Execution mode: vectorized
         Reducer 11 
             Local Work:
@@ -728,7 +728,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col11
+                outputColumnNames: _col2, _col3, _col4, _col5, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -736,7 +736,7 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col3, _col4, _col5, _col6, _col11
+                  outputColumnNames: _col3, _col4, _col5, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19
                   input vertices:
                     1 Map 15
                   Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: PARTIAL Column stats: NONE
@@ -746,12 +746,12 @@ STAGE PLANS:
                     keys:
                       0 _col3 (type: int)
                       1 _col0 (type: int)
-                    outputColumnNames: _col4, _col5, _col6, _col11, _col15, _col16, _col17, _col18, _col19, _col20
+                    outputColumnNames: _col4, _col5, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col22, _col23, _col24, _col25, _col26, _col27
                     input vertices:
                       1 Map 16
                     Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
-                      expressions: _col15 (type: string), _col16 (type: int), _col17 (type: string), _col18 (type: string), _col19 (type: string), _col20 (type: string), CASE WHEN ((_col11 = 1)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 2)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 3)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 4)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 5)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 6)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 7)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 8)) THEN ((_col5 * CAST( _col4 AS decimal(10,0))))
  ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 9)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 10)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 11)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 12)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 1)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 2)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 3)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 4)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 5)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: d
 ecimal(18,2)), CASE WHEN ((_col11 = 6)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 7)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 8)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 9)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 10)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 11)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 12)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2))
+                      expressions: _col22 (type: string), _col23 (type: int), _col24 (type: string), _col25 (type: string), _col26 (type: string), _col27 (type: string), CASE WHEN (_col8) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col9) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col10) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col11) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col12) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col13) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col14) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col15) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col16) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col17) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col18) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col19) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_c
 ol8) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col9) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col10) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col11) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col12) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col13) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col14) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col15) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col16) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col17) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col18) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col19) THEN (_col5) ELSE (0) END (type: decimal(18,2))
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29
                       Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: PARTIAL Column stats: NONE
                       Group By Operator
@@ -802,7 +802,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col11
+                outputColumnNames: _col2, _col3, _col4, _col5, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -810,7 +810,7 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col3, _col4, _col5, _col6, _col11
+                  outputColumnNames: _col3, _col4, _col5, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19
                   input vertices:
                     1 Map 8
                   Statistics: Num rows: 191667562 Data size: 26061245514 Basic stats: PARTIAL Column stats: NONE
@@ -820,12 +820,12 @@ STAGE PLANS:
                     keys:
                       0 _col3 (type: int)
                       1 _col0 (type: int)
-                    outputColumnNames: _col4, _col5, _col6, _col11, _col15, _col16, _col17, _col18, _col19, _col20
+                    outputColumnNames: _col4, _col5, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col22, _col23, _col24, _col25, _col26, _col27
                     input vertices:
                       1 Map 9
                     Statistics: Num rows: 210834322 Data size: 28667370686 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
-                      expressions: _col15 (type: string), _col16 (type: int), _col17 (type: string), _col18 (type: string), _col19 (type: string), _col20 (type: string), CASE WHEN ((_col11 = 1)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 2)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 3)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 4)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 5)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 6)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 7)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 8)) THEN ((_col5 * CAST( _col4 AS decimal(10,0))))
  ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 9)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 10)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 11)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 12)) THEN ((_col5 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 1)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 2)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 3)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 4)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 5)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: d
 ecimal(18,2)), CASE WHEN ((_col11 = 6)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 7)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 8)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 9)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 10)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 11)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2)), CASE WHEN ((_col11 = 12)) THEN ((_col6 * CAST( _col4 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2))
+                      expressions: _col22 (type: string), _col23 (type: int), _col24 (type: string), _col25 (type: string), _col26 (type: string), _col27 (type: string), CASE WHEN (_col8) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col9) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col10) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col11) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col12) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col13) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col14) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col15) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col16) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col17) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col18) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col19) THEN (_col4) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_c
 ol8) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col9) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col10) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col11) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col12) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col13) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col14) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col15) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col16) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col17) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col18) THEN (_col5) ELSE (0) END (type: decimal(18,2)), CASE WHEN (_col19) THEN (_col5) ELSE (0) END (type: decimal(18,2))
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29
                       Statistics: Num rows: 210834322 Data size: 28667370686 Basic stats: PARTIAL Column stats: NONE
                       Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query67.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query67.q.out b/ql/src/test/results/clientpositive/perf/spark/query67.q.out
index 44da5c7..4bc6c14 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query67.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query67.q.out
@@ -145,15 +145,15 @@ STAGE PLANS:
                     predicate: (ss_item_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_item_sk (type: int), ss_store_sk (type: int), ss_quantity (type: int), ss_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                      expressions: ss_sold_date_sk (type: int), ss_item_sk (type: int), ss_store_sk (type: int), CASE WHEN ((ss_sales_price is not null and ss_quantity is not null)) THEN ((ss_sales_price * CAST( ss_quantity AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2))
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: decimal(18,2))
             Execution mode: vectorized
         Map 7 
             Map Operator Tree:
@@ -166,14 +166,14 @@ STAGE PLANS:
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_date_sk (type: int), d_year (type: int), d_moy (type: int), d_qoy (type: int)
-                      outputColumnNames: _col0, _col2, _col3, _col4
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: int), _col3 (type: int), _col4 (type: int)
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int)
             Execution mode: vectorized
         Map 9 
             Map Operator Tree:
@@ -205,7 +205,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col7, _col8, _col9
+                outputColumnNames: _col1, _col2, _col3, _col5, _col6, _col7
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -213,7 +213,7 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col1, _col3, _col4, _col7, _col8, _col9, _col11
+                  outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col9
                   input vertices:
                     1 Map 8
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
@@ -222,7 +222,7 @@ STAGE PLANS:
                     sort order: +
                     Map-reduce partition columns: _col1 (type: int)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col11 (type: string)
+                    value expressions: _col3 (type: decimal(18,2)), _col5 (type: int), _col6 (type: int), _col7 (type: int), _col9 (type: string)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -231,24 +231,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col4, _col7, _col8, _col9, _col11, _col13, _col14, _col15, _col16
+                outputColumnNames: _col3, _col5, _col6, _col7, _col9, _col11, _col12, _col13, _col14
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col15 (type: string), _col14 (type: string), _col13 (type: string), _col16 (type: string), _col7 (type: int), _col9 (type: int), _col8 (type: int), _col11 (type: string), CASE WHEN ((_col4 is not null and _col3 is not null)) THEN ((_col4 * CAST( _col3 AS decimal(10,0)))) ELSE (0) END (type: decimal(18,2))
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                  Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col8)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string), 0L (type: bigint)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                Group By Operator
+                  aggregations: sum(_col3)
+                  keys: _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col5 (type: int), _col6 (type: int), _col7 (type: int), _col9 (type: string), 0L (type: bigint)
+                  mode: hash
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                  Statistics: Num rows: 6899852151 Data size: 608706960084 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string), _col8 (type: bigint)
+                    sort order: +++++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string), _col8 (type: bigint)
                     Statistics: Num rows: 6899852151 Data size: 608706960084 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string), _col8 (type: bigint)
-                      sort order: +++++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string), _col8 (type: bigint)
-                      Statistics: Num rows: 6899852151 Data size: 608706960084 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col9 (type: decimal(28,2))
+                    value expressions: _col9 (type: decimal(28,2))
         Reducer 4 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -264,17 +260,17 @@ STAGE PLANS:
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                   Statistics: Num rows: 3449926075 Data size: 304353479997 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col0 (type: string), _col8 (type: decimal(28,2))
+                    key expressions: _col2 (type: string), _col8 (type: decimal(28,2))
                     sort order: +-
-                    Map-reduce partition columns: _col0 (type: string)
+                    Map-reduce partition columns: _col2 (type: string)
                     Statistics: Num rows: 3449926075 Data size: 304353479997 Basic stats: COMPLETE Column stats: NONE
                     TopN Hash Memory Usage: 0.1
-                    value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string)
+                    value expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string)
         Reducer 5 
             Execution mode: vectorized
             Reduce Operator Tree:
               Select Operator
-                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: string), VALUE._col1 (type: string), VALUE._col2 (type: string), VALUE._col3 (type: int), VALUE._col4 (type: int), VALUE._col5 (type: int), VALUE._col6 (type: string), KEY.reducesinkkey1 (type: decimal(28,2))
+                expressions: VALUE._col0 (type: string), VALUE._col1 (type: string), KEY.reducesinkkey0 (type: string), VALUE._col2 (type: string), VALUE._col3 (type: int), VALUE._col4 (type: int), VALUE._col5 (type: int), VALUE._col6 (type: string), KEY.reducesinkkey1 (type: decimal(28,2))
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                 Statistics: Num rows: 3449926075 Data size: 304353479997 Basic stats: COMPLETE Column stats: NONE
                 PTF Operator
@@ -287,7 +283,7 @@ STAGE PLANS:
                         input alias: ptf_1
                         name: windowingtablefunction
                         order by: _col8 DESC NULLS LAST
-                        partition by: _col0
+                        partition by: _col2
                         raw input shape:
                         window functions:
                             window function definition
@@ -302,7 +298,7 @@ STAGE PLANS:
                     predicate: (rank_window_0 <= 100) (type: boolean)
                     Statistics: Num rows: 1149975358 Data size: 101451159969 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: string), _col8 (type: decimal(28,2)), rank_window_0 (type: int)
+                      expressions: _col2 (type: string), _col1 (type: string), _col0 (type: string), _col3 (type: string), _col4 (type: int), _col6 (type: int), _col5 (type: int), _col7 (type: string), _col8 (type: decimal(28,2)), rank_window_0 (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
                       Statistics: Num rows: 1149975358 Data size: 101451159969 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query68.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query68.q.out b/ql/src/test/results/clientpositive/perf/spark/query68.q.out
index ada5aa9..a1ceab9 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query68.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query68.q.out
@@ -357,11 +357,11 @@ STAGE PLANS:
                 keys:
                   0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col8, _col18
+                outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col8, _col13
                 Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col6), sum(_col7), sum(_col8)
-                  keys: _col1 (type: int), _col18 (type: string), _col3 (type: int), _col5 (type: int)
+                  keys: _col1 (type: int), _col13 (type: string), _col3 (type: int), _col5 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                   Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query7.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query7.q.out b/ql/src/test/results/clientpositive/perf/spark/query7.q.out
index 3e58d6e..c9ac621 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query7.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query7.q.out
@@ -221,11 +221,11 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col4, _col5, _col6, _col7, _col18
+                outputColumnNames: _col4, _col5, _col6, _col7, _col12
                 Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col4), count(_col4), sum(_col5), count(_col5), sum(_col7), count(_col7), sum(_col6), count(_col6)
-                  keys: _col18 (type: string)
+                  keys: _col12 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                   Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query70.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query70.q.out b/ql/src/test/results/clientpositive/perf/spark/query70.q.out
index e39389b..56767af 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query70.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query70.q.out
@@ -246,13 +246,13 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col6
+                  outputColumnNames: _col2, _col5
                   input vertices:
                     1 Map 14
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2)
-                    keys: _col6 (type: string)
+                    keys: _col5 (type: string)
                     mode: hash
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query71.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query71.q.out b/ql/src/test/results/clientpositive/perf/spark/query71.q.out
index 2b87b9d..7a659e0 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query71.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query71.q.out
@@ -301,11 +301,11 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col4, _col5, _col8, _col9
+                outputColumnNames: _col0, _col4, _col5, _col7, _col8
                 Statistics: Num rows: 1341632299 Data size: 145603835081 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col0)
-                  keys: _col4 (type: int), _col8 (type: int), _col9 (type: int), _col5 (type: string)
+                  keys: _col4 (type: int), _col7 (type: int), _col8 (type: int), _col5 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 1341632299 Data size: 145603835081 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query72.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query72.q.out b/ql/src/test/results/clientpositive/perf/spark/query72.q.out
index 77792eb..23ab1d1 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query72.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query72.q.out
@@ -207,7 +207,7 @@ STAGE PLANS:
                     predicate: ((d_year = 2001) and d_date_sk is not null and d_week_seq is not null) (type: boolean)
                     Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_date (type: string), d_week_seq (type: int)
+                      expressions: d_date_sk (type: int), d_week_seq (type: int), (UDFToDouble(d_date) + 5.0D) (type: double)
                       outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -215,7 +215,7 @@ STAGE PLANS:
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string), _col2 (type: int)
+                        value expressions: _col1 (type: int), _col2 (type: double)
             Execution mode: vectorized
         Map 14 
             Map Operator Tree:
@@ -266,7 +266,7 @@ STAGE PLANS:
                     predicate: d_date_sk is not null (type: boolean)
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_date (type: string)
+                      expressions: d_date_sk (type: int), UDFToDouble(d_date) (type: double)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -274,7 +274,7 @@ STAGE PLANS:
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
+                        value expressions: _col1 (type: double)
             Execution mode: vectorized
         Map 19 
             Map Operator Tree:
@@ -362,7 +362,7 @@ STAGE PLANS:
                     keys:
                       0 _col5 (type: int)
                       1 _col0 (type: int)
-                    outputColumnNames: _col1, _col4, _col6, _col7, _col9, _col10, _col16
+                    outputColumnNames: _col1, _col4, _col6, _col7, _col9, _col10, _col13
                     input vertices:
                       1 Map 16
                     Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: COMPLETE Column stats: NONE
@@ -371,7 +371,7 @@ STAGE PLANS:
                       sort order: +
                       Map-reduce partition columns: _col4 (type: int)
                       Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int), _col6 (type: int), _col7 (type: int), _col9 (type: string), _col10 (type: int), _col16 (type: int)
+                      value expressions: _col1 (type: int), _col6 (type: int), _col7 (type: int), _col9 (type: int), _col10 (type: double), _col13 (type: int)
         Reducer 11 
             Reduce Operator Tree:
               Join Operator
@@ -380,14 +380,14 @@ STAGE PLANS:
                 keys:
                   0 _col4 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col4, _col6, _col7, _col9, _col10, _col16, _col18
+                outputColumnNames: _col1, _col4, _col6, _col7, _col9, _col10, _col13, _col15
                 Statistics: Num rows: 463810558 Data size: 62809267017 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 463810558 Data size: 62809267017 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col4 (type: int), _col6 (type: int), _col7 (type: int), _col9 (type: string), _col10 (type: int), _col16 (type: int), _col18 (type: string)
+                  value expressions: _col4 (type: int), _col6 (type: int), _col7 (type: int), _col9 (type: int), _col10 (type: double), _col13 (type: int), _col15 (type: string)
         Reducer 12 
             Reduce Operator Tree:
               Join Operator
@@ -396,21 +396,21 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col4, _col6, _col7, _col9, _col10, _col16, _col18, _col20
+                outputColumnNames: _col4, _col6, _col7, _col9, _col10, _col13, _col15, _col17
                 Statistics: Num rows: 510191624 Data size: 69090195216 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (UDFToDouble(_col20) > (UDFToDouble(_col9) + 5.0D)) (type: boolean)
+                  predicate: (_col17 > _col10) (type: boolean)
                   Statistics: Num rows: 170063874 Data size: 23030064981 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col18 (type: string), _col4 (type: int), _col6 (type: int), _col7 (type: int), _col10 (type: int), _col16 (type: int)
-                    outputColumnNames: _col3, _col8, _col10, _col11, _col14, _col20
+                    expressions: _col15 (type: string), _col4 (type: int), _col6 (type: int), _col7 (type: int), _col9 (type: int), _col13 (type: int)
+                    outputColumnNames: _col3, _col8, _col10, _col11, _col13, _col17
                     Statistics: Num rows: 170063874 Data size: 23030064981 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col8 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col8 (type: int)
                       Statistics: Num rows: 170063874 Data size: 23030064981 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col3 (type: string), _col10 (type: int), _col11 (type: int), _col14 (type: int), _col20 (type: int)
+                      value expressions: _col3 (type: string), _col10 (type: int), _col11 (type: int), _col13 (type: int), _col17 (type: int)
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -419,37 +419,37 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col8 (type: int)
-                outputColumnNames: _col0, _col3, _col5, _col9, _col14, _col16, _col17, _col20, _col26
+                outputColumnNames: _col0, _col3, _col5, _col9, _col14, _col16, _col17, _col19, _col23
                 Statistics: Num rows: 187070265 Data size: 25333072028 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
                   predicate: (_col3 < _col17) (type: boolean)
                   Statistics: Num rows: 62356755 Data size: 8444357342 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col0 (type: int), _col20 (type: int)
+                    key expressions: _col0 (type: int), _col19 (type: int)
                     sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col20 (type: int)
+                    Map-reduce partition columns: _col0 (type: int), _col19 (type: int)
                     Statistics: Num rows: 62356755 Data size: 8444357342 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: string), _col9 (type: string), _col14 (type: int), _col16 (type: int), _col26 (type: int)
+                    value expressions: _col5 (type: string), _col9 (type: string), _col14 (type: int), _col16 (type: int), _col23 (type: int)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int), _col20 (type: int)
+                  0 _col0 (type: int), _col19 (type: int)
                   1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col5, _col9, _col14, _col16, _col20, _col26
+                outputColumnNames: _col5, _col9, _col14, _col16, _col19, _col23
                 Statistics: Num rows: 68592431 Data size: 9288793277 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col14 (type: int), _col16 (type: int), _col5 (type: string), _col9 (type: string), _col20 (type: int), _col26 (type: int)
-                  outputColumnNames: _col4, _col6, _col13, _col15, _col22, _col28
+                  expressions: _col14 (type: int), _col16 (type: int), _col5 (type: string), _col9 (type: string), _col19 (type: int), _col23 (type: int)
+                  outputColumnNames: _col4, _col6, _col13, _col15, _col19, _col25
                   Statistics: Num rows: 68592431 Data size: 9288793277 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col4 (type: int), _col6 (type: int)
                     sort order: ++
                     Map-reduce partition columns: _col4 (type: int), _col6 (type: int)
                     Statistics: Num rows: 68592431 Data size: 9288793277 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col13 (type: string), _col15 (type: string), _col22 (type: int), _col28 (type: int)
+                    value expressions: _col13 (type: string), _col15 (type: string), _col19 (type: int), _col25 (type: int)
         Reducer 4 
             Reduce Operator Tree:
               Join Operator
@@ -458,10 +458,10 @@ STAGE PLANS:
                 keys:
                   0 _col4 (type: int), _col6 (type: int)
                   1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col13, _col15, _col22, _col28
+                outputColumnNames: _col13, _col15, _col19, _col25
                 Statistics: Num rows: 75451675 Data size: 10217672826 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col15 (type: string), _col13 (type: string), _col22 (type: int), CASE WHEN (_col28 is null) THEN (1) ELSE (0) END (type: int), CASE WHEN (_col28 is not null) THEN (1) ELSE (0) END (type: int)
+                  expressions: _col15 (type: string), _col13 (type: string), _col19 (type: int), CASE WHEN (_col25 is null) THEN (1) ELSE (0) END (type: int), CASE WHEN (_col25 is not null) THEN (1) ELSE (0) END (type: int)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 75451675 Data size: 10217672826 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -523,7 +523,7 @@ STAGE PLANS:
                   sort order: +
                   Map-reduce partition columns: _col2 (type: int)
                   Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: int), _col9 (type: string), _col10 (type: int)
+                  value expressions: _col1 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: int), _col9 (type: int), _col10 (type: double)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query74.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query74.q.out b/ql/src/test/results/clientpositive/perf/spark/query74.q.out
index 05969bb..cc9b74e 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query74.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query74.q.out
@@ -182,15 +182,14 @@ STAGE PLANS:
                     predicate: ((d_year = 2001) and (d_year) IN (2001, 2002) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), 2001 (type: int)
-                      outputColumnNames: _col0, _col1
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int)
             Execution mode: vectorized
         Map 14 
             Map Operator Tree:
@@ -242,15 +241,14 @@ STAGE PLANS:
                     predicate: ((d_year = 2001) and (d_year) IN (2001, 2002) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), 2001 (type: int)
-                      outputColumnNames: _col0, _col1
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int)
             Execution mode: vectorized
         Map 20 
             Map Operator Tree:
@@ -302,15 +300,14 @@ STAGE PLANS:
                     predicate: ((d_year = 2002) and (d_year) IN (2001, 2002) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), 2002 (type: int)
-                      outputColumnNames: _col0, _col1
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int)
             Execution mode: vectorized
         Map 26 
             Map Operator Tree:
@@ -342,15 +339,14 @@ STAGE PLANS:
                     predicate: ((d_year = 2002) and (d_year) IN (2001, 2002) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), 2002 (type: int)
-                      outputColumnNames: _col0, _col1
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int)
             Execution mode: vectorized
         Map 8 
             Map Operator Tree:
@@ -400,14 +396,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col4
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col4 (type: int)
+                  value expressions: _col2 (type: decimal(7,2))
         Reducer 11 
             Reduce Operator Tree:
               Join Operator
@@ -416,38 +412,38 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col4, _col6, _col7, _col8
+                outputColumnNames: _col2, _col5, _col6, _col7
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: max(_col2)
-                  keys: _col6 (type: string), _col7 (type: string), _col8 (type: string), _col4 (type: int)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string)
                   mode: hash
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: int)
-                    sort order: ++++
-                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: int)
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string)
+                    sort order: +++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col4 (type: decimal(7,2))
+                    value expressions: _col3 (type: decimal(7,2))
         Reducer 12 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator
                 aggregations: max(VALUE._col0)
-                keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string), KEY._col3 (type: int)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string)
                 mode: mergepartial
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: string), _col4 (type: decimal(7,2))
-                  outputColumnNames: _col0, _col4
+                  expressions: _col0 (type: string), _col3 (type: decimal(7,2))
+                  outputColumnNames: _col0, _col3
                   Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (_col4 > 0) (type: boolean)
+                    predicate: (_col3 > 0) (type: boolean)
                     Statistics: Num rows: 116159124 Data size: 10247591639 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: string), _col4 (type: decimal(7,2))
+                      expressions: _col0 (type: string), _col3 (type: decimal(7,2))
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 116159124 Data size: 10247591639 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -464,14 +460,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col4
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col4 (type: int)
+                  value expressions: _col2 (type: decimal(7,2))
         Reducer 17 
             Reduce Operator Tree:
               Join Operator
@@ -480,46 +476,46 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col4, _col6, _col7, _col8
+                outputColumnNames: _col2, _col5, _col6, _col7
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: max(_col2)
-                  keys: _col6 (type: string), _col7 (type: string), _col8 (type: string), _col4 (type: int)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string)
                   mode: hash
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: int)
-                    sort order: ++++
-                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: int)
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string)
+                    sort order: +++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string)
                     Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col4 (type: decimal(7,2))
+                    value expressions: _col3 (type: decimal(7,2))
         Reducer 18 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator
                 aggregations: max(VALUE._col0)
-                keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string), KEY._col3 (type: int)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string)
                 mode: mergepartial
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: string), _col4 (type: decimal(7,2))
-                  outputColumnNames: _col0, _col4
+                  expressions: _col0 (type: string), _col3 (type: decimal(7,2))
+                  outputColumnNames: _col0, _col3
                   Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (_col4 > 0) (type: boolean)
+                    predicate: (_col3 > 0) (type: boolean)
                     Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: string), _col4 (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1
+                      expressions: _col0 (type: string), _col3 (type: decimal(7,2)), _col3 is not null (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: decimal(7,2))
+                        value expressions: _col1 (type: decimal(7,2)), _col2 (type: boolean)
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -528,14 +524,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col4
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col4 (type: int)
+                  value expressions: _col2 (type: decimal(7,2))
         Reducer 22 
             Reduce Operator Tree:
               Join Operator
@@ -544,14 +540,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col4
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col4 (type: int)
+                  value expressions: _col2 (type: decimal(7,2))
         Reducer 23 
             Reduce Operator Tree:
               Join Operator
@@ -560,39 +556,35 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col4, _col6, _col7, _col8
+                outputColumnNames: _col2, _col5, _col6, _col7
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: max(_col2)
-                  keys: _col6 (type: string), _col7 (type: string), _col8 (type: string), _col4 (type: int)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string)
                   mode: hash
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: int)
-                    sort order: ++++
-                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: int)
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string)
+                    sort order: +++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col4 (type: decimal(7,2))
+                    value expressions: _col3 (type: decimal(7,2))
         Reducer 24 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator
                 aggregations: max(VALUE._col0)
-                keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string), KEY._col3 (type: int)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string)
                 mode: mergepartial
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col4 (type: decimal(7,2))
-                  outputColumnNames: _col0, _col1, _col2, _col3
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: decimal(7,2))
+                  value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: decimal(7,2))
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -601,31 +593,31 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col4, _col6, _col7, _col8
+                outputColumnNames: _col2, _col5, _col6, _col7
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: max(_col2)
-                  keys: _col6 (type: string), _col7 (type: string), _col8 (type: string), _col4 (type: int)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string)
                   mode: hash
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: int)
-                    sort order: ++++
-                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: int)
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string)
+                    sort order: +++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string)
                     Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col4 (type: decimal(7,2))
+                    value expressions: _col3 (type: decimal(7,2))
         Reducer 4 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator
                 aggregations: max(VALUE._col0)
-                keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string), KEY._col3 (type: int)
+                keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string)
                 mode: mergepartial
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: string), _col4 (type: decimal(7,2))
+                  expressions: _col0 (type: string), _col3 (type: decimal(7,2))
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
@@ -646,13 +638,13 @@ STAGE PLANS:
                   1 _col0 (type: string)
                   2 _col0 (type: string)
                   3 _col0 (type: string)
-                outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col8, _col9
+                outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 1149975359 Data size: 101451160012 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col5 is not null) THEN (((_col1 / _col5) > (_col9 / _col3))) ELSE ((null > (_col9 / _col3))) END) ELSE (CASE WHEN (_col5 is not null) THEN (((_col1 / _col5) > null)) ELSE (null) END) END (type: boolean)
+                  predicate: CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col6) THEN (((_col1 / _col5) > (_col10 / _col3))) ELSE ((null > (_col10 / _col3))) END) ELSE (CASE WHEN (_col6) THEN (((_col1 / _col5) > null)) ELSE (null) END) END (type: boolean)
                   Statistics: Num rows: 574987679 Data size: 50725579961 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col6 (type: string), _col7 (type: string), _col8 (type: string)
+                    expressions: _col7 (type: string), _col8 (type: string), _col9 (type: string)
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 574987679 Data size: 50725579961 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator


[29/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query18.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query18.q.out b/ql/src/test/results/clientpositive/perf/spark/query18.q.out
index e77a918..1d73576 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query18.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query18.q.out
@@ -106,15 +106,15 @@ STAGE PLANS:
                     predicate: ((c_birth_month) IN (9, 5, 12, 4, 1, 10) and c_current_addr_sk is not null and c_current_cdemo_sk is not null and c_customer_sk is not null) (type: boolean)
                     Statistics: Num rows: 80000000 Data size: 68801615852 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: c_customer_sk (type: int), c_current_cdemo_sk (type: int), c_current_addr_sk (type: int), c_birth_year (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col4
+                      expressions: c_customer_sk (type: int), c_current_cdemo_sk (type: int), c_current_addr_sk (type: int), CAST( c_birth_year AS decimal(12,2)) (type: decimal(12,2))
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 80000000 Data size: 68801615852 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col2 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col2 (type: int)
                         Statistics: Num rows: 80000000 Data size: 68801615852 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: int), _col1 (type: int), _col4 (type: int)
+                        value expressions: _col0 (type: int), _col1 (type: int), _col3 (type: decimal(12,2))
             Execution mode: vectorized
         Map 13 
             Map Operator Tree:
@@ -145,15 +145,15 @@ STAGE PLANS:
                     predicate: ((cd_education_status = 'College') and (cd_gender = 'M') and cd_demo_sk is not null) (type: boolean)
                     Statistics: Num rows: 465450 Data size: 179296539 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cd_demo_sk (type: int), cd_dep_count (type: int)
-                      outputColumnNames: _col0, _col3
+                      expressions: cd_demo_sk (type: int), CAST( cd_dep_count AS decimal(12,2)) (type: decimal(12,2))
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 465450 Data size: 179296539 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 465450 Data size: 179296539 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col3 (type: int)
+                        value expressions: _col1 (type: decimal(12,2))
             Execution mode: vectorized
         Map 15 
             Map Operator Tree:
@@ -224,7 +224,7 @@ STAGE PLANS:
                     predicate: (cs_bill_cdemo_sk is not null and cs_bill_customer_sk is not null and cs_item_sk is not null and cs_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), cs_bill_customer_sk (type: int), cs_bill_cdemo_sk (type: int), cs_item_sk (type: int), cs_quantity (type: int), cs_list_price (type: decimal(7,2)), cs_sales_price (type: decimal(7,2)), cs_coupon_amt (type: decimal(7,2)), cs_net_profit (type: decimal(7,2))
+                      expressions: cs_sold_date_sk (type: int), cs_bill_customer_sk (type: int), cs_bill_cdemo_sk (type: int), cs_item_sk (type: int), CAST( cs_quantity AS decimal(12,2)) (type: decimal(12,2)), CAST( cs_list_price AS decimal(12,2)) (type: decimal(12,2)), CAST( cs_coupon_amt AS decimal(12,2)) (type: decimal(12,2)), CAST( cs_sales_price AS decimal(12,2)) (type: decimal(12,2)), CAST( cs_net_profit AS decimal(12,2)) (type: decimal(12,2))
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                       Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -232,7 +232,7 @@ STAGE PLANS:
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(12,2)), _col5 (type: decimal(12,2)), _col6 (type: decimal(12,2)), _col7 (type: decimal(12,2)), _col8 (type: decimal(12,2))
             Execution mode: vectorized
         Reducer 10 
             Reduce Operator Tree:
@@ -249,7 +249,7 @@ STAGE PLANS:
                   sort order: +
                   Map-reduce partition columns: _col2 (type: int)
                   Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2))
+                  value expressions: _col1 (type: int), _col3 (type: int), _col4 (type: decimal(12,2)), _col5 (type: decimal(12,2)), _col6 (type: decimal(12,2)), _col7 (type: decimal(12,2)), _col8 (type: decimal(12,2))
         Reducer 11 
             Reduce Operator Tree:
               Join Operator
@@ -258,14 +258,14 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, _col8, _col14
+                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, _col8, _col11
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col3 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col3 (type: int)
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2)), _col14 (type: int)
+                  value expressions: _col1 (type: int), _col4 (type: decimal(12,2)), _col5 (type: decimal(12,2)), _col6 (type: decimal(12,2)), _col7 (type: decimal(12,2)), _col8 (type: decimal(12,2)), _col11 (type: decimal(12,2))
         Reducer 12 
             Reduce Operator Tree:
               Join Operator
@@ -274,18 +274,18 @@ STAGE PLANS:
                 keys:
                   0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col4, _col5, _col6, _col7, _col8, _col14, _col16
+                outputColumnNames: _col1, _col4, _col5, _col6, _col7, _col8, _col11, _col13
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col16 (type: string), _col1 (type: int), _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2)), _col14 (type: int)
-                  outputColumnNames: _col1, _col3, _col6, _col7, _col8, _col9, _col10, _col16
+                  expressions: _col13 (type: string), _col1 (type: int), _col4 (type: decimal(12,2)), _col5 (type: decimal(12,2)), _col6 (type: decimal(12,2)), _col7 (type: decimal(12,2)), _col8 (type: decimal(12,2)), _col11 (type: decimal(12,2))
+                  outputColumnNames: _col1, _col3, _col6, _col7, _col8, _col9, _col10, _col13
                   Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col3 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col3 (type: int)
                     Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: string), _col6 (type: int), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2)), _col9 (type: decimal(7,2)), _col10 (type: decimal(7,2)), _col16 (type: int)
+                    value expressions: _col1 (type: string), _col6 (type: decimal(12,2)), _col7 (type: decimal(12,2)), _col8 (type: decimal(12,2)), _col9 (type: decimal(12,2)), _col10 (type: decimal(12,2)), _col13 (type: decimal(12,2))
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -294,14 +294,14 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col4, _col6, _col7, _col8
+                outputColumnNames: _col0, _col1, _col3, _col5, _col6, _col7
                 Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col4 (type: int), _col6 (type: string), _col7 (type: string), _col8 (type: string)
+                  value expressions: _col0 (type: int), _col3 (type: decimal(12,2)), _col5 (type: string), _col6 (type: string), _col7 (type: string)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -310,14 +310,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col4, _col6, _col7, _col8
+                outputColumnNames: _col0, _col3, _col5, _col6, _col7
                 Statistics: Num rows: 96800003 Data size: 83249958789 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 96800003 Data size: 83249958789 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col4 (type: int), _col6 (type: string), _col7 (type: string), _col8 (type: string)
+                  value expressions: _col3 (type: decimal(12,2)), _col5 (type: string), _col6 (type: string), _col7 (type: string)
         Reducer 4 
             Reduce Operator Tree:
               Join Operator
@@ -326,24 +326,20 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col3 (type: int)
-                outputColumnNames: _col4, _col6, _col7, _col8, _col11, _col16, _col17, _col18, _col19, _col20, _col26
+                outputColumnNames: _col3, _col5, _col6, _col7, _col10, _col15, _col16, _col17, _col18, _col19, _col22
                 Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col11 (type: string), _col8 (type: string), _col7 (type: string), _col6 (type: string), CAST( _col16 AS decimal(12,2)) (type: decimal(12,2)), CAST( _col17 AS decimal(12,2)) (type: decimal(12,2)), CAST( _col19 AS decimal(12,2)) (type: decimal(12,2)), CAST( _col18 AS decimal(12,2)) (type: decimal(12,2)), CAST( _col20 AS decimal(12,2)) (type: decimal(12,2)), CAST( _col4 AS decimal(12,2)) (type: decimal(12,2)), CAST( _col26 AS decimal(12,2)) (type: decimal(12,2))
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
-                  Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col4), count(_col4), sum(_col5), count(_col5), sum(_col6), count(_col6), sum(_col7), count(_col7), sum(_col8), count(_col8), sum(_col9), count(_col9), sum(_col10), count(_col10)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), 0L (type: bigint)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18
+                Group By Operator
+                  aggregations: sum(_col15), count(_col15), sum(_col16), count(_col16), sum(_col17), count(_col17), sum(_col18), count(_col18), sum(_col19), count(_col19), sum(_col3), count(_col3), sum(_col22), count(_col22)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col10 (type: string), 0L (type: bigint)
+                  mode: hash
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18
+                  Statistics: Num rows: 2108229765 Data size: 285496662075 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: bigint)
+                    sort order: +++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: bigint)
                     Statistics: Num rows: 2108229765 Data size: 285496662075 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: bigint)
-                      sort order: +++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: bigint)
-                      Statistics: Num rows: 2108229765 Data size: 285496662075 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col5 (type: decimal(22,2)), _col6 (type: bigint), _col7 (type: decimal(22,2)), _col8 (type: bigint), _col9 (type: decimal(22,2)), _col10 (type: bigint), _col11 (type: decimal(22,2)), _col12 (type: bigint), _col13 (type: decimal(22,2)), _col14 (type: bigint), _col15 (type: decimal(22,2)), _col16 (type: bigint), _col17 (type: decimal(22,2)), _col18 (type: bigint)
+                    value expressions: _col5 (type: decimal(22,2)), _col6 (type: bigint), _col7 (type: decimal(22,2)), _col8 (type: bigint), _col9 (type: decimal(22,2)), _col10 (type: bigint), _col11 (type: decimal(22,2)), _col12 (type: bigint), _col13 (type: decimal(22,2)), _col14 (type: bigint), _col15 (type: decimal(22,2)), _col16 (type: bigint), _col17 (type: decimal(22,2)), _col18 (type: bigint)
         Reducer 5 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -355,7 +351,7 @@ STAGE PLANS:
                 Statistics: Num rows: 1054114882 Data size: 142748330969 Basic stats: COMPLETE Column stats: NONE
                 pruneGroupingSetId: true
                 Select Operator
-                  expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), (_col5 / _col6) (type: decimal(38,18)), (_col7 / _col8) (type: decimal(38,18)), (_col9 / _col10) (type: decimal(38,18)), (_col11 / _col12) (type: decimal(38,18)), (_col13 / _col14) (type: decimal(38,18)), (_col15 / _col16) (type: decimal(38,18)), (_col17 / _col18) (type: decimal(38,18))
+                  expressions: _col3 (type: string), _col2 (type: string), _col1 (type: string), _col0 (type: string), (_col5 / _col6) (type: decimal(38,18)), (_col7 / _col8) (type: decimal(38,18)), (_col9 / _col10) (type: decimal(38,18)), (_col11 / _col12) (type: decimal(38,18)), (_col13 / _col14) (type: decimal(38,18)), (_col15 / _col16) (type: decimal(38,18)), (_col17 / _col18) (type: decimal(38,18))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                   Statistics: Num rows: 1054114882 Data size: 142748330969 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query19.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query19.q.out b/ql/src/test/results/clientpositive/perf/spark/query19.q.out
index 237157e..f6e29e6 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query19.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query19.q.out
@@ -80,7 +80,7 @@ STAGE PLANS:
                     predicate: s_store_sk is not null (type: boolean)
                     Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int), s_zip (type: string)
+                      expressions: s_store_sk (type: int), substr(s_zip, 1, 5) (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
@@ -171,7 +171,7 @@ STAGE PLANS:
                     predicate: ca_address_sk is not null (type: boolean)
                     Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ca_address_sk (type: int), ca_zip (type: string)
+                      expressions: ca_address_sk (type: int), substr(ca_zip, 1, 5) (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -227,7 +227,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col2 (type: int)
-                outputColumnNames: _col3, _col7, _col8, _col13, _col14, _col15, _col16
+                outputColumnNames: _col3, _col7, _col8, _col11, _col12, _col13, _col14
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -235,20 +235,20 @@ STAGE PLANS:
                   keys:
                     0 _col7 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col3, _col8, _col13, _col14, _col15, _col16, _col19
+                  outputColumnNames: _col3, _col8, _col11, _col12, _col13, _col14, _col16
                   input vertices:
                     1 Map 12
                   Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (substr(_col3, 1, 5) <> substr(_col19, 1, 5)) (type: boolean)
+                    predicate: (_col3 <> _col16) (type: boolean)
                     Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col8 (type: decimal(7,2)), _col13 (type: int), _col14 (type: string), _col15 (type: int), _col16 (type: string)
-                      outputColumnNames: _col8, _col13, _col14, _col15, _col16
+                      expressions: _col8 (type: decimal(7,2)), _col11 (type: int), _col12 (type: string), _col13 (type: int), _col14 (type: string)
+                      outputColumnNames: _col8, _col11, _col12, _col13, _col14
                       Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         aggregations: sum(_col8)
-                        keys: _col14 (type: string), _col13 (type: int), _col15 (type: int), _col16 (type: string)
+                        keys: _col12 (type: string), _col11 (type: int), _col13 (type: int), _col14 (type: string)
                         mode: hash
                         outputColumnNames: _col0, _col1, _col2, _col3, _col4
                         Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
@@ -317,14 +317,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col9, _col10, _col11, _col12
+                outputColumnNames: _col2, _col3, _col4, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col2 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col2 (type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col9 (type: int), _col10 (type: string), _col11 (type: int), _col12 (type: string)
+                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2)), _col7 (type: int), _col8 (type: string), _col9 (type: int), _col10 (type: string)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query2.q.out b/ql/src/test/results/clientpositive/perf/spark/query2.q.out
index 07e8c66..f623575 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query2.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query2.q.out
@@ -191,15 +191,15 @@ STAGE PLANS:
                     predicate: (d_date_sk is not null and d_week_seq is not null) (type: boolean)
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_week_seq (type: int), d_day_name (type: string)
-                      outputColumnNames: _col0, _col1, _col2
+                      expressions: d_date_sk (type: int), d_week_seq (type: int), (d_day_name = 'Sunday') (type: boolean), (d_day_name = 'Monday') (type: boolean), (d_day_name = 'Tuesday') (type: boolean), (d_day_name = 'Wednesday') (type: boolean), (d_day_name = 'Thursday') (type: boolean), (d_day_name = 'Friday') (type: boolean), (d_day_name = 'Saturday') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: string)
+                        value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean)
             Execution mode: vectorized
         Map 15 
             Map Operator Tree:
@@ -250,15 +250,15 @@ STAGE PLANS:
                     predicate: (d_date_sk is not null and d_week_seq is not null) (type: boolean)
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_week_seq (type: int), d_day_name (type: string)
-                      outputColumnNames: _col0, _col1, _col2
+                      expressions: d_date_sk (type: int), d_week_seq (type: int), (d_day_name = 'Sunday') (type: boolean), (d_day_name = 'Monday') (type: boolean), (d_day_name = 'Tuesday') (type: boolean), (d_day_name = 'Wednesday') (type: boolean), (d_day_name = 'Thursday') (type: boolean), (d_day_name = 'Friday') (type: boolean), (d_day_name = 'Saturday') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: string)
+                        value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean)
             Execution mode: vectorized
         Map 8 
             Map Operator Tree:
@@ -307,10 +307,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4
+                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 475191764 Data size: 64437789277 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col3 (type: int), CASE WHEN ((_col4 = 'Sunday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Monday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Tuesday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Wednesday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Thursday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Friday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Saturday')) THEN (_col1) ELSE (null) END (type: decimal(7,2))
+                  expressions: _col3 (type: int), CASE WHEN (_col4) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col5) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col6) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col7) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col8) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col9) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col10) THEN (_col1) ELSE (null) END (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 475191764 Data size: 64437789277 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -364,10 +364,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4
+                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 475191764 Data size: 64437789277 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col3 (type: int), CASE WHEN ((_col4 = 'Sunday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Monday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Tuesday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Wednesday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Thursday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Friday')) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col4 = 'Saturday')) THEN (_col1) ELSE (null) END (type: decimal(7,2))
+                  expressions: _col3 (type: int), CASE WHEN (_col4) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col5) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col6) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col7) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col8) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col9) THEN (_col1) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col10) THEN (_col1) ELSE (null) END (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 475191764 Data size: 64437789277 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -407,10 +407,10 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                   2 (_col0 - 53) (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col11, _col12, _col13, _col14, _col15, _col16, _col17
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col10, _col11, _col12, _col13, _col14, _col15, _col16
                 Statistics: Num rows: 574982057 Data size: 77969728401 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), round((_col1 / _col11), 2) (type: decimal(20,2)), round((_col2 / _col12), 2) (type: decimal(20,2)), round((_col3 / _col13), 2) (type: decimal(20,2)), round((_col4 / _col14), 2) (type: decimal(20,2)), round((_col5 / _col15), 2) (type: decimal(20,2)), round((_col6 / _col16), 2) (type: decimal(20,2)), round((_col7 / _col17), 2) (type: decimal(20,2))
+                  expressions: _col0 (type: int), round((_col1 / _col10), 2) (type: decimal(20,2)), round((_col2 / _col11), 2) (type: decimal(20,2)), round((_col3 / _col12), 2) (type: decimal(20,2)), round((_col4 / _col13), 2) (type: decimal(20,2)), round((_col5 / _col14), 2) (type: decimal(20,2)), round((_col6 / _col15), 2) (type: decimal(20,2)), round((_col7 / _col16), 2) (type: decimal(20,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 574982057 Data size: 77969728401 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query20.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query20.q.out b/ql/src/test/results/clientpositive/perf/spark/query20.q.out
index f9c3ba5..953986d 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query20.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query20.q.out
@@ -162,11 +162,11 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col6, _col7, _col8, _col9, _col10
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col10 (type: string), _col9 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: decimal(7,2))
+                  keys: _col9 (type: string), _col8 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: decimal(7,2))
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query21.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query21.q.out b/ql/src/test/results/clientpositive/perf/spark/query21.q.out
index 77fde06..6c2efe7 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query21.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query21.q.out
@@ -112,8 +112,8 @@ STAGE PLANS:
                     predicate: (CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-03-09 00:00:00' AND TIMESTAMP'1998-05-08 00:00:00' and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 8116 Data size: 9081804 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_date (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: d_date_sk (type: int), (CAST( d_date AS DATE) < DATE'1998-04-08') (type: boolean), (CAST( d_date AS DATE) >= DATE'1998-04-08') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 8116 Data size: 9081804 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -150,7 +150,7 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col1, _col2, _col3, _col5
+                        outputColumnNames: _col1, _col2, _col3, _col5, _col6
                         input vertices:
                           1 Map 5
                         Statistics: Num rows: 41342400 Data size: 653203228 Basic stats: COMPLETE Column stats: NONE
@@ -159,7 +159,7 @@ STAGE PLANS:
                           sort order: +
                           Map-reduce partition columns: _col1 (type: int)
                           Statistics: Num rows: 41342400 Data size: 653203228 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col2 (type: int), _col3 (type: int), _col5 (type: string)
+                          value expressions: _col2 (type: int), _col3 (type: int), _col5 (type: boolean), _col6 (type: boolean)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -193,7 +193,7 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col5, _col7
+                outputColumnNames: _col2, _col3, _col5, _col6, _col8
                 Statistics: Num rows: 45476640 Data size: 718523566 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -201,12 +201,12 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col3, _col5, _col7, _col10
+                  outputColumnNames: _col3, _col5, _col6, _col8, _col10
                   input vertices:
                     1 Map 7
                   Statistics: Num rows: 50024305 Data size: 790375939 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col10 (type: string), _col7 (type: string), CASE WHEN ((CAST( _col5 AS DATE) < DATE'1998-04-08')) THEN (_col3) ELSE (0) END (type: int), CASE WHEN ((CAST( _col5 AS DATE) >= DATE'1998-04-08')) THEN (_col3) ELSE (0) END (type: int)
+                    expressions: _col10 (type: string), _col8 (type: string), CASE WHEN (_col5) THEN (_col3) ELSE (0) END (type: int), CASE WHEN (_col6) THEN (_col3) ELSE (0) END (type: int)
                     outputColumnNames: _col0, _col1, _col2, _col3
                     Statistics: Num rows: 50024305 Data size: 790375939 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query22.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query22.q.out b/ql/src/test/results/clientpositive/perf/spark/query22.q.out
index 8c9d8a5..2b5e7d0 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query22.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query22.q.out
@@ -185,11 +185,11 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col8, _col9, _col10, _col11
+                outputColumnNames: _col3, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 50024305 Data size: 790375939 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col3), count(_col3)
-                  keys: _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), 0L (type: bigint)
+                  keys: _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), 0L (type: bigint)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                   Statistics: Num rows: 250121525 Data size: 3951879695 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query23.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query23.q.out b/ql/src/test/results/clientpositive/perf/spark/query23.q.out
index bfda977..e85f710 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query23.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query23.q.out
@@ -1,5 +1,5 @@
-Warning: Map Join MAPJOIN[285][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
-Warning: Map Join MAPJOIN[286][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[275][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[276][bigTable=?] in task 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: explain
 with frequent_ss_items as 
  (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt
@@ -146,15 +146,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ss_quantity (type: int), ss_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), (CAST( ss_quantity AS decimal(10,0)) * ss_sales_price) (type: decimal(18,2))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: decimal(18,2))
             Execution mode: vectorized
         Map 18 
             Map Operator Tree:
@@ -204,15 +204,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ss_quantity (type: int), ss_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), (CAST( ss_quantity AS decimal(10,0)) * ss_sales_price) (type: decimal(18,2))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: decimal(18,2))
             Execution mode: vectorized
         Map 25 
             Map Operator Tree:
@@ -260,14 +260,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int), _col3 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(18,2))
         Reducer 15 
             Reduce Operator Tree:
               Join Operator
@@ -276,24 +276,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col6
+                outputColumnNames: _col2, _col4
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col6 (type: int), (CAST( _col2 AS decimal(10,0)) * _col3) (type: decimal(18,2))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col4 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: decimal(28,2))
+                    value expressions: _col1 (type: decimal(28,2))
         Reducer 16 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -351,14 +347,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int), _col3 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(18,2))
         Reducer 22 
             Reduce Operator Tree:
               Join Operator
@@ -367,24 +363,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col6
+                outputColumnNames: _col2, _col4
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col6 (type: int), (CAST( _col2 AS decimal(10,0)) * _col3) (type: decimal(18,2))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col4 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: decimal(28,2))
+                    value expressions: _col1 (type: decimal(28,2))
         Reducer 23 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -446,15 +438,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ss_quantity (type: int), ss_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), (CAST( ss_quantity AS decimal(10,0)) * ss_sales_price) (type: decimal(18,2))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: decimal(18,2))
             Execution mode: vectorized
         Map 47 
             Map Operator Tree:
@@ -504,15 +496,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ss_quantity (type: int), ss_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), (CAST( ss_quantity AS decimal(10,0)) * ss_sales_price) (type: decimal(18,2))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: decimal(18,2))
             Execution mode: vectorized
         Map 54 
             Map Operator Tree:
@@ -560,14 +552,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int), _col3 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(18,2))
         Reducer 44 
             Reduce Operator Tree:
               Join Operator
@@ -576,24 +568,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col6
+                outputColumnNames: _col2, _col4
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col6 (type: int), (CAST( _col2 AS decimal(10,0)) * _col3) (type: decimal(18,2))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col4 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: decimal(28,2))
+                    value expressions: _col1 (type: decimal(28,2))
         Reducer 45 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -651,14 +639,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int), _col3 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(18,2))
         Reducer 51 
             Reduce Operator Tree:
               Join Operator
@@ -667,24 +655,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col6
+                outputColumnNames: _col2, _col4
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col6 (type: int), (CAST( _col2 AS decimal(10,0)) * _col3) (type: decimal(18,2))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col4 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: decimal(28,2))
+                    value expressions: _col1 (type: decimal(28,2))
         Reducer 52 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -791,7 +775,7 @@ STAGE PLANS:
                     predicate: i_item_sk is not null (type: boolean)
                     Statistics: Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: i_item_sk (type: int), i_item_desc (type: string)
+                      expressions: i_item_sk (type: int), substr(i_item_desc, 1, 30) (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -811,15 +795,15 @@ STAGE PLANS:
                     predicate: ss_customer_sk is not null (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_customer_sk (type: int), ss_quantity (type: int), ss_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2
+                      expressions: ss_customer_sk (type: int), (CAST( ss_quantity AS decimal(10,0)) * ss_sales_price) (type: decimal(18,2))
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2))
+                        value expressions: _col1 (type: decimal(18,2))
             Execution mode: vectorized
         Map 30 
             Map Operator Tree:
@@ -910,13 +894,13 @@ STAGE PLANS:
                 Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: int), _col3 (type: bigint)
-                  outputColumnNames: _col0, _col3
+                  outputColumnNames: _col1, _col3
                   Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: (_col3 > 4L) (type: boolean)
                     Statistics: Num rows: 116159124 Data size: 10247591639 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: int)
+                      expressions: _col1 (type: int)
                       outputColumnNames: _col1
                       Statistics: Num rows: 116159124 Data size: 10247591639 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
@@ -953,24 +937,20 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col3 (type: int), (CAST( _col1 AS decimal(10,0)) * _col2) (type: decimal(18,2))
+                Group By Operator
+                  aggregations: sum(_col1)
+                  keys: _col2 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: decimal(28,2))
+                    value expressions: _col1 (type: decimal(28,2))
         Reducer 29 
             Execution mode: vectorized
             Local Work:
@@ -1100,24 +1080,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col5, _col6
+                outputColumnNames: _col3, _col4, _col5
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: substr(_col6, 1, 30) (type: string), _col5 (type: int), _col3 (type: string)
-                  outputColumnNames: _col0, _col1, _col2
+                Group By Operator
+                  aggregations: count()
+                  keys: _col4 (type: int), _col3 (type: string), _col5 (type: string)
+                  mode: hash
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: count()
-                    keys: _col1 (type: int), _col0 (type: string), _col2 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string)
+                    sort order: +++
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string)
-                      sort order: +++
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col3 (type: bigint)
+                    value expressions: _col3 (type: bigint)
         Reducer 4 
             Reduce Operator Tree:
               Join Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query24.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query24.q.out b/ql/src/test/results/clientpositive/perf/spark/query24.q.out
index 91fe702..2d57eca 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query24.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query24.q.out
@@ -136,12 +136,12 @@ STAGE PLANS:
                     Statistics: Num rows: 852 Data size: 1628138 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: s_store_sk (type: int), s_store_name (type: string), s_state (type: string), s_zip (type: string)
-                      outputColumnNames: _col0, _col1, _col3, _col4
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 852 Data size: 1628138 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
                           0 _col2 (type: string)
-                          1 _col4 (type: string)
+                          1 _col3 (type: string)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -167,7 +167,7 @@ STAGE PLANS:
                     predicate: (ca_address_sk is not null and ca_zip is not null) (type: boolean)
                     Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ca_address_sk (type: int), ca_state (type: string), ca_zip (type: string), ca_country (type: string)
+                      expressions: ca_address_sk (type: int), ca_state (type: string), ca_zip (type: string), upper(ca_country) (type: string)
                       outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
@@ -175,8 +175,8 @@ STAGE PLANS:
                              Inner Join 0 to 1
                         keys:
                           0 _col2 (type: string)
-                          1 _col4 (type: string)
-                        outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col7
+                          1 _col3 (type: string)
+                        outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6
                         input vertices:
                           1 Map 19
                         Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
@@ -185,7 +185,7 @@ STAGE PLANS:
                           sort order: +
                           Map-reduce partition columns: _col0 (type: int)
                           Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col1 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col7 (type: string)
+                          value expressions: _col1 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: string)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -276,62 +276,62 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col5, _col7, _col9, _col11, _col12, _col13
+                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col8, _col10, _col11, _col12
                 Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (_col13 <> upper(_col3)) (type: boolean)
+                  predicate: (_col12 <> _col3) (type: boolean)
                   Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col9 (type: int), _col4 (type: int)
+                    key expressions: _col8 (type: int), _col4 (type: int)
                     sort order: ++
-                    Map-reduce partition columns: _col9 (type: int), _col4 (type: int)
+                    Map-reduce partition columns: _col8 (type: int), _col4 (type: int)
                     Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: string), _col5 (type: string), _col7 (type: string), _col11 (type: string), _col12 (type: string)
+                    value expressions: _col1 (type: string), _col5 (type: string), _col6 (type: string), _col10 (type: string), _col11 (type: string)
         Reducer 14 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col9 (type: int), _col4 (type: int)
+                  0 _col8 (type: int), _col4 (type: int)
                   1 _col1 (type: int), _col2 (type: int)
-                outputColumnNames: _col1, _col5, _col7, _col11, _col12, _col14, _col17, _col18
+                outputColumnNames: _col1, _col5, _col6, _col10, _col11, _col13, _col16, _col17
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col14 (type: int)
+                  key expressions: _col13 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col14 (type: int)
+                  Map-reduce partition columns: _col13 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col5 (type: string), _col7 (type: string), _col11 (type: string), _col12 (type: string), _col17 (type: int), _col18 (type: decimal(7,2))
+                  value expressions: _col1 (type: string), _col5 (type: string), _col6 (type: string), _col10 (type: string), _col11 (type: string), _col16 (type: int), _col17 (type: decimal(7,2))
         Reducer 15 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col14 (type: int)
+                  0 _col13 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col5, _col7, _col11, _col12, _col14, _col17, _col18, _col20, _col21, _col22, _col23, _col24
+                outputColumnNames: _col1, _col5, _col6, _col10, _col11, _col13, _col16, _col17, _col19, _col20, _col21, _col22, _col23
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col14 (type: int), _col17 (type: int)
+                  key expressions: _col13 (type: int), _col16 (type: int)
                   sort order: ++
-                  Map-reduce partition columns: _col14 (type: int), _col17 (type: int)
+                  Map-reduce partition columns: _col13 (type: int), _col16 (type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col5 (type: string), _col7 (type: string), _col11 (type: string), _col12 (type: string), _col18 (type: decimal(7,2)), _col20 (type: decimal(7,2)), _col21 (type: string), _col22 (type: string), _col23 (type: string), _col24 (type: int)
+                  value expressions: _col1 (type: string), _col5 (type: string), _col6 (type: string), _col10 (type: string), _col11 (type: string), _col17 (type: decimal(7,2)), _col19 (type: decimal(7,2)), _col20 (type: string), _col21 (type: string), _col22 (type: string), _col23 (type: int)
         Reducer 16 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col14 (type: int), _col17 (type: int)
+                  0 _col13 (type: int), _col16 (type: int)
                   1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col1, _col5, _col7, _col11, _col12, _col18, _col20, _col21, _col22, _col23, _col24
+                outputColumnNames: _col1, _col5, _col6, _col10, _col11, _col17, _col19, _col20, _col21, _col22, _col23
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col18)
-                  keys: _col11 (type: string), _col12 (type: string), _col1 (type: string), _col5 (type: string), _col7 (type: string), _col20 (type: decimal(7,2)), _col21 (type: string), _col22 (type: string), _col23 (type: string), _col24 (type: int)
+                  aggregations: sum(_col17)
+                  keys: _col10 (type: string), _col11 (type: string), _col1 (type: string), _col5 (type: string), _col6 (type: string), _col19 (type: decimal(7,2)), _col20 (type: string), _col21 (type: string), _col22 (type: string), _col23 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
@@ -397,12 +397,12 @@ STAGE PLANS:
                     Statistics: Num rows: 852 Data size: 1628138 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: s_store_sk (type: int), s_store_name (type: string), s_state (type: string), s_zip (type: string)
-                      outputColumnNames: _col0, _col1, _col3, _col4
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 852 Data size: 1628138 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
                           0 _col2 (type: string)
-                          1 _col4 (type: string)
+                          1 _col3 (type: string)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -487,14 +487,14 @@ STAGE PLANS:
                     Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: i_item_sk (type: int), i_current_price (type: decimal(7,2)), i_size (type: string), i_units (type: string), i_manager_id (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: decimal(7,2)), _col2 (type: string), _col4 (type: string), _col5 (type: int)
+                        value expressions: _col1 (type: decimal(7,2)), _col2 (type: string), _col3 (type: string), _col4 (type: int)
             Execution mode: vectorized
         Map 7 
             Map Operator Tree:
@@ -506,7 +506,7 @@ STAGE PLANS:
                     predicate: (ca_address_sk is not null and ca_zip is not null) (type: boolean)
                     Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ca_address_sk (type: int), ca_state (type: string), ca_zip (type: string), ca_country (type: string)
+                      expressions: ca_address_sk (type: int), ca_state (type: string), ca_zip (type: string), upper(ca_country) (type: string)
                       outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
@@ -514,8 +514,8 @@ STAGE PLANS:
                              Inner Join 0 to 1
                         keys:
                           0 _col2 (type: string)
-                          1 _col4 (type: string)
-                        outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col7
+                          1 _col3 (type: string)
+                        outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6
                         input vertices:
                           1 Map 9
                         Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
@@ -524,7 +524,7 @@ STAGE PLANS:
                           sort order: +
                           Map-reduce partition columns: _col0 (type: int)
                           Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col1 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col7 (type: string)
+                          value expressions: _col1 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: string)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -536,14 +536,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, _col7, _col9, _col10
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, _col7, _col8, _col9
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col3 (type: int), _col4 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: string), _col9 (type: string), _col10 (type: int)
+                  value expressions: _col0 (type: int), _col3 (type: int), _col4 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: string), _col8 (type: string), _col9 (type: int)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -552,14 +552,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int), _col2 (type: int)
                   1 _col0 (type: int), _col9 (type: int)
-                outputColumnNames: _col0, _col3, _col4, _col6, _col7, _col9, _col10, _col13, _col14, _col17, _col21, _col23
+                outputColumnNames: _col0, _col3, _col4, _col6, _col7, _col8, _col9, _col12, _col13, _col16, _col20, _col21
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int), _col3 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col0 (type: int), _col3 (type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col4 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: string), _col9 (type: string), _col10 (type: int), _col13 (type: string), _col14 (type: string), _col17 (type: string), _col21 (type: string), _col23 (type: string)
+                  value expressions: _col4 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: string), _col8 (type: string), _col9 (type: int), _col12 (type: string), _col13 (type: string), _col16 (type: string), _col20 (type: string), _col21 (type: string)
         Reducer 4 
             Reduce Operator Tree:
               Join Operator
@@ -568,11 +568,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int), _col3 (type: int)
                   1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col4, _col6, _col7, _col9, _col10, _col13, _col14, _col17, _col21, _col23
+                outputColumnNames: _col4, _col6, _col7, _col8, _col9, _col12, _col13, _col16, _col20, _col21
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col4)
-                  keys: _col13 (type: string), _col14 (type: string), _col21 (type: string), _col6 (type: decimal(7,2)), _col7 (type: string), _col9 (type: string), _col10 (type: int), _col17 (type: string), _col23 (type: string)
+                  keys: _col12 (type: string), _col13 (type: string), _col20 (type: string), _col6 (type: decimal(7,2)), _col7 (type: string), _col8 (type: string), _col9 (type: int), _col16 (type: string), _col21 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
@@ -639,21 +639,21 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col5, _col7, _col9, _col11, _col12, _col13
+                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col8, _col10, _col11, _col12
                 Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (_col13 <> upper(_col3)) (type: boolean)
+                  predicate: (_col12 <> _col3) (type: boolean)
                   Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col9 (type: int), _col11 (type: string), _col12 (type: string), _col1 (type: string), _col4 (type: int), _col5 (type: string), _col7 (type: string)
-                    outputColumnNames: _col0, _col2, _col3, _col6, _col9, _col10, _col12
+                    expressions: _col8 (type: int), _col10 (type: string), _col11 (type: string), _col1 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: string)
+                    outputColumnNames: _col0, _col2, _col3, _col6, _col9, _col10, _col11
                     Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int), _col9 (type: int)
                       sort order: ++
                       Map-reduce partition columns: _col0 (type: int), _col9 (type: int)
                       Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col2 (type: string), _col3 (type: string), _col6 (type: string), _col10 (type: string), _col12 (type: string)
+                      value expressions: _col2 (type: string), _col3 (type: string), _col6 (type: string), _col10 (type: string), _col11 (type: string)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query25.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query25.q.out b/ql/src/test/results/clientpositive/perf/spark/query25.q.out
index 5bee2a3..72fe357 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query25.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query25.q.out
@@ -295,14 +295,14 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int), _col1 (type: int)
                   1 _col1 (type: int), _col2 (type: int)
-                outputColumnNames: _col3, _col8, _col9, _col10, _col11
+                outputColumnNames: _col3, _col6, _col7, _col8, _col9
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col8 (type: int), _col9 (type: int), _col10 (type: int)
+                  key expressions: _col6 (type: int), _col7 (type: int), _col8 (type: int)
                   sort order: +++
-                  Map-reduce partition columns: _col8 (type: int), _col9 (type: int), _col10 (type: int)
+                  Map-reduce partition columns: _col6 (type: int), _col7 (type: int), _col8 (type: int)
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: decimal(7,2)), _col11 (type: decimal(7,2))
+                  value expressions: _col3 (type: decimal(7,2)), _col9 (type: decimal(7,2))
         Reducer 13 
             Reduce Operator Tree:
               Join Operator
@@ -342,15 +342,15 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col1 (type: int), _col2 (type: int), _col4 (type: int)
-                  1 _col8 (type: int), _col9 (type: int), _col10 (type: int)
-                outputColumnNames: _col1, _col3, _col5, _col12, _col20
+                  1 _col6 (type: int), _col7 (type: int), _col8 (type: int)
+                outputColumnNames: _col1, _col3, _col5, _col10, _col16
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col5 (type: decimal(7,2)), _col12 (type: decimal(7,2)), _col20 (type: decimal(7,2))
+                  value expressions: _col3 (type: int), _col5 (type: decimal(7,2)), _col10 (type: decimal(7,2)), _col16 (type: decimal(7,2))
         Reducer 4 
             Local Work:
               Map Reduce Local Work
@@ -361,7 +361,7 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col5, _col12, _col20, _col25, _col26
+                outputColumnNames: _col3, _col5, _col10, _col16, _col19, _col20
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -369,13 +369,13 @@ STAGE PLANS:
                   keys:
                     0 _col3 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col5, _col12, _col20, _col25, _col26, _col28, _col29
+                  outputColumnNames: _col5, _col10, _col16, _col19, _col20, _col22, _col23
                   input vertices:
                     1 Map 16
                   Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
-                    aggregations: sum(_col5), sum(_col20), sum(_col12)
-                    keys: _col25 (type: string), _col26 (type: string), _col28 (type: string), _col29 (type: string)
+                    aggregations: sum(_col5), sum(_col16), sum(_col10)
+                    keys: _col19 (type: string), _col20 (type: string), _col22 (type: string), _col23 (type: string)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                     Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE


[48/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join45.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join45.q.out b/ql/src/test/results/clientpositive/join45.q.out
index 6cf6c33..7865e0e 100644
--- a/ql/src/test/results/clientpositive/join45.q.out
+++ b/ql/src/test/results/clientpositive/join45.q.out
@@ -363,24 +363,24 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(value) BETWEEN 100.0D AND 102.0D (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: boolean)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(value) BETWEEN 100.0D AND 102.0D (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -388,21 +388,25 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: ((_col0 = _col2) or UDFToDouble(_col1) BETWEEN 100.0D AND 102.0D or UDFToDouble(_col3) BETWEEN 100.0D AND 102.0D) (type: boolean)
-            Statistics: Num rows: 9026 Data size: 173876 Basic stats: COMPLETE Column stats: NONE
-            Limit
-              Number of rows: 10
-              Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator
-                compressed: false
+            predicate: ((_col0 = _col3) or _col2 or _col5) (type: boolean)
+            Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3
+              Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
+              Limit
+                Number of rows: 10
                 Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                table:
-                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -474,24 +478,24 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -499,21 +503,25 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (((UDFToDouble(_col0) + UDFToDouble(_col2)) <= 102.0D) and ((UDFToDouble(_col0) + UDFToDouble(_col2)) >= 100.0D)) (type: boolean)
+            predicate: (((_col2 + _col5) <= 102.0D) and ((_col2 + _col5) >= 100.0D)) (type: boolean)
             Statistics: Num rows: 1388 Data size: 26738 Basic stats: COMPLETE Column stats: NONE
-            Limit
-              Number of rows: 10
-              Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator
-                compressed: false
+            Select Operator
+              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3
+              Statistics: Num rows: 1388 Data size: 26738 Basic stats: COMPLETE Column stats: NONE
+              Limit
+                Number of rows: 10
                 Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                table:
-                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -579,24 +587,24 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -604,21 +612,25 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (((UDFToDouble(_col0) + UDFToDouble(_col2)) <= 102.0D) or ((UDFToDouble(_col0) + UDFToDouble(_col2)) >= 100.0D)) (type: boolean)
+            predicate: (((_col2 + _col5) <= 102.0D) or ((_col2 + _col5) >= 100.0D)) (type: boolean)
             Statistics: Num rows: 8332 Data size: 160507 Basic stats: COMPLETE Column stats: NONE
-            Limit
-              Number of rows: 10
-              Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator
-                compressed: false
+            Select Operator
+              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3
+              Statistics: Num rows: 8332 Data size: 160507 Basic stats: COMPLETE Column stats: NONE
+              Limit
+                Number of rows: 10
                 Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                table:
-                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -686,24 +698,24 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -711,21 +723,25 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (struct(UDFToDouble(_col0),UDFToDouble(_col2))) IN (const struct(100.0D,100.0D), const struct(101.0D,101.0D), const struct(102.0D,102.0D)) (type: boolean)
-            Statistics: Num rows: 6250 Data size: 120400 Basic stats: COMPLETE Column stats: NONE
-            Limit
-              Number of rows: 10
-              Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator
-                compressed: false
+            predicate: (struct(_col2,_col5)) IN (const struct(100.0D,100.0D), const struct(101.0D,101.0D), const struct(102.0D,102.0D)) (type: boolean)
+            Statistics: Num rows: 9375 Data size: 180600 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3
+              Statistics: Num rows: 9375 Data size: 180600 Basic stats: COMPLETE Column stats: NONE
+              Limit
+                Number of rows: 10
                 Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                table:
-                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -784,15 +800,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: string)
                 sort order: +
                 Map-reduce partition columns: _col0 (type: string)
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: string)
+                value expressions: _col1 (type: string), _col2 (type: double)
           TableScan
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -813,7 +829,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -829,18 +845,18 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), _col3 (type: string), _col4 (type: string)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -848,13 +864,13 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
           Statistics: Num rows: 13750 Data size: 264875 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: ((UDFToDouble(_col4) + UDFToDouble(_col0)) >= 100.0D) (type: boolean)
+            predicate: ((_col7 + _col2) >= 100.0D) (type: boolean)
             Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: _col0 (type: string), _col1 (type: string), _col4 (type: string), _col5 (type: string), _col2 (type: string), _col3 (type: string)
+              expressions: _col0 (type: string), _col1 (type: string), _col5 (type: string), _col6 (type: string), _col3 (type: string), _col4 (type: string)
               outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
               Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
               Limit
@@ -937,15 +953,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: string)
                 sort order: +
                 Map-reduce partition columns: _col0 (type: string)
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: string)
+                value expressions: _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -966,7 +982,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -982,18 +998,18 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), _col3 (type: string), _col4 (type: string)
           TableScan
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1001,21 +1017,25 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
           Statistics: Num rows: 13750 Data size: 264875 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: ((UDFToDouble(_col4) + UDFToDouble(_col0)) <= 102.0D) (type: boolean)
+            predicate: ((_col7 + _col2) <= 102.0D) (type: boolean)
             Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
-            Limit
-              Number of rows: 10
-              Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator
-                compressed: false
+            Select Operator
+              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+              Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
+              Limit
+                Number of rows: 10
                 Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                table:
-                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1052,7 +1072,7 @@ POSTHOOK: Input: default@src1
 35	val_35	NULL	NULL	66	val_66
 35	val_35	NULL	NULL	66	val_66
 35	val_35	NULL	NULL	66	val_66
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[6][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM src
@@ -1086,24 +1106,24 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1111,17 +1131,21 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: ((UDFToDouble(_col2) + UDFToDouble(_col0)) >= 100.0D) (type: boolean)
+            predicate: ((_col5 + _col2) >= 100.0D) (type: boolean)
             Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            Select Operator
+              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3
+              Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -1172,7 +1196,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[6][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT *
 FROM src
 JOIN src1 a ON (a.key+src.key >= 100)
@@ -1235,15 +1259,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: string)
                 sort order: +
                 Map-reduce partition columns: _col0 (type: string)
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: string)
+                value expressions: _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -1264,7 +1288,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -1280,18 +1304,18 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), _col3 (type: string), _col4 (type: string)
           TableScan
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1299,21 +1323,25 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
           Statistics: Num rows: 13750 Data size: 264875 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: ((UDFToDouble(_col4) + UDFToDouble(_col0)) <= 102.0D) (type: boolean)
+            predicate: ((_col7 + _col2) <= 102.0D) (type: boolean)
             Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
-            Limit
-              Number of rows: 10
-              Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator
-                compressed: false
+            Select Operator
+              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+              Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
+              Limit
+                Number of rows: 10
                 Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                table:
-                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1340,7 +1368,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Input: default@src1
 #### A masked pattern was here ####
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[6][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM src
@@ -1374,24 +1402,24 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1399,17 +1427,21 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: ((UDFToDouble(_col2) + UDFToDouble(_col0)) >= 100.0D) (type: boolean)
+            predicate: ((_col5 + _col2) >= 100.0D) (type: boolean)
             Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            Select Operator
+              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3
+              Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -1460,7 +1492,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[6][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: SELECT *
 FROM src
 JOIN src1 a ON (a.key+src.key >= 100)
@@ -1523,15 +1555,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: string)
                 sort order: +
                 Map-reduce partition columns: _col0 (type: string)
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: string)
+                value expressions: _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -1552,7 +1584,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -1568,18 +1600,18 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double), _col3 (type: string), _col4 (type: string)
           TableScan
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1587,21 +1619,25 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
           Statistics: Num rows: 13750 Data size: 264875 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: ((UDFToDouble(_col4) + UDFToDouble(_col0)) <= 102.0D) (type: boolean)
+            predicate: ((_col7 + _col2) <= 102.0D) (type: boolean)
             Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
-            Limit
-              Number of rows: 10
-              Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator
-                compressed: false
+            Select Operator
+              expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+              Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
+              Limit
+                Number of rows: 10
                 Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                table:
-                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1718,18 +1754,18 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: t3
+            alias: t5
             Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
-              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+              expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string), (c_int = 42) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
               Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string)
+                value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string), _col6 (type: boolean)
           TableScan
-            alias: t5
+            alias: t3
             Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
@@ -1766,13 +1802,13 @@ STAGE PLANS:
             1 
             2 
             3 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29, _col30
           Statistics: Num rows: 176000 Data size: 9396800 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (((_col0 = _col24) or ((_col1 = _col25) and (_col26 = _col20))) and ((_col12 = _col24) or ((_col27 = _col15) and (_col13 = _col25))) and ((_col6 = _col24) or ((_col28 = _col16) and (_col8 = 42)))) (type: boolean)
+            predicate: (((_col0 = _col25) or ((_col29 = _col17) and _col6)) and ((_col13 = _col25) or ((_col28 = _col16) and (_col14 = _col26))) and ((_col7 = _col25) or ((_col8 = _col26) and (_col27 = _col21)))) (type: boolean)
             Statistics: Num rows: 74250 Data size: 3964275 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: _col18 (type: string), _col19 (type: string), _col20 (type: int), _col21 (type: float), _col22 (type: boolean), _col23 (type: string), _col24 (type: string), _col25 (type: string), _col26 (type: int), _col27 (type: float), _col28 (type: boolean), _col29 (type: string), _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: float), _col16 (type: boolean), _col17 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: int), _col9 (type: float), _col10 (type: boolean), _col11 (type: string)
+              expressions: _col19 (type: string), _col20 (type: string), _col21 (type: int), _col22 (type: float), _col23 (type: boolean), _col24 (type: string), _col25 (type: string), _col26 (type: string), _col27 (type: int), _col28 (type: float), _col29 (type: boolean), _col30 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: int), _col10 (type: float), _col11 (type: boolean), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: int), _col16 (type: float), _col17 (type: boolean), _col18 (type: string), _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string)
               outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29
               Statistics: Num rows: 74250 Data size: 3964275 Basic stats: COMPLETE Column stats: NONE
               Limit

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join46.q.out b/ql/src/test/results/clientpositive/join46.q.out
index 738f0b6..3640691 100644
--- a/ql/src/test/results/clientpositive/join46.q.out
+++ b/ql/src/test/results/clientpositive/join46.q.out
@@ -167,15 +167,15 @@ STAGE PLANS:
             alias: test1_n2
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col1 (type: int)
                 sort order: +
                 Map-reduce partition columns: _col1 (type: int)
                 Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
           TableScan
             alias: test2_n0
             filterExpr: key BETWEEN 100 AND 102 (type: boolean)
@@ -198,20 +198,24 @@ STAGE PLANS:
           condition map:
                Left Outer Join 0 to 1
           filter predicates:
-            0 {VALUE._col0 BETWEEN 100 AND 102}
+            0 {VALUE._col2}
             1 
           keys:
             0 _col1 (type: int)
             1 _col1 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
           Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -274,13 +278,13 @@ STAGE PLANS:
             alias: test1_n2
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
           TableScan
             alias: test2_n0
             filterExpr: key BETWEEN 100 AND 102 (type: boolean)
@@ -301,20 +305,24 @@ STAGE PLANS:
           condition map:
                Left Outer Join 0 to 1
           filter predicates:
-            0 {VALUE._col0 BETWEEN 100 AND 102}
+            0 {VALUE._col3}
             1 
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
           Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -467,13 +475,13 @@ STAGE PLANS:
             alias: test1_n2
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
           TableScan
             alias: test2_n0
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
@@ -490,20 +498,24 @@ STAGE PLANS:
           condition map:
                Left Outer Join 0 to 1
           filter predicates:
-            0 {VALUE._col0 BETWEEN 100 AND 102}
+            0 {VALUE._col3}
             1 
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
           Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -571,13 +583,13 @@ STAGE PLANS:
             alias: test1_n2
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
           TableScan
             alias: test2_n0
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
@@ -596,16 +608,20 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+          residual filter predicates: {((_col1 = _col5) or _col3 or _col4 BETWEEN 100 AND 102)}
           Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -676,13 +692,13 @@ STAGE PLANS:
             alias: test1_n2
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
           TableScan
             alias: test2_n0
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
@@ -701,16 +717,20 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+          residual filter predicates: {((_col1 = _col5) or _col3)}
           Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -878,15 +898,15 @@ STAGE PLANS:
             alias: test1_n2
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col1 (type: int)
                 sort order: +
                 Map-reduce partition columns: _col1 (type: int)
                 Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
           TableScan
             alias: test2_n0
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
@@ -907,16 +927,20 @@ STAGE PLANS:
           keys:
             0 _col1 (type: int)
             1 _col1 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+          residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
           Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1095,13 +1119,13 @@ STAGE PLANS:
             alias: test2_n0
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1109,16 +1133,20 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+          residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col6)}
           Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1300,13 +1328,13 @@ STAGE PLANS:
             alias: test2_n0
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1314,16 +1342,20 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {((_col1 = _col4) or _col3 BETWEEN 100 AND 102)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+          residual filter predicates: {((_col1 = _col4) or _col6)}
           Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1403,15 +1435,15 @@ STAGE PLANS:
             alias: test2_n0
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col1 (type: int)
                 sort order: +
                 Map-reduce partition columns: _col1 (type: int)
                 Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1419,16 +1451,20 @@ STAGE PLANS:
           keys:
             0 _col1 (type: int)
             1 _col1 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+          residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
           Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1874,7 +1910,7 @@ NULL	NULL	NULL	105	NULL	None
 101	2	Car	102	2	Del
 99	2	Mat	102	2	Del
 NULL	NULL	NULL	104	3	Fli
-Warning: Shuffle Join JOIN[17][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[18][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM (
@@ -1948,15 +1984,15 @@ STAGE PLANS:
             alias: test2_n0
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col1 (type: int)
                 sort order: +
                 Map-reduce partition columns: _col1 (type: int)
                 Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -1964,15 +2000,19 @@ STAGE PLANS:
           keys:
             0 _col1 (type: int)
             1 _col1 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+          residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
           Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+            Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -2012,15 +2052,15 @@ STAGE PLANS:
             alias: test1_n2
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col1 (type: int)
                 sort order: +
                 Map-reduce partition columns: _col1 (type: int)
                 Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col2 (type: string)
+                value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
           TableScan
             alias: test2_n0
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
@@ -2041,15 +2081,19 @@ STAGE PLANS:
           keys:
             0 _col1 (type: int)
             1 _col1 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-          residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+          residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
           Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+            Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -2057,7 +2101,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[17][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[18][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: SELECT *
 FROM (
   SELECT test1_n2.key AS key1, test1_n2.value AS value1, test1_n2.col_1 AS col_1,


[38/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/subquery_scalar.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/subquery_scalar.q.out b/ql/src/test/results/clientpositive/llap/subquery_scalar.q.out
index c72e4b2..c43ad91 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_scalar.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_scalar.q.out
@@ -109,13 +109,13 @@ STAGE PLANS:
                   alias: part
                   Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string), UDFToDouble(p_size) (type: double)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                    Statistics: Num rows: 26 Data size: 16302 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                      Statistics: Num rows: 26 Data size: 16302 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col9 (type: double)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -147,16 +147,16 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
-                residual filter predicates: {(UDFToDouble(_col5) > _col9)}
-                Statistics: Num rows: 8 Data size: 5120 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
+                residual filter predicates: {(_col9 > _col10)}
+                Statistics: Num rows: 8 Data size: 5184 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                  Statistics: Num rows: 8 Data size: 5120 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 8 Data size: 5184 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 8 Data size: 5120 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 8 Data size: 5184 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -397,12 +397,12 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: p_partkey (type: int), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 1 Data size: 582 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                      Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 582 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                        Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -432,15 +432,15 @@ STAGE PLANS:
                   0 
                   1 
                   2 
-                outputColumnNames: _col2, _col4, _col5, _col6, _col7, _col8, _col9, _col10
-                Statistics: Num rows: 1 Data size: 959 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                Statistics: Num rows: 1 Data size: 875 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col2 (type: int), null (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: int), _col8 (type: string), _col9 (type: double), _col10 (type: string)
+                  expressions: _col2 (type: int), null (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: int), _col7 (type: string), _col8 (type: double), _col9 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                  Statistics: Num rows: 1 Data size: 959 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 875 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 1 Data size: 959 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 1 Data size: 875 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -1245,13 +1245,13 @@ STAGE PLANS:
                   alias: part
                   Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string), (p_partkey * p_size) (type: int)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                    Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                      Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col9 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -1283,9 +1283,9 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
-                residual filter predicates: {((_col0 * _col5) <> _col9)}
-                Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
+                residual filter predicates: {(_col9 <> _col10)}
+                Statistics: Num rows: 26 Data size: 16302 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
                   expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
@@ -1383,7 +1383,7 @@ STAGE PLANS:
                     predicate: p_name is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 3250 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_name (type: string), p_size (type: int)
+                      expressions: p_name (type: string), (p_size + 100) (type: int)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 26 Data size: 3250 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
@@ -1427,7 +1427,7 @@ STAGE PLANS:
                   0 _col0 (type: string)
                   1 _col1 (type: string)
                 outputColumnNames: _col1, _col2
-                residual filter predicates: {((_col1 + 100) < _col2)}
+                residual filter predicates: {(_col1 < _col2)}
                 Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
                   Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
@@ -1659,15 +1659,15 @@ STAGE PLANS:
                     predicate: p_type is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string), UDFToDouble(p_size) (type: double)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                      Statistics: Num rows: 26 Data size: 16302 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col4 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col4 (type: string)
-                        Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                        Statistics: Num rows: 26 Data size: 16302 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col9 (type: double)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -1702,16 +1702,16 @@ STAGE PLANS:
                 keys:
                   0 _col4 (type: string)
                   1 _col1 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
-                residual filter predicates: {(UDFToDouble(_col5) > _col9)}
-                Statistics: Num rows: 9 Data size: 5690 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
+                residual filter predicates: {(_col9 > _col10)}
+                Statistics: Num rows: 9 Data size: 5763 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                  Statistics: Num rows: 9 Data size: 5690 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 9 Data size: 5763 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 9 Data size: 5690 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 9 Data size: 5763 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -3754,8 +3754,8 @@ STAGE PLANS:
                 keys:
                   0 _col4 (type: string)
                   1 _col1 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col13
-                residual filter predicates: {(not (_col1 like _col13))}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                residual filter predicates: {(not (_col1 like _col9))}
                 Statistics: Num rows: 5 Data size: 795 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -3860,12 +3860,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: l_orderkey (type: int), l_partkey (type: int), l_suppkey (type: int)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 14 Data size: 168 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col1 (type: int)
-                        Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 14 Data size: 168 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col2 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -3941,8 +3941,8 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col5
-                residual filter predicates: {(_col0 <> _col5)}
+                outputColumnNames: _col0, _col1, _col2, _col4
+                residual filter predicates: {(_col0 <> _col4)}
                 Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
                   expressions: _col1 (type: int), _col2 (type: int)
@@ -4074,12 +4074,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: l_orderkey (type: int), l_partkey (type: int), l_suppkey (type: int)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 14 Data size: 168 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col1 (type: int)
-                        Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 14 Data size: 168 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col2 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -4155,8 +4155,8 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col5
-                residual filter predicates: {(_col0 <> _col5)}
+                outputColumnNames: _col0, _col1, _col2, _col4
+                residual filter predicates: {(_col0 <> _col4)}
                 Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
                   expressions: _col1 (type: int), _col2 (type: int)
@@ -5224,15 +5224,15 @@ STAGE PLANS:
                     predicate: name is not null (type: boolean)
                     Statistics: Num rows: 5 Data size: 1650 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: empno (type: int), name (type: string), deptno (type: int), gender (type: string), city (type: string), empid (type: int), age (type: int), slacker (type: boolean), manager (type: boolean), joinedat (type: date)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
-                      Statistics: Num rows: 5 Data size: 1650 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: empno (type: int), name (type: string), deptno (type: int), gender (type: string), city (type: string), empid (type: int), age (type: int), slacker (type: boolean), manager (type: boolean), joinedat (type: date), UDFToLong(deptno) (type: bigint)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
+                      Statistics: Num rows: 5 Data size: 1690 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col1 (type: string)
-                        Statistics: Num rows: 5 Data size: 1650 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col2 (type: int), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: int), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: date)
+                        Statistics: Num rows: 5 Data size: 1690 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: int), _col2 (type: int), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: int), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: date), _col10 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 4 
@@ -5287,12 +5287,12 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: string)
                   1 _col1 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
-                residual filter predicates: {(UDFToLong(_col2) <> _col10)}
-                Statistics: Num rows: 1 Data size: 359 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
+                residual filter predicates: {(_col10 <> _col11)}
+                Statistics: Num rows: 1 Data size: 367 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 1 Data size: 359 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 1 Data size: 367 Basic stats: COMPLETE Column stats: COMPLETE
                   value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: int), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: int), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: date)
         Reducer 3 
             Execution mode: llap
@@ -5303,8 +5303,8 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col12
-                residual filter predicates: {(UDFToLong(_col0) > _col12)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col13
+                residual filter predicates: {(UDFToLong(_col0) > _col13)}
                 Statistics: Num rows: 1 Data size: 359 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
                   expressions: _col0 (type: int), _col1 (type: string), _col2 (type: int), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: int), _col7 (type: boolean), _col8 (type: boolean), _col9 (type: date)
@@ -5999,8 +5999,8 @@ STAGE PLANS:
                   0 _col4 (type: string)
                   1 _col0 (type: string)
                   2 _col1 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col11
-                residual filter predicates: {(_col5 > _col11)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10
+                residual filter predicates: {(_col5 > _col10)}
                 Statistics: Num rows: 4 Data size: 2492 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
                   expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
@@ -6033,12 +6033,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: _col0 (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 4 Data size: 416 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 4 Data size: 448 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 4 Data size: 416 Basic stats: COMPLETE Column stats: COMPLETE
         Reducer 6 
             Execution mode: vectorized, llap
             Reduce Operator Tree:


[19/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query58.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query58.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query58.q.out
index 2504d78..b4410ff 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query58.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query58.q.out
@@ -141,10 +141,10 @@ POSTHOOK: Input: default@web_sales
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
-  HiveProject(item_id=[$0], ss_item_rev=[$3], ss_dev=[*(/(/($3, +(+($3, $1), $5)), CAST(3):DECIMAL(10, 0)), CAST(100):DECIMAL(10, 0))], cs_item_rev=[$1], cs_dev=[*(/(/($1, +(+($3, $1), $5)), CAST(3):DECIMAL(10, 0)), CAST(100):DECIMAL(10, 0))], ws_item_rev=[$5], ws_dev=[*(/(/($5, +(+($3, $1), $5)), CAST(3):DECIMAL(10, 0)), CAST(100):DECIMAL(10, 0))], average=[/(+(+($3, $1), $5), CAST(3):DECIMAL(10, 0))])
-    HiveJoin(condition=[AND(AND(AND(AND(=($0, $4), BETWEEN(false, $3, *(0.9, $5), *(1.1, $5))), BETWEEN(false, $1, *(0.9, $5), *(1.1, $5))), BETWEEN(false, $5, *(0.9, $3), *(1.1, $3))), BETWEEN(false, $5, *(0.9, $1), *(1.1, $1)))], joinType=[inner], algorithm=[none], cost=[not available])
-      HiveJoin(condition=[AND(AND(=($2, $0), BETWEEN(false, $3, *(0.9, $1), *(1.1, $1))), BETWEEN(false, $1, *(0.9, $3), *(1.1, $3)))], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveProject(i_item_id=[$0], $f1=[$1])
+  HiveProject(item_id=[$0], ss_item_rev=[$5], ss_dev=[*(/(/($5, +(+($5, $1), $9)), CAST(3):DECIMAL(10, 0)), CAST(100):DECIMAL(10, 0))], cs_item_rev=[$1], cs_dev=[*(/(/($1, +(+($5, $1), $9)), CAST(3):DECIMAL(10, 0)), CAST(100):DECIMAL(10, 0))], ws_item_rev=[$9], ws_dev=[*(/(/($9, +(+($5, $1), $9)), CAST(3):DECIMAL(10, 0)), CAST(100):DECIMAL(10, 0))], average=[/(+(+($5, $1), $9), CAST(3):DECIMAL(10, 0))])
+    HiveJoin(condition=[AND(AND(AND(AND(=($0, $8), BETWEEN(false, $5, $10, $11)), BETWEEN(false, $1, $10, $11)), BETWEEN(false, $9, $6, $7)), BETWEEN(false, $9, $2, $3))], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveJoin(condition=[AND(AND(=($4, $0), BETWEEN(false, $5, $2, $3)), BETWEEN(false, $1, $6, $7))], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject($f0=[$0], $f1=[$1], *=[*(0.9, $1)], *3=[*(1.1, $1)])
           HiveAggregate(group=[{4}], agg#0=[sum($2)])
             HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -175,7 +175,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                           HiveProject(d_week_seq=[$4])
                             HiveFilter(condition=[AND(=($2, _UTF-16LE'1998-02-19'), IS NOT NULL($4))])
                               HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-        HiveProject(i_item_id=[$0], $f1=[$1])
+        HiveProject($f0=[$0], $f1=[$1], *=[*(0.9, $1)], *3=[*(1.1, $1)])
           HiveAggregate(group=[{4}], agg#0=[sum($2)])
             HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -206,7 +206,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                           HiveProject(d_week_seq=[$4])
                             HiveFilter(condition=[AND(=($2, _UTF-16LE'1998-02-19'), IS NOT NULL($4))])
                               HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-      HiveProject(i_item_id=[$0], $f1=[$1])
+      HiveProject($f0=[$0], $f1=[$1], *=[*(0.9, $1)], *3=[*(1.1, $1)])
         HiveAggregate(group=[{4}], agg#0=[sum($2)])
           HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query59.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query59.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query59.q.out
index bb92a1f..8674a8a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query59.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query59.q.out
@@ -94,24 +94,24 @@ POSTHOOK: Input: default@store_sales
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC], dir1=[ASC], dir2=[ASC], fetch=[100])
-  HiveProject(s_store_name1=[$2], s_store_id1=[$1], d_week_seq1=[$3], _o__c3=[/($5, $16)], _o__c4=[/($6, $17)], _o__c5=[/($7, $7)], _o__c6=[/($8, $18)], _o__c7=[/($9, $19)], _o__c8=[/($10, $20)], _o__c9=[/($11, $21)])
-    HiveJoin(condition=[AND(=($1, $15), =($3, -($14, 52)))], joinType=[inner], algorithm=[none], cost=[not available])
+  HiveProject(s_store_name1=[$2], s_store_id1=[$1], d_week_seq1=[$3], _o__c3=[/($5, $15)], _o__c4=[/($6, $16)], _o__c5=[/($7, $7)], _o__c6=[/($8, $17)], _o__c7=[/($9, $18)], _o__c8=[/($10, $19)], _o__c9=[/($11, $20)])
+    HiveJoin(condition=[AND(=($1, $14), =($3, -($13, 52)))], joinType=[inner], algorithm=[none], cost=[not available])
       HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveProject(s_store_sk=[$0], s_store_id=[$1], s_store_name=[$5])
           HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
             HiveTableScan(table=[[default, store]], table:alias=[store])
-        HiveJoin(condition=[=($10, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[=($9, $0)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7], $f8=[$8])
             HiveAggregate(group=[{0, 1}], agg#0=[sum($2)], agg#1=[sum($3)], agg#2=[sum($4)], agg#3=[sum($5)], agg#4=[sum($6)], agg#5=[sum($7)], agg#6=[sum($8)])
-              HiveProject($f0=[$4], $f1=[$1], $f2=[CASE(=($5, _UTF-16LE'Sunday'), $2, null)], $f3=[CASE(=($5, _UTF-16LE'Monday'), $2, null)], $f4=[CASE(=($5, _UTF-16LE'Tuesday'), $2, null)], $f5=[CASE(=($5, _UTF-16LE'Wednesday'), $2, null)], $f6=[CASE(=($5, _UTF-16LE'Thursday'), $2, null)], $f7=[CASE(=($5, _UTF-16LE'Friday'), $2, null)], $f8=[CASE(=($5, _UTF-16LE'Saturday'), $2, null)])
+              HiveProject($f0=[$4], $f1=[$1], $f2=[CASE($5, $2, null)], $f3=[CASE($6, $2, null)], $f4=[CASE($7, $2, null)], $f5=[CASE($8, $2, null)], $f6=[CASE($9, $2, null)], $f7=[CASE($10, $2, null)], $f8=[CASE($11, $2, null)])
                 HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_date_sk=[$0], ss_store_sk=[$7], ss_sales_price=[$13])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(d_date_sk=[$0], d_week_seq=[$4], d_day_name=[$14])
+                  HiveProject(d_date_sk=[$0], d_week_seq=[$4], ==[=($14, _UTF-16LE'Sunday')], =3=[=($14, _UTF-16LE'Monday')], =4=[=($14, _UTF-16LE'Tuesday')], =5=[=($14, _UTF-16LE'Wednesday')], =6=[=($14, _UTF-16LE'Thursday')], =7=[=($14, _UTF-16LE'Friday')], =8=[=($14, _UTF-16LE'Saturday')])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(d_month_seq=[$3], d_week_seq=[$4])
+          HiveProject(d_week_seq=[$4])
             HiveFilter(condition=[AND(BETWEEN(false, $3, 1185, 1196), IS NOT NULL($4))])
               HiveTableScan(table=[[default, date_dim]], table:alias=[d])
       HiveProject(d_week_seq2=[$2], s_store_id2=[$1], sun_sales2=[$4], mon_sales2=[$5], wed_sales2=[$6], thu_sales2=[$7], fri_sales2=[$8], sat_sales2=[$9])
@@ -119,18 +119,18 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC], dir1=[ASC], dir2=[
           HiveProject(s_store_sk=[$0], s_store_id=[$1])
             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
               HiveTableScan(table=[[default, store]], table:alias=[store])
-          HiveJoin(condition=[=($9, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7])
               HiveAggregate(group=[{0, 1}], agg#0=[sum($2)], agg#1=[sum($3)], agg#2=[sum($5)], agg#3=[sum($6)], agg#4=[sum($7)], agg#5=[sum($8)])
-                HiveProject($f0=[$4], $f1=[$1], $f2=[CASE(=($5, _UTF-16LE'Sunday'), $2, null)], $f3=[CASE(=($5, _UTF-16LE'Monday'), $2, null)], $f4=[CASE(=($5, _UTF-16LE'Tuesday'), $2, null)], $f5=[CASE(=($5, _UTF-16LE'Wednesday'), $2, null)], $f6=[CASE(=($5, _UTF-16LE'Thursday'), $2, null)], $f7=[CASE(=($5, _UTF-16LE'Friday'), $2, null)], $f8=[CASE(=($5, _UTF-16LE'Saturday'), $2, null)])
+                HiveProject($f0=[$4], $f1=[$1], $f2=[CASE($5, $2, null)], $f3=[CASE($6, $2, null)], $f4=[CASE($7, $2, null)], $f5=[CASE($8, $2, null)], $f6=[CASE($9, $2, null)], $f7=[CASE($10, $2, null)], $f8=[CASE($11, $2, null)])
                   HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(ss_sold_date_sk=[$0], ss_store_sk=[$7], ss_sales_price=[$13])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(d_date_sk=[$0], d_week_seq=[$4], d_day_name=[$14])
+                    HiveProject(d_date_sk=[$0], d_week_seq=[$4], ==[=($14, _UTF-16LE'Sunday')], =3=[=($14, _UTF-16LE'Monday')], =4=[=($14, _UTF-16LE'Tuesday')], =5=[=($14, _UTF-16LE'Wednesday')], =6=[=($14, _UTF-16LE'Thursday')], =7=[=($14, _UTF-16LE'Friday')], =8=[=($14, _UTF-16LE'Saturday')])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-            HiveProject(d_month_seq=[$3], d_week_seq=[$4])
+            HiveProject(d_week_seq=[$4])
               HiveFilter(condition=[AND(BETWEEN(false, $3, 1197, 1208), IS NOT NULL($4))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[d])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query6.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query6.q.out
index 02149e7..f502c00 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query6.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query6.q.out
@@ -88,13 +88,13 @@ HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
                 HiveProject(ca_address_sk=[$0], ca_state=[$8])
                   HiveFilter(condition=[IS NOT NULL($0)])
                     HiveTableScan(table=[[default, customer_address]], table:alias=[a])
-          HiveProject(i_item_sk=[$0], i_current_price=[$1], i_category=[$2], _o__c0=[$3], i_category0=[$4], cnt=[$5])
-            HiveJoin(condition=[AND(=($4, $2), >($1, *(1.2, CAST($3):DECIMAL(16, 6))))], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveProject(i_item_sk=[$0], i_current_price=[$1], i_category=[$2], i_category0=[$3], *=[$4], cnt=[$5])
+            HiveJoin(condition=[AND(=($3, $2), >($1, $4))], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(i_item_sk=[$0], i_current_price=[$5], i_category=[$12])
                 HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($12))])
                   HiveTableScan(table=[[default, item]], table:alias=[i])
               HiveJoin(condition=[true], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(_o__c0=[/($1, $2)], i_category=[$0])
+                HiveProject(i_category=[$0], *=[*(1.2, CAST(/($1, $2)):DECIMAL(16, 6))])
                   HiveAggregate(group=[{12}], agg#0=[sum($5)], agg#1=[count($5)])
                     HiveFilter(condition=[IS NOT NULL($12)])
                       HiveTableScan(table=[[default, item]], table:alias=[j])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query60.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query60.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query60.q.out
index 81dfec7..acda930 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query60.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query60.q.out
@@ -173,8 +173,8 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
       HiveProject(i_item_id=[$0], $f1=[$1])
         HiveUnion(all=[true])
           HiveProject(i_item_id=[$0], $f1=[$1])
-            HiveAggregate(group=[{1}], agg#0=[sum($8)])
-              HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{1}], agg#0=[sum($7)])
+              HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(i_item_sk=[$0], i_item_id=[$1])
                     HiveFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($0))])
@@ -183,21 +183,21 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                     HiveAggregate(group=[{1}])
                       HiveFilter(condition=[AND(=($12, _UTF-16LE'Children'), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ca_address_sk=[$0], ca_gmt_offset=[$1], ss_sold_date_sk=[$2], ss_item_sk=[$3], ss_addr_sk=[$4], ss_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8])
-                  HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-6):DECIMAL(5, 2)])
+                HiveProject(ca_address_sk=[$0], ss_sold_date_sk=[$1], ss_item_sk=[$2], ss_addr_sk=[$3], ss_ext_sales_price=[$4], d_date_sk=[$5])
+                  HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ca_address_sk=[$0])
                       HiveFilter(condition=[AND(=($11, -6), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_addr_sk=[$6], ss_ext_sales_price=[$15])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6), IS NOT NULL($2))])
                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(9):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), =($8, 9), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(i_item_id=[$0], $f1=[$1])
-            HiveAggregate(group=[{1}], agg#0=[sum($8)])
-              HiveJoin(condition=[=($7, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{1}], agg#0=[sum($7)])
+              HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(i_item_sk=[$0], i_item_id=[$1])
                     HiveFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($0))])
@@ -206,21 +206,21 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                     HiveAggregate(group=[{1}])
                       HiveFilter(condition=[AND(=($12, _UTF-16LE'Children'), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ca_address_sk=[$0], ca_gmt_offset=[$1], cs_sold_date_sk=[$2], cs_bill_addr_sk=[$3], cs_item_sk=[$4], cs_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8])
-                  HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-6):DECIMAL(5, 2)])
+                HiveProject(ca_address_sk=[$0], cs_sold_date_sk=[$1], cs_bill_addr_sk=[$2], cs_item_sk=[$3], cs_ext_sales_price=[$4], d_date_sk=[$5])
+                  HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ca_address_sk=[$0])
                       HiveFilter(condition=[AND(=($11, -6), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(cs_sold_date_sk=[$0], cs_bill_addr_sk=[$6], cs_item_sk=[$15], cs_ext_sales_price=[$23])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($6), IS NOT NULL($15))])
                           HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(9):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), =($8, 9), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(i_item_id=[$0], $f1=[$1])
-            HiveAggregate(group=[{1}], agg#0=[sum($8)])
-              HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{1}], agg#0=[sum($7)])
+              HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(i_item_sk=[$0], i_item_id=[$1])
                     HiveFilter(condition=[AND(IS NOT NULL($1), IS NOT NULL($0))])
@@ -229,16 +229,16 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                     HiveAggregate(group=[{1}])
                       HiveFilter(condition=[AND(=($12, _UTF-16LE'Children'), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ca_address_sk=[$0], ca_gmt_offset=[$1], ws_sold_date_sk=[$2], ws_item_sk=[$3], ws_bill_addr_sk=[$4], ws_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8])
-                  HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-6):DECIMAL(5, 2)])
+                HiveProject(ca_address_sk=[$0], ws_sold_date_sk=[$1], ws_item_sk=[$2], ws_bill_addr_sk=[$3], ws_ext_sales_price=[$4], d_date_sk=[$5])
+                  HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(ca_address_sk=[$0])
                       HiveFilter(condition=[AND(=($11, -6), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_bill_addr_sk=[$7], ws_ext_sales_price=[$23])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($3))])
                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(9):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), =($8, 9), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query61.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query61.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query61.q.out
index c5356df..8e8cf27 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query61.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query61.q.out
@@ -106,59 +106,59 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
   HiveProject(promotions=[$0], total=[$1], _o__c2=[*(/(CAST($0):DECIMAL(15, 4), CAST($1):DECIMAL(15, 4)), CAST(100):DECIMAL(10, 0))])
     HiveJoin(condition=[true], joinType=[inner], algorithm=[none], cost=[not available])
       HiveProject($f0=[$0])
-        HiveAggregate(group=[{}], agg#0=[sum($9)])
-          HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveAggregate(group=[{}], agg#0=[sum($8)])
+          HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($2, $1)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(c_customer_sk=[$0], c_current_addr_sk=[$4])
                 HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                   HiveTableScan(table=[[default, customer]], table:alias=[customer])
-              HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-7):DECIMAL(5, 2)])
+              HiveProject(ca_address_sk=[$0])
                 HiveFilter(condition=[AND(=($11, -7), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-            HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$1], ss_customer_sk=[$2], ss_store_sk=[$3], ss_promo_sk=[$4], ss_ext_sales_price=[$5], d_date_sk=[$6], d_year=[$7], d_moy=[$8], i_item_sk=[$9], i_category=[$10], s_store_sk=[$11], s_gmt_offset=[$12], p_promo_sk=[$13], p_channel_dmail=[$14], p_channel_email=[$15], p_channel_tv=[$16])
-              HiveJoin(condition=[=($4, $13)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveJoin(condition=[=($3, $11)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveJoin(condition=[=($1, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$1], ss_customer_sk=[$2], ss_store_sk=[$3], ss_promo_sk=[$4], ss_ext_sales_price=[$5], d_date_sk=[$6], i_item_sk=[$7], s_store_sk=[$8], p_promo_sk=[$9])
+              HiveJoin(condition=[=($4, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveJoin(condition=[=($3, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveJoin(condition=[=($1, $7)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_store_sk=[$7], ss_promo_sk=[$8], ss_ext_sales_price=[$15])
                         HiveFilter(condition=[AND(IS NOT NULL($7), IS NOT NULL($8), IS NOT NULL($0), IS NOT NULL($3), IS NOT NULL($2))])
                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(11):INTEGER])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), =($8, 11), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                    HiveProject(i_item_sk=[$0], i_category=[CAST(_UTF-16LE'Electronics'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                    HiveProject(i_item_sk=[$0])
                       HiveFilter(condition=[AND(=($12, _UTF-16LE'Electronics'), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                  HiveProject(s_store_sk=[$0], s_gmt_offset=[CAST(-7):DECIMAL(5, 2)])
+                  HiveProject(s_store_sk=[$0])
                     HiveFilter(condition=[AND(=($27, -7), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, store]], table:alias=[store])
-                HiveProject(p_promo_sk=[$0], p_channel_dmail=[$8], p_channel_email=[$9], p_channel_tv=[$11])
+                HiveProject(p_promo_sk=[$0])
                   HiveFilter(condition=[AND(OR(=($8, _UTF-16LE'Y'), =($9, _UTF-16LE'Y'), =($11, _UTF-16LE'Y')), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
       HiveProject($f0=[$0])
-        HiveAggregate(group=[{}], agg#0=[sum($8)])
-          HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveAggregate(group=[{}], agg#0=[sum($7)])
+          HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($2, $1)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(c_customer_sk=[$0], c_current_addr_sk=[$4])
                 HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                   HiveTableScan(table=[[default, customer]], table:alias=[customer])
-              HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-7):DECIMAL(5, 2)])
+              HiveProject(ca_address_sk=[$0])
                 HiveFilter(condition=[AND(=($11, -7), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-            HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$1], ss_customer_sk=[$2], ss_store_sk=[$3], ss_ext_sales_price=[$4], d_date_sk=[$5], d_year=[$6], d_moy=[$7], i_item_sk=[$8], i_category=[$9], s_store_sk=[$10], s_gmt_offset=[$11])
-              HiveJoin(condition=[=($3, $10)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveJoin(condition=[=($1, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$1], ss_customer_sk=[$2], ss_store_sk=[$3], ss_ext_sales_price=[$4], d_date_sk=[$5], i_item_sk=[$6], s_store_sk=[$7])
+              HiveJoin(condition=[=($3, $7)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_store_sk=[$7], ss_ext_sales_price=[$15])
                       HiveFilter(condition=[AND(IS NOT NULL($7), IS NOT NULL($0), IS NOT NULL($3), IS NOT NULL($2))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(11):INTEGER])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(=($6, 1999), =($8, 11), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                  HiveProject(i_item_sk=[$0], i_category=[CAST(_UTF-16LE'Electronics'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                  HiveProject(i_item_sk=[$0])
                     HiveFilter(condition=[AND(=($12, _UTF-16LE'Electronics'), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(s_store_sk=[$0], s_gmt_offset=[CAST(-7):DECIMAL(5, 2)])
+                HiveProject(s_store_sk=[$0])
                   HiveFilter(condition=[AND(=($27, -7), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store]], table:alias=[store])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query63.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query63.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query63.q.out
index a080989..78c9b13 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query63.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query63.q.out
@@ -70,20 +70,20 @@ HiveSortLimit(sort0=[$0], sort1=[$2], sort2=[$1], dir0=[ASC], dir1=[ASC], dir2=[
     HiveFilter(condition=[CASE(>($2, 0), >(/(ABS(-($1, $2)), $2), 0.1), null)])
       HiveProject((tok_table_or_col i_manager_id)=[$0], (tok_function sum (tok_table_or_col ss_sales_price))=[$2], avg_window_0=[avg($2) OVER (PARTITION BY $0 ORDER BY $0 NULLS FIRST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
         HiveProject(i_manager_id=[$0], d_moy=[$1], $f2=[$2])
-          HiveAggregate(group=[{9, 12}], agg#0=[sum($4)])
+          HiveAggregate(group=[{6, 8}], agg#0=[sum($4)])
             HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(s_store_sk=[$0])
                 HiveFilter(condition=[IS NOT NULL($0)])
                   HiveTableScan(table=[[default, store]], table:alias=[store])
-              HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_store_sk=[$7], ss_sales_price=[$13])
                     HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0), IS NOT NULL($7))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(i_item_sk=[$0], i_brand=[$8], i_class=[$10], i_category=[$12], i_manager_id=[$20])
+                  HiveProject(i_item_sk=[$0], i_manager_id=[$20])
                     HiveFilter(condition=[AND(IN($10, _UTF-16LE'personal', _UTF-16LE'portable', _UTF-16LE'refernece', _UTF-16LE'self-help', _UTF-16LE'accessories', _UTF-16LE'classical', _UTF-16LE'fragrances', _UTF-16LE'pants'), IN($8, _UTF-16LE'scholaramalgamalg #14', _UTF-16LE'scholaramalgamalg #7', _UTF-16LE'exportiunivamalg #9', _UTF-16LE'scholaramalgamalg #9', _UTF-16LE'amalgimporto #1', _UTF-16LE'edu packscholar #1', _UTF-16LE'exportiimporto #1', _UTF-16LE'importoamalg #1'), IN($12, _UTF-16LE'Books', _UTF-16LE'Children', _UTF-16LE'Electronics', _UTF-16LE'Women', _UTF-16LE'Music', _UTF-16LE'Men'), OR(AND(IN($12, _UTF-16LE'Books', _UTF-16LE'Children', _UTF-16LE'Electronics'), IN($10, _UTF-16LE'personal', _UTF-16LE'portable', _UTF-16LE'refernece', _UTF-16LE'self-help'), IN($8, _UTF-16LE'scholaramalgamalg #14', _UTF-16LE'scholaramalgamalg #7', _UTF-16LE'exportiunivamalg #9', _UTF-16LE'scholaramalgamalg #9')), AND(IN($12, _UTF-16LE'Women', _UTF-16LE'Music', _UTF-16LE'Men'), IN($10, 
 _UTF-16LE'accessories', _UTF-16LE'classical', _UTF-16LE'fragrances', _UTF-16LE'pants'), IN($8, _UTF-16LE'amalgimporto #1', _UTF-16LE'edu packscholar #1', _UTF-16LE'exportiimporto #1', _UTF-16LE'importoamalg #1'))), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(d_date_sk=[$0], d_month_seq=[$3], d_moy=[$8])
+                HiveProject(d_date_sk=[$0], d_moy=[$8])
                   HiveFilter(condition=[AND(IN($3, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query64.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query64.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query64.q.out
index 3b59bd8..5a5bb79 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query64.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query64.q.out
@@ -268,7 +268,7 @@ HiveProject(product_name=[$0], store_name=[$1], store_zip=[$2], b_street_number=
     HiveProject(product_name=[$0], store_name=[$2], store_zip=[$3], b_street_number=[$4], b_streen_name=[$5], b_city=[$6], b_zip=[$7], c_street_number=[$8], c_street_name=[$9], c_city=[$10], c_zip=[$11], cnt=[$12], s1=[$13], s2=[$14], s3=[$15], s11=[$20], s21=[$21], s31=[$22], cnt1=[$19])
       HiveJoin(condition=[AND(AND(AND(=($1, $16), <=($19, $12)), =($2, $17)), =($3, $18))], joinType=[inner], algorithm=[none], cost=[not available])
         HiveProject($f0=[$13], $f1=[$12], $f2=[$10], $f3=[$11], $f4=[$6], $f5=[$7], $f6=[$8], $f7=[$9], $f8=[$2], $f9=[$3], $f10=[$4], $f11=[$5], $f15=[$14], $f16=[$15], $f17=[$16], $f18=[$17])
-          HiveAggregate(group=[{9, 11, 16, 17, 18, 19, 25, 26, 27, 28, 30, 31, 48, 51}], agg#0=[count()], agg#1=[sum($45)], agg#2=[sum($46)], agg#3=[sum($47)])
+          HiveAggregate(group=[{9, 11, 16, 17, 18, 19, 25, 26, 27, 28, 30, 31, 48, 49}], agg#0=[count()], agg#1=[sum($45)], agg#2=[sum($46)], agg#3=[sum($47)])
             HiveJoin(condition=[AND(<>($1, $21), =($39, $0))], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2])
                 HiveFilter(condition=[IS NOT NULL($0)])
@@ -302,7 +302,7 @@ HiveProject(product_name=[$0], store_name=[$1], store_zip=[$2], b_street_number=
                   HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2])
                     HiveFilter(condition=[IS NOT NULL($0)])
                       HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd2])
-                HiveProject(sr_item_sk=[$0], sr_ticket_number=[$1], ca_address_sk=[$2], ca_street_number=[$3], ca_street_name=[$4], ca_city=[$5], ca_zip=[$6], s_store_sk=[$7], s_store_name=[$8], s_zip=[$9], hd_demo_sk=[$10], hd_income_band_sk=[$11], ib_income_band_sk=[$12], p_promo_sk=[$13], ss_sold_date_sk=[$14], ss_item_sk=[$15], ss_customer_sk=[$16], ss_cdemo_sk=[$17], ss_hdemo_sk=[$18], ss_addr_sk=[$19], ss_store_sk=[$20], ss_promo_sk=[$21], ss_ticket_number=[$22], ss_wholesale_cost=[$23], ss_list_price=[$24], ss_coupon_amt=[$25], i_item_sk=[$26], i_current_price=[$27], i_color=[$28], i_product_name=[$29], d_date_sk=[$30], d_year=[$31], $f0=[$32], $f1=[$33], $f2=[$34])
+                HiveProject(sr_item_sk=[$0], sr_ticket_number=[$1], ca_address_sk=[$2], ca_street_number=[$3], ca_street_name=[$4], ca_city=[$5], ca_zip=[$6], s_store_sk=[$7], s_store_name=[$8], s_zip=[$9], hd_demo_sk=[$10], hd_income_band_sk=[$11], ib_income_band_sk=[$12], p_promo_sk=[$13], ss_sold_date_sk=[$14], ss_item_sk=[$15], ss_customer_sk=[$16], ss_cdemo_sk=[$17], ss_hdemo_sk=[$18], ss_addr_sk=[$19], ss_store_sk=[$20], ss_promo_sk=[$21], ss_ticket_number=[$22], ss_wholesale_cost=[$23], ss_list_price=[$24], ss_coupon_amt=[$25], i_item_sk=[$26], i_product_name=[$27], d_date_sk=[$28], $f0=[$29])
                   HiveJoin(condition=[AND(=($15, $0), =($22, $1))], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(sr_item_sk=[$2], sr_ticket_number=[$9])
                       HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($9))])
@@ -315,44 +315,43 @@ HiveProject(product_name=[$0], store_name=[$1], store_zip=[$2], b_street_number=
                         HiveProject(s_store_sk=[$0], s_store_name=[$5], s_zip=[$25])
                           HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($5), IS NOT NULL($25))])
                             HiveTableScan(table=[[default, store]], table:alias=[store])
-                        HiveJoin(condition=[=($5, $22)], joinType=[inner], algorithm=[none], cost=[not available])
-                          HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                            HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-                              HiveProject(hd_demo_sk=[$0], hd_income_band_sk=[$1])
-                                HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
-                                  HiveTableScan(table=[[default, household_demographics]], table:alias=[hd1])
-                              HiveProject(ib_income_band_sk=[$0])
+                        HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                          HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+                            HiveProject(hd_demo_sk=[$0], hd_income_band_sk=[$1])
+                              HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
+                                HiveTableScan(table=[[default, household_demographics]], table:alias=[hd1])
+                            HiveProject(ib_income_band_sk=[$0])
+                              HiveFilter(condition=[IS NOT NULL($0)])
+                                HiveTableScan(table=[[default, income_band]], table:alias=[ib1])
+                          HiveProject(p_promo_sk=[$0], ss_sold_date_sk=[$1], ss_item_sk=[$2], ss_customer_sk=[$3], ss_cdemo_sk=[$4], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_promo_sk=[$8], ss_ticket_number=[$9], ss_wholesale_cost=[$10], ss_list_price=[$11], ss_coupon_amt=[$12], i_item_sk=[$13], i_product_name=[$14], d_date_sk=[$15], $f0=[$16])
+                            HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                              HiveProject(p_promo_sk=[$0])
                                 HiveFilter(condition=[IS NOT NULL($0)])
-                                  HiveTableScan(table=[[default, income_band]], table:alias=[ib1])
-                            HiveProject(p_promo_sk=[$0], ss_sold_date_sk=[$1], ss_item_sk=[$2], ss_customer_sk=[$3], ss_cdemo_sk=[$4], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_promo_sk=[$8], ss_ticket_number=[$9], ss_wholesale_cost=[$10], ss_list_price=[$11], ss_coupon_amt=[$12], i_item_sk=[$13], i_current_price=[$14], i_color=[$15], i_product_name=[$16], d_date_sk=[$17], d_year=[$18])
-                              HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                                HiveProject(p_promo_sk=[$0])
-                                  HiveFilter(condition=[IS NOT NULL($0)])
-                                    HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
-                                HiveJoin(condition=[=($0, $16)], joinType=[inner], algorithm=[none], cost=[not available])
+                                  HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
+                              HiveJoin(condition=[=($1, $15)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveJoin(condition=[=($0, $14)], joinType=[inner], algorithm=[none], cost=[not available])
                                   HiveJoin(condition=[=($1, $12)], joinType=[inner], algorithm=[none], cost=[not available])
                                     HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_cdemo_sk=[$4], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_promo_sk=[$8], ss_ticket_number=[$9], ss_wholesale_cost=[$11], ss_list_price=[$12], ss_coupon_amt=[$19])
                                       HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($9), IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($3), IS NOT NULL($4), IS NOT NULL($8), IS NOT NULL($5), IS NOT NULL($6))])
                                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                    HiveProject(i_item_sk=[$0], i_current_price=[$5], i_color=[$17], i_product_name=[$21])
+                                    HiveProject(i_item_sk=[$0], i_product_name=[$21])
                                       HiveFilter(condition=[AND(IN($17, _UTF-16LE'maroon', _UTF-16LE'burnished', _UTF-16LE'dim', _UTF-16LE'steel', _UTF-16LE'navajo', _UTF-16LE'chocolate'), BETWEEN(false, $5, 35, 45), BETWEEN(false, $5, 36, 50), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                                  HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER])
+                                  HiveProject(d_date_sk=[$0])
                                     HiveFilter(condition=[AND(=($6, 2000), IS NOT NULL($0))])
                                       HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
-                          HiveProject($f0=[$0], $f1=[$1], $f2=[$2])
-                            HiveFilter(condition=[>($1, *(2, $2))])
-                              HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)])
-                                HiveProject($f0=[$0], $f1=[$2], $f2=[+(+($5, $6), $7)])
-                                  HiveJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner], algorithm=[none], cost=[not available])
-                                    HiveProject(cs_item_sk=[$15], cs_order_number=[$17], cs_ext_list_price=[$25])
-                                      HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($17))])
-                                        HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                    HiveProject(cr_item_sk=[$2], cr_order_number=[$16], cr_refunded_cash=[$23], cr_reversed_charge=[$24], cr_store_credit=[$25])
-                                      HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($16))])
-                                        HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
+                                HiveProject($f0=[$0])
+                                  HiveFilter(condition=[>($1, *(2, $2))])
+                                    HiveAggregate(group=[{0}], agg#0=[sum($2)], agg#1=[sum($5)])
+                                      HiveJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner], algorithm=[none], cost=[not available])
+                                        HiveProject(cs_item_sk=[$15], cs_order_number=[$17], cs_ext_list_price=[$25])
+                                          HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($17))])
+                                            HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
+                                        HiveProject(cr_item_sk=[$2], cr_order_number=[$16], +=[+(+($23, $24), $25)])
+                                          HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($16))])
+                                            HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
         HiveProject($f1=[$12], $f2=[$10], $f3=[$11], $f15=[$14], $f16=[$15], $f17=[$16], $f18=[$17])
-          HiveAggregate(group=[{9, 11, 16, 17, 18, 19, 25, 26, 27, 28, 30, 31, 48, 51}], agg#0=[count()], agg#1=[sum($45)], agg#2=[sum($46)], agg#3=[sum($47)])
+          HiveAggregate(group=[{9, 11, 16, 17, 18, 19, 25, 26, 27, 28, 30, 31, 48, 49}], agg#0=[count()], agg#1=[sum($45)], agg#2=[sum($46)], agg#3=[sum($47)])
             HiveJoin(condition=[AND(<>($1, $21), =($39, $0))], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2])
                 HiveFilter(condition=[IS NOT NULL($0)])
@@ -386,7 +385,7 @@ HiveProject(product_name=[$0], store_name=[$1], store_zip=[$2], b_street_number=
                   HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2])
                     HiveFilter(condition=[IS NOT NULL($0)])
                       HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd2])
-                HiveProject(sr_item_sk=[$0], sr_ticket_number=[$1], ca_address_sk=[$2], ca_street_number=[$3], ca_street_name=[$4], ca_city=[$5], ca_zip=[$6], s_store_sk=[$7], s_store_name=[$8], s_zip=[$9], hd_demo_sk=[$10], hd_income_band_sk=[$11], ib_income_band_sk=[$12], p_promo_sk=[$13], ss_sold_date_sk=[$14], ss_item_sk=[$15], ss_customer_sk=[$16], ss_cdemo_sk=[$17], ss_hdemo_sk=[$18], ss_addr_sk=[$19], ss_store_sk=[$20], ss_promo_sk=[$21], ss_ticket_number=[$22], ss_wholesale_cost=[$23], ss_list_price=[$24], ss_coupon_amt=[$25], i_item_sk=[$26], i_current_price=[$27], i_color=[$28], i_product_name=[$29], d_date_sk=[$30], d_year=[$31], $f0=[$32], $f1=[$33], $f2=[$34])
+                HiveProject(sr_item_sk=[$0], sr_ticket_number=[$1], ca_address_sk=[$2], ca_street_number=[$3], ca_street_name=[$4], ca_city=[$5], ca_zip=[$6], s_store_sk=[$7], s_store_name=[$8], s_zip=[$9], hd_demo_sk=[$10], hd_income_band_sk=[$11], ib_income_band_sk=[$12], p_promo_sk=[$13], ss_sold_date_sk=[$14], ss_item_sk=[$15], ss_customer_sk=[$16], ss_cdemo_sk=[$17], ss_hdemo_sk=[$18], ss_addr_sk=[$19], ss_store_sk=[$20], ss_promo_sk=[$21], ss_ticket_number=[$22], ss_wholesale_cost=[$23], ss_list_price=[$24], ss_coupon_amt=[$25], i_item_sk=[$26], i_product_name=[$27], d_date_sk=[$28], $f0=[$29])
                   HiveJoin(condition=[AND(=($15, $0), =($22, $1))], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(sr_item_sk=[$2], sr_ticket_number=[$9])
                       HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($9))])
@@ -399,40 +398,39 @@ HiveProject(product_name=[$0], store_name=[$1], store_zip=[$2], b_street_number=
                         HiveProject(s_store_sk=[$0], s_store_name=[$5], s_zip=[$25])
                           HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($5), IS NOT NULL($25))])
                             HiveTableScan(table=[[default, store]], table:alias=[store])
-                        HiveJoin(condition=[=($5, $22)], joinType=[inner], algorithm=[none], cost=[not available])
-                          HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                            HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-                              HiveProject(hd_demo_sk=[$0], hd_income_band_sk=[$1])
-                                HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
-                                  HiveTableScan(table=[[default, household_demographics]], table:alias=[hd1])
-                              HiveProject(ib_income_band_sk=[$0])
+                        HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                          HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+                            HiveProject(hd_demo_sk=[$0], hd_income_band_sk=[$1])
+                              HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
+                                HiveTableScan(table=[[default, household_demographics]], table:alias=[hd1])
+                            HiveProject(ib_income_band_sk=[$0])
+                              HiveFilter(condition=[IS NOT NULL($0)])
+                                HiveTableScan(table=[[default, income_band]], table:alias=[ib1])
+                          HiveProject(p_promo_sk=[$0], ss_sold_date_sk=[$1], ss_item_sk=[$2], ss_customer_sk=[$3], ss_cdemo_sk=[$4], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_promo_sk=[$8], ss_ticket_number=[$9], ss_wholesale_cost=[$10], ss_list_price=[$11], ss_coupon_amt=[$12], i_item_sk=[$13], i_product_name=[$14], d_date_sk=[$15], $f0=[$16])
+                            HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                              HiveProject(p_promo_sk=[$0])
                                 HiveFilter(condition=[IS NOT NULL($0)])
-                                  HiveTableScan(table=[[default, income_band]], table:alias=[ib1])
-                            HiveProject(p_promo_sk=[$0], ss_sold_date_sk=[$1], ss_item_sk=[$2], ss_customer_sk=[$3], ss_cdemo_sk=[$4], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_promo_sk=[$8], ss_ticket_number=[$9], ss_wholesale_cost=[$10], ss_list_price=[$11], ss_coupon_amt=[$12], i_item_sk=[$13], i_current_price=[$14], i_color=[$15], i_product_name=[$16], d_date_sk=[$17], d_year=[$18])
-                              HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                                HiveProject(p_promo_sk=[$0])
-                                  HiveFilter(condition=[IS NOT NULL($0)])
-                                    HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
-                                HiveJoin(condition=[=($0, $16)], joinType=[inner], algorithm=[none], cost=[not available])
+                                  HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
+                              HiveJoin(condition=[=($1, $15)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveJoin(condition=[=($0, $14)], joinType=[inner], algorithm=[none], cost=[not available])
                                   HiveJoin(condition=[=($1, $12)], joinType=[inner], algorithm=[none], cost=[not available])
                                     HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_cdemo_sk=[$4], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_promo_sk=[$8], ss_ticket_number=[$9], ss_wholesale_cost=[$11], ss_list_price=[$12], ss_coupon_amt=[$19])
                                       HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($9), IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($3), IS NOT NULL($4), IS NOT NULL($8), IS NOT NULL($5), IS NOT NULL($6))])
                                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                    HiveProject(i_item_sk=[$0], i_current_price=[$5], i_color=[$17], i_product_name=[$21])
+                                    HiveProject(i_item_sk=[$0], i_product_name=[$21])
                                       HiveFilter(condition=[AND(IN($17, _UTF-16LE'maroon', _UTF-16LE'burnished', _UTF-16LE'dim', _UTF-16LE'steel', _UTF-16LE'navajo', _UTF-16LE'chocolate'), BETWEEN(false, $5, 35, 45), BETWEEN(false, $5, 36, 50), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                                  HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+                                  HiveProject(d_date_sk=[$0])
                                     HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
                                       HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
-                          HiveProject($f0=[$0], $f1=[$1], $f2=[$2])
-                            HiveFilter(condition=[>($1, *(2, $2))])
-                              HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)])
-                                HiveProject($f0=[$0], $f1=[$2], $f2=[+(+($5, $6), $7)])
-                                  HiveJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner], algorithm=[none], cost=[not available])
-                                    HiveProject(cs_item_sk=[$15], cs_order_number=[$17], cs_ext_list_price=[$25])
-                                      HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($17))])
-                                        HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                    HiveProject(cr_item_sk=[$2], cr_order_number=[$16], cr_refunded_cash=[$23], cr_reversed_charge=[$24], cr_store_credit=[$25])
-                                      HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($16))])
-                                        HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
+                                HiveProject($f0=[$0])
+                                  HiveFilter(condition=[>($1, *(2, $2))])
+                                    HiveAggregate(group=[{0}], agg#0=[sum($2)], agg#1=[sum($5)])
+                                      HiveJoin(condition=[AND(=($0, $3), =($1, $4))], joinType=[inner], algorithm=[none], cost=[not available])
+                                        HiveProject(cs_item_sk=[$15], cs_order_number=[$17], cs_ext_list_price=[$25])
+                                          HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($17))])
+                                            HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
+                                        HiveProject(cr_item_sk=[$2], cr_order_number=[$16], +=[+(+($23, $24), $25)])
+                                          HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($16))])
+                                            HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query65.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query65.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query65.q.out
index 1b154a4..25cb9cc 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query65.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query65.q.out
@@ -72,17 +72,17 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
         HiveFilter(condition=[IS NOT NULL($0)])
           HiveTableScan(table=[[default, item]], table:alias=[item])
       HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveJoin(condition=[AND(=($3, $0), <=($2, *(0.1, $4)))], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[AND(=($3, $0), <=($2, $4))], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(ss_store_sk=[$1], ss_item_sk=[$0], $f2=[$2])
             HiveAggregate(group=[{1, 2}], agg#0=[sum($3)])
               HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_store_sk=[$7], ss_sales_price=[$13])
                   HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($2))])
                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                HiveProject(d_date_sk=[$0], d_month_seq=[$3])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject($f0=[$0], $f1=[/($1, $2)])
+          HiveProject($f0=[$0], *=[*(0.1, /($1, $2))])
             HiveAggregate(group=[{1}], agg#0=[sum($2)], agg#1=[count($2)])
               HiveProject(ss_item_sk=[$0], ss_store_sk=[$1], $f2=[$2])
                 HiveAggregate(group=[{1, 2}], agg#0=[sum($3)])
@@ -90,7 +90,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                     HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_store_sk=[$7], ss_sales_price=[$13])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(d_date_sk=[$0], d_month_seq=[$3])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
         HiveProject(s_store_sk=[$0], s_store_name=[$5])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query66.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query66.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query66.q.out
index d97f351..e2409a9 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query66.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query66.q.out
@@ -463,43 +463,43 @@ HiveProject(w_warehouse_name=[$0], w_warehouse_sq_ft=[$1], w_city=[$2], w_county
           HiveUnion(all=[true])
             HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7], $f8=[$8], $f9=[$9], $f10=[$10], $f11=[$11], $f12=[$12], $f13=[$13], $f14=[$14], $f15=[$15], $f16=[$16], $f17=[$17], $f18=[$18], $f19=[$19], $f20=[$20], $f21=[$21], $f22=[$22], $f23=[$23], $f24=[$24], $f25=[$25], $f26=[$26], $f27=[$27], $f28=[$28], $f29=[$29])
               HiveAggregate(group=[{0, 1, 2, 3, 4, 5}], agg#0=[sum($6)], agg#1=[sum($7)], agg#2=[sum($8)], agg#3=[sum($9)], agg#4=[sum($10)], agg#5=[sum($11)], agg#6=[sum($12)], agg#7=[sum($13)], agg#8=[sum($14)], agg#9=[sum($15)], agg#10=[sum($16)], agg#11=[sum($17)], agg#12=[sum($18)], agg#13=[sum($19)], agg#14=[sum($20)], agg#15=[sum($21)], agg#16=[sum($22)], agg#17=[sum($23)], agg#18=[sum($24)], agg#19=[sum($25)], agg#20=[sum($26)], agg#21=[sum($27)], agg#22=[sum($28)], agg#23=[sum($29)])
-                HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f7=[CASE(=($18, 1), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f8=[CASE(=($18, 2), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f9=[CASE(=($18, 3), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f10=[CASE(=($18, 4), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f11=[CASE(=($18, 5), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f12=[CASE(=($18, 6), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f13=[CASE(=($18, 7), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f14=[CASE(=($18, 8), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f15=[CASE(=($18, 9), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f16=[CASE(=($18, 10), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f17=[CASE(=($18, 11), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f18=[CASE(=($18, 12), *($12, CAST($11):DECIMAL(10, 0)), 0)], $f19=[CASE(=($18, 1), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f20=[CASE(=($18, 2), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f21=[CASE(=($18, 3), *($13, CAST($11):DECIMAL(10, 0)),
  0)], $f22=[CASE(=($18, 4), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f23=[CASE(=($18, 5), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f24=[CASE(=($18, 6), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f25=[CASE(=($18, 7), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f26=[CASE(=($18, 8), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f27=[CASE(=($18, 9), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f28=[CASE(=($18, 10), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f29=[CASE(=($18, 11), *($13, CAST($11):DECIMAL(10, 0)), 0)], $f30=[CASE(=($18, 12), *($13, CAST($11):DECIMAL(10, 0)), 0)])
+                HiveProject($f0=[$1], $f1=[$2], $f2=[$3], $f3=[$4], $f4=[$5], $f5=[$6], $f7=[CASE($15, $11, 0)], $f8=[CASE($16, $11, 0)], $f9=[CASE($17, $11, 0)], $f10=[CASE($18, $11, 0)], $f11=[CASE($19, $11, 0)], $f12=[CASE($20, $11, 0)], $f13=[CASE($21, $11, 0)], $f14=[CASE($22, $11, 0)], $f15=[CASE($23, $11, 0)], $f16=[CASE($24, $11, 0)], $f17=[CASE($25, $11, 0)], $f18=[CASE($26, $11, 0)], $f19=[CASE($15, $12, 0)], $f20=[CASE($16, $12, 0)], $f21=[CASE($17, $12, 0)], $f22=[CASE($18, $12, 0)], $f23=[CASE($19, $12, 0)], $f24=[CASE($20, $12, 0)], $f25=[CASE($21, $12, 0)], $f26=[CASE($22, $12, 0)], $f27=[CASE($23, $12, 0)], $f28=[CASE($24, $12, 0)], $f29=[CASE($25, $12, 0)], $f30=[CASE($26, $12, 0)])
                   HiveJoin(condition=[=($10, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(w_warehouse_sk=[$0], w_warehouse_name=[$2], w_warehouse_sq_ft=[$3], w_city=[$8], w_county=[$9], w_state=[$10], w_country=[$12])
                       HiveFilter(condition=[IS NOT NULL($0)])
                         HiveTableScan(table=[[default, warehouse]], table:alias=[warehouse])
-                    HiveJoin(condition=[=($2, $12)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                        HiveJoin(condition=[=($1, $7)], joinType=[inner], algorithm=[none], cost=[not available])
-                          HiveProject(ws_sold_date_sk=[$0], ws_sold_time_sk=[$1], ws_ship_mode_sk=[$14], ws_warehouse_sk=[$15], ws_quantity=[$18], ws_sales_price=[$21], ws_net_paid_inc_tax=[$30])
+                    HiveJoin(condition=[=($2, $20)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveJoin(condition=[=($0, $7)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+                          HiveProject(ws_sold_date_sk=[$0], ws_sold_time_sk=[$1], ws_ship_mode_sk=[$14], ws_warehouse_sk=[$15], *=[*($21, CAST($18):DECIMAL(10, 0))], *5=[*($30, CAST($18):DECIMAL(10, 0))])
                             HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0), IS NOT NULL($1), IS NOT NULL($14))])
                               HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                          HiveProject(t_time_sk=[$0], t_time=[$2])
+                          HiveProject(t_time_sk=[$0])
                             HiveFilter(condition=[AND(BETWEEN(false, $2, 49530, 78330), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-                        HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER], d_moy=[$8])
+                        HiveProject(d_date_sk=[$0], ==[=($8, 1)], =2=[=($8, 2)], =3=[=($8, 3)], =4=[=($8, 4)], =5=[=($8, 5)], =6=[=($8, 6)], =7=[=($8, 7)], =8=[=($8, 8)], =9=[=($8, 9)], =10=[=($8, 10)], =11=[=($8, 11)], =12=[=($8, 12)])
                           HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                      HiveProject(sm_ship_mode_sk=[$0], sm_carrier=[$4])
+                      HiveProject(sm_ship_mode_sk=[$0])
                         HiveFilter(condition=[AND(IN($4, _UTF-16LE'DIAMOND', _UTF-16LE'AIRBORNE'), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, ship_mode]], table:alias=[ship_mode])
             HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7], $f8=[$8], $f9=[$9], $f10=[$10], $f11=[$11], $f12=[$12], $f13=[$13], $f14=[$14], $f15=[$15], $f16=[$16], $f17=[$17], $f18=[$18], $f19=[$19], $f20=[$20], $f21=[$21], $f22=[$22], $f23=[$23], $f24=[$24], $f25=[$25], $f26=[$26], $f27=[$27], $f28=[$28], $f29=[$29])
               HiveAggregate(group=[{0, 1, 2, 3, 4, 5}], agg#0=[sum($6)], agg#1=[sum($7)], agg#2=[sum($8)], agg#3=[sum($9)], agg#4=[sum($10)], agg#5=[sum($11)], agg#6=[sum($12)], agg#7=[sum($13)], agg#8=[sum($14)], agg#9=[sum($15)], agg#10=[sum($16)], agg#11=[sum($17)], agg#12=[sum($18)], agg#13=[sum($19)], agg#14=[sum($20)], agg#15=[sum($21)], agg#16=[sum($22)], agg#17=[sum($23)], agg#18=[sum($24)], agg#19=[sum($25)], agg#20=[sum($26)], agg#21=[sum($27)], agg#22=[sum($28)], agg#23=[sum($29)])
-                HiveProject($f0=[$15], $f1=[$16], $f2=[$17], $f3=[$18], $f4=[$19], $f5=[$20], $f7=[CASE(=($11, 1), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f8=[CASE(=($11, 2), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f9=[CASE(=($11, 3), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f10=[CASE(=($11, 4), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f11=[CASE(=($11, 5), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f12=[CASE(=($11, 6), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f13=[CASE(=($11, 7), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f14=[CASE(=($11, 8), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f15=[CASE(=($11, 9), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f16=[CASE(=($11, 10), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f17=[CASE(=($11, 11), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f18=[CASE(=($11, 12), *($5, CAST($4):DECIMAL(10, 0)), 0)], $f19=[CASE(=($11, 1), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f20=[CASE(=($11, 2), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f21=[CASE(=($11, 3), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f22=[CASE(=($11, 
 4), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f23=[CASE(=($11, 5), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f24=[CASE(=($11, 6), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f25=[CASE(=($11, 7), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f26=[CASE(=($11, 8), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f27=[CASE(=($11, 9), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f28=[CASE(=($11, 10), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f29=[CASE(=($11, 11), *($6, CAST($4):DECIMAL(10, 0)), 0)], $f30=[CASE(=($11, 12), *($6, CAST($4):DECIMAL(10, 0)), 0)])
-                  HiveJoin(condition=[=($3, $14)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveJoin(condition=[=($2, $12)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                        HiveJoin(condition=[=($1, $7)], joinType=[inner], algorithm=[none], cost=[not available])
-                          HiveProject(cs_sold_date_sk=[$0], cs_sold_time_sk=[$1], cs_ship_mode_sk=[$13], cs_warehouse_sk=[$14], cs_quantity=[$18], cs_ext_sales_price=[$23], cs_net_paid_inc_ship_tax=[$32])
+                HiveProject($f0=[$22], $f1=[$23], $f2=[$24], $f3=[$25], $f4=[$26], $f5=[$27], $f7=[CASE($8, $4, 0)], $f8=[CASE($9, $4, 0)], $f9=[CASE($10, $4, 0)], $f10=[CASE($11, $4, 0)], $f11=[CASE($12, $4, 0)], $f12=[CASE($13, $4, 0)], $f13=[CASE($14, $4, 0)], $f14=[CASE($15, $4, 0)], $f15=[CASE($16, $4, 0)], $f16=[CASE($17, $4, 0)], $f17=[CASE($18, $4, 0)], $f18=[CASE($19, $4, 0)], $f19=[CASE($8, $5, 0)], $f20=[CASE($9, $5, 0)], $f21=[CASE($10, $5, 0)], $f22=[CASE($11, $5, 0)], $f23=[CASE($12, $5, 0)], $f24=[CASE($13, $5, 0)], $f25=[CASE($14, $5, 0)], $f26=[CASE($15, $5, 0)], $f27=[CASE($16, $5, 0)], $f28=[CASE($17, $5, 0)], $f29=[CASE($18, $5, 0)], $f30=[CASE($19, $5, 0)])
+                  HiveJoin(condition=[=($3, $21)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveJoin(condition=[=($2, $20)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveJoin(condition=[=($0, $7)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+                          HiveProject(cs_sold_date_sk=[$0], cs_sold_time_sk=[$1], cs_ship_mode_sk=[$13], cs_warehouse_sk=[$14], *=[*($23, CAST($18):DECIMAL(10, 0))], *5=[*($32, CAST($18):DECIMAL(10, 0))])
                             HiveFilter(condition=[AND(IS NOT NULL($14), IS NOT NULL($0), IS NOT NULL($1), IS NOT NULL($13))])
                               HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                          HiveProject(t_time_sk=[$0], t_time=[$2])
+                          HiveProject(t_time_sk=[$0])
                             HiveFilter(condition=[AND(BETWEEN(false, $2, 49530, 78330), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-                        HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER], d_moy=[$8])
+                        HiveProject(d_date_sk=[$0], ==[=($8, 1)], =2=[=($8, 2)], =3=[=($8, 3)], =4=[=($8, 4)], =5=[=($8, 5)], =6=[=($8, 6)], =7=[=($8, 7)], =8=[=($8, 8)], =9=[=($8, 9)], =10=[=($8, 10)], =11=[=($8, 11)], =12=[=($8, 12)])
                           HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                      HiveProject(sm_ship_mode_sk=[$0], sm_carrier=[$4])
+                      HiveProject(sm_ship_mode_sk=[$0])
                         HiveFilter(condition=[AND(IN($4, _UTF-16LE'DIAMOND', _UTF-16LE'AIRBORNE'), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, ship_mode]], table:alias=[ship_mode])
                     HiveProject(w_warehouse_sk=[$0], w_warehouse_name=[$2], w_warehouse_sq_ft=[$3], w_city=[$8], w_county=[$9], w_state=[$10], w_country=[$12])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query68.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query68.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query68.q.out
index cd71cda..f14338c 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query68.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query68.q.out
@@ -111,19 +111,19 @@ HiveSortLimit(sort0=[$0], sort1=[$4], dir0=[ASC], dir1=[ASC], fetch=[100])
             HiveProject(ca_address_sk=[$0], ca_city=[$6])
               HiveFilter(condition=[IS NOT NULL($0)])
                 HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-            HiveJoin(condition=[=($2, $14)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($4, $12)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($2, $11)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($4, $10)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_ticket_number=[$9], ss_ext_sales_price=[$15], ss_ext_list_price=[$17], ss_ext_tax=[$18])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($5), IS NOT NULL($6), IS NOT NULL($3))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[$6], d_dom=[$9])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(IN($6, 1998, 1999, 2000), BETWEEN(false, $9, 1, 2), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                HiveProject(s_store_sk=[$0], s_city=[$22])
+                HiveProject(s_store_sk=[$0])
                   HiveFilter(condition=[AND(IN($22, _UTF-16LE'Cedar Grove', _UTF-16LE'Wildwood'), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store]], table:alias=[store])
-              HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+              HiveProject(hd_demo_sk=[$0])
                 HiveFilter(condition=[AND(OR(=($3, 2), =($4, 1)), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query69.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query69.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query69.q.out
index 9089fc8..0cc24d3 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query69.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query69.q.out
@@ -132,7 +132,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$4], sort4=[$6], dir0=[
                       HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3])
                         HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[$8])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), BETWEEN(false, $8, 1, 3), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject(ws_bill_customer_sk0=[$0], $f1=[true])
@@ -141,7 +141,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$4], sort4=[$6], dir0=[
                       HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4])
                         HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                      HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[$8])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(=($6, 1999), BETWEEN(false, $8, 1, 3), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(cs_ship_customer_sk0=[$0], $f1=[true])
@@ -150,7 +150,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$4], sort4=[$6], dir0=[
                 HiveProject(cs_sold_date_sk=[$0], cs_ship_customer_sk=[$7])
                   HiveFilter(condition=[AND(IS NOT NULL($7), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[$8])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(=($6, 1999), BETWEEN(false, $8, 1, 3), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query7.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query7.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query7.q.out
index 29415ca..d4c3ac6 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query7.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query7.q.out
@@ -58,19 +58,19 @@ HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
         HiveProject(i_item_sk=[$0], i_item_id=[$1])
           HiveFilter(condition=[IS NOT NULL($0)])
             HiveTableScan(table=[[default, item]], table:alias=[item])
-        HiveJoin(condition=[=($3, $14)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveJoin(condition=[=($0, $12)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[=($3, $10)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($2, $8)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_cdemo_sk=[$4], ss_promo_sk=[$8], ss_quantity=[$10], ss_list_price=[$12], ss_sales_price=[$13], ss_coupon_amt=[$19])
                 HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0), IS NOT NULL($2), IS NOT NULL($8))])
                   HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-              HiveProject(cd_demo_sk=[$0], cd_gender=[CAST(_UTF-16LE'F'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], cd_marital_status=[CAST(_UTF-16LE'W'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], cd_education_status=[CAST(_UTF-16LE'Primary'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+              HiveProject(cd_demo_sk=[$0])
                 HiveFilter(condition=[AND(=($1, _UTF-16LE'F'), =($2, _UTF-16LE'W'), =($3, _UTF-16LE'Primary'), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, customer_demographics]], table:alias=[customer_demographics])
-            HiveProject(d_date_sk=[$0], d_year=[CAST(1998):INTEGER])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(=($6, 1998), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(p_promo_sk=[$0], p_channel_email=[$9], p_channel_event=[$14])
+          HiveProject(p_promo_sk=[$0])
             HiveFilter(condition=[AND(OR(=($9, _UTF-16LE'N'), =($14, _UTF-16LE'N')), IS NOT NULL($0))])
               HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query71.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query71.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query71.q.out
index 4e52893..20444c6 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query71.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query71.q.out
@@ -92,9 +92,9 @@ CBO PLAN:
 HiveProject(brand_id=[$0], brand=[$1], t_hour=[$2], t_minute=[$3], ext_price=[$4])
   HiveSortLimit(sort0=[$4], sort1=[$5], dir0=[DESC-nulls-last], dir1=[ASC])
     HiveProject(brand_id=[$2], brand=[$3], t_hour=[$0], t_minute=[$1], ext_price=[$4], (tok_table_or_col i_brand_id)=[$2])
-      HiveAggregate(group=[{1, 2, 8, 9}], agg#0=[sum($4)])
-        HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveProject(t_time_sk=[$0], t_hour=[$3], t_minute=[$4], t_meal_time=[$9])
+      HiveAggregate(group=[{1, 2, 7, 8}], agg#0=[sum($3)])
+        HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveProject(t_time_sk=[$0], t_hour=[$3], t_minute=[$4])
             HiveFilter(condition=[AND(IN($9, _UTF-16LE'breakfast', _UTF-16LE'dinner'), IS NOT NULL($0))])
               HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
           HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -105,7 +105,7 @@ HiveProject(brand_id=[$0], brand=[$1], t_hour=[$2], t_minute=[$3], ext_price=[$4
                     HiveProject(ws_sold_date_sk=[$0], ws_sold_time_sk=[$1], ws_item_sk=[$3], ws_ext_sales_price=[$23])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($3), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER], d_moy=[CAST(12):INTEGER])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(=($8, 12), =($6, 2001), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject(ext_price=[$3], sold_item_sk=[$2], time_sk=[$1])
@@ -113,7 +113,7 @@ HiveProject(brand_id=[$0], brand=[$1], t_hour=[$2], t_minute=[$3], ext_price=[$4
                     HiveProject(cs_sold_date_sk=[$0], cs_sold_time_sk=[$1], cs_item_sk=[$15], cs_ext_sales_price=[$23])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($15), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER], d_moy=[CAST(12):INTEGER])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(=($8, 12), =($6, 2001), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject(ext_price=[$3], sold_item_sk=[$2], time_sk=[$1])
@@ -121,10 +121,10 @@ HiveProject(brand_id=[$0], brand=[$1], t_hour=[$2], t_minute=[$3], ext_price=[$4
                     HiveProject(ss_sold_date_sk=[$0], ss_sold_time_sk=[$1], ss_item_sk=[$2], ss_ext_sales_price=[$15])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2), IS NOT NULL($1))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER], d_moy=[CAST(12):INTEGER])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(=($8, 12), =($6, 2001), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-            HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8], i_manager_id=[CAST(1):INTEGER])
+            HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8])
               HiveFilter(condition=[AND(=($20, 1), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, item]], table:alias=[item])
 


[27/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query4.q.out b/ql/src/test/results/clientpositive/perf/spark/query4.q.out
index 67e8b4f..93e83ef 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query4.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query4.q.out
@@ -237,13 +237,13 @@ STAGE PLANS:
         Reducer 10 <- Map 13 (PARTITION-LEVEL SORT, 398), Map 9 (PARTITION-LEVEL SORT, 398)
         Reducer 11 <- Map 14 (PARTITION-LEVEL SORT, 975), Reducer 10 (PARTITION-LEVEL SORT, 975)
         Reducer 12 <- Reducer 11 (GROUP, 481)
-        Reducer 16 <- Map 15 (PARTITION-LEVEL SORT, 306), Map 19 (PARTITION-LEVEL SORT, 306)
-        Reducer 17 <- Map 20 (PARTITION-LEVEL SORT, 873), Reducer 16 (PARTITION-LEVEL SORT, 873)
-        Reducer 18 <- Reducer 17 (GROUP, 369)
+        Reducer 16 <- Map 15 (PARTITION-LEVEL SORT, 154), Map 19 (PARTITION-LEVEL SORT, 154)
+        Reducer 17 <- Map 20 (PARTITION-LEVEL SORT, 706), Reducer 16 (PARTITION-LEVEL SORT, 706)
+        Reducer 18 <- Reducer 17 (GROUP, 186)
         Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 154), Map 7 (PARTITION-LEVEL SORT, 154)
-        Reducer 22 <- Map 21 (PARTITION-LEVEL SORT, 154), Map 25 (PARTITION-LEVEL SORT, 154)
-        Reducer 23 <- Map 26 (PARTITION-LEVEL SORT, 706), Reducer 22 (PARTITION-LEVEL SORT, 706)
-        Reducer 24 <- Reducer 23 (GROUP, 186)
+        Reducer 22 <- Map 21 (PARTITION-LEVEL SORT, 306), Map 25 (PARTITION-LEVEL SORT, 306)
+        Reducer 23 <- Map 26 (PARTITION-LEVEL SORT, 873), Reducer 22 (PARTITION-LEVEL SORT, 873)
+        Reducer 24 <- Reducer 23 (GROUP, 369)
         Reducer 28 <- Map 27 (PARTITION-LEVEL SORT, 306), Map 31 (PARTITION-LEVEL SORT, 306)
         Reducer 29 <- Map 32 (PARTITION-LEVEL SORT, 873), Reducer 28 (PARTITION-LEVEL SORT, 873)
         Reducer 3 <- Map 8 (PARTITION-LEVEL SORT, 706), Reducer 2 (PARTITION-LEVEL SORT, 706)
@@ -266,16 +266,15 @@ STAGE PLANS:
                     predicate: (ws_bill_customer_sk is not null and ws_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_bill_customer_sk (type: int), ws_ext_discount_amt (type: decimal(7,2)), ws_ext_sales_price (type: decimal(7,2)), ws_ext_wholesale_cost (type: decimal(7,2)), ws_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      expressions: ws_sold_date_sk (type: int), ws_bill_customer_sk (type: int), ((((ws_ext_list_price - ws_ext_wholesale_cost) - ws_ext_discount_amt) + ws_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
-            Execution mode: vectorized
+                        value expressions: _col1 (type: int), _col2 (type: decimal(14,6))
         Map 13 
             Map Operator Tree:
                 TableScan
@@ -318,23 +317,22 @@ STAGE PLANS:
         Map 15 
             Map Operator Tree:
                 TableScan
-                  alias: catalog_sales
-                  filterExpr: (cs_bill_customer_sk is not null and cs_sold_date_sk is not null) (type: boolean)
-                  Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
+                  alias: web_sales
+                  filterExpr: (ws_bill_customer_sk is not null and ws_sold_date_sk is not null) (type: boolean)
+                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (cs_bill_customer_sk is not null and cs_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (ws_bill_customer_sk is not null and ws_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), cs_bill_customer_sk (type: int), cs_ext_discount_amt (type: decimal(7,2)), cs_ext_sales_price (type: decimal(7,2)), cs_ext_wholesale_cost (type: decimal(7,2)), cs_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                      Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
+                      expressions: ws_sold_date_sk (type: int), ws_bill_customer_sk (type: int), ((((ws_ext_list_price - ws_ext_wholesale_cost) - ws_ext_discount_amt) + ws_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
-            Execution mode: vectorized
+                        Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: decimal(14,6))
         Map 19 
             Map Operator Tree:
                 TableScan
@@ -377,23 +375,22 @@ STAGE PLANS:
         Map 21 
             Map Operator Tree:
                 TableScan
-                  alias: web_sales
-                  filterExpr: (ws_bill_customer_sk is not null and ws_sold_date_sk is not null) (type: boolean)
-                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                  alias: catalog_sales
+                  filterExpr: (cs_bill_customer_sk is not null and cs_sold_date_sk is not null) (type: boolean)
+                  Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ws_bill_customer_sk is not null and ws_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (cs_bill_customer_sk is not null and cs_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_bill_customer_sk (type: int), ws_ext_discount_amt (type: decimal(7,2)), ws_ext_sales_price (type: decimal(7,2)), ws_ext_wholesale_cost (type: decimal(7,2)), ws_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                      Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                      expressions: cs_sold_date_sk (type: int), cs_bill_customer_sk (type: int), ((((cs_ext_list_price - cs_ext_wholesale_cost) - cs_ext_discount_amt) + cs_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
-            Execution mode: vectorized
+                        Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: decimal(14,6))
         Map 25 
             Map Operator Tree:
                 TableScan
@@ -443,16 +440,15 @@ STAGE PLANS:
                     predicate: (cs_bill_customer_sk is not null and cs_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), cs_bill_customer_sk (type: int), cs_ext_discount_amt (type: decimal(7,2)), cs_ext_sales_price (type: decimal(7,2)), cs_ext_wholesale_cost (type: decimal(7,2)), cs_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      expressions: cs_sold_date_sk (type: int), cs_bill_customer_sk (type: int), ((((cs_ext_list_price - cs_ext_wholesale_cost) - cs_ext_discount_amt) + cs_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
-            Execution mode: vectorized
+                        value expressions: _col1 (type: int), _col2 (type: decimal(14,6))
         Map 31 
             Map Operator Tree:
                 TableScan
@@ -502,16 +498,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ss_ext_discount_amt (type: decimal(7,2)), ss_ext_sales_price (type: decimal(7,2)), ss_ext_wholesale_cost (type: decimal(7,2)), ss_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ((((ss_ext_list_price - ss_ext_wholesale_cost) - ss_ext_discount_amt) + ss_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
-            Execution mode: vectorized
+                        value expressions: _col1 (type: int), _col2 (type: decimal(14,6))
         Map 37 
             Map Operator Tree:
                 TableScan
@@ -600,16 +595,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ss_ext_discount_amt (type: decimal(7,2)), ss_ext_sales_price (type: decimal(7,2)), ss_ext_wholesale_cost (type: decimal(7,2)), ss_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ((((ss_ext_list_price - ss_ext_wholesale_cost) - ss_ext_discount_amt) + ss_ext_sales_price) / 2) (type: decimal(14,6))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
-            Execution mode: vectorized
+                        value expressions: _col1 (type: int), _col2 (type: decimal(14,6))
         Reducer 10 
             Reduce Operator Tree:
               Join Operator
@@ -618,14 +612,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 11 
             Reduce Operator Tree:
               Join Operator
@@ -634,24 +628,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, _col11, _col12, _col13, _col14, _col15
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 2) (type: decimal(14,6))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 12 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -686,14 +676,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
-                Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col1, _col2
+                Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
-                  Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 17 
             Reduce Operator Tree:
               Join Operator
@@ -702,24 +692,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, _col11, _col12, _col13, _col14, _col15
-                Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 2) (type: decimal(14,6))
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
+                Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                  Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                    Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 18 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -728,24 +714,24 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string), KEY._col3 (type: string), KEY._col4 (type: string), KEY._col5 (type: string), KEY._col6 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: string), _col7 (type: decimal(24,6))
                   outputColumnNames: _col0, _col7
-                  Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: (_col7 > 0) (type: boolean)
-                    Statistics: Num rows: 58077952 Data size: 7864921389 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: string), _col7 (type: decimal(24,6))
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 58077952 Data size: 7864921389 Basic stats: COMPLETE Column stats: NONE
+                      expressions: _col0 (type: string), _col7 (type: decimal(24,6)), _col7 is not null (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 58077952 Data size: 7864921389 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: decimal(24,6))
+                        Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: decimal(24,6)), _col2 (type: boolean)
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -754,14 +740,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 22 
             Reduce Operator Tree:
               Join Operator
@@ -770,14 +756,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
-                Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col1, _col2
+                Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
-                  Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 23 
             Reduce Operator Tree:
               Join Operator
@@ -786,24 +772,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, _col11, _col12, _col13, _col14, _col15
-                Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 2) (type: decimal(14,6))
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
+                Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                    Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                  Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 24 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -812,24 +794,24 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string), KEY._col1 (type: string), KEY._col2 (type: string), KEY._col3 (type: string), KEY._col4 (type: string), KEY._col5 (type: string), KEY._col6 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: string), _col7 (type: decimal(24,6))
                   outputColumnNames: _col0, _col7
-                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: (_col7 > 0) (type: boolean)
-                    Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 58077952 Data size: 7864921389 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: string), _col7 (type: decimal(24,6))
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
+                      expressions: _col0 (type: string), _col7 (type: decimal(24,6)), _col7 is not null (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 58077952 Data size: 7864921389 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: decimal(24,6))
+                        Statistics: Num rows: 58077952 Data size: 7864921389 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: decimal(24,6)), _col2 (type: boolean)
         Reducer 28 
             Reduce Operator Tree:
               Join Operator
@@ -838,14 +820,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 29 
             Reduce Operator Tree:
               Join Operator
@@ -854,24 +836,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, _col11, _col12, _col13, _col14, _col15
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 2) (type: decimal(14,6))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -880,24 +858,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, _col11, _col12, _col13, _col14, _col15
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 2) (type: decimal(14,6))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 30 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -925,14 +899,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2)), _col4 (type: decimal(7,2)), _col5 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(14,6))
         Reducer 35 
             Reduce Operator Tree:
               Join Operator
@@ -941,24 +915,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9, _col10, _col11, _col12, _col13, _col14, _col15
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: string), ((((_col5 - _col4) - _col2) + _col3) / 2) (type: decimal(14,6))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(24,6))
+                    value expressions: _col7 (type: decimal(24,6))
         Reducer 36 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -1013,13 +983,13 @@ STAGE PLANS:
                   3 _col0 (type: string)
                   4 _col0 (type: string)
                   5 _col0 (type: string)
-                outputColumnNames: _col1, _col3, _col5, _col7, _col9, _col11, _col12
+                outputColumnNames: _col1, _col3, _col5, _col6, _col8, _col9, _col11, _col13, _col14
                 Statistics: Num rows: 1916625598 Data size: 169085266687 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col5 is not null) THEN (((_col9 / _col5) > (_col12 / _col3))) ELSE ((null > (_col12 / _col3))) END) ELSE (CASE WHEN (_col5 is not null) THEN (((_col9 / _col5) > null)) ELSE (null) END) END and CASE WHEN (_col7 is not null) THEN (CASE WHEN (_col5 is not null) THEN (((_col9 / _col5) > (_col1 / _col7))) ELSE ((null > (_col1 / _col7))) END) ELSE (CASE WHEN (_col5 is not null) THEN (((_col9 / _col5) > null)) ELSE (null) END) END) (type: boolean)
+                  predicate: (CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col9) THEN (((_col11 / _col8) > (_col14 / _col3))) ELSE ((null > (_col14 / _col3))) END) ELSE (CASE WHEN (_col9) THEN (((_col11 / _col8) > null)) ELSE (null) END) END and CASE WHEN (_col6) THEN (CASE WHEN (_col9) THEN (((_col11 / _col8) > (_col1 / _col5))) ELSE ((null > (_col1 / _col5))) END) ELSE (CASE WHEN (_col9) THEN (((_col11 / _col8) > null)) ELSE (null) END) END) (type: boolean)
                   Statistics: Num rows: 479156399 Data size: 42271316627 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col11 (type: string)
+                    expressions: _col13 (type: string)
                     outputColumnNames: _col0
                     Statistics: Num rows: 479156399 Data size: 42271316627 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query40.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query40.q.out b/ql/src/test/results/clientpositive/perf/spark/query40.q.out
index 8508af5..1364cf1 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query40.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query40.q.out
@@ -110,8 +110,8 @@ STAGE PLANS:
                     predicate: (CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-03-09 00:00:00' AND TIMESTAMP'1998-05-08 00:00:00' and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 8116 Data size: 9081804 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_date (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: d_date_sk (type: int), (CAST( d_date AS DATE) < DATE'1998-04-08') (type: boolean), (CAST( d_date AS DATE) >= DATE'1998-04-08') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 8116 Data size: 9081804 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -208,7 +208,7 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col1, _col2, _col4, _col7, _col9
+                  outputColumnNames: _col1, _col2, _col4, _col7, _col9, _col10
                   input vertices:
                     1 Map 7
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
@@ -217,7 +217,7 @@ STAGE PLANS:
                     sort order: +
                     Map-reduce partition columns: _col2 (type: int)
                     Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: int), _col4 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col9 (type: string)
+                    value expressions: _col1 (type: int), _col4 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col9 (type: boolean), _col10 (type: boolean)
         Reducer 3 
             Local Work:
               Map Reduce Local Work
@@ -228,7 +228,7 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col4, _col7, _col9, _col11
+                outputColumnNames: _col1, _col4, _col7, _col9, _col10, _col12
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -236,12 +236,12 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col4, _col7, _col9, _col11, _col14
+                  outputColumnNames: _col4, _col7, _col9, _col10, _col12, _col14
                   input vertices:
                     1 Map 9
                   Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col14 (type: string), _col11 (type: string), CASE WHEN ((CAST( _col9 AS DATE) < DATE'1998-04-08')) THEN ((_col4 - CASE WHEN (_col7 is not null) THEN (_col7) ELSE (0) END)) ELSE (0) END (type: decimal(13,2)), CASE WHEN ((CAST( _col9 AS DATE) >= DATE'1998-04-08')) THEN ((_col4 - CASE WHEN (_col7 is not null) THEN (_col7) ELSE (0) END)) ELSE (0) END (type: decimal(13,2))
+                    expressions: _col14 (type: string), _col12 (type: string), CASE WHEN (_col9) THEN ((_col4 - CASE WHEN (_col7 is not null) THEN (_col7) ELSE (0) END)) ELSE (0) END (type: decimal(13,2)), CASE WHEN (_col10) THEN ((_col4 - CASE WHEN (_col7 is not null) THEN (_col7) ELSE (0) END)) ELSE (0) END (type: decimal(13,2))
                     outputColumnNames: _col0, _col1, _col2, _col3
                     Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query42.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query42.q.out b/ql/src/test/results/clientpositive/perf/spark/query42.q.out
index d6178e2..f4b4914 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query42.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query42.q.out
@@ -145,11 +145,11 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7, _col8
+                outputColumnNames: _col2, _col5, _col6
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: int), _col8 (type: string)
+                  keys: _col5 (type: int), _col6 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query43.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query43.q.out b/ql/src/test/results/clientpositive/perf/spark/query43.q.out
index f292196..6144454 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query43.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query43.q.out
@@ -111,15 +111,15 @@ STAGE PLANS:
                     predicate: ((d_year = 1998) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_day_name (type: string)
-                      outputColumnNames: _col0, _col2
+                      expressions: d_date_sk (type: int), (d_day_name = 'Sunday') (type: boolean), (d_day_name = 'Monday') (type: boolean), (d_day_name = 'Tuesday') (type: boolean), (d_day_name = 'Wednesday') (type: boolean), (d_day_name = 'Thursday') (type: boolean), (d_day_name = 'Friday') (type: boolean), (d_day_name = 'Saturday') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                       Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: string)
+                        value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean)
             Execution mode: vectorized
         Reducer 2 
             Local Work:
@@ -131,7 +131,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col5
+                outputColumnNames: _col1, _col2, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -139,12 +139,12 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col5, _col7, _col8
+                  outputColumnNames: _col2, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col12, _col13
                   input vertices:
                     1 Map 6
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col8 (type: string), _col7 (type: string), CASE WHEN ((_col5 = 'Sunday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Monday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Tuesday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Wednesday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Thursday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Friday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Saturday')) THEN (_col2) ELSE (null) END (type: decimal(7,2))
+                    expressions: _col13 (type: string), _col12 (type: string), CASE WHEN (_col4) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col5) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col6) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col7) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col8) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col9) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col10) THEN (_col2) ELSE (null) END (type: decimal(7,2))
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query46.q.out b/ql/src/test/results/clientpositive/perf/spark/query46.q.out
index 5016067..3bb29c6 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query46.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query46.q.out
@@ -343,11 +343,11 @@ STAGE PLANS:
                 keys:
                   0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col17
+                outputColumnNames: _col1, _col3, _col5, _col6, _col7, _col12
                 Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col6), sum(_col7)
-                  keys: _col1 (type: int), _col17 (type: string), _col3 (type: int), _col5 (type: int)
+                  keys: _col1 (type: int), _col12 (type: string), _col3 (type: int), _col5 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query47.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query47.q.out b/ql/src/test/results/clientpositive/perf/spark/query47.q.out
index f6a2e1b..020ee59 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query47.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query47.q.out
@@ -654,13 +654,13 @@ STAGE PLANS:
                     predicate: rank_window_0 is not null (type: boolean)
                     Statistics: Num rows: 383325119 Data size: 33817053293 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col1 (type: string), _col0 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), rank_window_0 (type: int)
+                      expressions: _col1 (type: string), _col0 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), (rank_window_0 - 1) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                       Statistics: Num rows: 383325119 Data size: 33817053293 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), (_col5 - 1) (type: int)
+                        key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: int)
                         sort order: +++++
-                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), (_col5 - 1) (type: int)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: int)
                         Statistics: Num rows: 383325119 Data size: 33817053293 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col4 (type: decimal(17,2))
         Reducer 3 
@@ -744,13 +744,13 @@ STAGE PLANS:
                     predicate: rank_window_0 is not null (type: boolean)
                     Statistics: Num rows: 383325119 Data size: 33817053293 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col1 (type: string), _col0 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), rank_window_0 (type: int)
+                      expressions: _col1 (type: string), _col0 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: decimal(17,2)), (rank_window_0 + 1) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                       Statistics: Num rows: 383325119 Data size: 33817053293 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), (_col5 + 1) (type: int)
+                        key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: int)
                         sort order: +++++
-                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), (_col5 + 1) (type: int)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: int)
                         Statistics: Num rows: 383325119 Data size: 33817053293 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col4 (type: decimal(17,2))
         Reducer 6 
@@ -760,9 +760,9 @@ STAGE PLANS:
                      Inner Join 0 to 1
                      Inner Join 1 to 2
                 keys:
-                  0 _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), (_col5 + 1) (type: int)
+                  0 _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: int)
                   1 _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col8 (type: int)
-                  2 _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), (_col5 - 1) (type: int)
+                  2 _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col5 (type: int)
                 outputColumnNames: _col4, _col6, _col10, _col11, _col12, _col13, _col19
                 Statistics: Num rows: 843315280 Data size: 74397518857 Basic stats: COMPLETE Column stats: NONE
                 Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query48.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query48.q.out b/ql/src/test/results/clientpositive/perf/spark/query48.q.out
index a775c7e..024d205 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query48.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query48.q.out
@@ -150,7 +150,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 1 
+        Map 8 
             Map Operator Tree:
                 TableScan
                   alias: store
@@ -165,8 +165,8 @@ STAGE PLANS:
                       Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col0 (type: int)
-                          1 _col3 (type: int)
+                          0 _col4 (type: int)
+                          1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -174,13 +174,32 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 3 <- Map 2 (PARTITION-LEVEL SORT, 49), Map 7 (PARTITION-LEVEL SORT, 49)
-        Reducer 4 <- Map 8 (PARTITION-LEVEL SORT, 55), Reducer 3 (PARTITION-LEVEL SORT, 55)
-        Reducer 5 <- Map 9 (PARTITION-LEVEL SORT, 218), Reducer 4 (PARTITION-LEVEL SORT, 218)
-        Reducer 6 <- Reducer 5 (GROUP, 1)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 46), Map 6 (PARTITION-LEVEL SORT, 46)
+        Reducer 3 <- Map 7 (PARTITION-LEVEL SORT, 49), Reducer 2 (PARTITION-LEVEL SORT, 49)
+        Reducer 4 <- Map 9 (PARTITION-LEVEL SORT, 218), Reducer 3 (PARTITION-LEVEL SORT, 218)
+        Reducer 5 <- Reducer 4 (GROUP, 1)
 #### A masked pattern was here ####
       Vertices:
-        Map 2 
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: customer_demographics
+                  filterExpr: ((cd_marital_status = 'M') and (cd_education_status = '4 yr Degree') and cd_demo_sk is not null) (type: boolean)
+                  Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((cd_education_status = '4 yr Degree') and (cd_marital_status = 'M') and cd_demo_sk is not null) (type: boolean)
+                    Statistics: Num rows: 465450 Data size: 179296539 Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cd_demo_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 465450 Data size: 179296539 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 465450 Data size: 179296539 Basic stats: COMPLETE Column stats: NONE
+            Execution mode: vectorized
+        Map 6 
             Map Operator Tree:
                 TableScan
                   alias: store_sales
@@ -190,28 +209,16 @@ STAGE PLANS:
                     predicate: ((ss_net_profit BETWEEN 0 AND 2000 or ss_net_profit BETWEEN 150 AND 3000 or ss_net_profit BETWEEN 50 AND 25000) and (ss_sales_price BETWEEN 100 AND 150 or ss_sales_price BETWEEN 50 AND 100 or ss_sales_price BETWEEN 150 AND 200) and ss_addr_sk is not null and ss_cdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null) (type: boolean)
                     Statistics: Num rows: 63999513 Data size: 5646055611 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_cdemo_sk (type: int), ss_addr_sk (type: int), ss_store_sk (type: int), ss_quantity (type: int), ss_net_profit (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6
+                      expressions: ss_sold_date_sk (type: int), ss_cdemo_sk (type: int), ss_addr_sk (type: int), ss_store_sk (type: int), ss_quantity (type: int), ss_net_profit BETWEEN 0 AND 2000 (type: boolean), ss_net_profit BETWEEN 150 AND 3000 (type: boolean), ss_net_profit BETWEEN 50 AND 25000 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                       Statistics: Num rows: 63999513 Data size: 5646055611 Basic stats: COMPLETE Column stats: NONE
-                      Map Join Operator
-                        condition map:
-                             Inner Join 0 to 1
-                        keys:
-                          0 _col0 (type: int)
-                          1 _col3 (type: int)
-                        outputColumnNames: _col1, _col2, _col3, _col5, _col7
-                        input vertices:
-                          0 Map 1
-                        Statistics: Num rows: 70399465 Data size: 6210661306 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col1 (type: int)
-                          sort order: +
-                          Map-reduce partition columns: _col1 (type: int)
-                          Statistics: Num rows: 70399465 Data size: 6210661306 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col2 (type: int), _col3 (type: int), _col5 (type: int), _col7 (type: decimal(7,2))
+                      Reduce Output Operator
+                        key expressions: _col1 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col1 (type: int)
+                        Statistics: Num rows: 63999513 Data size: 5646055611 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean)
             Execution mode: vectorized
-            Local Work:
-              Map Reduce Local Work
         Map 7 
             Map Operator Tree:
                 TableScan
@@ -231,25 +238,6 @@ STAGE PLANS:
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-        Map 8 
-            Map Operator Tree:
-                TableScan
-                  alias: customer_demographics
-                  filterExpr: ((cd_marital_status = 'M') and (cd_education_status = '4 yr Degree') and cd_demo_sk is not null) (type: boolean)
-                  Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: ((cd_education_status = '4 yr Degree') and (cd_marital_status = 'M') and cd_demo_sk is not null) (type: boolean)
-                    Statistics: Num rows: 465450 Data size: 179296539 Basic stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: cd_demo_sk (type: int)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 465450 Data size: 179296539 Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 465450 Data size: 179296539 Basic stats: COMPLETE Column stats: NONE
-            Execution mode: vectorized
         Map 9 
             Map Operator Tree:
                 TableScan
@@ -260,49 +248,61 @@ STAGE PLANS:
                     predicate: ((ca_country = 'United States') and (ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is not null) (type: boolean)
                     Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ca_address_sk (type: int), ca_state (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: ca_address_sk (type: int), (ca_state) IN ('KY', 'GA', 'NM') (type: boolean), (ca_state) IN ('MT', 'OR', 'IN') (type: boolean), (ca_state) IN ('WI', 'MO', 'WV') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
+                        value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean)
             Execution mode: vectorized
-        Reducer 3 
+        Reducer 2 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
-                  1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col5, _col7
-                Statistics: Num rows: 77439413 Data size: 6831727584 Basic stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: int)
+                  1 _col1 (type: int)
+                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, _col8
+                Statistics: Num rows: 70399465 Data size: 6210661306 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col2 (type: int)
-                  Statistics: Num rows: 77439413 Data size: 6831727584 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col5 (type: int), _col7 (type: decimal(7,2))
-        Reducer 4 
+                  Map-reduce partition columns: _col1 (type: int)
+                  Statistics: Num rows: 70399465 Data size: 6210661306 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean)
+        Reducer 3 
+            Local Work:
+              Map Reduce Local Work
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col2 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col5, _col7
-                Statistics: Num rows: 85183356 Data size: 7514900505 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col3 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col3 (type: int)
+                outputColumnNames: _col3, _col4, _col5, _col6, _col7, _col8
+                Statistics: Num rows: 77439413 Data size: 6831727584 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 _col4 (type: int)
+                    1 _col0 (type: int)
+                  outputColumnNames: _col3, _col5, _col6, _col7, _col8
+                  input vertices:
+                    1 Map 8
                   Statistics: Num rows: 85183356 Data size: 7514900505 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col5 (type: int), _col7 (type: decimal(7,2))
-        Reducer 5 
+                  Reduce Output Operator
+                    key expressions: _col3 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col3 (type: int)
+                    Statistics: Num rows: 85183356 Data size: 7514900505 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col5 (type: int), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean)
+        Reducer 4 
             Reduce Operator Tree:
               Join Operator
                 condition map:
@@ -310,15 +310,15 @@ STAGE PLANS:
                 keys:
                   0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col5, _col7, _col14
+                outputColumnNames: _col5, _col6, _col7, _col8, _col12, _col13, _col14
                 Statistics: Num rows: 93701693 Data size: 8266390734 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (((_col14) IN ('KY', 'GA', 'NM') and _col7 BETWEEN 0 AND 2000) or ((_col14) IN ('MT', 'OR', 'IN') and _col7 BETWEEN 150 AND 3000) or ((_col14) IN ('WI', 'MO', 'WV') and _col7 BETWEEN 50 AND 25000)) (type: boolean)
-                  Statistics: Num rows: 31233897 Data size: 2755463519 Basic stats: COMPLETE Column stats: NONE
+                  predicate: ((_col12 and _col6) or (_col13 and _col7) or (_col14 and _col8)) (type: boolean)
+                  Statistics: Num rows: 70276269 Data size: 6199792984 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col5 (type: int)
                     outputColumnNames: _col5
-                    Statistics: Num rows: 31233897 Data size: 2755463519 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 70276269 Data size: 6199792984 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
                       aggregations: sum(_col5)
                       mode: hash
@@ -328,7 +328,7 @@ STAGE PLANS:
                         sort order: 
                         Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: bigint)
-        Reducer 6 
+        Reducer 5 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator


[22/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query13.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query13.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query13.q.out
index ccad088..19f3039 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query13.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query13.q.out
@@ -114,28 +114,28 @@ POSTHOOK: Input: default@store_sales
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveProject($f0=[/(CAST($0):DOUBLE, $1)], $f1=[/($2, $3)], $f2=[/($4, $5)], $f3=[CAST($4):DECIMAL(17, 2)])
-  HiveAggregate(group=[{}], agg#0=[sum($16)], agg#1=[count($16)], agg#2=[sum($18)], agg#3=[count($18)], agg#4=[sum($19)], agg#5=[count($19)])
-    HiveJoin(condition=[AND(=($0, $12), OR(AND(=($1, _UTF-16LE'M'), =($2, _UTF-16LE'4 yr Degree'), BETWEEN(false, $17, 100, 150), =($7, 3)), AND(=($1, _UTF-16LE'D'), =($2, _UTF-16LE'Primary'), BETWEEN(false, $17, 50, 100), =($7, 1)), AND(=($1, _UTF-16LE'U'), =($2, _UTF-16LE'Advanced Degree'), BETWEEN(false, $17, 150, 200), =($7, 1))))], joinType=[inner], algorithm=[none], cost=[not available])
-      HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2], cd_education_status=[$3])
+  HiveAggregate(group=[{}], agg#0=[sum($21)], agg#1=[count($21)], agg#2=[sum($22)], agg#3=[count($22)], agg#4=[sum($23)], agg#5=[count($23)])
+    HiveJoin(condition=[AND(=($0, $17), OR(AND($1, $2, $27, $12), AND($3, $4, $28, $13), AND($5, $6, $29, $13)))], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveProject(cd_demo_sk=[$0], ==[=($2, _UTF-16LE'M')], =2=[=($3, _UTF-16LE'4 yr Degree')], =3=[=($2, _UTF-16LE'D')], =4=[=($3, _UTF-16LE'Primary')], =5=[=($2, _UTF-16LE'U')], =6=[=($3, _UTF-16LE'Advanced Degree')])
         HiveFilter(condition=[AND(IN($2, _UTF-16LE'M', _UTF-16LE'D', _UTF-16LE'U'), IN($3, _UTF-16LE'4 yr Degree', _UTF-16LE'Primary', _UTF-16LE'Advanced Degree'), IS NOT NULL($0))])
           HiveTableScan(table=[[default, customer_demographics]], table:alias=[customer_demographics])
-      HiveJoin(condition=[AND(=($11, $0), OR(AND(IN($1, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM'), BETWEEN(false, $17, 100, 200)), AND(IN($1, _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN'), BETWEEN(false, $17, 150, 300)), AND(IN($1, _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV'), BETWEEN(false, $17, 50, 250))))], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveProject(ca_address_sk=[$0], ca_state=[$8], ca_country=[CAST(_UTF-16LE'United States'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+      HiveJoin(condition=[AND(=($12, $0), OR(AND($1, $17), AND($2, $18), AND($3, $19)))], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject(ca_address_sk=[$0], IN=[IN($8, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM')], IN2=[IN($8, _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN')], IN3=[IN($8, _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV')])
           HiveFilter(condition=[AND(IN($8, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM', _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN', _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV'), =($10, _UTF-16LE'United States'), IS NOT NULL($0))])
             HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
         HiveJoin(condition=[=($7, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3])
+          HiveProject(hd_demo_sk=[$0], ==[=($3, 3)], =2=[=($3, 1)])
             HiveFilter(condition=[AND(IN($3, 3, 1), IS NOT NULL($0))])
               HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-          HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
-              HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
-                HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-            HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveProject(s_store_sk=[$0])
-                HiveFilter(condition=[IS NOT NULL($0)])
-                  HiveTableScan(table=[[default, store]], table:alias=[store])
-              HiveProject(ss_sold_date_sk=[$0], ss_cdemo_sk=[$4], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_quantity=[$10], ss_sales_price=[$13], ss_ext_sales_price=[$15], ss_ext_wholesale_cost=[$16], ss_net_profit=[$22])
+          HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(s_store_sk=[$0])
+              HiveFilter(condition=[IS NOT NULL($0)])
+                HiveTableScan(table=[[default, store]], table:alias=[store])
+            HiveJoin(condition=[=($1, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveProject(d_date_sk=[$0])
+                HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
+                  HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+              HiveProject(ss_sold_date_sk=[$0], ss_cdemo_sk=[$4], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_quantity=[$10], ss_ext_sales_price=[$15], ss_ext_wholesale_cost=[$16], BETWEEN=[BETWEEN(false, $22, 100, 200)], BETWEEN9=[BETWEEN(false, $22, 150, 300)], BETWEEN10=[BETWEEN(false, $22, 50, 250)], BETWEEN11=[BETWEEN(false, $13, 100, 150)], BETWEEN12=[BETWEEN(false, $13, 50, 100)], BETWEEN13=[BETWEEN(false, $13, 150, 200)])
                 HiveFilter(condition=[AND(OR(BETWEEN(false, $13, 100, 150), BETWEEN(false, $13, 50, 100), BETWEEN(false, $13, 150, 200)), OR(BETWEEN(false, $22, 100, 200), BETWEEN(false, $22, 150, 300), BETWEEN(false, $22, 50, 250)), IS NOT NULL($7), IS NOT NULL($4), IS NOT NULL($5), IS NOT NULL($6), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query14.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query14.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query14.q.out
index 43a4fab..e5a0be1 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query14.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query14.q.out
@@ -233,7 +233,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
               HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3], $f4=[$4])
                 HiveAggregate(group=[{0, 1, 2}], agg#0=[sum($3)], agg#1=[count()])
                   HiveProject(i_brand_id=[$1], i_class_id=[$2], i_category_id=[$3], $f3=[*(CAST($6):DECIMAL(10, 0), $7)])
-                    HiveSemiJoin(condition=[=($5, $11)], joinType=[inner])
+                    HiveSemiJoin(condition=[=($5, $9)], joinType=[inner])
                       HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                         HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
                           HiveFilter(condition=[IS NOT NULL($0)])
@@ -242,7 +242,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                           HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_quantity=[$10], ss_list_price=[$12])
                             HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                          HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(11):INTEGER])
+                          HiveProject(d_date_sk=[$0])
                             HiveFilter(condition=[AND(=($6, 2000), =($8, 11), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                       HiveProject(i_item_sk=[$0], i_brand_id=[$1], i_class_id=[$2], i_category_id=[$3], $f0=[$4], $f1=[$5], $f2=[$6])
@@ -256,39 +256,39 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                 HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
                                   HiveUnion(all=[true])
                                     HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
-                                      HiveAggregate(group=[{5, 6, 7}], agg#0=[count()])
-                                        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                                      HiveAggregate(group=[{4, 5, 6}], agg#0=[count()])
+                                        HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                                             HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2])
                                               HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                                            HiveProject(d_date_sk=[$0])
                                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
                                           HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
                                             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11))])
                                               HiveTableScan(table=[[default, item]], table:alias=[iss])
                                     HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
-                                      HiveAggregate(group=[{5, 6, 7}], agg#0=[count()])
-                                        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                                      HiveAggregate(group=[{4, 5, 6}], agg#0=[count()])
+                                        HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                                             HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15])
                                               HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                                            HiveProject(d_date_sk=[$0])
                                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, date_dim]], table:alias=[d2])
                                           HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
                                             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11))])
                                               HiveTableScan(table=[[default, item]], table:alias=[ics])
                                     HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
-                                      HiveAggregate(group=[{5, 6, 7}], agg#0=[count()])
-                                        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                                      HiveAggregate(group=[{4, 5, 6}], agg#0=[count()])
+                                        HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                                             HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3])
                                               HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                                            HiveProject(d_date_sk=[$0])
                                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, date_dim]], table:alias=[d3])
                                           HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
@@ -309,7 +309,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                       HiveProject(ss_sold_date_sk=[$0], ss_quantity=[$10], ss_list_price=[$12])
                                         HiveFilter(condition=[IS NOT NULL($0)])
                                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[$6])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                                   HiveProject(quantity=[$1], list_price=[$2])
@@ -317,7 +317,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                       HiveProject(cs_sold_date_sk=[$0], cs_quantity=[$18], cs_list_price=[$20])
                                         HiveFilter(condition=[IS NOT NULL($0)])
                                           HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[$6])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                                   HiveProject(quantity=[$1], list_price=[$2])
@@ -325,7 +325,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                       HiveProject(ws_sold_date_sk=[$0], ws_quantity=[$18], ws_list_price=[$20])
                                         HiveFilter(condition=[IS NOT NULL($0)])
                                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[$6])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject($f0=[/($0, $1)])
@@ -337,7 +337,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                             HiveProject(ss_sold_date_sk=[$0], ss_quantity=[$10], ss_list_price=[$12])
                               HiveFilter(condition=[IS NOT NULL($0)])
                                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                         HiveProject(quantity=[$1], list_price=[$2])
@@ -345,7 +345,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                             HiveProject(cs_sold_date_sk=[$0], cs_quantity=[$18], cs_list_price=[$20])
                               HiveFilter(condition=[IS NOT NULL($0)])
                                 HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                         HiveProject(quantity=[$1], list_price=[$2])
@@ -353,7 +353,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                             HiveProject(ws_sold_date_sk=[$0], ws_quantity=[$18], ws_list_price=[$20])
                               HiveFilter(condition=[IS NOT NULL($0)])
                                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(channel=[_UTF-16LE'catalog'], i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], sales=[$3], number_sales=[$4])
@@ -361,7 +361,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
               HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3], $f4=[$4])
                 HiveAggregate(group=[{0, 1, 2}], agg#0=[sum($3)], agg#1=[count()])
                   HiveProject(i_brand_id=[$1], i_class_id=[$2], i_category_id=[$3], $f3=[*(CAST($6):DECIMAL(10, 0), $7)])
-                    HiveSemiJoin(condition=[=($5, $11)], joinType=[inner])
+                    HiveSemiJoin(condition=[=($5, $9)], joinType=[inner])
                       HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                         HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
                           HiveFilter(condition=[IS NOT NULL($0)])
@@ -370,7 +370,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                           HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15], cs_quantity=[$18], cs_list_price=[$20])
                             HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                          HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(11):INTEGER])
+                          HiveProject(d_date_sk=[$0])
                             HiveFilter(condition=[AND(=($6, 2000), =($8, 11), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                       HiveProject(i_item_sk=[$0], i_brand_id=[$1], i_class_id=[$2], i_category_id=[$3], $f0=[$4], $f1=[$5], $f2=[$6])
@@ -384,39 +384,39 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                 HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
                                   HiveUnion(all=[true])
                                     HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
-                                      HiveAggregate(group=[{5, 6, 7}], agg#0=[count()])
-                                        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                                      HiveAggregate(group=[{4, 5, 6}], agg#0=[count()])
+                                        HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                                             HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2])
                                               HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                                            HiveProject(d_date_sk=[$0])
                                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
                                           HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
                                             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11))])
                                               HiveTableScan(table=[[default, item]], table:alias=[iss])
                                     HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
-                                      HiveAggregate(group=[{5, 6, 7}], agg#0=[count()])
-                                        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                                      HiveAggregate(group=[{4, 5, 6}], agg#0=[count()])
+                                        HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                                             HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15])
                                               HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                                            HiveProject(d_date_sk=[$0])
                                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, date_dim]], table:alias=[d2])
                                           HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
                                             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11))])
                                               HiveTableScan(table=[[default, item]], table:alias=[ics])
                                     HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
-                                      HiveAggregate(group=[{5, 6, 7}], agg#0=[count()])
-                                        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                                      HiveAggregate(group=[{4, 5, 6}], agg#0=[count()])
+                                        HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                                             HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3])
                                               HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                                            HiveProject(d_date_sk=[$0])
                                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, date_dim]], table:alias=[d3])
                                           HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
@@ -437,7 +437,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                       HiveProject(ss_sold_date_sk=[$0], ss_quantity=[$10], ss_list_price=[$12])
                                         HiveFilter(condition=[IS NOT NULL($0)])
                                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[$6])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                                   HiveProject(quantity=[$1], list_price=[$2])
@@ -445,7 +445,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                       HiveProject(cs_sold_date_sk=[$0], cs_quantity=[$18], cs_list_price=[$20])
                                         HiveFilter(condition=[IS NOT NULL($0)])
                                           HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[$6])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                                   HiveProject(quantity=[$1], list_price=[$2])
@@ -453,7 +453,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                       HiveProject(ws_sold_date_sk=[$0], ws_quantity=[$18], ws_list_price=[$20])
                                         HiveFilter(condition=[IS NOT NULL($0)])
                                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[$6])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject($f0=[/($0, $1)])
@@ -465,7 +465,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                             HiveProject(ss_sold_date_sk=[$0], ss_quantity=[$10], ss_list_price=[$12])
                               HiveFilter(condition=[IS NOT NULL($0)])
                                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                         HiveProject(quantity=[$1], list_price=[$2])
@@ -473,7 +473,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                             HiveProject(cs_sold_date_sk=[$0], cs_quantity=[$18], cs_list_price=[$20])
                               HiveFilter(condition=[IS NOT NULL($0)])
                                 HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                         HiveProject(quantity=[$1], list_price=[$2])
@@ -481,7 +481,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                             HiveProject(ws_sold_date_sk=[$0], ws_quantity=[$18], ws_list_price=[$20])
                               HiveFilter(condition=[IS NOT NULL($0)])
                                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(channel=[_UTF-16LE'web'], i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], sales=[$3], number_sales=[$4])
@@ -489,7 +489,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
               HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3], $f4=[$4])
                 HiveAggregate(group=[{0, 1, 2}], agg#0=[sum($3)], agg#1=[count()])
                   HiveProject(i_brand_id=[$1], i_class_id=[$2], i_category_id=[$3], $f3=[*(CAST($6):DECIMAL(10, 0), $7)])
-                    HiveSemiJoin(condition=[=($5, $11)], joinType=[inner])
+                    HiveSemiJoin(condition=[=($5, $9)], joinType=[inner])
                       HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                         HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
                           HiveFilter(condition=[IS NOT NULL($0)])
@@ -498,7 +498,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                           HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_quantity=[$18], ws_list_price=[$20])
                             HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                          HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[CAST(11):INTEGER])
+                          HiveProject(d_date_sk=[$0])
                             HiveFilter(condition=[AND(=($6, 2000), =($8, 11), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                       HiveProject(i_item_sk=[$0], i_brand_id=[$1], i_class_id=[$2], i_category_id=[$3], $f0=[$4], $f1=[$5], $f2=[$6])
@@ -512,39 +512,39 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                 HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
                                   HiveUnion(all=[true])
                                     HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
-                                      HiveAggregate(group=[{5, 6, 7}], agg#0=[count()])
-                                        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                                      HiveAggregate(group=[{4, 5, 6}], agg#0=[count()])
+                                        HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                                             HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2])
                                               HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                                            HiveProject(d_date_sk=[$0])
                                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
                                           HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
                                             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11))])
                                               HiveTableScan(table=[[default, item]], table:alias=[iss])
                                     HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
-                                      HiveAggregate(group=[{5, 6, 7}], agg#0=[count()])
-                                        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                                      HiveAggregate(group=[{4, 5, 6}], agg#0=[count()])
+                                        HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                                             HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15])
                                               HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                                            HiveProject(d_date_sk=[$0])
                                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, date_dim]], table:alias=[d2])
                                           HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
                                             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11))])
                                               HiveTableScan(table=[[default, item]], table:alias=[ics])
                                     HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], $f3=[$3])
-                                      HiveAggregate(group=[{5, 6, 7}], agg#0=[count()])
-                                        HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+                                      HiveAggregate(group=[{4, 5, 6}], agg#0=[count()])
+                                        HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                                           HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                                             HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3])
                                               HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                                            HiveProject(d_date_sk=[$0])
                                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                                 HiveTableScan(table=[[default, date_dim]], table:alias=[d3])
                                           HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11])
@@ -565,7 +565,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                       HiveProject(ss_sold_date_sk=[$0], ss_quantity=[$10], ss_list_price=[$12])
                                         HiveFilter(condition=[IS NOT NULL($0)])
                                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[$6])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                                   HiveProject(quantity=[$1], list_price=[$2])
@@ -573,7 +573,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                       HiveProject(cs_sold_date_sk=[$0], cs_quantity=[$18], cs_list_price=[$20])
                                         HiveFilter(condition=[IS NOT NULL($0)])
                                           HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[$6])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                                   HiveProject(quantity=[$1], list_price=[$2])
@@ -581,7 +581,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                                       HiveProject(ws_sold_date_sk=[$0], ws_quantity=[$18], ws_list_price=[$20])
                                         HiveFilter(condition=[IS NOT NULL($0)])
                                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                                      HiveProject(d_date_sk=[$0], d_year=[$6])
+                                      HiveProject(d_date_sk=[$0])
                                         HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject($f0=[/($0, $1)])
@@ -593,7 +593,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                             HiveProject(ss_sold_date_sk=[$0], ss_quantity=[$10], ss_list_price=[$12])
                               HiveFilter(condition=[IS NOT NULL($0)])
                                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1999, 2001), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                         HiveProject(quantity=[$1], list_price=[$2])
@@ -601,7 +601,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                             HiveProject(cs_sold_date_sk=[$0], cs_quantity=[$18], cs_list_price=[$20])
                               HiveFilter(condition=[IS NOT NULL($0)])
                                 HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                         HiveProject(quantity=[$1], list_price=[$2])
@@ -609,7 +609,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], dir0=[ASC], dir1=[
                             HiveProject(ws_sold_date_sk=[$0], ws_quantity=[$18], ws_list_price=[$20])
                               HiveFilter(condition=[IS NOT NULL($0)])
                                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[$6])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(BETWEEN(false, $6, 1998, 2000), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query15.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query15.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query15.q.out
index 522bbb0..c00a741 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query15.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query15.q.out
@@ -49,21 +49,21 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
   HiveProject(ca_zip=[$0], $f1=[$1])
-    HiveAggregate(group=[{4}], agg#0=[sum($7)])
-      HiveJoin(condition=[AND(=($6, $0), OR(>($7, 500), IN(substr($4, 1, 5), _UTF-16LE'85669', _UTF-16LE'86197', _UTF-16LE'88274', _UTF-16LE'83405', _UTF-16LE'86475', _UTF-16LE'85392', _UTF-16LE'85460', _UTF-16LE'80348', _UTF-16LE'81792'), IN($3, _UTF-16LE'CA', _UTF-16LE'WA', _UTF-16LE'GA')))], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveAggregate(group=[{3}], agg#0=[sum($8)])
+      HiveJoin(condition=[AND(=($7, $0), OR($9, $4, $5))], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(c_customer_sk=[$0], c_current_addr_sk=[$4])
             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
               HiveTableScan(table=[[default, customer]], table:alias=[customer])
-          HiveProject(ca_address_sk=[$0], ca_state=[$8], ca_zip=[$9])
+          HiveProject(ca_address_sk=[$0], ca_zip=[$9], IN=[IN(substr($9, 1, 5), _UTF-16LE'85669', _UTF-16LE'86197', _UTF-16LE'88274', _UTF-16LE'83405', _UTF-16LE'86475', _UTF-16LE'85392', _UTF-16LE'85460', _UTF-16LE'80348', _UTF-16LE'81792')], IN3=[IN($8, _UTF-16LE'CA', _UTF-16LE'WA', _UTF-16LE'GA')])
             HiveFilter(condition=[IS NOT NULL($0)])
               HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-        HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$1], cs_sales_price=[$2], d_date_sk=[$3], d_year=[$4], d_qoy=[$5])
-          HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_sales_price=[$21])
+        HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$1], cs_sales_price=[$2], >=[$3], d_date_sk=[$4])
+          HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_sales_price=[$21], >=[>($21, 500)])
               HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-            HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_qoy=[CAST(2):INTEGER])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(=($10, 2), =($6, 2000), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query17.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query17.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query17.q.out
index 6c5b480..84832a4 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query17.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query17.q.out
@@ -104,35 +104,35 @@ CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC], dir1=[ASC], dir2=[ASC], fetch=[100])
   HiveProject(i_item_id=[$0], i_item_desc=[$1], s_state=[$2], store_sales_quantitycount=[$3], store_sales_quantityave=[/(CAST($4):DOUBLE, $3)], store_sales_quantitystdev=[POWER(/(-($5, /(*($6, $6), $3)), CASE(=($3, 1), null, -($3, 1))), 0.5)], store_sales_quantitycov=[/(POWER(/(-($5, /(*($6, $6), $3)), CASE(=($3, 1), null, -($3, 1))), 0.5), /(CAST($4):DOUBLE, $3))], as_store_returns_quantitycount=[$7], as_store_returns_quantityave=[/(CAST($8):DOUBLE, $7)], as_store_returns_quantitystdev=[POWER(/(-($9, /(*($10, $10), $7)), CASE(=($7, 1), null, -($7, 1))), 0.5)], store_returns_quantitycov=[/(POWER(/(-($9, /(*($10, $10), $7)), CASE(=($7, 1), null, -($7, 1))), 0.5), /(CAST($8):DOUBLE, $7))], catalog_sales_quantitycount=[$11], catalog_sales_quantityave=[/(CAST($12):DOUBLE, $11)], catalog_sales_quantitystdev=[/(POWER(/(-($13, /(*($14, $14), $11)), CASE(=($11, 1), null, -($11, 1))), 0.5), /(CAST($12):DOUBLE, $11))], catalog_sales_quantitycov=[/(POWER(/(-($13, /(*($14, $14), $11)), CASE(=($
 11, 1), null, -($11, 1))), 0.5), /(CAST($12):DOUBLE, $11))])
     HiveAggregate(group=[{0, 1, 2}], agg#0=[count($3)], agg#1=[sum($3)], agg#2=[sum($7)], agg#3=[sum($6)], agg#4=[count($4)], agg#5=[sum($4)], agg#6=[sum($9)], agg#7=[sum($8)], agg#8=[count($5)], agg#9=[sum($5)], agg#10=[sum($11)], agg#11=[sum($10)])
-      HiveProject($f0=[$9], $f1=[$10], $f2=[$25], $f3=[$5], $f4=[$21], $f5=[$14], $f30=[CAST($5):DOUBLE], $f7=[*(CAST($5):DOUBLE, CAST($5):DOUBLE)], $f40=[CAST($21):DOUBLE], $f9=[*(CAST($21):DOUBLE, CAST($21):DOUBLE)], $f50=[CAST($14):DOUBLE], $f11=[*(CAST($14):DOUBLE, CAST($14):DOUBLE)])
-        HiveJoin(condition=[=($24, $3)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveJoin(condition=[AND(AND(=($2, $19), =($1, $18)), =($4, $20))], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveJoin(condition=[=($8, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveProject($f0=[$8], $f1=[$9], $f2=[$22], $f3=[$5], $f4=[$19], $f5=[$13], $f30=[CAST($5):DOUBLE], $f7=[*(CAST($5):DOUBLE, CAST($5):DOUBLE)], $f40=[CAST($19):DOUBLE], $f9=[*(CAST($19):DOUBLE, CAST($19):DOUBLE)], $f50=[CAST($13):DOUBLE], $f11=[*(CAST($13):DOUBLE, CAST($13):DOUBLE)])
+        HiveJoin(condition=[=($21, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[AND(AND(=($2, $17), =($1, $16)), =($4, $18))], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_store_sk=[$7], ss_ticket_number=[$9], ss_quantity=[$10])
                   HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($2), IS NOT NULL($9), IS NOT NULL($0), IS NOT NULL($7))])
                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                HiveProject(d_date_sk=[$0], d_quarter_name=[CAST(_UTF-16LE'2000Q1'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(=($15, _UTF-16LE'2000Q1'), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
               HiveProject(i_item_sk=[$0], i_item_id=[$1], i_item_desc=[$4])
                 HiveFilter(condition=[IS NOT NULL($0)])
                   HiveTableScan(table=[[default, item]], table:alias=[item])
-            HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$1], cs_item_sk=[$2], cs_quantity=[$3], d_date_sk=[$4], d_quarter_name=[$5], sr_returned_date_sk=[$6], sr_item_sk=[$7], sr_customer_sk=[$8], sr_ticket_number=[$9], sr_return_quantity=[$10], d_date_sk0=[$11], d_quarter_name0=[$12])
-              HiveJoin(condition=[AND(=($8, $1), =($7, $2))], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$1], cs_item_sk=[$2], cs_quantity=[$3], d_date_sk=[$4], sr_returned_date_sk=[$5], sr_item_sk=[$6], sr_customer_sk=[$7], sr_ticket_number=[$8], sr_return_quantity=[$9], d_date_sk0=[$10])
+              HiveJoin(condition=[AND(=($7, $1), =($6, $2))], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_item_sk=[$15], cs_quantity=[$18])
                     HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($15), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                  HiveProject(d_date_sk=[$0], d_quarter_name=[$15])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(IN($15, _UTF-16LE'2000Q1', _UTF-16LE'2000Q2', _UTF-16LE'2000Q3'), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[d3])
-                HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$1], sr_customer_sk=[$2], sr_ticket_number=[$3], sr_return_quantity=[$4], d_date_sk=[$5], d_quarter_name=[$6])
+                HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$1], sr_customer_sk=[$2], sr_ticket_number=[$3], sr_return_quantity=[$4], d_date_sk=[$5])
                   HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(sr_returned_date_sk=[$0], sr_item_sk=[$2], sr_customer_sk=[$3], sr_ticket_number=[$9], sr_return_quantity=[$10])
                       HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($2), IS NOT NULL($9), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                    HiveProject(d_date_sk=[$0], d_quarter_name=[$15])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(IN($15, _UTF-16LE'2000Q1', _UTF-16LE'2000Q2', _UTF-16LE'2000Q3'), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[d2])
           HiveProject(s_store_sk=[$0], s_state=[$24])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query18.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query18.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query18.q.out
index 7e931c5..ebeb13b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query18.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query18.q.out
@@ -80,35 +80,34 @@ POSTHOOK: Input: default@item
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$1], sort1=[$2], sort2=[$3], sort3=[$0], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], fetch=[100])
-  HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[/($4, $5)], $f5=[/($6, $7)], $f6=[/($8, $9)], $f7=[/($10, $11)], $f8=[/($12, $13)], $f9=[/($14, $15)], $f10=[/($16, $17)])
-    HiveAggregate(group=[{0, 1, 2, 3}], groups=[[{0, 1, 2, 3}, {0, 1, 2}, {0, 1}, {0}, {}]], agg#0=[sum($4)], agg#1=[count($4)], agg#2=[sum($5)], agg#3=[count($5)], agg#4=[sum($6)], agg#5=[count($6)], agg#6=[sum($7)], agg#7=[count($7)], agg#8=[sum($8)], agg#9=[count($8)], agg#10=[sum($9)], agg#11=[count($9)], agg#12=[sum($10)], agg#13=[count($10)])
-      HiveProject($f0=[$11], $f1=[$8], $f2=[$7], $f3=[$6], $f4=[CAST($16):DECIMAL(12, 2)], $f5=[CAST($17):DECIMAL(12, 2)], $f6=[CAST($19):DECIMAL(12, 2)], $f7=[CAST($18):DECIMAL(12, 2)], $f8=[CAST($20):DECIMAL(12, 2)], $f9=[CAST($4):DECIMAL(12, 2)], $f10=[CAST($26):DECIMAL(12, 2)])
-        HiveJoin(condition=[=($13, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveJoin(condition=[=($1, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveProject(c_customer_sk=[$0], c_current_cdemo_sk=[$2], c_current_addr_sk=[$4], c_birth_month=[$12], c_birth_year=[$13])
-                HiveFilter(condition=[AND(IN($12, 9, 5, 12, 4, 1, 10), IS NOT NULL($0), IS NOT NULL($2), IS NOT NULL($4))])
-                  HiveTableScan(table=[[default, customer]], table:alias=[customer])
-              HiveProject(ca_address_sk=[$0], ca_county=[$7], ca_state=[$8], ca_country=[$10])
-                HiveFilter(condition=[AND(IN($8, _UTF-16LE'ND', _UTF-16LE'WI', _UTF-16LE'AL', _UTF-16LE'NC', _UTF-16LE'OK', _UTF-16LE'MS', _UTF-16LE'TN'), IS NOT NULL($0))])
-                  HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-            HiveProject(cd_demo_sk=[$0])
+  HiveProject($f0=[$3], $f1=[$2], $f2=[$1], $f3=[$0], $f4=[/($4, $5)], $f5=[/($6, $7)], $f6=[/($8, $9)], $f7=[/($10, $11)], $f8=[/($12, $13)], $f9=[/($14, $15)], $f10=[/($16, $17)])
+    HiveAggregate(group=[{5, 6, 7, 10}], groups=[[{5, 6, 7, 10}, {6, 7, 10}, {7, 10}, {10}, {}]], agg#0=[sum($15)], agg#1=[count($15)], agg#2=[sum($16)], agg#3=[count($16)], agg#4=[sum($17)], agg#5=[count($17)], agg#6=[sum($18)], agg#7=[count($18)], agg#8=[sum($19)], agg#9=[count($19)], agg#10=[sum($3)], agg#11=[count($3)], agg#12=[sum($22)], agg#13=[count($22)])
+      HiveJoin(condition=[=($12, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[=($1, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($2, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(c_customer_sk=[$0], c_current_cdemo_sk=[$2], c_current_addr_sk=[$4], CAST=[CAST($13):DECIMAL(12, 2)])
+              HiveFilter(condition=[AND(IN($12, 9, 5, 12, 4, 1, 10), IS NOT NULL($0), IS NOT NULL($2), IS NOT NULL($4))])
+                HiveTableScan(table=[[default, customer]], table:alias=[customer])
+            HiveProject(ca_address_sk=[$0], ca_county=[$7], ca_state=[$8], ca_country=[$10])
+              HiveFilter(condition=[AND(IN($8, _UTF-16LE'ND', _UTF-16LE'WI', _UTF-16LE'AL', _UTF-16LE'NC', _UTF-16LE'OK', _UTF-16LE'MS', _UTF-16LE'TN'), IS NOT NULL($0))])
+                HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
+          HiveProject(cd_demo_sk=[$0])
+            HiveFilter(condition=[IS NOT NULL($0)])
+              HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd2])
+        HiveProject(i_item_sk=[$0], i_item_id=[$1], cs_sold_date_sk=[$2], cs_bill_customer_sk=[$3], cs_bill_cdemo_sk=[$4], cs_item_sk=[$5], CAST=[$6], CAST5=[$7], CAST6=[$8], CAST7=[$9], CAST8=[$10], d_date_sk=[$11], cd_demo_sk=[$12], CAST0=[$13])
+          HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(i_item_sk=[$0], i_item_id=[$1])
               HiveFilter(condition=[IS NOT NULL($0)])
-                HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd2])
-          HiveProject(i_item_sk=[$0], i_item_id=[$1], cs_sold_date_sk=[$2], cs_bill_customer_sk=[$3], cs_bill_cdemo_sk=[$4], cs_item_sk=[$5], cs_quantity=[$6], cs_list_price=[$7], cs_sales_price=[$8], cs_coupon_amt=[$9], cs_net_profit=[$10], d_date_sk=[$11], d_year=[$12], cd_demo_sk=[$13], cd_gender=[$14], cd_education_status=[$15], cd_dep_count=[$16])
-            HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveProject(i_item_sk=[$0], i_item_id=[$1])
-                HiveFilter(condition=[IS NOT NULL($0)])
-                  HiveTableScan(table=[[default, item]], table:alias=[item])
-              HiveJoin(condition=[=($2, $11)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_bill_cdemo_sk=[$4], cs_item_sk=[$15], cs_quantity=[$18], cs_list_price=[$20], cs_sales_price=[$21], cs_coupon_amt=[$27], cs_net_profit=[$33])
-                    HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($3), IS NOT NULL($0), IS NOT NULL($15))])
-                      HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
-                    HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
-                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                HiveProject(cd_demo_sk=[$0], cd_gender=[CAST(_UTF-16LE'M'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], cd_education_status=[CAST(_UTF-16LE'College'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], cd_dep_count=[$6])
-                  HiveFilter(condition=[AND(=($1, _UTF-16LE'M'), =($3, _UTF-16LE'College'), IS NOT NULL($0))])
-                    HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd1])
+                HiveTableScan(table=[[default, item]], table:alias=[item])
+            HiveJoin(condition=[=($2, $10)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_bill_cdemo_sk=[$4], cs_item_sk=[$15], CAST=[CAST($18):DECIMAL(12, 2)], CAST5=[CAST($20):DECIMAL(12, 2)], CAST6=[CAST($27):DECIMAL(12, 2)], CAST7=[CAST($21):DECIMAL(12, 2)], CAST8=[CAST($33):DECIMAL(12, 2)])
+                  HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($3), IS NOT NULL($0), IS NOT NULL($15))])
+                    HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
+                HiveProject(d_date_sk=[$0])
+                  HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
+                    HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+              HiveProject(cd_demo_sk=[$0], CAST=[CAST($6):DECIMAL(12, 2)])
+                HiveFilter(condition=[AND(=($1, _UTF-16LE'M'), =($3, _UTF-16LE'College'), IS NOT NULL($0))])
+                  HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd1])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query19.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query19.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query19.q.out
index c24d76f..be19bab 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query19.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query19.q.out
@@ -64,29 +64,29 @@ CBO PLAN:
 HiveProject(brand_id=[$0], brand=[$1], i_manufact_id=[$2], i_manufact=[$3], ext_price=[$4])
   HiveSortLimit(sort0=[$4], sort1=[$5], sort2=[$6], sort3=[$2], sort4=[$3], dir0=[DESC-nulls-last], dir1=[ASC], dir2=[ASC], dir3=[ASC], dir4=[ASC], fetch=[100])
     HiveProject(brand_id=[$0], brand=[$1], i_manufact_id=[$2], i_manufact=[$3], ext_price=[$4], (tok_table_or_col i_brand)=[$1], (tok_table_or_col i_brand_id)=[$0])
-      HiveAggregate(group=[{13, 14, 15, 16}], agg#0=[sum($8)])
-        HiveJoin(condition=[AND(<>(substr($3, 1, 5), substr($19, 1, 5)), =($7, $18))], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveAggregate(group=[{11, 12, 13, 14}], agg#0=[sum($8)])
+        HiveJoin(condition=[AND(<>($3, $16), =($7, $15))], joinType=[inner], algorithm=[none], cost=[not available])
           HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($1, $2)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(c_customer_sk=[$0], c_current_addr_sk=[$4])
                 HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                   HiveTableScan(table=[[default, customer]], table:alias=[customer])
-              HiveProject(ca_address_sk=[$0], ca_zip=[$9])
+              HiveProject(ca_address_sk=[$0], substr=[substr($9, 1, 5)])
                 HiveFilter(condition=[IS NOT NULL($0)])
                   HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-            HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$1], ss_customer_sk=[$2], ss_store_sk=[$3], ss_ext_sales_price=[$4], d_date_sk=[$5], d_year=[$6], d_moy=[$7], i_item_sk=[$8], i_brand_id=[$9], i_brand=[$10], i_manufact_id=[$11], i_manufact=[$12], i_manager_id=[$13])
-              HiveJoin(condition=[=($1, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$1], ss_customer_sk=[$2], ss_store_sk=[$3], ss_ext_sales_price=[$4], d_date_sk=[$5], i_item_sk=[$6], i_brand_id=[$7], i_brand=[$8], i_manufact_id=[$9], i_manufact=[$10])
+              HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_store_sk=[$7], ss_ext_sales_price=[$15])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($2), IS NOT NULL($3), IS NOT NULL($7))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(11):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($8, 11), =($6, 1999), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8], i_manufact_id=[$13], i_manufact=[$14], i_manager_id=[CAST(7):INTEGER])
+                HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_brand=[$8], i_manufact_id=[$13], i_manufact=[$14])
                   HiveFilter(condition=[AND(=($20, 7), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, item]], table:alias=[item])
-          HiveProject(s_store_sk=[$0], s_zip=[$25])
+          HiveProject(s_store_sk=[$0], substr=[substr($25, 1, 5)])
             HiveFilter(condition=[IS NOT NULL($0)])
               HiveTableScan(table=[[default, store]], table:alias=[store])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query2.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query2.q.out
index cca252e..7b14ad3 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query2.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query2.q.out
@@ -126,12 +126,12 @@ POSTHOOK: Input: default@web_sales
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], dir0=[ASC])
-  HiveProject(d_week_seq1=[$0], _o__c1=[round(/($1, $11), 2)], _o__c2=[round(/($2, $12), 2)], _o__c3=[round(/($3, $13), 2)], _o__c4=[round(/($4, $14), 2)], _o__c5=[round(/($5, $15), 2)], _o__c6=[round(/($6, $16), 2)], _o__c7=[round(/($7, $17), 2)])
-    HiveJoin(condition=[=($0, -($10, 53))], joinType=[inner], algorithm=[none], cost=[not available])
+  HiveProject(d_week_seq1=[$0], _o__c1=[round(/($1, $10), 2)], _o__c2=[round(/($2, $11), 2)], _o__c3=[round(/($3, $12), 2)], _o__c4=[round(/($4, $13), 2)], _o__c5=[round(/($5, $14), 2)], _o__c6=[round(/($6, $15), 2)], _o__c7=[round(/($7, $16), 2)])
+    HiveJoin(condition=[=($0, -($9, 53))], joinType=[inner], algorithm=[none], cost=[not available])
       HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7])
           HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)], agg#2=[sum($3)], agg#3=[sum($4)], agg#4=[sum($5)], agg#5=[sum($6)], agg#6=[sum($7)])
-            HiveProject($f0=[$3], $f1=[CASE(=($4, _UTF-16LE'Sunday'), $1, null)], $f2=[CASE(=($4, _UTF-16LE'Monday'), $1, null)], $f3=[CASE(=($4, _UTF-16LE'Tuesday'), $1, null)], $f4=[CASE(=($4, _UTF-16LE'Wednesday'), $1, null)], $f5=[CASE(=($4, _UTF-16LE'Thursday'), $1, null)], $f6=[CASE(=($4, _UTF-16LE'Friday'), $1, null)], $f7=[CASE(=($4, _UTF-16LE'Saturday'), $1, null)])
+            HiveProject($f0=[$3], $f1=[CASE($4, $1, null)], $f2=[CASE($5, $1, null)], $f3=[CASE($6, $1, null)], $f4=[CASE($7, $1, null)], $f5=[CASE($8, $1, null)], $f6=[CASE($9, $1, null)], $f7=[CASE($10, $1, null)])
               HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(ws_sold_date_sk=[$0], ws_ext_sales_price=[$1])
                   HiveUnion(all=[true])
@@ -141,17 +141,17 @@ HiveSortLimit(sort0=[$0], dir0=[ASC])
                     HiveProject(cs_sold_date_sk=[$0], cs_ext_sales_price=[$23])
                       HiveFilter(condition=[IS NOT NULL($0)])
                         HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                HiveProject(d_date_sk=[$0], d_week_seq=[$4], d_day_name=[$14])
+                HiveProject(d_date_sk=[$0], d_week_seq=[$4], ==[=($14, _UTF-16LE'Sunday')], =3=[=($14, _UTF-16LE'Monday')], =4=[=($14, _UTF-16LE'Tuesday')], =5=[=($14, _UTF-16LE'Wednesday')], =6=[=($14, _UTF-16LE'Thursday')], =7=[=($14, _UTF-16LE'Friday')], =8=[=($14, _UTF-16LE'Saturday')])
                   HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-        HiveProject(d_week_seq=[$4], d_year=[CAST(2001):INTEGER])
+        HiveProject(d_week_seq=[$4])
           HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($4))])
             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
       HiveProject(d_week_seq2=[$0], sun_sales2=[$1], mon_sales2=[$2], tue_sales2=[$3], wed_sales2=[$4], thu_sales2=[$5], fri_sales2=[$6], sat_sales2=[$7])
         HiveJoin(condition=[=($8, $0)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$5], $f6=[$6], $f7=[$7])
             HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)], agg#2=[sum($3)], agg#3=[sum($4)], agg#4=[sum($5)], agg#5=[sum($6)], agg#6=[sum($7)])
-              HiveProject($f0=[$3], $f1=[CASE(=($4, _UTF-16LE'Sunday'), $1, null)], $f2=[CASE(=($4, _UTF-16LE'Monday'), $1, null)], $f3=[CASE(=($4, _UTF-16LE'Tuesday'), $1, null)], $f4=[CASE(=($4, _UTF-16LE'Wednesday'), $1, null)], $f5=[CASE(=($4, _UTF-16LE'Thursday'), $1, null)], $f6=[CASE(=($4, _UTF-16LE'Friday'), $1, null)], $f7=[CASE(=($4, _UTF-16LE'Saturday'), $1, null)])
+              HiveProject($f0=[$3], $f1=[CASE($4, $1, null)], $f2=[CASE($5, $1, null)], $f3=[CASE($6, $1, null)], $f4=[CASE($7, $1, null)], $f5=[CASE($8, $1, null)], $f6=[CASE($9, $1, null)], $f7=[CASE($10, $1, null)])
                 HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ws_sold_date_sk=[$0], ws_ext_sales_price=[$1])
                     HiveUnion(all=[true])
@@ -161,10 +161,10 @@ HiveSortLimit(sort0=[$0], dir0=[ASC])
                       HiveProject(cs_sold_date_sk=[$0], cs_ext_sales_price=[$23])
                         HiveFilter(condition=[IS NOT NULL($0)])
                           HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                  HiveProject(d_date_sk=[$0], d_week_seq=[$4], d_day_name=[$14])
+                  HiveProject(d_date_sk=[$0], d_week_seq=[$4], ==[=($14, _UTF-16LE'Sunday')], =3=[=($14, _UTF-16LE'Monday')], =4=[=($14, _UTF-16LE'Tuesday')], =5=[=($14, _UTF-16LE'Wednesday')], =6=[=($14, _UTF-16LE'Thursday')], =7=[=($14, _UTF-16LE'Friday')], =8=[=($14, _UTF-16LE'Saturday')])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(d_week_seq=[$4], d_year=[CAST(2002):INTEGER])
+          HiveProject(d_week_seq=[$4])
             HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($4))])
               HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query20.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query20.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query20.q.out
index 834c804..ba354b6 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query20.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query20.q.out
@@ -75,7 +75,7 @@ HiveProject(i_item_desc=[$0], i_category=[$1], i_class=[$2], i_current_price=[$3
             HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15], cs_ext_sales_price=[$23])
               HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-            HiveProject(d_date_sk=[$0], d_date=[$2])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 2001-01-12 00:00:00, 2001-02-11 00:00:00), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query21.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query21.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query21.q.out
index a54a085..3a67503 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query21.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query21.q.out
@@ -71,20 +71,20 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
   HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3])
     HiveFilter(condition=[CASE(>($2, 0), BETWEEN(false, /(CAST($3):DOUBLE, CAST($2):DOUBLE), 6.66667E-1, 1.5E0), null)])
       HiveAggregate(group=[{0, 1}], agg#0=[sum($2)], agg#1=[sum($3)])
-        HiveProject($f0=[$1], $f1=[$9], $f2=[CASE(<(CAST($7):DATE, 1998-04-08), $5, 0)], $f3=[CASE(>=(CAST($7):DATE, 1998-04-08), $5, 0)])
+        HiveProject($f0=[$1], $f1=[$10], $f2=[CASE($7, $5, 0)], $f3=[CASE($8, $5, 0)])
           HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject(w_warehouse_sk=[$0], w_warehouse_name=[$2])
               HiveFilter(condition=[IS NOT NULL($0)])
                 HiveTableScan(table=[[default, warehouse]], table:alias=[warehouse])
-            HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], inv_warehouse_sk=[$2], inv_quantity_on_hand=[$3])
                   HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($1), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, inventory]], table:alias=[inventory])
-                HiveProject(d_date_sk=[$0], d_date=[$2])
+                HiveProject(d_date_sk=[$0], <=[<(CAST($2):DATE, 1998-04-08)], >==[>=(CAST($2):DATE, 1998-04-08)])
                   HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-03-09 00:00:00, 1998-05-08 00:00:00), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-              HiveProject(i_item_sk=[$0], i_item_id=[$1], i_current_price=[$5])
+              HiveProject(i_item_sk=[$0], i_item_id=[$1])
                 HiveFilter(condition=[AND(BETWEEN(false, $5, 0.99, 1.49), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, item]], table:alias=[item])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query22.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query22.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query22.q.out
index c5118ee..7231d6e 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query22.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query22.q.out
@@ -58,12 +58,12 @@ HiveSortLimit(sort0=[$4], sort1=[$0], sort2=[$1], sort3=[$2], sort4=[$3], dir0=[
         HiveProject(i_item_sk=[$0], i_brand=[$8], i_class=[$10], i_category=[$12], i_product_name=[$21])
           HiveFilter(condition=[IS NOT NULL($0)])
             HiveTableScan(table=[[default, item]], table:alias=[item])
-        HiveJoin(condition=[=($2, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], inv_warehouse_sk=[$2], inv_quantity_on_hand=[$3])
               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1), IS NOT NULL($2))])
                 HiveTableScan(table=[[default, inventory]], table:alias=[inventory])
-            HiveProject(d_date_sk=[$0], d_month_seq=[$3])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(w_warehouse_sk=[$0])


[26/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query49.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query49.q.out b/ql/src/test/results/clientpositive/perf/spark/query49.q.out
index 07d14b5..354c178 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query49.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query49.q.out
@@ -304,7 +304,7 @@ STAGE PLANS:
                     predicate: ((ws_net_paid > 0) and (ws_net_profit > 1) and (ws_quantity > 0) and ws_item_sk is not null and ws_order_number is not null and ws_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 5333432 Data size: 725192506 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_item_sk (type: int), ws_order_number (type: int), ws_quantity (type: int), ws_net_paid (type: decimal(7,2))
+                      expressions: ws_sold_date_sk (type: int), ws_item_sk (type: int), ws_order_number (type: int), CASE WHEN (ws_quantity is not null) THEN (ws_quantity) ELSE (0) END (type: int), CASE WHEN (ws_net_paid is not null) THEN (ws_net_paid) ELSE (0) END (type: decimal(12,2))
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 5333432 Data size: 725192506 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -312,7 +312,7 @@ STAGE PLANS:
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 5333432 Data size: 725192506 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(12,2))
             Execution mode: vectorized
         Map 10 
             Map Operator Tree:
@@ -343,7 +343,7 @@ STAGE PLANS:
                     predicate: ((wr_return_amt > 10000) and wr_item_sk is not null and wr_order_number is not null) (type: boolean)
                     Statistics: Num rows: 4799489 Data size: 441731394 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: wr_item_sk (type: int), wr_order_number (type: int), wr_return_quantity (type: int), wr_return_amt (type: decimal(7,2))
+                      expressions: wr_item_sk (type: int), wr_order_number (type: int), CASE WHEN (wr_return_quantity is not null) THEN (wr_return_quantity) ELSE (0) END (type: int), CASE WHEN (wr_return_amt is not null) THEN (wr_return_amt) ELSE (0) END (type: decimal(12,2))
                       outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 4799489 Data size: 441731394 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -351,7 +351,7 @@ STAGE PLANS:
                         sort order: ++
                         Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
                         Statistics: Num rows: 4799489 Data size: 441731394 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col2 (type: int), _col3 (type: decimal(12,2))
             Execution mode: vectorized
         Map 12 
             Map Operator Tree:
@@ -363,7 +363,7 @@ STAGE PLANS:
                     predicate: ((cs_net_paid > 0) and (cs_net_profit > 1) and (cs_quantity > 0) and cs_item_sk is not null and cs_order_number is not null and cs_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 10666290 Data size: 1444429931 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), cs_item_sk (type: int), cs_order_number (type: int), cs_quantity (type: int), cs_net_paid (type: decimal(7,2))
+                      expressions: cs_sold_date_sk (type: int), cs_item_sk (type: int), cs_order_number (type: int), CASE WHEN (cs_quantity is not null) THEN (cs_quantity) ELSE (0) END (type: int), CASE WHEN (cs_net_paid is not null) THEN (cs_net_paid) ELSE (0) END (type: decimal(12,2))
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 10666290 Data size: 1444429931 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -371,7 +371,7 @@ STAGE PLANS:
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 10666290 Data size: 1444429931 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(12,2))
             Execution mode: vectorized
         Map 19 
             Map Operator Tree:
@@ -383,7 +383,7 @@ STAGE PLANS:
                     predicate: ((cr_return_amount > 10000) and cr_item_sk is not null and cr_order_number is not null) (type: boolean)
                     Statistics: Num rows: 9599627 Data size: 1019078226 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cr_item_sk (type: int), cr_order_number (type: int), cr_return_quantity (type: int), cr_return_amount (type: decimal(7,2))
+                      expressions: cr_item_sk (type: int), cr_order_number (type: int), CASE WHEN (cr_return_quantity is not null) THEN (cr_return_quantity) ELSE (0) END (type: int), CASE WHEN (cr_return_amount is not null) THEN (cr_return_amount) ELSE (0) END (type: decimal(12,2))
                       outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 9599627 Data size: 1019078226 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -391,7 +391,7 @@ STAGE PLANS:
                         sort order: ++
                         Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
                         Statistics: Num rows: 9599627 Data size: 1019078226 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col2 (type: int), _col3 (type: decimal(12,2))
             Execution mode: vectorized
         Map 20 
             Map Operator Tree:
@@ -403,7 +403,7 @@ STAGE PLANS:
                     predicate: ((ss_net_paid > 0) and (ss_net_profit > 1) and (ss_quantity > 0) and ss_item_sk is not null and ss_sold_date_sk is not null and ss_ticket_number is not null) (type: boolean)
                     Statistics: Num rows: 21333171 Data size: 1882018537 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_item_sk (type: int), ss_ticket_number (type: int), ss_quantity (type: int), ss_net_paid (type: decimal(7,2))
+                      expressions: ss_sold_date_sk (type: int), ss_item_sk (type: int), ss_ticket_number (type: int), CASE WHEN (ss_quantity is not null) THEN (ss_quantity) ELSE (0) END (type: int), CASE WHEN (ss_net_paid is not null) THEN (ss_net_paid) ELSE (0) END (type: decimal(12,2))
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 21333171 Data size: 1882018537 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -411,7 +411,7 @@ STAGE PLANS:
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 21333171 Data size: 1882018537 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: decimal(12,2))
             Execution mode: vectorized
         Map 27 
             Map Operator Tree:
@@ -423,7 +423,7 @@ STAGE PLANS:
                     predicate: ((sr_return_amt > 10000) and sr_item_sk is not null and sr_ticket_number is not null) (type: boolean)
                     Statistics: Num rows: 19197050 Data size: 1487398277 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: sr_item_sk (type: int), sr_ticket_number (type: int), sr_return_quantity (type: int), sr_return_amt (type: decimal(7,2))
+                      expressions: sr_item_sk (type: int), sr_ticket_number (type: int), CASE WHEN (sr_return_quantity is not null) THEN (sr_return_quantity) ELSE (0) END (type: int), CASE WHEN (sr_return_amt is not null) THEN (sr_return_amt) ELSE (0) END (type: decimal(12,2))
                       outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 19197050 Data size: 1487398277 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -431,7 +431,7 @@ STAGE PLANS:
                         sort order: ++
                         Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
                         Statistics: Num rows: 19197050 Data size: 1487398277 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: int), _col3 (type: decimal(7,2))
+                        value expressions: _col2 (type: int), _col3 (type: decimal(12,2))
             Execution mode: vectorized
         Reducer 13 
             Reduce Operator Tree:
@@ -448,7 +448,7 @@ STAGE PLANS:
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 11732919 Data size: 1588872958 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2))
+                  value expressions: _col3 (type: int), _col4 (type: decimal(12,2))
         Reducer 14 
             Reduce Operator Tree:
               Join Operator
@@ -457,24 +457,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int), _col2 (type: int)
                   1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col11, _col12
+                outputColumnNames: _col1, _col3, _col4, _col8, _col9
                 Statistics: Num rows: 12906211 Data size: 1747760291 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col1 (type: int), CASE WHEN (_col11 is not null) THEN (_col11) ELSE (0) END (type: int), CASE WHEN (_col3 is not null) THEN (_col3) ELSE (0) END (type: int), CASE WHEN (_col12 is not null) THEN (_col12) ELSE (0) END (type: decimal(12,2)), CASE WHEN (_col4 is not null) THEN (_col4) ELSE (0) END (type: decimal(12,2))
+                Group By Operator
+                  aggregations: sum(_col8), sum(_col3), sum(_col9), sum(_col4)
+                  keys: _col1 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 12906211 Data size: 1747760291 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1), sum(_col2), sum(_col3), sum(_col4)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 12906211 Data size: 1747760291 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 12906211 Data size: 1747760291 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: bigint), _col2 (type: bigint), _col3 (type: decimal(22,2)), _col4 (type: decimal(22,2))
+                    value expressions: _col1 (type: bigint), _col2 (type: bigint), _col3 (type: decimal(22,2)), _col4 (type: decimal(22,2))
         Reducer 15 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -587,7 +583,7 @@ STAGE PLANS:
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 5866775 Data size: 797711773 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2))
+                  value expressions: _col3 (type: int), _col4 (type: decimal(12,2))
         Reducer 21 
             Reduce Operator Tree:
               Join Operator
@@ -603,7 +599,7 @@ STAGE PLANS:
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
                   Statistics: Num rows: 23466488 Data size: 2070220435 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col4 (type: decimal(7,2))
+                  value expressions: _col3 (type: int), _col4 (type: decimal(12,2))
         Reducer 22 
             Reduce Operator Tree:
               Join Operator
@@ -612,24 +608,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int), _col2 (type: int)
                   1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col11, _col12
+                outputColumnNames: _col1, _col3, _col4, _col8, _col9
                 Statistics: Num rows: 25813137 Data size: 2277242527 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col1 (type: int), CASE WHEN (_col11 is not null) THEN (_col11) ELSE (0) END (type: int), CASE WHEN (_col3 is not null) THEN (_col3) ELSE (0) END (type: int), CASE WHEN (_col12 is not null) THEN (_col12) ELSE (0) END (type: decimal(12,2)), CASE WHEN (_col4 is not null) THEN (_col4) ELSE (0) END (type: decimal(12,2))
+                Group By Operator
+                  aggregations: sum(_col8), sum(_col3), sum(_col9), sum(_col4)
+                  keys: _col1 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 25813137 Data size: 2277242527 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1), sum(_col2), sum(_col3), sum(_col4)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 25813137 Data size: 2277242527 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 25813137 Data size: 2277242527 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: bigint), _col2 (type: bigint), _col3 (type: decimal(22,2)), _col4 (type: decimal(22,2))
+                    value expressions: _col1 (type: bigint), _col2 (type: bigint), _col3 (type: decimal(22,2)), _col4 (type: decimal(22,2))
         Reducer 23 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -736,24 +728,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int), _col2 (type: int)
                   1 _col0 (type: int), _col1 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col11, _col12
+                outputColumnNames: _col1, _col3, _col4, _col8, _col9
                 Statistics: Num rows: 6453452 Data size: 877482969 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col1 (type: int), CASE WHEN (_col11 is not null) THEN (_col11) ELSE (0) END (type: int), CASE WHEN (_col3 is not null) THEN (_col3) ELSE (0) END (type: int), CASE WHEN (_col12 is not null) THEN (_col12) ELSE (0) END (type: decimal(12,2)), CASE WHEN (_col4 is not null) THEN (_col4) ELSE (0) END (type: decimal(12,2))
+                Group By Operator
+                  aggregations: sum(_col8), sum(_col3), sum(_col9), sum(_col4)
+                  keys: _col1 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 6453452 Data size: 877482969 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1), sum(_col2), sum(_col3), sum(_col4)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 6453452 Data size: 877482969 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 6453452 Data size: 877482969 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: bigint), _col2 (type: bigint), _col3 (type: decimal(22,2)), _col4 (type: decimal(22,2))
+                    value expressions: _col1 (type: bigint), _col2 (type: bigint), _col3 (type: decimal(22,2)), _col4 (type: decimal(22,2))
         Reducer 4 
             Execution mode: vectorized
             Reduce Operator Tree:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query5.q.out b/ql/src/test/results/clientpositive/perf/spark/query5.q.out
index 6e5743b..f9959a2 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query5.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query5.q.out
@@ -568,11 +568,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col5, _col9
+                outputColumnNames: _col2, _col3, _col4, _col5, _col8
                 Statistics: Num rows: 383314363 Data size: 50888782999 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2), sum(_col4), sum(_col3), sum(_col5)
-                  keys: _col9 (type: string)
+                  keys: _col8 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 383314363 Data size: 50888782999 Basic stats: COMPLETE Column stats: NONE
@@ -626,13 +626,13 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col3, _col4, _col5, _col9
+                  outputColumnNames: _col2, _col3, _col4, _col5, _col8
                   input vertices:
                     1 Map 23
                   Statistics: Num rows: 365910798 Data size: 49753286377 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2), sum(_col4), sum(_col3), sum(_col5)
-                    keys: _col9 (type: string)
+                    keys: _col8 (type: string)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 365910798 Data size: 49753286377 Basic stats: COMPLETE Column stats: NONE
@@ -686,13 +686,13 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col3, _col4, _col5, _col9
+                  outputColumnNames: _col2, _col3, _col4, _col5, _col8
                   input vertices:
                     1 Map 8
                   Statistics: Num rows: 766640042 Data size: 66884806171 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col2), sum(_col4), sum(_col3), sum(_col5)
-                    keys: _col9 (type: string)
+                    keys: _col8 (type: string)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 766640042 Data size: 66884806171 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query50.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query50.q.out b/ql/src/test/results/clientpositive/perf/spark/query50.q.out
index 2a84a92..6a59f7d 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query50.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query50.q.out
@@ -149,7 +149,7 @@ STAGE PLANS:
                       Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 _col10 (type: int)
+                          0 _col8 (type: int)
                           1 _col0 (type: int)
             Execution mode: vectorized
             Local Work:
@@ -267,14 +267,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int), _col2 (type: int), _col3 (type: int)
                   1 _col1 (type: int), _col2 (type: int), _col4 (type: int)
-                outputColumnNames: _col0, _col7, _col10
+                outputColumnNames: _col0, _col5, _col8
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col7 (type: int)
+                  key expressions: _col5 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col7 (type: int)
+                  Map-reduce partition columns: _col5 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col10 (type: int)
+                  value expressions: _col0 (type: int), _col8 (type: int)
         Reducer 4 
             Local Work:
               Map Reduce Local Work
@@ -283,22 +283,22 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col7 (type: int)
+                  0 _col5 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col7, _col10
+                outputColumnNames: _col0, _col5, _col8
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
                   keys:
-                    0 _col10 (type: int)
+                    0 _col8 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col7, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23
+                  outputColumnNames: _col0, _col5, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21
                   input vertices:
                     1 Map 10
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col14 (type: string), _col15 (type: int), _col16 (type: string), _col17 (type: string), _col18 (type: string), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: string), _col23 (type: string), CASE WHEN (((_col0 - _col7) <= 30)) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col0 - _col7) > 30) and ((_col0 - _col7) <= 60))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col0 - _col7) > 60) and ((_col0 - _col7) <= 90))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col0 - _col7) > 90) and ((_col0 - _col7) <= 120))) THEN (1) ELSE (0) END (type: int), CASE WHEN (((_col0 - _col7) > 120)) THEN (1) ELSE (0) END (type: int)
+                    expressions: _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: string), _col16 (type: string), _col17 (type: string), _col18 (type: string), _col19 (type: string), _col20 (type: string), _col21 (type: string), CASE WHEN (((_col0 - _col5) <= 30)) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col0 - _col5) > 30) and ((_col0 - _col5) <= 60))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col0 - _col5) > 60) and ((_col0 - _col5) <= 90))) THEN (1) ELSE (0) END (type: int), CASE WHEN ((((_col0 - _col5) > 90) and ((_col0 - _col5) <= 120))) THEN (1) ELSE (0) END (type: int), CASE WHEN (((_col0 - _col5) > 120)) THEN (1) ELSE (0) END (type: int)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
                     Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query52.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query52.q.out b/ql/src/test/results/clientpositive/perf/spark/query52.q.out
index 5de7ee7..45c9237 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query52.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query52.q.out
@@ -145,11 +145,11 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7, _col8
+                outputColumnNames: _col2, _col5, _col6
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: int), _col8 (type: string)
+                  keys: _col5 (type: int), _col6 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query53.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query53.q.out b/ql/src/test/results/clientpositive/perf/spark/query53.q.out
index 3479cb5..ea5dde1 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query53.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query53.q.out
@@ -133,14 +133,14 @@ STAGE PLANS:
                     Statistics: Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: i_item_sk (type: int), i_manufact_id (type: int)
-                      outputColumnNames: _col0, _col4
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col4 (type: int)
+                        value expressions: _col1 (type: int)
             Execution mode: vectorized
         Map 7 
             Map Operator Tree:
@@ -153,14 +153,14 @@ STAGE PLANS:
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_date_sk (type: int), d_qoy (type: int)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: int)
+                        value expressions: _col1 (type: int)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -170,14 +170,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col2, _col3, _col8
+                outputColumnNames: _col0, _col2, _col3, _col5
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int), _col3 (type: decimal(7,2)), _col8 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: decimal(7,2)), _col5 (type: int)
         Reducer 3 
             Local Work:
               Map Reduce Local Work
@@ -188,7 +188,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col8, _col11
+                outputColumnNames: _col2, _col3, _col5, _col7
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -196,13 +196,13 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col3, _col8, _col11
+                  outputColumnNames: _col3, _col5, _col7
                   input vertices:
                     1 Map 8
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col3)
-                    keys: _col8 (type: int), _col11 (type: int)
+                    keys: _col5 (type: int), _col7 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query54.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query54.q.out b/ql/src/test/results/clientpositive/perf/spark/query54.q.out
index 7d488f9..690f1d4 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query54.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query54.q.out
@@ -613,10 +613,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col9, _col10
+                outputColumnNames: _col5, _col6
                 Statistics: Num rows: 574982058 Data size: 77969728405 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  keys: _col10 (type: int), _col9 (type: int)
+                  keys: _col6 (type: int), _col5 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 574982058 Data size: 77969728405 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query55.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query55.q.out b/ql/src/test/results/clientpositive/perf/spark/query55.q.out
index 2d5ce9f..1ae7bf4 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query55.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query55.q.out
@@ -129,11 +129,11 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7, _col8
+                outputColumnNames: _col2, _col5, _col6
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: int), _col8 (type: string)
+                  keys: _col5 (type: int), _col6 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query56.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query56.q.out b/ql/src/test/results/clientpositive/perf/spark/query56.q.out
index 51b2222..1395c16 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query56.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query56.q.out
@@ -402,14 +402,14 @@ STAGE PLANS:
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col1 (type: int), _col3 (type: decimal(7,2))
-                  outputColumnNames: _col3, _col5
+                  outputColumnNames: _col2, _col4
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col3 (type: int)
+                    key expressions: _col2 (type: int)
                     sort order: +
-                    Map-reduce partition columns: _col3 (type: int)
+                    Map-reduce partition columns: _col2 (type: int)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: decimal(7,2))
+                    value expressions: _col4 (type: decimal(7,2))
         Reducer 15 
             Reduce Operator Tree:
               Join Operator
@@ -433,11 +433,11 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col4 (type: int)
-                outputColumnNames: _col1, _col8
+                  1 _col3 (type: int)
+                outputColumnNames: _col1, _col7
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   keys: _col1 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
@@ -510,14 +510,14 @@ STAGE PLANS:
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col2 (type: int), _col3 (type: decimal(7,2))
-                  outputColumnNames: _col4, _col5
+                  outputColumnNames: _col3, _col4
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col4 (type: int)
+                    key expressions: _col3 (type: int)
                     sort order: +
-                    Map-reduce partition columns: _col4 (type: int)
+                    Map-reduce partition columns: _col3 (type: int)
                     Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: decimal(7,2))
+                    value expressions: _col4 (type: decimal(7,2))
         Reducer 26 
             Reduce Operator Tree:
               Join Operator
@@ -541,11 +541,11 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col3 (type: int)
-                outputColumnNames: _col1, _col8
+                  1 _col2 (type: int)
+                outputColumnNames: _col1, _col7
                 Statistics: Num rows: 191667562 Data size: 26061245514 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   keys: _col1 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
@@ -584,11 +584,11 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col3 (type: int)
-                outputColumnNames: _col1, _col8
+                  1 _col2 (type: int)
+                outputColumnNames: _col1, _col7
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   keys: _col1 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
@@ -640,14 +640,14 @@ STAGE PLANS:
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col1 (type: int), _col3 (type: decimal(7,2))
-                  outputColumnNames: _col3, _col5
+                  outputColumnNames: _col2, _col4
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col3 (type: int)
+                    key expressions: _col2 (type: int)
                     sort order: +
-                    Map-reduce partition columns: _col3 (type: int)
+                    Map-reduce partition columns: _col2 (type: int)
                     Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: decimal(7,2))
+                    value expressions: _col4 (type: decimal(7,2))
         Reducer 4 
             Execution mode: vectorized
             Reduce Operator Tree:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query57.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query57.q.out b/ql/src/test/results/clientpositive/perf/spark/query57.q.out
index 5976141..9d54fb2 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query57.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query57.q.out
@@ -530,9 +530,9 @@ STAGE PLANS:
                           outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                           Statistics: Num rows: 15971437 Data size: 2162853414 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
-                            key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col7 (type: int)
+                            key expressions: _col0 (type: string), _col1 (type: string), _col7 (type: int), _col2 (type: string)
                             sort order: ++++
-                            Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col7 (type: int)
+                            Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col7 (type: int), _col2 (type: string)
                             Statistics: Num rows: 15971437 Data size: 2162853414 Basic stats: COMPLETE Column stats: NONE
                             value expressions: _col3 (type: int), _col4 (type: int), _col5 (type: decimal(17,2)), _col6 (type: decimal(21,6))
         Reducer 2 
@@ -660,13 +660,13 @@ STAGE PLANS:
                     predicate: rank_window_0 is not null (type: boolean)
                     Statistics: Num rows: 191657247 Data size: 25954241376 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col1 (type: string), _col0 (type: string), _col4 (type: string), _col5 (type: decimal(17,2)), rank_window_0 (type: int)
+                      expressions: _col1 (type: string), _col0 (type: string), _col4 (type: string), _col5 (type: decimal(17,2)), (rank_window_0 - 1) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 191657247 Data size: 25954241376 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), (_col4 - 1) (type: int)
+                        key expressions: _col0 (type: string), _col1 (type: string), _col4 (type: int), _col2 (type: string)
                         sort order: ++++
-                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), (_col4 - 1) (type: int)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col4 (type: int), _col2 (type: string)
                         Statistics: Num rows: 191657247 Data size: 25954241376 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col3 (type: decimal(17,2))
         Reducer 3 
@@ -738,13 +738,13 @@ STAGE PLANS:
                     predicate: rank_window_0 is not null (type: boolean)
                     Statistics: Num rows: 191657247 Data size: 25954241376 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col1 (type: string), _col0 (type: string), _col4 (type: string), _col5 (type: decimal(17,2)), rank_window_0 (type: int)
+                      expressions: _col1 (type: string), _col0 (type: string), _col4 (type: string), _col5 (type: decimal(17,2)), (rank_window_0 + 1) (type: int)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4
                       Statistics: Num rows: 191657247 Data size: 25954241376 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), (_col4 + 1) (type: int)
+                        key expressions: _col0 (type: string), _col1 (type: string), _col4 (type: int), _col2 (type: string)
                         sort order: ++++
-                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), (_col4 + 1) (type: int)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col4 (type: int), _col2 (type: string)
                         Statistics: Num rows: 191657247 Data size: 25954241376 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col3 (type: decimal(17,2))
         Reducer 6 
@@ -754,9 +754,9 @@ STAGE PLANS:
                      Inner Join 0 to 1
                      Inner Join 1 to 2
                 keys:
-                  0 _col0 (type: string), _col1 (type: string), _col2 (type: string), (_col4 + 1) (type: int)
-                  1 _col0 (type: string), _col1 (type: string), _col2 (type: string), _col7 (type: int)
-                  2 _col0 (type: string), _col1 (type: string), _col2 (type: string), (_col4 - 1) (type: int)
+                  0 _col0 (type: string), _col1 (type: string), _col4 (type: int), _col2 (type: string)
+                  1 _col0 (type: string), _col1 (type: string), _col7 (type: int), _col2 (type: string)
+                  2 _col0 (type: string), _col1 (type: string), _col4 (type: int), _col2 (type: string)
                 outputColumnNames: _col3, _col5, _col6, _col8, _col9, _col10, _col11, _col16
                 Statistics: Num rows: 421645952 Data size: 57099332264 Basic stats: COMPLETE Column stats: NONE
                 Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query58.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query58.q.out b/ql/src/test/results/clientpositive/perf/spark/query58.q.out
index c7d4039..d3c7e0b 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query58.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query58.q.out
@@ -728,12 +728,16 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: decimal(17,2)), (0.9 * _col1) (type: decimal(19,3)), (1.1 * _col1) (type: decimal(20,3))
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: decimal(17,2))
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: decimal(17,2)), _col2 (type: decimal(19,3)), _col3 (type: decimal(20,3))
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -867,12 +871,16 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: decimal(17,2)), (0.9 * _col1) (type: decimal(19,3)), (1.1 * _col1) (type: decimal(20,3))
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: decimal(17,2))
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: decimal(17,2)), _col2 (type: decimal(19,3)), _col3 (type: decimal(20,3))
         Reducer 35 
             Reduce Operator Tree:
               Join Operator
@@ -917,12 +925,16 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: decimal(17,2)), (0.9 * _col1) (type: decimal(19,3)), (1.1 * _col1) (type: decimal(20,3))
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: decimal(17,2))
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: decimal(17,2)), _col2 (type: decimal(19,3)), _col3 (type: decimal(20,3))
         Reducer 40 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -946,13 +958,13 @@ STAGE PLANS:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
                   2 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col3, _col5
+                outputColumnNames: _col0, _col1, _col2, _col3, _col5, _col6, _col7, _col9, _col10, _col11
                 Statistics: Num rows: 766650239 Data size: 67634106674 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (_col1 BETWEEN (0.9 * _col3) AND (1.1 * _col3) and _col1 BETWEEN (0.9 * _col5) AND (1.1 * _col5) and _col3 BETWEEN (0.9 * _col1) AND (1.1 * _col1) and _col3 BETWEEN (0.9 * _col5) AND (1.1 * _col5) and _col5 BETWEEN (0.9 * _col1) AND (1.1 * _col1) and _col5 BETWEEN (0.9 * _col3) AND (1.1 * _col3)) (type: boolean)
+                  predicate: (_col1 BETWEEN _col10 AND _col11 and _col1 BETWEEN _col6 AND _col7 and _col5 BETWEEN _col10 AND _col11 and _col5 BETWEEN _col2 AND _col3 and _col9 BETWEEN _col2 AND _col3 and _col9 BETWEEN _col6 AND _col7) (type: boolean)
                   Statistics: Num rows: 1442 Data size: 127213 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col0 (type: string), _col3 (type: decimal(17,2)), (((_col3 / ((_col3 + _col1) + _col5)) / 3) * 100) (type: decimal(38,17)), _col1 (type: decimal(17,2)), (((_col1 / ((_col3 + _col1) + _col5)) / 3) * 100) (type: decimal(38,17)), _col5 (type: decimal(17,2)), (((_col5 / ((_col3 + _col1) + _col5)) / 3) * 100) (type: decimal(38,17)), (((_col3 + _col1) + _col5) / 3) (type: decimal(23,6))
+                    expressions: _col0 (type: string), _col5 (type: decimal(17,2)), (((_col5 / ((_col5 + _col1) + _col9)) / 3) * 100) (type: decimal(38,17)), _col1 (type: decimal(17,2)), (((_col1 / ((_col5 + _col1) + _col9)) / 3) * 100) (type: decimal(38,17)), _col9 (type: decimal(17,2)), (((_col9 / ((_col5 + _col1) + _col9)) / 3) * 100) (type: decimal(38,17)), (((_col5 + _col1) + _col9) / 3) (type: decimal(23,6))
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                     Statistics: Num rows: 1442 Data size: 127213 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query59.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query59.q.out b/ql/src/test/results/clientpositive/perf/spark/query59.q.out
index aef93d3..c66c814 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query59.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query59.q.out
@@ -212,15 +212,15 @@ STAGE PLANS:
                     predicate: (d_date_sk is not null and d_week_seq is not null) (type: boolean)
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_week_seq (type: int), d_day_name (type: string)
-                      outputColumnNames: _col0, _col1, _col2
+                      expressions: d_date_sk (type: int), d_week_seq (type: int), (d_day_name = 'Sunday') (type: boolean), (d_day_name = 'Monday') (type: boolean), (d_day_name = 'Wednesday') (type: boolean), (d_day_name = 'Thursday') (type: boolean), (d_day_name = 'Friday') (type: boolean), (d_day_name = 'Saturday') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col5, _col6, _col7, _col8
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: string)
+                        value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean)
             Execution mode: vectorized
         Map 15 
             Map Operator Tree:
@@ -233,12 +233,12 @@ STAGE PLANS:
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_week_seq (type: int)
-                      outputColumnNames: _col1
+                      outputColumnNames: _col0
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
         Map 7 
@@ -251,15 +251,15 @@ STAGE PLANS:
                     predicate: (d_date_sk is not null and d_week_seq is not null) (type: boolean)
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int), d_week_seq (type: int), d_day_name (type: string)
-                      outputColumnNames: _col0, _col1, _col2
+                      expressions: d_date_sk (type: int), d_week_seq (type: int), (d_day_name = 'Sunday') (type: boolean), (d_day_name = 'Monday') (type: boolean), (d_day_name = 'Tuesday') (type: boolean), (d_day_name = 'Wednesday') (type: boolean), (d_day_name = 'Thursday') (type: boolean), (d_day_name = 'Friday') (type: boolean), (d_day_name = 'Saturday') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: string)
+                        value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean)
             Execution mode: vectorized
         Map 8 
             Map Operator Tree:
@@ -272,12 +272,12 @@ STAGE PLANS:
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_week_seq (type: int)
-                      outputColumnNames: _col1
+                      outputColumnNames: _col0
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
         Reducer 11 
@@ -288,10 +288,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col4, _col5
+                outputColumnNames: _col1, _col2, _col4, _col5, _col6, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col4 (type: int), _col1 (type: int), CASE WHEN ((_col5 = 'Sunday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Monday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Wednesday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Thursday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Friday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Saturday')) THEN (_col2) ELSE (null) END (type: decimal(7,2))
+                  expressions: _col4 (type: int), _col1 (type: int), CASE WHEN (_col5) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col6) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col8) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col9) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col10) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col11) THEN (_col2) ELSE (null) END (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col5, _col6, _col7, _col8
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -330,7 +330,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col1 (type: int)
+                  1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                 Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
@@ -339,12 +339,12 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6, _col7, _col11
+                  outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6, _col7, _col10
                   input vertices:
                     1 Map 16
                   Statistics: Num rows: 383325119 Data size: 33817053337 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col0 (type: int), _col11 (type: string), _col2 (type: decimal(17,2)), _col3 (type: decimal(17,2)), _col4 (type: decimal(17,2)), _col5 (type: decimal(17,2)), _col6 (type: decimal(17,2)), _col7 (type: decimal(17,2))
+                    expressions: _col0 (type: int), _col10 (type: string), _col2 (type: decimal(17,2)), _col3 (type: decimal(17,2)), _col4 (type: decimal(17,2)), _col5 (type: decimal(17,2)), _col6 (type: decimal(17,2)), _col7 (type: decimal(17,2))
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                     Statistics: Num rows: 383325119 Data size: 33817053337 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
@@ -361,10 +361,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col4, _col5
+                outputColumnNames: _col1, _col2, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col4 (type: int), _col1 (type: int), CASE WHEN ((_col5 = 'Sunday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Monday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Tuesday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Wednesday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Thursday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Friday')) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN ((_col5 = 'Saturday')) THEN (_col2) ELSE (null) END (type: decimal(7,2))
+                  expressions: _col4 (type: int), _col1 (type: int), CASE WHEN (_col5) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col6) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col7) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col8) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col9) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col10) THEN (_col2) ELSE (null) END (type: decimal(7,2)), CASE WHEN (_col11) THEN (_col2) ELSE (null) END (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -403,7 +403,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col1 (type: int)
+                  1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                 Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
@@ -412,28 +412,28 @@ STAGE PLANS:
                   keys:
                     0 _col1 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col12, _col13
+                  outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col11, _col12
                   input vertices:
                     1 Map 9
                   Statistics: Num rows: 383325119 Data size: 33817053337 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col12 (type: string), _col0 (type: int)
+                    key expressions: _col11 (type: string), _col0 (type: int)
                     sort order: ++
-                    Map-reduce partition columns: _col12 (type: string), _col0 (type: int)
+                    Map-reduce partition columns: _col11 (type: string), _col0 (type: int)
                     Statistics: Num rows: 383325119 Data size: 33817053337 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col2 (type: decimal(17,2)), _col3 (type: decimal(17,2)), _col4 (type: decimal(17,2)), _col5 (type: decimal(17,2)), _col6 (type: decimal(17,2)), _col7 (type: decimal(17,2)), _col8 (type: decimal(17,2)), _col13 (type: string)
+                    value expressions: _col2 (type: decimal(17,2)), _col3 (type: decimal(17,2)), _col4 (type: decimal(17,2)), _col5 (type: decimal(17,2)), _col6 (type: decimal(17,2)), _col7 (type: decimal(17,2)), _col8 (type: decimal(17,2)), _col12 (type: string)
         Reducer 5 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col12 (type: string), _col0 (type: int)
+                  0 _col11 (type: string), _col0 (type: int)
                   1 _col1 (type: string), (_col0 - 52) (type: int)
-                outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col12, _col13, _col16, _col17, _col18, _col19, _col20, _col21
+                outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col11, _col12, _col15, _col16, _col17, _col18, _col19, _col20
                 Statistics: Num rows: 421657640 Data size: 37198759476 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col13 (type: string), _col12 (type: string), _col0 (type: int), (_col2 / _col16) (type: decimal(37,20)), (_col3 / _col17) (type: decimal(37,20)), (_col4 / _col4) (type: decimal(37,20)), (_col5 / _col18) (type: decimal(37,20)), (_col6 / _col19) (type: decimal(37,20)), (_col7 / _col20) (type: decimal(37,20)), (_col8 / _col21) (type: decimal(37,20))
+                  expressions: _col12 (type: string), _col11 (type: string), _col0 (type: int), (_col2 / _col15) (type: decimal(37,20)), (_col3 / _col16) (type: decimal(37,20)), (_col4 / _col4) (type: decimal(37,20)), (_col5 / _col17) (type: decimal(37,20)), (_col6 / _col18) (type: decimal(37,20)), (_col7 / _col19) (type: decimal(37,20)), (_col8 / _col20) (type: decimal(37,20))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
                   Statistics: Num rows: 421657640 Data size: 37198759476 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query6.q.out b/ql/src/test/results/clientpositive/perf/spark/query6.q.out
index 454d5d6..2702aef 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query6.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query6.q.out
@@ -326,7 +326,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: (_col1 / _col2) (type: decimal(37,22)), _col0 (type: string)
+                  expressions: _col0 (type: string), (1.2 * CAST( (_col1 / _col2) AS decimal(16,6))) (type: decimal(19,7))
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 231000 Data size: 331780228 Basic stats: COMPLETE Column stats: NONE
                   Map Join Operator
@@ -340,23 +340,23 @@ STAGE PLANS:
                       1 Reducer 19
                     Statistics: Num rows: 231000 Data size: 333859228 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col1 (type: string)
+                      key expressions: _col0 (type: string)
                       sort order: +
-                      Map-reduce partition columns: _col1 (type: string)
+                      Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 231000 Data size: 333859228 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: decimal(37,22))
+                      value expressions: _col1 (type: decimal(19,7))
         Reducer 16 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: string)
+                  0 _col0 (type: string)
                   1 _col2 (type: string)
-                outputColumnNames: _col0, _col3, _col4
+                outputColumnNames: _col1, _col3, _col4
                 Statistics: Num rows: 508200 Data size: 729916518 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (_col4 > (1.2 * CAST( _col0 AS decimal(16,6)))) (type: boolean)
+                  predicate: (_col4 > _col1) (type: boolean)
                   Statistics: Num rows: 169400 Data size: 243305506 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col3 (type: int)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query60.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query60.q.out b/ql/src/test/results/clientpositive/perf/spark/query60.q.out
index 919393d..61e2e86 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query60.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query60.q.out
@@ -422,14 +422,14 @@ STAGE PLANS:
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col1 (type: int), _col3 (type: decimal(7,2))
-                  outputColumnNames: _col3, _col5
+                  outputColumnNames: _col2, _col4
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col3 (type: int)
+                    key expressions: _col2 (type: int)
                     sort order: +
-                    Map-reduce partition columns: _col3 (type: int)
+                    Map-reduce partition columns: _col2 (type: int)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: decimal(7,2))
+                    value expressions: _col4 (type: decimal(7,2))
         Reducer 15 
             Reduce Operator Tree:
               Join Operator
@@ -453,11 +453,11 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col4 (type: int)
-                outputColumnNames: _col1, _col8
+                  1 _col3 (type: int)
+                outputColumnNames: _col1, _col7
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   keys: _col1 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
@@ -531,14 +531,14 @@ STAGE PLANS:
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col2 (type: int), _col3 (type: decimal(7,2))
-                  outputColumnNames: _col4, _col5
+                  outputColumnNames: _col3, _col4
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col4 (type: int)
+                    key expressions: _col3 (type: int)
                     sort order: +
-                    Map-reduce partition columns: _col4 (type: int)
+                    Map-reduce partition columns: _col3 (type: int)
                     Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: decimal(7,2))
+                    value expressions: _col4 (type: decimal(7,2))
         Reducer 26 
             Reduce Operator Tree:
               Join Operator
@@ -562,11 +562,11 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col3 (type: int)
-                outputColumnNames: _col1, _col8
+                  1 _col2 (type: int)
+                outputColumnNames: _col1, _col7
                 Statistics: Num rows: 191667562 Data size: 26061245514 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   keys: _col1 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
@@ -606,11 +606,11 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col3 (type: int)
-                outputColumnNames: _col1, _col8
+                  1 _col2 (type: int)
+                outputColumnNames: _col1, _col7
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   keys: _col1 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
@@ -662,14 +662,14 @@ STAGE PLANS:
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col1 (type: int), _col3 (type: decimal(7,2))
-                  outputColumnNames: _col3, _col5
+                  outputColumnNames: _col2, _col4
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col3 (type: int)
+                    key expressions: _col2 (type: int)
                     sort order: +
-                    Map-reduce partition columns: _col3 (type: int)
+                    Map-reduce partition columns: _col2 (type: int)
                     Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: decimal(7,2))
+                    value expressions: _col4 (type: decimal(7,2))
         Reducer 4 
             Execution mode: vectorized
             Reduce Operator Tree:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query61.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query61.q.out b/ql/src/test/results/clientpositive/perf/spark/query61.q.out
index 66e2c14..5aad596 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query61.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query61.q.out
@@ -264,10 +264,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col2 (type: int)
-                outputColumnNames: _col8
+                outputColumnNames: _col7
                 Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   mode: hash
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: NONE
@@ -510,10 +510,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col2 (type: int)
-                outputColumnNames: _col9
+                outputColumnNames: _col8
                 Statistics: Num rows: 927646829 Data size: 81837272625 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col9)
+                  aggregations: sum(_col8)
                   mode: hash
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query63.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query63.q.out b/ql/src/test/results/clientpositive/perf/spark/query63.q.out
index 1288b30..2d905d3 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query63.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query63.q.out
@@ -135,14 +135,14 @@ STAGE PLANS:
                     Statistics: Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: i_item_sk (type: int), i_manager_id (type: int)
-                      outputColumnNames: _col0, _col4
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 462000 Data size: 663560457 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col4 (type: int)
+                        value expressions: _col1 (type: int)
             Execution mode: vectorized
         Map 7 
             Map Operator Tree:
@@ -155,14 +155,14 @@ STAGE PLANS:
                     Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_date_sk (type: int), d_moy (type: int)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: int)
+                        value expressions: _col1 (type: int)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -172,14 +172,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col2, _col3, _col8
+                outputColumnNames: _col0, _col2, _col3, _col5
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: int), _col3 (type: decimal(7,2)), _col8 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: decimal(7,2)), _col5 (type: int)
         Reducer 3 
             Local Work:
               Map Reduce Local Work
@@ -190,7 +190,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col8, _col11
+                outputColumnNames: _col2, _col3, _col5, _col7
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -198,13 +198,13 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col3, _col8, _col11
+                  outputColumnNames: _col3, _col5, _col7
                   input vertices:
                     1 Map 8
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
                     aggregations: sum(_col3)
-                    keys: _col8 (type: int), _col11 (type: int)
+                    keys: _col5 (type: int), _col7 (type: int)
                     mode: hash
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query65.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query65.q.out b/ql/src/test/results/clientpositive/perf/spark/query65.q.out
index ca18202..7b68044 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query65.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query65.q.out
@@ -219,7 +219,7 @@ STAGE PLANS:
                     outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 158398803 Data size: 13973988377 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: int), (_col1 / _col2) (type: decimal(38,13))
+                      expressions: _col0 (type: int), (0.1 * (_col1 / _col2)) (type: decimal(38,12))
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 158398803 Data size: 13973988377 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -227,7 +227,7 @@ STAGE PLANS:
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 158398803 Data size: 13973988377 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: decimal(38,13))
+                        value expressions: _col1 (type: decimal(38,12))
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -278,7 +278,7 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col2, _col4, _col6
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (_col2 <= (0.1 * _col4)) (type: boolean)
+                  predicate: (_col2 <= _col4) (type: boolean)
                   Statistics: Num rows: 232318249 Data size: 20495183367 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col1 (type: int)


[13/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query27.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query27.q.out b/ql/src/test/results/clientpositive/perf/tez/query27.q.out
index 59cca4f..d7fd2ed 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query27.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query27.q.out
@@ -94,7 +94,7 @@ Stage-0
                         Select Operator [SEL_27] (rows=1427275 width=186)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                           Merge Join Operator [MERGEJOIN_100] (rows=1427275 width=186)
-                            Conds:RS_24._col1=RS_130._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col15","_col17"]
+                            Conds:RS_24._col1=RS_130._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col11","_col13"]
                           <-Map 14 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_130]
                               PartitionCols:_col0
@@ -108,7 +108,7 @@ Stage-0
                             SHUFFLE [RS_24]
                               PartitionCols:_col1
                               Merge Join Operator [MERGEJOIN_99] (rows=1427275 width=90)
-                                Conds:RS_21._col3=RS_119._col0(Inner),Output:["_col1","_col4","_col5","_col6","_col7","_col15"]
+                                Conds:RS_21._col3=RS_119._col0(Inner),Output:["_col1","_col4","_col5","_col6","_col7","_col11"]
                               <-Map 12 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_119]
                                   PartitionCols:_col0
@@ -126,7 +126,7 @@ Stage-0
                                   <-Map 10 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_111]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_110] (rows=652 width=8)
+                                      Select Operator [SEL_110] (rows=652 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_109] (rows=652 width=8)
                                           predicate:((d_year = 2001) and d_date_sk is not null)
@@ -140,7 +140,7 @@ Stage-0
                                       <-Map 8 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_103]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_102] (rows=14776 width=269)
+                                          Select Operator [SEL_102] (rows=14776 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_101] (rows=14776 width=268)
                                               predicate:((cd_education_status = '2 yr Degree') and (cd_gender = 'M') and (cd_marital_status = 'U') and cd_demo_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query29.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query29.q.out b/ql/src/test/results/clientpositive/perf/tez/query29.q.out
index a21c3c7..19f121e 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query29.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query29.q.out
@@ -144,20 +144,20 @@ Stage-0
                 SHUFFLE [RS_49]
                   PartitionCols:_col0, _col1, _col2, _col3
                   Group By Operator [GBY_48] (rows=21091879 width=496)
-                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col14)","sum(_col22)","sum(_col3)"],keys:_col7, _col8, _col27, _col28
+                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col13)","sum(_col19)","sum(_col3)"],keys:_col6, _col7, _col22, _col23
                     Top N Key Operator [TNK_93] (rows=4156223234 width=483)
-                      keys:_col7, _col8, _col27, _col28,sort order:++++,top n:100
+                      keys:_col6, _col7, _col22, _col23,sort order:++++,top n:100
                       Merge Join Operator [MERGEJOIN_205] (rows=4156223234 width=483)
-                        Conds:RS_44._col1, _col2=RS_45._col14, _col13(Inner),Output:["_col3","_col7","_col8","_col14","_col22","_col27","_col28"]
+                        Conds:RS_44._col2, _col1=RS_45._col11, _col12(Inner),Output:["_col3","_col6","_col7","_col13","_col19","_col22","_col23"]
                       <-Reducer 2 [SIMPLE_EDGE]
                         PARTITION_ONLY_SHUFFLE [RS_44]
-                          PartitionCols:_col1, _col2
+                          PartitionCols:_col2, _col1
                           Merge Join Operator [MERGEJOIN_199] (rows=7638375 width=10)
                             Conds:RS_216._col0=RS_208._col0(Inner),Output:["_col1","_col2","_col3"]
                           <-Map 8 [SIMPLE_EDGE] vectorized
                             PARTITION_ONLY_SHUFFLE [RS_208]
                               PartitionCols:_col0
-                              Select Operator [SEL_207] (rows=1957 width=8)
+                              Select Operator [SEL_207] (rows=1957 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_206] (rows=1957 width=8)
                                   predicate:((d_year) IN (1999, 2000, 2001) and d_date_sk is not null)
@@ -185,11 +185,11 @@ Stage-0
                                                Please refer to the previous Select Operator [SEL_207]
                       <-Reducer 14 [SIMPLE_EDGE]
                         SHUFFLE [RS_45]
-                          PartitionCols:_col14, _col13
+                          PartitionCols:_col11, _col12
                           Select Operator [SEL_40] (rows=21091879 width=484)
-                            Output:["_col1","_col2","_col8","_col13","_col14","_col16","_col21","_col22"]
+                            Output:["_col1","_col2","_col8","_col11","_col12","_col14","_col17","_col18"]
                             Merge Join Operator [MERGEJOIN_204] (rows=21091879 width=484)
-                              Conds:RS_37._col3=RS_249._col0(Inner),Output:["_col5","_col10","_col11","_col13","_col18","_col19","_col21","_col22"]
+                              Conds:RS_37._col3=RS_249._col0(Inner),Output:["_col5","_col8","_col9","_col11","_col14","_col15","_col17","_col18"]
                             <-Map 23 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_249]
                                 PartitionCols:_col0
@@ -203,7 +203,7 @@ Stage-0
                               SHUFFLE [RS_37]
                                 PartitionCols:_col3
                                 Merge Join Operator [MERGEJOIN_203] (rows=21091879 width=298)
-                                  Conds:RS_34._col1=RS_246._col0(Inner),Output:["_col3","_col5","_col10","_col11","_col13","_col18","_col19"]
+                                  Conds:RS_34._col1=RS_246._col0(Inner),Output:["_col3","_col5","_col8","_col9","_col11","_col14","_col15"]
                                 <-Map 22 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_246]
                                     PartitionCols:_col0
@@ -217,7 +217,7 @@ Stage-0
                                   SHUFFLE [RS_34]
                                     PartitionCols:_col1
                                     Merge Join Operator [MERGEJOIN_202] (rows=21091879 width=18)
-                                      Conds:RS_31._col1, _col2, _col4=RS_32._col1, _col2, _col3(Inner),Output:["_col1","_col3","_col5","_col10","_col11","_col13"]
+                                      Conds:RS_31._col1, _col2, _col4=RS_32._col1, _col2, _col3(Inner),Output:["_col1","_col3","_col5","_col8","_col9","_col11"]
                                     <-Reducer 17 [SIMPLE_EDGE]
                                       PARTITION_ONLY_SHUFFLE [RS_32]
                                         PartitionCols:_col1, _col2, _col3
@@ -226,7 +226,7 @@ Stage-0
                                         <-Map 15 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_223]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_220] (rows=201 width=12)
+                                            Select Operator [SEL_220] (rows=201 width=4)
                                               Output:["_col0"]
                                               Filter Operator [FIL_218] (rows=201 width=12)
                                                 predicate:((d_year = 1999) and d_date_sk is not null and d_moy BETWEEN 4 AND 7)
@@ -249,7 +249,7 @@ Stage-0
                                         <-Map 15 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_221]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_219] (rows=50 width=12)
+                                            Select Operator [SEL_219] (rows=50 width=4)
                                               Output:["_col0"]
                                               Filter Operator [FIL_217] (rows=50 width=12)
                                                 predicate:((d_moy = 4) and (d_year = 1999) and d_date_sk is not null)
@@ -315,7 +315,7 @@ Stage-0
                                                       PARTITION_ONLY_SHUFFLE [RS_146]
                                                         Group By Operator [GBY_145] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_144] (rows=7638375 width=6)
+                                                          Select Operator [SEL_144] (rows=7638375 width=8)
                                                             Output:["_col0"]
                                                              Please refer to the previous Merge Join Operator [MERGEJOIN_199]
                                                 <-Reducer 7 [BROADCAST_EDGE] vectorized
@@ -326,7 +326,7 @@ Stage-0
                                                       PARTITION_ONLY_SHUFFLE [RS_151]
                                                         Group By Operator [GBY_150] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_149] (rows=7638375 width=8)
+                                                          Select Operator [SEL_149] (rows=7638375 width=6)
                                                             Output:["_col0"]
                                                              Please refer to the previous Merge Join Operator [MERGEJOIN_199]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query3.q.out b/ql/src/test/results/clientpositive/perf/tez/query3.q.out
index d4296cf..e31c994 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query3.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query3.q.out
@@ -75,13 +75,13 @@ Stage-0
                 SHUFFLE [RS_17]
                   PartitionCols:_col0, _col1, _col2
                   Group By Operator [GBY_16] (rows=274400 width=220)
-                    Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col2)"],keys:_col8, _col4, _col5
+                    Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col2)"],keys:_col7, _col4, _col5
                     Merge Join Operator [MERGEJOIN_53] (rows=589741 width=108)
-                      Conds:RS_12._col0=RS_64._col0(Inner),Output:["_col2","_col4","_col5","_col8"]
+                      Conds:RS_12._col0=RS_64._col0(Inner),Output:["_col2","_col4","_col5","_col7"]
                     <-Map 8 [SIMPLE_EDGE] vectorized
                       PARTITION_ONLY_SHUFFLE [RS_64]
                         PartitionCols:_col0
-                        Select Operator [SEL_63] (rows=5619 width=12)
+                        Select Operator [SEL_63] (rows=5619 width=8)
                           Output:["_col0","_col1"]
                           Filter Operator [FIL_62] (rows=5619 width=12)
                             predicate:((d_moy = 12) and d_date_sk is not null)
@@ -95,7 +95,7 @@ Stage-0
                         <-Map 6 [SIMPLE_EDGE] vectorized
                           PARTITION_ONLY_SHUFFLE [RS_56]
                             PartitionCols:_col0
-                            Select Operator [SEL_55] (rows=669 width=111)
+                            Select Operator [SEL_55] (rows=669 width=107)
                               Output:["_col0","_col1","_col2"]
                               Filter Operator [FIL_54] (rows=669 width=111)
                                 predicate:((i_manufact_id = 436) and i_item_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query30.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query30.q.out b/ql/src/test/results/clientpositive/perf/tez/query30.q.out
index 9f9559e..d3381b3 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query30.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query30.q.out
@@ -97,7 +97,7 @@ Stage-0
               Select Operator [SEL_62] (rows=691171 width=942)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12"]
                 Merge Join Operator [MERGEJOIN_177] (rows=691171 width=942)
-                  Conds:RS_59._col0=RS_60._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col18"]
+                  Conds:RS_59._col0=RS_60._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col17"]
                 <-Reducer 2 [SIMPLE_EDGE]
                   SHUFFLE [RS_59]
                     PartitionCols:_col0
@@ -106,7 +106,7 @@ Stage-0
                     <-Map 5 [SIMPLE_EDGE] vectorized
                       SHUFFLE [RS_187]
                         PartitionCols:_col0
-                        Select Operator [SEL_184] (rows=784314 width=90)
+                        Select Operator [SEL_184] (rows=784314 width=4)
                           Output:["_col0"]
                           Filter Operator [FIL_181] (rows=784314 width=90)
                             predicate:((ca_state = 'IL') and ca_address_sk is not null)
@@ -145,9 +145,9 @@ Stage-0
                                     SHUFFLE [RS_43]
                                       PartitionCols:_col0
                                       Group By Operator [GBY_42] (rows=3923529 width=201)
-                                        Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col7, _col1
+                                        Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col6, _col1
                                         Merge Join Operator [MERGEJOIN_175] (rows=3923529 width=184)
-                                          Conds:RS_38._col2=RS_189._col0(Inner),Output:["_col1","_col3","_col7"]
+                                          Conds:RS_38._col2=RS_189._col0(Inner),Output:["_col1","_col3","_col6"]
                                         <-Map 5 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_189]
                                             PartitionCols:_col0
@@ -173,7 +173,7 @@ Stage-0
                                             <-Map 14 [SIMPLE_EDGE] vectorized
                                               SHUFFLE [RS_199]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_197] (rows=652 width=8)
+                                                Select Operator [SEL_197] (rows=652 width=4)
                                                   Output:["_col0"]
                                                   Filter Operator [FIL_196] (rows=652 width=8)
                                                     predicate:((d_year = 2002) and d_date_sk is not null)
@@ -190,9 +190,9 @@ Stage-0
                                 SHUFFLE [RS_23]
                                   PartitionCols:_col0, _col1
                                   Group By Operator [GBY_22] (rows=3746772 width=201)
-                                    Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col7, _col1
+                                    Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col6, _col1
                                     Merge Join Operator [MERGEJOIN_173] (rows=3746772 width=184)
-                                      Conds:RS_18._col2=RS_188._col0(Inner),Output:["_col1","_col3","_col7"]
+                                      Conds:RS_18._col2=RS_188._col0(Inner),Output:["_col1","_col3","_col6"]
                                     <-Map 5 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_188]
                                         PartitionCols:_col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query31.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query31.q.out b/ql/src/test/results/clientpositive/perf/tez/query31.q.out
index 32d06b6..c0762b7 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query31.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query31.q.out
@@ -157,32 +157,32 @@ Stage-0
       File Output Operator [FS_139]
         Select Operator [SEL_138] (rows=110 width=550)
           Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-          Filter Operator [FIL_136] (rows=110 width=770)
-            predicate:(CASE WHEN ((_col1 > 0)) THEN (CASE WHEN ((_col9 > 0)) THEN (((_col11 / _col9) > (_col5 / _col1))) ELSE ((null > (_col5 / _col1))) END) ELSE (CASE WHEN ((_col9 > 0)) THEN (((_col11 / _col9) > null)) ELSE (null) END) END and CASE WHEN ((_col3 > 0)) THEN (CASE WHEN ((_col7 > 0)) THEN (((_col9 / _col7) > (_col1 / _col3))) ELSE ((null > (_col1 / _col3))) END) ELSE (CASE WHEN ((_col7 > 0)) THEN (((_col9 / _col7) > null)) ELSE (null) END) END)
-            Merge Join Operator [MERGEJOIN_450] (rows=440 width=770)
-              Conds:RS_133._col0=RS_134._col0(Inner),Output:["_col0","_col1","_col3","_col5","_col7","_col9","_col11"]
+          Filter Operator [FIL_136] (rows=110 width=778)
+            predicate:(CASE WHEN ((_col11 > 0)) THEN (CASE WHEN (_col2) THEN (((_col6 / _col1) > (_col9 / _col11))) ELSE ((null > (_col9 / _col11))) END) ELSE (CASE WHEN (_col2) THEN (((_col6 / _col1) > null)) ELSE (null) END) END and CASE WHEN ((_col9 > 0)) THEN (CASE WHEN (_col7) THEN (((_col4 / _col6) > (_col13 / _col9))) ELSE ((null > (_col13 / _col9))) END) ELSE (CASE WHEN (_col7) THEN (((_col4 / _col6) > null)) ELSE (null) END) END)
+            Merge Join Operator [MERGEJOIN_450] (rows=440 width=778)
+              Conds:RS_133._col0=RS_134._col0(Inner),Output:["_col1","_col2","_col4","_col6","_col7","_col8","_col9","_col11","_col13"]
             <-Reducer 22 [ONE_TO_ONE_EDGE]
               FORWARD [RS_134]
                 PartitionCols:_col0
-                Merge Join Operator [MERGEJOIN_449] (rows=440 width=434)
-                  Conds:RS_123._col0=RS_536._col0(Inner),Output:["_col0","_col1","_col3","_col5"]
+                Merge Join Operator [MERGEJOIN_448] (rows=1605 width=434)
+                  Conds:RS_123._col0=RS_538._col0(Inner),Output:["_col0","_col1","_col3","_col5"]
                 <-Reducer 21 [ONE_TO_ONE_EDGE]
                   FORWARD [RS_123]
                     PartitionCols:_col0
-                    Merge Join Operator [MERGEJOIN_448] (rows=440 width=322)
-                      Conds:RS_522._col0=RS_529._col0(Inner),Output:["_col0","_col1","_col3"]
+                    Merge Join Operator [MERGEJOIN_447] (rows=1605 width=322)
+                      Conds:RS_524._col0=RS_531._col0(Inner),Output:["_col0","_col1","_col3"]
                     <-Reducer 20 [ONE_TO_ONE_EDGE] vectorized
-                      FORWARD [RS_522]
+                      FORWARD [RS_524]
                         PartitionCols:_col0
-                        Group By Operator [GBY_521] (rows=440 width=210)
+                        Group By Operator [GBY_523] (rows=1605 width=210)
                           Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
                         <-Reducer 19 [SIMPLE_EDGE]
                           SHUFFLE [RS_77]
                             PartitionCols:_col0
-                            Group By Operator [GBY_76] (rows=3960 width=210)
-                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col7
-                              Merge Join Operator [MERGEJOIN_441] (rows=10246882 width=209)
-                                Conds:RS_72._col1=RS_497._col0(Inner),Output:["_col2","_col7"]
+                            Group By Operator [GBY_76] (rows=33705 width=210)
+                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col5
+                              Merge Join Operator [MERGEJOIN_441] (rows=37399561 width=139)
+                                Conds:RS_72._col1=RS_497._col0(Inner),Output:["_col2","_col5"]
                               <-Map 32 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_497]
                                   PartitionCols:_col0
@@ -195,29 +195,29 @@ Stage-0
                               <-Reducer 18 [SIMPLE_EDGE]
                                 SHUFFLE [RS_72]
                                   PartitionCols:_col1
-                                  Merge Join Operator [MERGEJOIN_440] (rows=10246882 width=115)
-                                    Conds:RS_520._col0=RS_469._col0(Inner),Output:["_col1","_col2"]
+                                  Merge Join Operator [MERGEJOIN_440] (rows=37399561 width=42)
+                                    Conds:RS_522._col0=RS_469._col0(Inner),Output:["_col1","_col2"]
                                   <-Map 8 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_469]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_460] (rows=130 width=12)
+                                      Select Operator [SEL_460] (rows=130 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_454] (rows=130 width=12)
-                                          predicate:((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null)
+                                          predicate:((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null)
                                           TableScan [TS_3] (rows=73049 width=12)
                                             default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year","d_qoy"]
                                   <-Map 35 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_520]
+                                    SHUFFLE [RS_522]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_519] (rows=143931246 width=119)
+                                      Select Operator [SEL_521] (rows=525327191 width=114)
                                         Output:["_col0","_col1","_col2"]
-                                        Filter Operator [FIL_518] (rows=143931246 width=119)
-                                          predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_70_date_dim_d_date_sk_min) AND DynamicValue(RS_70_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_70_date_dim_d_date_sk_bloom_filter))) and ws_bill_addr_sk is not null and ws_sold_date_sk is not null)
-                                          TableScan [TS_60] (rows=144002668 width=119)
-                                            default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_addr_sk","ws_ext_sales_price"]
+                                        Filter Operator [FIL_520] (rows=525327191 width=114)
+                                          predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_70_date_dim_d_date_sk_min) AND DynamicValue(RS_70_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_70_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_sold_date_sk is not null)
+                                          TableScan [TS_60] (rows=575995635 width=114)
+                                            default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_addr_sk","ss_ext_sales_price"]
                                           <-Reducer 23 [BROADCAST_EDGE] vectorized
-                                            BROADCAST [RS_517]
-                                              Group By Operator [GBY_516] (rows=1 width=12)
+                                            BROADCAST [RS_519]
+                                              Group By Operator [GBY_518] (rows=1 width=12)
                                                 Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                               <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
                                                 PARTITION_ONLY_SHUFFLE [RS_484]
@@ -227,17 +227,17 @@ Stage-0
                                                       Output:["_col0"]
                                                        Please refer to the previous Select Operator [SEL_460]
                     <-Reducer 26 [ONE_TO_ONE_EDGE] vectorized
-                      FORWARD [RS_529]
+                      FORWARD [RS_531]
                         PartitionCols:_col0
-                        Group By Operator [GBY_528] (rows=440 width=210)
+                        Group By Operator [GBY_530] (rows=1605 width=210)
                           Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
                         <-Reducer 25 [SIMPLE_EDGE]
                           SHUFFLE [RS_97]
                             PartitionCols:_col0
-                            Group By Operator [GBY_96] (rows=3960 width=210)
-                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col7
-                              Merge Join Operator [MERGEJOIN_443] (rows=10246882 width=209)
-                                Conds:RS_92._col1=RS_498._col0(Inner),Output:["_col2","_col7"]
+                            Group By Operator [GBY_96] (rows=33705 width=210)
+                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col5
+                              Merge Join Operator [MERGEJOIN_443] (rows=37399561 width=139)
+                                Conds:RS_92._col1=RS_498._col0(Inner),Output:["_col2","_col5"]
                               <-Map 32 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_498]
                                   PartitionCols:_col0
@@ -245,28 +245,28 @@ Stage-0
                               <-Reducer 24 [SIMPLE_EDGE]
                                 SHUFFLE [RS_92]
                                   PartitionCols:_col1
-                                  Merge Join Operator [MERGEJOIN_442] (rows=10246882 width=115)
-                                    Conds:RS_527._col0=RS_471._col0(Inner),Output:["_col1","_col2"]
+                                  Merge Join Operator [MERGEJOIN_442] (rows=37399561 width=42)
+                                    Conds:RS_529._col0=RS_471._col0(Inner),Output:["_col1","_col2"]
                                   <-Map 8 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_471]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_461] (rows=130 width=12)
+                                      Select Operator [SEL_461] (rows=130 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_455] (rows=130 width=12)
-                                          predicate:((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null)
+                                          predicate:((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null)
                                            Please refer to the previous TableScan [TS_3]
                                   <-Map 36 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_527]
+                                    SHUFFLE [RS_529]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_526] (rows=143931246 width=119)
+                                      Select Operator [SEL_528] (rows=525327191 width=114)
                                         Output:["_col0","_col1","_col2"]
-                                        Filter Operator [FIL_525] (rows=143931246 width=119)
-                                          predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_90_date_dim_d_date_sk_min) AND DynamicValue(RS_90_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_90_date_dim_d_date_sk_bloom_filter))) and ws_bill_addr_sk is not null and ws_sold_date_sk is not null)
-                                          TableScan [TS_80] (rows=144002668 width=119)
-                                            default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_addr_sk","ws_ext_sales_price"]
+                                        Filter Operator [FIL_527] (rows=525327191 width=114)
+                                          predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_90_date_dim_d_date_sk_min) AND DynamicValue(RS_90_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_90_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_sold_date_sk is not null)
+                                          TableScan [TS_80] (rows=575995635 width=114)
+                                            default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_addr_sk","ss_ext_sales_price"]
                                           <-Reducer 27 [BROADCAST_EDGE] vectorized
-                                            BROADCAST [RS_524]
-                                              Group By Operator [GBY_523] (rows=1 width=12)
+                                            BROADCAST [RS_526]
+                                              Group By Operator [GBY_525] (rows=1 width=12)
                                                 Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                               <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
                                                 PARTITION_ONLY_SHUFFLE [RS_485]
@@ -276,17 +276,17 @@ Stage-0
                                                       Output:["_col0"]
                                                        Please refer to the previous Select Operator [SEL_461]
                 <-Reducer 30 [ONE_TO_ONE_EDGE] vectorized
-                  FORWARD [RS_536]
+                  FORWARD [RS_538]
                     PartitionCols:_col0
-                    Group By Operator [GBY_535] (rows=440 width=210)
+                    Group By Operator [GBY_537] (rows=1605 width=210)
                       Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
                     <-Reducer 29 [SIMPLE_EDGE]
                       SHUFFLE [RS_117]
                         PartitionCols:_col0
-                        Group By Operator [GBY_116] (rows=3960 width=210)
-                          Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col7
-                          Merge Join Operator [MERGEJOIN_445] (rows=10246882 width=209)
-                            Conds:RS_112._col1=RS_499._col0(Inner),Output:["_col2","_col7"]
+                        Group By Operator [GBY_116] (rows=33705 width=210)
+                          Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col5
+                          Merge Join Operator [MERGEJOIN_445] (rows=37399561 width=139)
+                            Conds:RS_112._col1=RS_499._col0(Inner),Output:["_col2","_col5"]
                           <-Map 32 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_499]
                               PartitionCols:_col0
@@ -294,28 +294,28 @@ Stage-0
                           <-Reducer 28 [SIMPLE_EDGE]
                             SHUFFLE [RS_112]
                               PartitionCols:_col1
-                              Merge Join Operator [MERGEJOIN_444] (rows=10246882 width=115)
-                                Conds:RS_534._col0=RS_473._col0(Inner),Output:["_col1","_col2"]
+                              Merge Join Operator [MERGEJOIN_444] (rows=37399561 width=42)
+                                Conds:RS_536._col0=RS_473._col0(Inner),Output:["_col1","_col2"]
                               <-Map 8 [SIMPLE_EDGE] vectorized
                                 PARTITION_ONLY_SHUFFLE [RS_473]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_462] (rows=130 width=12)
+                                  Select Operator [SEL_462] (rows=130 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_456] (rows=130 width=12)
                                       predicate:((d_qoy = 3) and (d_year = 2000) and d_date_sk is not null)
                                        Please refer to the previous TableScan [TS_3]
                               <-Map 37 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_534]
+                                SHUFFLE [RS_536]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_533] (rows=143931246 width=119)
+                                  Select Operator [SEL_535] (rows=525327191 width=114)
                                     Output:["_col0","_col1","_col2"]
-                                    Filter Operator [FIL_532] (rows=143931246 width=119)
-                                      predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_110_date_dim_d_date_sk_min) AND DynamicValue(RS_110_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_110_date_dim_d_date_sk_bloom_filter))) and ws_bill_addr_sk is not null and ws_sold_date_sk is not null)
-                                      TableScan [TS_100] (rows=144002668 width=119)
-                                        default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_addr_sk","ws_ext_sales_price"]
+                                    Filter Operator [FIL_534] (rows=525327191 width=114)
+                                      predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_110_date_dim_d_date_sk_min) AND DynamicValue(RS_110_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_110_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_sold_date_sk is not null)
+                                      TableScan [TS_100] (rows=575995635 width=114)
+                                        default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_addr_sk","ss_ext_sales_price"]
                                       <-Reducer 31 [BROADCAST_EDGE] vectorized
-                                        BROADCAST [RS_531]
-                                          Group By Operator [GBY_530] (rows=1 width=12)
+                                        BROADCAST [RS_533]
+                                          Group By Operator [GBY_532] (rows=1 width=12)
                                             Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                           <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
                                             PARTITION_ONLY_SHUFFLE [RS_486]
@@ -327,74 +327,76 @@ Stage-0
             <-Reducer 6 [ONE_TO_ONE_EDGE]
               FORWARD [RS_133]
                 PartitionCols:_col0
-                Merge Join Operator [MERGEJOIN_447] (rows=1605 width=434)
-                  Conds:RS_130._col0=RS_515._col0(Inner),Output:["_col0","_col1","_col3","_col5"]
+                Merge Join Operator [MERGEJOIN_449] (rows=440 width=442)
+                  Conds:RS_130._col0=RS_517._col0(Inner),Output:["_col0","_col1","_col2","_col4","_col6","_col7"]
                 <-Reducer 16 [ONE_TO_ONE_EDGE] vectorized
-                  FORWARD [RS_515]
+                  FORWARD [RS_517]
                     PartitionCols:_col0
-                    Group By Operator [GBY_514] (rows=1605 width=210)
-                      Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                    <-Reducer 15 [SIMPLE_EDGE]
-                      SHUFFLE [RS_57]
-                        PartitionCols:_col0
-                        Group By Operator [GBY_56] (rows=33705 width=210)
-                          Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col7
-                          Merge Join Operator [MERGEJOIN_439] (rows=37399561 width=139)
-                            Conds:RS_52._col1=RS_496._col0(Inner),Output:["_col2","_col7"]
-                          <-Map 32 [SIMPLE_EDGE] vectorized
-                            SHUFFLE [RS_496]
-                              PartitionCols:_col0
-                               Please refer to the previous Select Operator [SEL_493]
-                          <-Reducer 14 [SIMPLE_EDGE]
-                            SHUFFLE [RS_52]
-                              PartitionCols:_col1
-                              Merge Join Operator [MERGEJOIN_438] (rows=37399561 width=42)
-                                Conds:RS_513._col0=RS_467._col0(Inner),Output:["_col1","_col2"]
-                              <-Map 8 [SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_467]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_459] (rows=130 width=12)
-                                    Output:["_col0"]
-                                    Filter Operator [FIL_453] (rows=130 width=12)
-                                      predicate:((d_qoy = 3) and (d_year = 2000) and d_date_sk is not null)
-                                       Please refer to the previous TableScan [TS_3]
-                              <-Map 34 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_513]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_512] (rows=525327191 width=114)
-                                    Output:["_col0","_col1","_col2"]
-                                    Filter Operator [FIL_511] (rows=525327191 width=114)
-                                      predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_50_date_dim_d_date_sk_min) AND DynamicValue(RS_50_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_50_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_sold_date_sk is not null)
-                                      TableScan [TS_40] (rows=575995635 width=114)
-                                        default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_addr_sk","ss_ext_sales_price"]
-                                      <-Reducer 17 [BROADCAST_EDGE] vectorized
-                                        BROADCAST [RS_510]
-                                          Group By Operator [GBY_509] (rows=1 width=12)
-                                            Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                          <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                            PARTITION_ONLY_SHUFFLE [RS_483]
-                                              Group By Operator [GBY_477] (rows=1 width=12)
-                                                Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                Select Operator [SEL_468] (rows=130 width=4)
-                                                  Output:["_col0"]
-                                                   Please refer to the previous Select Operator [SEL_459]
+                    Select Operator [SEL_516] (rows=440 width=214)
+                      Output:["_col0","_col1","_col2"]
+                      Group By Operator [GBY_515] (rows=440 width=210)
+                        Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                      <-Reducer 15 [SIMPLE_EDGE]
+                        SHUFFLE [RS_57]
+                          PartitionCols:_col0
+                          Group By Operator [GBY_56] (rows=3960 width=210)
+                            Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col5
+                            Merge Join Operator [MERGEJOIN_439] (rows=10246882 width=209)
+                              Conds:RS_52._col1=RS_496._col0(Inner),Output:["_col2","_col5"]
+                            <-Map 32 [SIMPLE_EDGE] vectorized
+                              SHUFFLE [RS_496]
+                                PartitionCols:_col0
+                                 Please refer to the previous Select Operator [SEL_493]
+                            <-Reducer 14 [SIMPLE_EDGE]
+                              SHUFFLE [RS_52]
+                                PartitionCols:_col1
+                                Merge Join Operator [MERGEJOIN_438] (rows=10246882 width=115)
+                                  Conds:RS_514._col0=RS_467._col0(Inner),Output:["_col1","_col2"]
+                                <-Map 8 [SIMPLE_EDGE] vectorized
+                                  PARTITION_ONLY_SHUFFLE [RS_467]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_459] (rows=130 width=4)
+                                      Output:["_col0"]
+                                      Filter Operator [FIL_453] (rows=130 width=12)
+                                        predicate:((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null)
+                                         Please refer to the previous TableScan [TS_3]
+                                <-Map 34 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_514]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_513] (rows=143931246 width=119)
+                                      Output:["_col0","_col1","_col2"]
+                                      Filter Operator [FIL_512] (rows=143931246 width=119)
+                                        predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_50_date_dim_d_date_sk_min) AND DynamicValue(RS_50_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_50_date_dim_d_date_sk_bloom_filter))) and ws_bill_addr_sk is not null and ws_sold_date_sk is not null)
+                                        TableScan [TS_40] (rows=144002668 width=119)
+                                          default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_addr_sk","ws_ext_sales_price"]
+                                        <-Reducer 17 [BROADCAST_EDGE] vectorized
+                                          BROADCAST [RS_511]
+                                            Group By Operator [GBY_510] (rows=1 width=12)
+                                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                            <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
+                                              PARTITION_ONLY_SHUFFLE [RS_483]
+                                                Group By Operator [GBY_477] (rows=1 width=12)
+                                                  Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                  Select Operator [SEL_468] (rows=130 width=4)
+                                                    Output:["_col0"]
+                                                     Please refer to the previous Select Operator [SEL_459]
                 <-Reducer 5 [ONE_TO_ONE_EDGE]
                   FORWARD [RS_130]
                     PartitionCols:_col0
-                    Merge Join Operator [MERGEJOIN_446] (rows=1605 width=322)
-                      Conds:RS_501._col0=RS_508._col0(Inner),Output:["_col0","_col1","_col3"]
+                    Merge Join Operator [MERGEJOIN_446] (rows=440 width=326)
+                      Conds:RS_502._col0=RS_509._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
                     <-Reducer 12 [ONE_TO_ONE_EDGE] vectorized
-                      FORWARD [RS_508]
+                      FORWARD [RS_509]
                         PartitionCols:_col0
-                        Group By Operator [GBY_507] (rows=1605 width=210)
+                        Group By Operator [GBY_508] (rows=440 width=210)
                           Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
                         <-Reducer 11 [SIMPLE_EDGE]
                           SHUFFLE [RS_37]
                             PartitionCols:_col0
-                            Group By Operator [GBY_36] (rows=33705 width=210)
-                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col7
-                              Merge Join Operator [MERGEJOIN_437] (rows=37399561 width=139)
-                                Conds:RS_32._col1=RS_495._col0(Inner),Output:["_col2","_col7"]
+                            Group By Operator [GBY_36] (rows=3960 width=210)
+                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col5
+                              Merge Join Operator [MERGEJOIN_437] (rows=10246882 width=209)
+                                Conds:RS_32._col1=RS_495._col0(Inner),Output:["_col2","_col5"]
                               <-Map 32 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_495]
                                   PartitionCols:_col0
@@ -402,28 +404,28 @@ Stage-0
                               <-Reducer 10 [SIMPLE_EDGE]
                                 SHUFFLE [RS_32]
                                   PartitionCols:_col1
-                                  Merge Join Operator [MERGEJOIN_436] (rows=37399561 width=42)
-                                    Conds:RS_506._col0=RS_465._col0(Inner),Output:["_col1","_col2"]
+                                  Merge Join Operator [MERGEJOIN_436] (rows=10246882 width=115)
+                                    Conds:RS_507._col0=RS_465._col0(Inner),Output:["_col1","_col2"]
                                   <-Map 8 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_465]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_458] (rows=130 width=12)
+                                      Select Operator [SEL_458] (rows=130 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_452] (rows=130 width=12)
-                                          predicate:((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null)
+                                          predicate:((d_qoy = 3) and (d_year = 2000) and d_date_sk is not null)
                                            Please refer to the previous TableScan [TS_3]
                                   <-Map 33 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_506]
+                                    SHUFFLE [RS_507]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_505] (rows=525327191 width=114)
+                                      Select Operator [SEL_506] (rows=143931246 width=119)
                                         Output:["_col0","_col1","_col2"]
-                                        Filter Operator [FIL_504] (rows=525327191 width=114)
-                                          predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_30_date_dim_d_date_sk_min) AND DynamicValue(RS_30_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_30_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_sold_date_sk is not null)
-                                          TableScan [TS_20] (rows=575995635 width=114)
-                                            default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_addr_sk","ss_ext_sales_price"]
+                                        Filter Operator [FIL_505] (rows=143931246 width=119)
+                                          predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_30_date_dim_d_date_sk_min) AND DynamicValue(RS_30_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_30_date_dim_d_date_sk_bloom_filter))) and ws_bill_addr_sk is not null and ws_sold_date_sk is not null)
+                                          TableScan [TS_20] (rows=144002668 width=119)
+                                            default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_addr_sk","ws_ext_sales_price"]
                                           <-Reducer 13 [BROADCAST_EDGE] vectorized
-                                            BROADCAST [RS_503]
-                                              Group By Operator [GBY_502] (rows=1 width=12)
+                                            BROADCAST [RS_504]
+                                              Group By Operator [GBY_503] (rows=1 width=12)
                                                 Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                               <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
                                                 PARTITION_ONLY_SHUFFLE [RS_482]
@@ -433,52 +435,54 @@ Stage-0
                                                       Output:["_col0"]
                                                        Please refer to the previous Select Operator [SEL_458]
                     <-Reducer 4 [ONE_TO_ONE_EDGE] vectorized
-                      FORWARD [RS_501]
+                      FORWARD [RS_502]
                         PartitionCols:_col0
-                        Group By Operator [GBY_500] (rows=1605 width=210)
-                          Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                        <-Reducer 3 [SIMPLE_EDGE]
-                          SHUFFLE [RS_17]
-                            PartitionCols:_col0
-                            Group By Operator [GBY_16] (rows=33705 width=210)
-                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col7
-                              Merge Join Operator [MERGEJOIN_435] (rows=37399561 width=139)
-                                Conds:RS_12._col1=RS_494._col0(Inner),Output:["_col2","_col7"]
-                              <-Map 32 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_494]
-                                  PartitionCols:_col0
-                                   Please refer to the previous Select Operator [SEL_493]
-                              <-Reducer 2 [SIMPLE_EDGE]
-                                SHUFFLE [RS_12]
-                                  PartitionCols:_col1
-                                  Merge Join Operator [MERGEJOIN_434] (rows=37399561 width=42)
-                                    Conds:RS_491._col0=RS_463._col0(Inner),Output:["_col1","_col2"]
-                                  <-Map 8 [SIMPLE_EDGE] vectorized
-                                    PARTITION_ONLY_SHUFFLE [RS_463]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_457] (rows=130 width=12)
-                                        Output:["_col0"]
-                                        Filter Operator [FIL_451] (rows=130 width=12)
-                                          predicate:((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null)
-                                           Please refer to the previous TableScan [TS_3]
-                                  <-Map 1 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_491]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_490] (rows=525327191 width=114)
-                                        Output:["_col0","_col1","_col2"]
-                                        Filter Operator [FIL_489] (rows=525327191 width=114)
-                                          predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_10_date_dim_d_date_sk_min) AND DynamicValue(RS_10_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_10_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_sold_date_sk is not null)
-                                          TableScan [TS_0] (rows=575995635 width=114)
-                                            default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_addr_sk","ss_ext_sales_price"]
-                                          <-Reducer 9 [BROADCAST_EDGE] vectorized
-                                            BROADCAST [RS_488]
-                                              Group By Operator [GBY_487] (rows=1 width=12)
-                                                Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                              <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                PARTITION_ONLY_SHUFFLE [RS_481]
-                                                  Group By Operator [GBY_475] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                    Select Operator [SEL_464] (rows=130 width=4)
-                                                      Output:["_col0"]
-                                                       Please refer to the previous Select Operator [SEL_457]
+                        Select Operator [SEL_501] (rows=440 width=214)
+                          Output:["_col0","_col1","_col2"]
+                          Group By Operator [GBY_500] (rows=440 width=210)
+                            Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                          <-Reducer 3 [SIMPLE_EDGE]
+                            SHUFFLE [RS_17]
+                              PartitionCols:_col0
+                              Group By Operator [GBY_16] (rows=3960 width=210)
+                                Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col5
+                                Merge Join Operator [MERGEJOIN_435] (rows=10246882 width=209)
+                                  Conds:RS_12._col1=RS_494._col0(Inner),Output:["_col2","_col5"]
+                                <-Map 32 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_494]
+                                    PartitionCols:_col0
+                                     Please refer to the previous Select Operator [SEL_493]
+                                <-Reducer 2 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_12]
+                                    PartitionCols:_col1
+                                    Merge Join Operator [MERGEJOIN_434] (rows=10246882 width=115)
+                                      Conds:RS_491._col0=RS_463._col0(Inner),Output:["_col1","_col2"]
+                                    <-Map 8 [SIMPLE_EDGE] vectorized
+                                      PARTITION_ONLY_SHUFFLE [RS_463]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_457] (rows=130 width=4)
+                                          Output:["_col0"]
+                                          Filter Operator [FIL_451] (rows=130 width=12)
+                                            predicate:((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null)
+                                             Please refer to the previous TableScan [TS_3]
+                                    <-Map 1 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_491]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_490] (rows=143931246 width=119)
+                                          Output:["_col0","_col1","_col2"]
+                                          Filter Operator [FIL_489] (rows=143931246 width=119)
+                                            predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_10_date_dim_d_date_sk_min) AND DynamicValue(RS_10_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_10_date_dim_d_date_sk_bloom_filter))) and ws_bill_addr_sk is not null and ws_sold_date_sk is not null)
+                                            TableScan [TS_0] (rows=144002668 width=119)
+                                              default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_addr_sk","ws_ext_sales_price"]
+                                            <-Reducer 9 [BROADCAST_EDGE] vectorized
+                                              BROADCAST [RS_488]
+                                                Group By Operator [GBY_487] (rows=1 width=12)
+                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                  PARTITION_ONLY_SHUFFLE [RS_481]
+                                                    Group By Operator [GBY_475] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                      Select Operator [SEL_464] (rows=130 width=4)
+                                                        Output:["_col0"]
+                                                         Please refer to the previous Select Operator [SEL_457]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query32.q.out b/ql/src/test/results/clientpositive/perf/tez/query32.q.out
index 1c1a2e7..2e52e0a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query32.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query32.q.out
@@ -93,9 +93,9 @@ Stage-0
                 Select Operator [SEL_34] (rows=2478 width=112)
                   Output:["_col2"]
                   Filter Operator [FIL_33] (rows=2478 width=112)
-                    predicate:(_col2 > CAST( (1.3 * _col6) AS decimal(14,7)))
+                    predicate:(_col2 > _col5)
                     Merge Join Operator [MERGEJOIN_104] (rows=7434 width=112)
-                      Conds:RS_30._col1=RS_31._col2(Inner),Output:["_col2","_col6"]
+                      Conds:RS_30._col1=RS_31._col2(Inner),Output:["_col2","_col5"]
                     <-Reducer 2 [SIMPLE_EDGE]
                       PARTITION_ONLY_SHUFFLE [RS_30]
                         PartitionCols:_col1
@@ -104,7 +104,7 @@ Stage-0
                         <-Map 6 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_107]
                             PartitionCols:_col0
-                            Select Operator [SEL_106] (rows=8116 width=98)
+                            Select Operator [SEL_106] (rows=8116 width=4)
                               Output:["_col0"]
                               Filter Operator [FIL_105] (rows=8116 width=98)
                                 predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-03-18 00:00:00' AND TIMESTAMP'1998-06-16 00:00:00' and d_date_sk is not null)
@@ -129,7 +129,7 @@ Stage-0
                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
                                           Select Operator [SEL_120] (rows=669 width=4)
                                             Output:["_col0"]
-                                            Select Operator [SEL_118] (rows=669 width=8)
+                                            Select Operator [SEL_118] (rows=669 width=4)
                                               Output:["_col0"]
                                               Filter Operator [FIL_117] (rows=669 width=7)
                                                 predicate:((i_manufact_id = 269) and i_item_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query33.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query33.q.out b/ql/src/test/results/clientpositive/perf/tez/query33.q.out
index a76122c..6c4798e 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query33.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query33.q.out
@@ -215,9 +215,9 @@ Stage-0
                         SHUFFLE [RS_109]
                           PartitionCols:_col0
                           Group By Operator [GBY_108] (rows=19 width=115)
-                            Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                            Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col1
                             Merge Join Operator [MERGEJOIN_304] (rows=11364 width=3)
-                              Conds:RS_104._col0=RS_105._col3(Inner),Output:["_col1","_col8"]
+                              Conds:RS_104._col0=RS_105._col2(Inner),Output:["_col1","_col7"]
                             <-Reducer 2 [SIMPLE_EDGE]
                               SHUFFLE [RS_104]
                                 PartitionCols:_col0
@@ -250,15 +250,15 @@ Stage-0
                                                 default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_category","i_manufact_id"]
                             <-Reducer 23 [SIMPLE_EDGE]
                               SHUFFLE [RS_105]
-                                PartitionCols:_col3
+                                PartitionCols:_col2
                                 Select Operator [SEL_100] (rows=788222 width=110)
-                                  Output:["_col3","_col5"]
+                                  Output:["_col2","_col4"]
                                   Merge Join Operator [MERGEJOIN_301] (rows=788222 width=110)
                                     Conds:RS_97._col2=RS_348._col0(Inner),Output:["_col1","_col3"]
                                   <-Map 25 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_348]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_343] (rows=8000000 width=116)
+                                      Select Operator [SEL_343] (rows=8000000 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_342] (rows=8000000 width=112)
                                           predicate:((ca_gmt_offset = -6) and ca_address_sk is not null)
@@ -272,7 +272,7 @@ Stage-0
                                       <-Map 17 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_332]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_327] (rows=50 width=12)
+                                          Select Operator [SEL_327] (rows=50 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_326] (rows=50 width=12)
                                               predicate:((d_moy = 3) and (d_year = 1999) and d_date_sk is not null)
@@ -320,18 +320,18 @@ Stage-0
                         SHUFFLE [RS_34]
                           PartitionCols:_col0
                           Group By Operator [GBY_33] (rows=64 width=115)
-                            Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                            Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col1
                             Merge Join Operator [MERGEJOIN_302] (rows=41476 width=3)
-                              Conds:RS_29._col0=RS_30._col3(Inner),Output:["_col1","_col8"]
+                              Conds:RS_29._col0=RS_30._col2(Inner),Output:["_col1","_col7"]
                             <-Reducer 2 [SIMPLE_EDGE]
                               SHUFFLE [RS_29]
                                 PartitionCols:_col0
                                  Please refer to the previous Merge Join Operator [MERGEJOIN_293]
                             <-Reducer 16 [SIMPLE_EDGE]
                               SHUFFLE [RS_30]
-                                PartitionCols:_col3
+                                PartitionCols:_col2
                                 Select Operator [SEL_25] (rows=2876890 width=4)
-                                  Output:["_col3","_col5"]
+                                  Output:["_col2","_col4"]
                                   Merge Join Operator [MERGEJOIN_295] (rows=2876890 width=4)
                                     Conds:RS_22._col2=RS_344._col0(Inner),Output:["_col1","_col3"]
                                   <-Map 25 [SIMPLE_EDGE] vectorized
@@ -389,18 +389,18 @@ Stage-0
                         SHUFFLE [RS_71]
                           PartitionCols:_col0
                           Group By Operator [GBY_70] (rows=35 width=115)
-                            Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                            Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col1
                             Merge Join Operator [MERGEJOIN_303] (rows=22352 width=3)
-                              Conds:RS_66._col0=RS_67._col4(Inner),Output:["_col1","_col8"]
+                              Conds:RS_66._col0=RS_67._col3(Inner),Output:["_col1","_col7"]
                             <-Reducer 2 [SIMPLE_EDGE]
                               SHUFFLE [RS_66]
                                 PartitionCols:_col0
                                  Please refer to the previous Merge Join Operator [MERGEJOIN_293]
                             <-Reducer 20 [SIMPLE_EDGE]
                               SHUFFLE [RS_67]
-                                PartitionCols:_col4
+                                PartitionCols:_col3
                                 Select Operator [SEL_62] (rows=1550375 width=13)
-                                  Output:["_col4","_col5"]
+                                  Output:["_col3","_col4"]
                                   Merge Join Operator [MERGEJOIN_298] (rows=1550375 width=13)
                                     Conds:RS_59._col1=RS_346._col0(Inner),Output:["_col2","_col3"]
                                   <-Map 25 [SIMPLE_EDGE] vectorized

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query34.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query34.q.out b/ql/src/test/results/clientpositive/perf/tez/query34.q.out
index b40a921..fd60a3a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query34.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query34.q.out
@@ -126,7 +126,7 @@ Stage-0
                             <-Map 13 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_122]
                                 PartitionCols:_col0
-                                Select Operator [SEL_121] (rows=112 width=102)
+                                Select Operator [SEL_121] (rows=112 width=4)
                                   Output:["_col0"]
                                   Filter Operator [FIL_120] (rows=112 width=102)
                                     predicate:((s_county) IN ('Mobile County', 'Maverick County', 'Huron County', 'Kittitas County', 'Fairfield County', 'Jackson County', 'Barrow County', 'Pennington County') and s_store_sk is not null)
@@ -140,7 +140,7 @@ Stage-0
                                 <-Map 11 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_114]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_113] (rows=480 width=104)
+                                    Select Operator [SEL_113] (rows=480 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_112] (rows=480 width=104)
                                         predicate:((hd_buy_potential) IN ('>10000', 'unknown') and (hd_vehicle_count > 0) and CASE WHEN ((hd_vehicle_count > 0)) THEN (((UDFToDouble(hd_dep_count) / UDFToDouble(hd_vehicle_count)) > 1.2D)) ELSE (null) END and hd_demo_sk is not null)
@@ -154,7 +154,7 @@ Stage-0
                                     <-Map 9 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_106]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_105] (rows=595 width=12)
+                                        Select Operator [SEL_105] (rows=595 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_104] (rows=595 width=12)
                                             predicate:((d_dom BETWEEN 1 AND 3 or d_dom BETWEEN 25 AND 28) and (d_year) IN (2000, 2001, 2002) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query35.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query35.q.out b/ql/src/test/results/clientpositive/perf/tez/query35.q.out
index 4499383..f9e67b6 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query35.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query35.q.out
@@ -201,7 +201,7 @@ Stage-0
                                             <-Map 15 [SIMPLE_EDGE] vectorized
                                               PARTITION_ONLY_SHUFFLE [RS_194]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_193] (rows=217 width=12)
+                                                Select Operator [SEL_193] (rows=217 width=4)
                                                   Output:["_col0"]
                                                   Filter Operator [FIL_192] (rows=217 width=12)
                                                     predicate:((d_qoy < 4) and (d_year = 1999) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query36.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query36.q.out b/ql/src/test/results/clientpositive/perf/tez/query36.q.out
index 4f4ce8a..a367f2e 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query36.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query36.q.out
@@ -112,7 +112,7 @@ Stage-0
                               Select Operator [SEL_21] (rows=30601888 width=232)
                                 Output:["_col0","_col1","_col2","_col3"]
                                 Merge Join Operator [MERGEJOIN_82] (rows=30601888 width=232)
-                                  Conds:RS_18._col1=RS_104._col0(Inner),Output:["_col3","_col4","_col10","_col11"]
+                                  Conds:RS_18._col1=RS_104._col0(Inner),Output:["_col3","_col4","_col8","_col9"]
                                 <-Map 12 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_104]
                                     PartitionCols:_col0
@@ -130,7 +130,7 @@ Stage-0
                                     <-Map 10 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_93]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_92] (rows=278 width=90)
+                                        Select Operator [SEL_92] (rows=278 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_91] (rows=278 width=90)
                                             predicate:((s_state) IN ('SD', 'FL', 'MI', 'LA', 'MO', 'SC', 'AL', 'GA') and s_store_sk is not null)
@@ -144,7 +144,7 @@ Stage-0
                                         <-Map 8 [SIMPLE_EDGE] vectorized
                                           PARTITION_ONLY_SHUFFLE [RS_85]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_84] (rows=652 width=8)
+                                            Select Operator [SEL_84] (rows=652 width=4)
                                               Output:["_col0"]
                                               Filter Operator [FIL_83] (rows=652 width=8)
                                                 predicate:((d_year = 1999) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query37.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query37.q.out b/ql/src/test/results/clientpositive/perf/tez/query37.q.out
index 4407a48..c7c29fb 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query37.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query37.q.out
@@ -83,7 +83,7 @@ Stage-0
                           <-Map 11 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_93]
                               PartitionCols:_col0
-                              Select Operator [SEL_92] (rows=8116 width=98)
+                              Select Operator [SEL_92] (rows=8116 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_91] (rows=8116 width=98)
                                   predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'2001-06-02 00:00:00' AND TIMESTAMP'2001-08-01 00:00:00' and d_date_sk is not null)
@@ -92,7 +92,7 @@ Stage-0
                           <-Map 8 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_90]
                               PartitionCols:_col0
-                              Select Operator [SEL_89] (rows=4176000 width=11)
+                              Select Operator [SEL_89] (rows=4176000 width=8)
                                 Output:["_col0","_col1"]
                                 Filter Operator [FIL_88] (rows=4176000 width=11)
                                   predicate:(inv_date_sk is not null and inv_item_sk is not null and inv_quantity_on_hand BETWEEN 100 AND 500)
@@ -106,7 +106,7 @@ Stage-0
                           <-Map 6 [SIMPLE_EDGE] vectorized
                             PARTITION_ONLY_SHUFFLE [RS_82]
                               PartitionCols:_col0
-                              Select Operator [SEL_81] (rows=297 width=404)
+                              Select Operator [SEL_81] (rows=297 width=400)
                                 Output:["_col0","_col1","_col2","_col3"]
                                 Filter Operator [FIL_80] (rows=297 width=404)
                                   predicate:((i_manufact_id) IN (678, 964, 918, 849) and i_current_price BETWEEN 22 AND 52 and i_item_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query38.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query38.q.out b/ql/src/test/results/clientpositive/perf/tez/query38.q.out
index e91141d..ddf6e6e 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query38.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query38.q.out
@@ -112,9 +112,9 @@ Stage-0
                                     SHUFFLE [RS_42]
                                       PartitionCols:_col0, _col1, _col2
                                       Group By Operator [GBY_41] (rows=49146883 width=274)
-                                        Output:["_col0","_col1","_col2"],keys:_col7, _col6, _col3
+                                        Output:["_col0","_col1","_col2"],keys:_col6, _col5, _col3
                                         Merge Join Operator [MERGEJOIN_178] (rows=49146883 width=274)
-                                          Conds:RS_37._col1=RS_221._col0(Inner),Output:["_col3","_col6","_col7"]
+                                          Conds:RS_37._col1=RS_221._col0(Inner),Output:["_col3","_col5","_col6"]
                                         <-Map 18 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_221]
                                             PartitionCols:_col0
@@ -132,7 +132,7 @@ Stage-0
                                             <-Map 8 [SIMPLE_EDGE] vectorized
                                               PARTITION_ONLY_SHUFFLE [RS_203]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_200] (rows=317 width=102)
+                                                Select Operator [SEL_200] (rows=317 width=98)
                                                   Output:["_col0","_col1"]
                                                   Filter Operator [FIL_199] (rows=317 width=102)
                                                     predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)
@@ -173,9 +173,9 @@ Stage-0
                                     SHUFFLE [RS_68]
                                       PartitionCols:_col0, _col1, _col2
                                       Group By Operator [GBY_67] (rows=24986582 width=274)
-                                        Output:["_col0","_col1","_col2"],keys:_col7, _col6, _col3
+                                        Output:["_col0","_col1","_col2"],keys:_col6, _col5, _col3
                                         Merge Join Operator [MERGEJOIN_180] (rows=24986582 width=274)
-                                          Conds:RS_63._col1=RS_222._col0(Inner),Output:["_col3","_col6","_col7"]
+                                          Conds:RS_63._col1=RS_222._col0(Inner),Output:["_col3","_col5","_col6"]
                                         <-Map 18 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_222]
                                             PartitionCols:_col0
@@ -224,9 +224,9 @@ Stage-0
                                     SHUFFLE [RS_17]
                                       PartitionCols:_col0, _col1, _col2
                                       Group By Operator [GBY_16] (rows=91197425 width=274)
-                                        Output:["_col0","_col1","_col2"],keys:_col7, _col6, _col3
+                                        Output:["_col0","_col1","_col2"],keys:_col6, _col5, _col3
                                         Merge Join Operator [MERGEJOIN_176] (rows=91197425 width=274)
-                                          Conds:RS_12._col1=RS_220._col0(Inner),Output:["_col3","_col6","_col7"]
+                                          Conds:RS_12._col1=RS_220._col0(Inner),Output:["_col3","_col5","_col6"]
                                         <-Map 18 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_220]
                                             PartitionCols:_col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query39.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query39.q.out b/ql/src/test/results/clientpositive/perf/tez/query39.q.out
index 103e921..691e301 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query39.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query39.q.out
@@ -105,7 +105,7 @@ Stage-0
                             Select Operator [SEL_49] (rows=1032514 width=108)
                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                               Merge Join Operator [MERGEJOIN_201] (rows=1032514 width=108)
-                                Conds:RS_46._col2=RS_220._col0(Inner),Output:["_col3","_col7","_col8","_col9"]
+                                Conds:RS_46._col2=RS_220._col0(Inner),Output:["_col3","_col5","_col6","_col7"]
                               <-Map 14 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_220]
                                   PartitionCols:_col0
@@ -119,7 +119,7 @@ Stage-0
                                 SHUFFLE [RS_46]
                                   PartitionCols:_col2
                                   Merge Join Operator [MERGEJOIN_200] (rows=1032514 width=8)
-                                    Conds:RS_43._col1=RS_216._col0(Inner),Output:["_col2","_col3","_col7"]
+                                    Conds:RS_43._col1=RS_216._col0(Inner),Output:["_col2","_col3","_col5"]
                                   <-Map 13 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_216]
                                       PartitionCols:_col0
@@ -146,7 +146,7 @@ Stage-0
                                       <-Map 12 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_212]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_210] (rows=50 width=12)
+                                          Select Operator [SEL_210] (rows=50 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_208] (rows=50 width=12)
                                               predicate:((d_moy = 5) and (d_year = 1999) and d_date_sk is not null)
@@ -171,7 +171,7 @@ Stage-0
                             Select Operator [SEL_21] (rows=1032514 width=108)
                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                               Merge Join Operator [MERGEJOIN_198] (rows=1032514 width=108)
-                                Conds:RS_18._col2=RS_219._col0(Inner),Output:["_col3","_col7","_col8","_col9"]
+                                Conds:RS_18._col2=RS_219._col0(Inner),Output:["_col3","_col5","_col6","_col7"]
                               <-Map 14 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_219]
                                   PartitionCols:_col0
@@ -180,7 +180,7 @@ Stage-0
                                 SHUFFLE [RS_18]
                                   PartitionCols:_col2
                                   Merge Join Operator [MERGEJOIN_197] (rows=1032514 width=8)
-                                    Conds:RS_15._col1=RS_215._col0(Inner),Output:["_col2","_col3","_col7"]
+                                    Conds:RS_15._col1=RS_215._col0(Inner),Output:["_col2","_col3","_col5"]
                                   <-Map 13 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_215]
                                       PartitionCols:_col0
@@ -197,7 +197,7 @@ Stage-0
                                       <-Map 12 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_211]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_209] (rows=50 width=12)
+                                          Select Operator [SEL_209] (rows=50 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_207] (rows=50 width=12)
                                               predicate:((d_moy = 4) and (d_year = 1999) and d_date_sk is not null)


[43/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/dynamic_partition_pruning.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/dynamic_partition_pruning.q.out b/ql/src/test/results/clientpositive/llap/dynamic_partition_pruning.q.out
index accb3a7..6954647 100644
--- a/ql/src/test/results/clientpositive/llap/dynamic_partition_pruning.q.out
+++ b/ql/src/test/results/clientpositive/llap/dynamic_partition_pruning.q.out
@@ -535,14 +535,14 @@ STAGE PLANS:
                   filterExpr: ds is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: ds (type: string)
+                    expressions: day(CAST( ds AS DATE)) (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: day(CAST( _col0 AS DATE)) (type: int)
+                      key expressions: _col0 (type: int)
                       sort order: +
-                      Map-reduce partition columns: day(CAST( _col0 AS DATE)) (type: int)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: int)
+                      Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -555,16 +555,16 @@ STAGE PLANS:
                     predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
                     Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ds (type: string)
+                      expressions: day(CAST( ds AS DATE)) (type: int)
                       outputColumnNames: _col0
                       Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: day(CAST( _col0 AS DATE)) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: day(CAST( _col0 AS DATE)) (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
-                        expressions: day(CAST( _col0 AS DATE)) (type: int)
+                        expressions: _col0 (type: int)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -587,9 +587,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 day(CAST( _col0 AS DATE)) (type: int)
-                  1 day(CAST( _col0 AS DATE)) (type: int)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                Statistics: Num rows: 2200 Data size: 8800 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -678,14 +678,14 @@ STAGE PLANS:
                   filterExpr: ds is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: ds (type: string)
+                    expressions: day(CAST( ds AS DATE)) (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: day(CAST( _col0 AS DATE)) (type: int)
+                      key expressions: _col0 (type: int)
                       sort order: +
-                      Map-reduce partition columns: day(CAST( _col0 AS DATE)) (type: int)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: int)
+                      Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -698,13 +698,13 @@ STAGE PLANS:
                     predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
                     Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ds (type: string)
+                      expressions: day(CAST( ds AS DATE)) (type: int)
                       outputColumnNames: _col0
                       Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: day(CAST( _col0 AS DATE)) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: day(CAST( _col0 AS DATE)) (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
             Execution mode: llap
             LLAP IO: no inputs
@@ -715,9 +715,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 day(CAST( _col0 AS DATE)) (type: int)
-                  1 day(CAST( _col0 AS DATE)) (type: int)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                Statistics: Num rows: 2200 Data size: 8800 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -1214,12 +1214,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col2 (type: string)
+                        key expressions: _col0 (type: string), _col1 (type: string)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), _col2 (type: string)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
                         expressions: _col0 (type: string)
@@ -1237,7 +1237,7 @@ STAGE PLANS:
                             Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                             Target Vertex: Map 1
                       Select Operator
-                        expressions: _col2 (type: string)
+                        expressions: _col1 (type: string)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -1261,7 +1261,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: string), _col1 (type: string)
-                  1 _col0 (type: string), _col2 (type: string)
+                  1 _col0 (type: string), _col1 (type: string)
                 Statistics: Num rows: 2200 Data size: 809600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
@@ -1372,12 +1372,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col2 (type: string)
+                        key expressions: _col0 (type: string), _col1 (type: string)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), _col2 (type: string)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
             Execution mode: llap
             LLAP IO: no inputs
@@ -1389,7 +1389,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: string), _col1 (type: string)
-                  1 _col0 (type: string), _col2 (type: string)
+                  1 _col0 (type: string), _col1 (type: string)
                 Statistics: Num rows: 2200 Data size: 809600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
@@ -1770,14 +1770,14 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: UDFToDouble(hr) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: UDFToDouble(_col0) (type: double)
+                      key expressions: _col0 (type: double)
                       sort order: +
-                      Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: double)
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -1790,16 +1790,16 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: double)
+                      expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
-                        expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        expressions: _col0 (type: double)
                         outputColumnNames: _col0
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -1822,9 +1822,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: double)
+                  1 _col0 (type: double)
+                Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -1913,14 +1913,14 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: (UDFToDouble(_col0) * 2.0D) (type: double)
+                      key expressions: _col0 (type: double)
                       sort order: +
-                      Map-reduce partition columns: (UDFToDouble(_col0) * 2.0D) (type: double)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: double)
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -1965,9 +1965,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 (UDFToDouble(_col0) * 2.0D) (type: double)
+                  0 _col0 (type: double)
                   1 _col0 (type: double)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -2056,14 +2056,14 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: UDFToDouble(hr) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: UDFToDouble(_col0) (type: double)
+                      key expressions: _col0 (type: double)
                       sort order: +
-                      Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: double)
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -2076,13 +2076,13 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: double)
+                      expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
             Execution mode: llap
             LLAP IO: no inputs
@@ -2093,9 +2093,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: double)
+                  1 _col0 (type: double)
+                Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -2184,14 +2184,14 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: (UDFToDouble(_col0) * 2.0D) (type: double)
+                      key expressions: _col0 (type: double)
                       sort order: +
-                      Map-reduce partition columns: (UDFToDouble(_col0) * 2.0D) (type: double)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: double)
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -2221,9 +2221,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 (UDFToDouble(_col0) * 2.0D) (type: double)
+                  0 _col0 (type: double)
                   1 _col0 (type: double)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -2325,13 +2325,13 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) (type: string)
                     outputColumnNames: _col0
                     Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: CAST( (UDFToDouble(_col0) * 2.0D) AS STRING) (type: string)
+                      key expressions: _col0 (type: string)
                       sort order: +
-                      Map-reduce partition columns: CAST( (UDFToDouble(_col0) * 2.0D) AS STRING) (type: string)
+                      Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: no inputs
@@ -2345,16 +2345,16 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: double)
+                      expressions: CAST( hr AS STRING) (type: string)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: CAST( _col0 AS STRING) (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: CAST( _col0 AS STRING) (type: string)
+                        Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
-                        expressions: CAST( _col0 AS STRING) (type: string)
+                        expressions: _col0 (type: string)
                         outputColumnNames: _col0
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -2377,8 +2377,8 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 CAST( (UDFToDouble(_col0) * 2.0D) AS STRING) (type: string)
-                  1 CAST( _col0 AS STRING) (type: string)
+                  0 _col0 (type: string)
+                  1 _col0 (type: string)
                 Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
@@ -2632,12 +2632,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         sort order: 
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col2 (type: string)
+                        value expressions: _col0 (type: string), _col1 (type: string)
             Execution mode: llap
             LLAP IO: no inputs
         Reducer 2 
@@ -2649,8 +2649,8 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col4
-                residual filter predicates: {((_col0 = _col2) or (_col1 = _col4))}
+                outputColumnNames: _col0, _col1, _col2, _col3
+                residual filter predicates: {((_col0 = _col2) or (_col1 = _col3))}
                 Statistics: Num rows: 4000 Data size: 4420000 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   Statistics: Num rows: 4000 Data size: 4420000 Basic stats: COMPLETE Column stats: NONE
@@ -2763,12 +2763,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col2 (type: string)
+                        key expressions: _col0 (type: string), _col1 (type: string)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), _col2 (type: string)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
                         expressions: _col0 (type: string)
@@ -2786,7 +2786,7 @@ STAGE PLANS:
                             Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                             Target Vertex: Map 1
                       Select Operator
-                        expressions: _col2 (type: string)
+                        expressions: _col1 (type: string)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -2810,7 +2810,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: string), _col1 (type: string)
-                  1 _col0 (type: string), _col2 (type: string)
+                  1 _col0 (type: string), _col1 (type: string)
                 Statistics: Num rows: 2200 Data size: 809600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
@@ -3458,21 +3458,21 @@ STAGE PLANS:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: srcpart_hour_n0
-                  filterExpr: (UDFToDouble(hr) = 13.0D) (type: boolean)
-                  Statistics: Num rows: 2 Data size: 368 Basic stats: COMPLETE Column stats: NONE
+                  alias: srcpart_date_n2
+                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (UDFToDouble(hr) = 13.0D) (type: boolean)
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                    Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: string)
+                      expressions: ds (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
             Execution mode: llap
             LLAP IO: no inputs
         Map 5 
@@ -3489,31 +3489,31 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col1 (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: string)
+                        Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: string)
+                        value expressions: _col1 (type: string)
             Execution mode: llap
             LLAP IO: unknown
         Map 6 
             Map Operator Tree:
                 TableScan
-                  alias: srcpart_date_n2
-                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
-                  Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                  alias: srcpart_hour_n0
+                  filterExpr: (UDFToDouble(hr) = 13.0D) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 368 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
-                    Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (UDFToDouble(hr) = 13.0D) (type: boolean)
+                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ds (type: string)
+                      expressions: hr (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
             Execution mode: llap
             LLAP IO: no inputs
         Reducer 2 
@@ -3524,14 +3524,14 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: string)
-                  1 _col1 (type: string)
-                outputColumnNames: _col1
-                Statistics: Num rows: 1 Data size: 202 Basic stats: COMPLETE Column stats: NONE
+                  1 _col0 (type: string)
+                outputColumnNames: _col2
+                Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: string)
+                  key expressions: _col2 (type: string)
                   sort order: +
-                  Map-reduce partition columns: _col1 (type: string)
-                  Statistics: Num rows: 1 Data size: 202 Basic stats: COMPLETE Column stats: NONE
+                  Map-reduce partition columns: _col2 (type: string)
+                  Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -3539,9 +3539,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: string)
+                  0 _col2 (type: string)
                   1 _col0 (type: string)
-                Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 2 Data size: 889 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -4504,18 +4504,18 @@ STAGE PLANS:
                   filterExpr: ds is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: ds (type: string)
+                    expressions: day(CAST( ds AS DATE)) (type: int)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 8000 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
                       keys:
-                        0 day(CAST( _col0 AS DATE)) (type: int)
-                        1 day(CAST( _col0 AS DATE)) (type: int)
+                        0 _col0 (type: int)
+                        1 _col0 (type: int)
                       input vertices:
                         1 Map 3
-                      Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2200 Data size: 8800 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         aggregations: count()
                         mode: hash
@@ -4537,16 +4537,16 @@ STAGE PLANS:
                     predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
                     Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ds (type: string)
+                      expressions: day(CAST( ds AS DATE)) (type: int)
                       outputColumnNames: _col0
                       Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: day(CAST( _col0 AS DATE)) (type: int)
+                        key expressions: _col0 (type: int)
                         sort order: +
-                        Map-reduce partition columns: day(CAST( _col0 AS DATE)) (type: int)
+                        Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
-                        expressions: day(CAST( _col0 AS DATE)) (type: int)
+                        expressions: _col0 (type: int)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -4848,7 +4848,7 @@ STAGE PLANS:
                            Inner Join 0 to 1
                       keys:
                         0 _col0 (type: string), _col1 (type: string)
-                        1 _col0 (type: string), _col2 (type: string)
+                        1 _col0 (type: string), _col1 (type: string)
                       input vertices:
                         1 Map 3
                       Statistics: Num rows: 2200 Data size: 809600 Basic stats: COMPLETE Column stats: NONE
@@ -4874,12 +4874,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col2 (type: string)
+                        key expressions: _col0 (type: string), _col1 (type: string)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), _col2 (type: string)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
                         expressions: _col0 (type: string)
@@ -4897,7 +4897,7 @@ STAGE PLANS:
                             Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                             Target Vertex: Map 1
                       Select Operator
-                        expressions: _col2 (type: string)
+                        expressions: _col1 (type: string)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -5140,18 +5140,18 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: UDFToDouble(hr) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
                       keys:
-                        0 UDFToDouble(_col0) (type: double)
-                        1 UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        0 _col0 (type: double)
+                        1 _col0 (type: double)
                       input vertices:
                         1 Map 3
-                      Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         aggregations: count()
                         mode: hash
@@ -5173,16 +5173,16 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: double)
+                      expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
-                        expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        expressions: _col0 (type: double)
                         outputColumnNames: _col0
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -5277,18 +5277,18 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
                       keys:
-                        0 (UDFToDouble(_col0) * 2.0D) (type: double)
+                        0 _col0 (type: double)
                         1 _col0 (type: double)
                       input vertices:
                         1 Map 3
-                      Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         aggregations: count()
                         mode: hash
@@ -6046,42 +6046,54 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Map 1 <- Map 2 (BROADCAST_EDGE)
-        Map 3 <- Map 1 (BROADCAST_EDGE)
-        Reducer 4 <- Map 3 (CUSTOM_SIMPLE_EDGE)
+        Map 1 <- Map 3 (BROADCAST_EDGE), Map 4 (BROADCAST_EDGE)
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: srcpart_hour_n0
-                  filterExpr: (UDFToDouble(hr) = 13.0D) (type: boolean)
-                  Statistics: Num rows: 2 Data size: 368 Basic stats: COMPLETE Column stats: NONE
+                  alias: srcpart_date_n2
+                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (UDFToDouble(hr) = 13.0D) (type: boolean)
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                    Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: string)
+                      expressions: ds (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: string)
-                          1 _col1 (type: string)
-                        outputColumnNames: _col1
+                          1 _col0 (type: string)
+                        outputColumnNames: _col2
                         input vertices:
-                          1 Map 2
-                        Statistics: Num rows: 1 Data size: 202 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col1 (type: string)
-                          sort order: +
-                          Map-reduce partition columns: _col1 (type: string)
-                          Statistics: Num rows: 1 Data size: 202 Basic stats: COMPLETE Column stats: NONE
+                          1 Map 3
+                        Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
+                        Map Join Operator
+                          condition map:
+                               Inner Join 0 to 1
+                          keys:
+                            0 _col2 (type: string)
+                            1 _col0 (type: string)
+                          input vertices:
+                            1 Map 4
+                          Statistics: Num rows: 2 Data size: 889 Basic stats: COMPLETE Column stats: NONE
+                          Group By Operator
+                            aggregations: count()
+                            mode: hash
+                            outputColumnNames: _col0
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                            Reduce Output Operator
+                              sort order: 
+                              Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                              value expressions: _col0 (type: bigint)
             Execution mode: llap
             LLAP IO: no inputs
-        Map 2 
+        Map 3 
             Map Operator Tree:
                 TableScan
                   alias: srcpart
@@ -6095,47 +6107,34 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col1 (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: string)
+                        Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: string)
+                        value expressions: _col1 (type: string)
             Execution mode: llap
             LLAP IO: unknown
-        Map 3 
+        Map 4 
             Map Operator Tree:
                 TableScan
-                  alias: srcpart_date_n2
-                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
-                  Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                  alias: srcpart_hour_n0
+                  filterExpr: (UDFToDouble(hr) = 13.0D) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 368 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
-                    Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (UDFToDouble(hr) = 13.0D) (type: boolean)
+                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ds (type: string)
+                      expressions: hr (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
-                      Map Join Operator
-                        condition map:
-                             Inner Join 0 to 1
-                        keys:
-                          0 _col1 (type: string)
-                          1 _col0 (type: string)
-                        input vertices:
-                          0 Map 1
-                        Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
-                        Group By Operator
-                          aggregations: count()
-                          mode: hash
-                          outputColumnNames: _col0
-                          Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                          Reduce Output Operator
-                            sort order: 
-                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                            value expressions: _col0 (type: bigint)
+                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
             Execution mode: llap
             LLAP IO: no inputs
-        Reducer 4 
+        Reducer 2 
             Execution mode: llap
             Reduce Operator Tree:
               Group By Operator
@@ -6461,18 +6460,18 @@ STAGE PLANS:
                   alias: srcpart_orc
                   Statistics: Num rows: 2000 Data size: 564000 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: ds (type: string), hr (type: int)
+                    expressions: ds (type: string), UDFToDouble(hr) (type: double)
                     outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 2000 Data size: 376000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 384000 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
                       keys:
-                        0 _col0 (type: string), UDFToDouble(_col1) (type: double)
-                        1 _col0 (type: string), UDFToDouble(_col2) (type: double)
+                        0 _col0 (type: string), _col1 (type: double)
+                        1 _col0 (type: string), _col1 (type: double)
                       input vertices:
                         1 Map 3
-                      Statistics: Num rows: 2200 Data size: 413600 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2200 Data size: 422400 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         aggregations: count()
                         mode: hash
@@ -6494,13 +6493,13 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and (date) IN ('2008-04-08', '2008-04-09') and ds is not null and hr is not null) (type: boolean)
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      expressions: ds (type: string), UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), UDFToDouble(_col2) (type: double)
+                        key expressions: _col0 (type: string), _col1 (type: double)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), UDFToDouble(_col2) (type: double)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: double)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
                         expressions: _col0 (type: string)
@@ -6518,7 +6517,7 @@ STAGE PLANS:
                             Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                             Target Vertex: Map 1
                       Select Operator
-                        expressions: UDFToDouble(_col2) (type: double)
+                        expressions: _col1 (type: double)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/dynamic_semijoin_reduction_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/dynamic_semijoin_reduction_2.q.out b/ql/src/test/results/clientpositive/llap/dynamic_semijoin_reduction_2.q.out
index 2810fdd..096751c 100644
--- a/ql/src/test/results/clientpositive/llap/dynamic_semijoin_reduction_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/dynamic_semijoin_reduction_2.q.out
@@ -601,13 +601,13 @@ STAGE PLANS:
                     Statistics: Num rows: 8 Data size: 1400 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: value (type: string)
-                      outputColumnNames: _col1
-                      Statistics: Num rows: 8 Data size: 1400 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 8 Data size: 712 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col1 (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: string)
-                        Statistics: Num rows: 8 Data size: 1400 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 8 Data size: 712 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -662,7 +662,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col1 (type: string)
-                  1 _col1 (type: string)
+                  1 _col0 (type: string)
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                 Group By Operator
                   aggregations: count()

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/explainanalyze_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/explainanalyze_2.q.out b/ql/src/test/results/clientpositive/llap/explainanalyze_2.q.out
index 9332e71..36bd120 100644
--- a/ql/src/test/results/clientpositive/llap/explainanalyze_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/explainanalyze_2.q.out
@@ -74,12 +74,12 @@ Stage-0
               Select Operator [SEL_124] (rows=66/61 width=268)
                 Output:["_col0","_col1","_col2"]
                 Merge Join Operator [MERGEJOIN_123] (rows=66/61 width=268)
-                  Conds:RS_21._col3=RS_22._col1(Inner),Output:["_col1","_col2","_col5"]
+                  Conds:RS_21._col3=RS_22._col0(Inner),Output:["_col1","_col2","_col4"]
                 <-Reducer 11 [SIMPLE_EDGE] llap
                   SHUFFLE [RS_22]
-                    PartitionCols:_col1
-                    Select Operator [SEL_17] (rows=525/319 width=178)
-                      Output:["_col1"]
+                    PartitionCols:_col0
+                    Select Operator [SEL_17] (rows=525/319 width=91)
+                      Output:["_col0"]
                       Group By Operator [GBY_16] (rows=525/319 width=178)
                         Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                       <-Union 10 [SIMPLE_EDGE]
@@ -130,12 +130,12 @@ Stage-0
               Select Operator [SEL_128] (rows=66/61 width=268)
                 Output:["_col0","_col1","_col2"]
                 Merge Join Operator [MERGEJOIN_127] (rows=66/61 width=268)
-                  Conds:RS_46._col3=RS_47._col1(Inner),Output:["_col1","_col2","_col5"]
+                  Conds:RS_46._col3=RS_47._col0(Inner),Output:["_col1","_col2","_col4"]
                 <-Reducer 15 [SIMPLE_EDGE] llap
                   SHUFFLE [RS_47]
-                    PartitionCols:_col1
-                    Select Operator [SEL_42] (rows=525/319 width=178)
-                      Output:["_col1"]
+                    PartitionCols:_col0
+                    Select Operator [SEL_42] (rows=525/319 width=91)
+                      Output:["_col0"]
                       Group By Operator [GBY_41] (rows=525/319 width=178)
                         Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                       <-Union 14 [SIMPLE_EDGE]
@@ -280,12 +280,12 @@ Stage-0
                     Select Operator [SEL_235] (rows=130/61 width=177)
                       Output:["_col0","_col1"]
                       Merge Join Operator [MERGEJOIN_234] (rows=130/61 width=177)
-                        Conds:RS_55._col3=RS_56._col1(Inner),Output:["_col1","_col2"]
+                        Conds:RS_55._col3=RS_56._col0(Inner),Output:["_col1","_col2"]
                       <-Reducer 20 [SIMPLE_EDGE] llap
                         SHUFFLE [RS_56]
-                          PartitionCols:_col1
-                          Select Operator [SEL_51] (rows=1025/319 width=178)
-                            Output:["_col1"]
+                          PartitionCols:_col0
+                          Select Operator [SEL_51] (rows=1025/319 width=91)
+                            Output:["_col0"]
                             Group By Operator [GBY_50] (rows=1025/319 width=178)
                               Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                             <-Union 19 [SIMPLE_EDGE]
@@ -353,7 +353,7 @@ Stage-0
                     Select Operator [SEL_224] (rows=66/61 width=177)
                       Output:["_col0","_col1"]
                       Merge Join Operator [MERGEJOIN_223] (rows=66/61 width=177)
-                        Conds:RS_21._col3=RS_22._col1(Inner),Output:["_col1","_col2"]
+                        Conds:RS_21._col3=RS_22._col0(Inner),Output:["_col1","_col2"]
                       <-Reducer 2 [SIMPLE_EDGE] llap
                         SHUFFLE [RS_21]
                           PartitionCols:_col3
@@ -369,9 +369,9 @@ Stage-0
                                Please refer to the previous Select Operator [SEL_5]
                       <-Reducer 14 [SIMPLE_EDGE] llap
                         SHUFFLE [RS_22]
-                          PartitionCols:_col1
-                          Select Operator [SEL_17] (rows=525/319 width=178)
-                            Output:["_col1"]
+                          PartitionCols:_col0
+                          Select Operator [SEL_17] (rows=525/319 width=91)
+                            Output:["_col0"]
                             Group By Operator [GBY_16] (rows=525/319 width=178)
                               Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                             <-Union 13 [SIMPLE_EDGE]
@@ -399,16 +399,16 @@ Stage-0
               Select Operator [SEL_231] (rows=193/61 width=177)
                 Output:["_col0","_col1"]
                 Merge Join Operator [MERGEJOIN_230] (rows=193/61 width=177)
-                  Conds:RS_104._col3=RS_105._col1(Inner),Output:["_col1","_col2"]
+                  Conds:RS_104._col3=RS_105._col0(Inner),Output:["_col1","_col2"]
                 <-Reducer 2 [SIMPLE_EDGE] llap
                   SHUFFLE [RS_104]
                     PartitionCols:_col3
                      Please refer to the previous Merge Join Operator [MERGEJOIN_217]
                 <-Reducer 29 [SIMPLE_EDGE] llap
                   SHUFFLE [RS_105]
-                    PartitionCols:_col1
-                    Select Operator [SEL_100] (rows=1525/319 width=178)
-                      Output:["_col1"]
+                    PartitionCols:_col0
+                    Select Operator [SEL_100] (rows=1525/319 width=91)
+                      Output:["_col0"]
                       Group By Operator [GBY_99] (rows=1525/319 width=178)
                         Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                       <-Union 28 [SIMPLE_EDGE]
@@ -1595,7 +1595,7 @@ Stage-5
                             Select Operator [SEL_258] (rows=193/304 width=175)
                               Output:["_col0","_col1"]
                               Merge Join Operator [MERGEJOIN_257] (rows=193/304 width=175)
-                                Conds:RS_104._col1=RS_105._col1(Inner),Output:["_col0","_col3"]
+                                Conds:RS_104._col1=RS_105._col0(Inner),Output:["_col0","_col3"]
                               <-Reducer 14 [SIMPLE_EDGE] llap
                                 SHUFFLE [RS_104]
                                   PartitionCols:_col1
@@ -1621,9 +1621,9 @@ Stage-5
                                             default@src1,y,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
                               <-Reducer 35 [SIMPLE_EDGE] llap
                                 SHUFFLE [RS_105]
-                                  PartitionCols:_col1
-                                  Select Operator [SEL_100] (rows=1525/319 width=178)
-                                    Output:["_col1"]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_100] (rows=1525/319 width=91)
+                                    Output:["_col0"]
                                     Group By Operator [GBY_99] (rows=1525/319 width=178)
                                       Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                     <-Union 34 [SIMPLE_EDGE]
@@ -1691,7 +1691,7 @@ Stage-5
                                   Select Operator [SEL_254] (rows=2640/1056 width=178)
                                     Output:["_col0","_col1"]
                                     Merge Join Operator [MERGEJOIN_253] (rows=2640/1056 width=178)
-                                      Conds:RS_55._col1=RS_56._col1(Inner),Output:["_col0","_col3"]
+                                      Conds:RS_55._col1=RS_56._col0(Inner),Output:["_col0","_col3"]
                                     <-Reducer 11 [SIMPLE_EDGE] llap
                                       SHUFFLE [RS_55]
                                         PartitionCols:_col1
@@ -1717,9 +1717,9 @@ Stage-5
                                                   default@src,y,Tbl:COMPLETE,Col:COMPLETE,Output:["key","value"]
                                     <-Reducer 25 [SIMPLE_EDGE] llap
                                       SHUFFLE [RS_56]
-                                        PartitionCols:_col1
-                                        Select Operator [SEL_51] (rows=1025/319 width=178)
-                                          Output:["_col1"]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_51] (rows=1025/319 width=91)
+                                          Output:["_col0"]
                                           Group By Operator [GBY_50] (rows=1025/319 width=178)
                                             Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                           <-Union 24 [SIMPLE_EDGE]
@@ -1764,12 +1764,12 @@ Stage-5
                                   Select Operator [SEL_247] (rows=66/61 width=177)
                                     Output:["_col0","_col1"]
                                     Merge Join Operator [MERGEJOIN_246] (rows=66/61 width=177)
-                                      Conds:RS_21._col3=RS_22._col1(Inner),Output:["_col1","_col2"]
+                                      Conds:RS_21._col3=RS_22._col0(Inner),Output:["_col1","_col2"]
                                     <-Reducer 18 [SIMPLE_EDGE] llap
                                       SHUFFLE [RS_22]
-                                        PartitionCols:_col1
-                                        Select Operator [SEL_17] (rows=525/319 width=178)
-                                          Output:["_col1"]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_17] (rows=525/319 width=91)
+                                          Output:["_col0"]
                                           Group By Operator [GBY_16] (rows=525/319 width=178)
                                             Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                           <-Union 17 [SIMPLE_EDGE]


[35/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/unionDistinct_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/unionDistinct_1.q.out b/ql/src/test/results/clientpositive/llap/unionDistinct_1.q.out
index b1eec43..93791ac 100644
--- a/ql/src/test/results/clientpositive/llap/unionDistinct_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/unionDistinct_1.q.out
@@ -667,238 +667,184 @@ POSTHOOK: query: select unionsrc.key, unionsrc.value FROM (select s1.key as key,
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: hdfs://### HDFS PATH ###
+100	val_100
 104	val_104
 105	val_105
 113	val_113
 118	val_118
+119	val_119
 12	val_12
 120	val_120
+128	val_128
+129	val_129
 133	val_133
 136	val_136
+145	val_145
 155	val_155
 158	val_158
 160	val_160
 162	val_162
+167	val_167
 168	val_168
 17	val_17
 170	val_170
+174	val_174
 175	val_175
+178	val_178
 18	val_18
 180	val_180
+181	val_181
 186	val_186
 19	val_19
+193	val_193
 197	val_197
+199	val_199
+20	val_20
 200	val_200
+201	val_201
+213	val_213
+214	val_214
 216	val_216
 218	val_218
+219	val_219
+221	val_221
 222	val_222
+223	val_223
 224	val_224
+226	val_226
 228	val_228
+233	val_233
 235	val_235
 237	val_237
 239	val_239
+241	val_241
 244	val_244
 247	val_247
+249	val_249
 256	val_256
+260	val_260
+262	val_262
 263	val_263
 273	val_273
+277	val_277
 28	val_28
+281	val_281
 283	val_283
 286	val_286
+287	val_287
+288	val_288
 292	val_292
+298	val_298
+302	val_302
 306	val_306
 308	val_308
+310	val_310
+323	val_323
 327	val_327
 33	val_33
+336	val_336
+341	val_341
+344	val_344
 348	val_348
+351	val_351
 353	val_353
 362	val_362
 366	val_366
+375	val_375
+382	val_382
+384	val_384
+393	val_393
+395	val_395
 396	val_396
 397	val_397
+399	val_399
 401	val_401
+403	val_403
+406	val_406
 409	val_409
 411	val_411
+418	val_418
 419	val_419
 427	val_427
 43	val_43
 432	val_432
+435	val_435
 436	val_436
 439	val_439
 443	val_443
 453	val_453
+455	val_455
+459	val_459
 460	val_460
 462	val_462
 47	val_47
 472	val_472
-485	val_485
-496	val_496
-54	val_54
-64	val_64
-70	val_70
-8	val_8
-83	val_83
-84	val_84
-85	val_85
-90	val_90
-0	val_0
-103	val_103
-114	val_114
-125	val_125
-138	val_138
-146	val_146
-150	val_150
-152	val_152
-153	val_153
-156	val_156
-157	val_157
-165	val_165
-172	val_172
-177	val_177
-179	val_179
-187	val_187
-195	val_195
-196	val_196
-217	val_217
-242	val_242
-248	val_248
-252	val_252
-265	val_265
-27	val_27
-272	val_272
-280	val_280
-291	val_291
-305	val_305
-309	val_309
-311	val_311
-315	val_315
-317	val_317
-322	val_322
-333	val_333
-34	val_34
-345	val_345
-35	val_35
-356	val_356
-364	val_364
-368	val_368
-369	val_369
-37	val_37
-373	val_373
-377	val_377
-4	val_4
-402	val_402
-404	val_404
-413	val_413
-42	val_42
-430	val_430
-431	val_431
-444	val_444
-449	val_449
-452	val_452
-454	val_454
-457	val_457
-463	val_463
-466	val_466
-470	val_470
-475	val_475
-481	val_481
-489	val_489
-491	val_491
-57	val_57
-65	val_65
-66	val_66
-74	val_74
-76	val_76
-78	val_78
-9	val_9
-92	val_92
-95	val_95
-100	val_100
-119	val_119
-128	val_128
-129	val_129
-145	val_145
-167	val_167
-174	val_174
-178	val_178
-181	val_181
-193	val_193
-199	val_199
-20	val_20
-201	val_201
-213	val_213
-214	val_214
-219	val_219
-221	val_221
-223	val_223
-226	val_226
-233	val_233
-241	val_241
-249	val_249
-260	val_260
-262	val_262
-277	val_277
-281	val_281
-287	val_287
-288	val_288
-298	val_298
-302	val_302
-310	val_310
-323	val_323
-336	val_336
-341	val_341
-344	val_344
-351	val_351
-375	val_375
-382	val_382
-384	val_384
-393	val_393
-395	val_395
-399	val_399
-403	val_403
-406	val_406
-418	val_418
-435	val_435
-455	val_455
-459	val_459
 477	val_477
 478	val_478
 479	val_479
 482	val_482
+485	val_485
 493	val_493
 494	val_494
 495	val_495
+496	val_496
 497	val_497
 5	val_5
+54	val_54
 58	val_58
+64	val_64
 67	val_67
+70	val_70
 77	val_77
+8	val_8
 80	val_80
+83	val_83
+84	val_84
+85	val_85
 86	val_86
+90	val_90
 97	val_97
 98	val_98
+0	val_0
 10	val_10
+103	val_103
 11	val_11
 111	val_111
+114	val_114
 116	val_116
+125	val_125
 126	val_126
 131	val_131
 134	val_134
 137	val_137
+138	val_138
 143	val_143
+146	val_146
 149	val_149
 15	val_15
+150	val_150
+152	val_152
+153	val_153
+156	val_156
+157	val_157
 163	val_163
 164	val_164
+165	val_165
 166	val_166
 169	val_169
+172	val_172
 176	val_176
+177	val_177
+179	val_179
 183	val_183
+187	val_187
 189	val_189
 190	val_190
 191	val_191
 192	val_192
 194	val_194
+195	val_195
+196	val_196
 2	val_2
 202	val_202
 203	val_203
@@ -906,75 +852,129 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 207	val_207
 208	val_208
 209	val_209
+217	val_217
 229	val_229
 230	val_230
 238	val_238
 24	val_24
+242	val_242
+248	val_248
+252	val_252
 255	val_255
 257	val_257
 258	val_258
 26	val_26
+265	val_265
 266	val_266
+27	val_27
+272	val_272
 274	val_274
 275	val_275
 278	val_278
+280	val_280
 282	val_282
 284	val_284
 285	val_285
 289	val_289
+291	val_291
 296	val_296
 30	val_30
+305	val_305
 307	val_307
+309	val_309
+311	val_311
+315	val_315
 316	val_316
+317	val_317
 318	val_318
 321	val_321
+322	val_322
 325	val_325
 331	val_331
 332	val_332
+333	val_333
 335	val_335
 338	val_338
 339	val_339
+34	val_34
 342	val_342
+345	val_345
+35	val_35
+356	val_356
 360	val_360
+364	val_364
 365	val_365
 367	val_367
+368	val_368
+369	val_369
+37	val_37
+373	val_373
 374	val_374
+377	val_377
 378	val_378
 379	val_379
 386	val_386
 389	val_389
 392	val_392
 394	val_394
+4	val_4
 400	val_400
+402	val_402
+404	val_404
 407	val_407
 41	val_41
+413	val_413
 414	val_414
 417	val_417
+42	val_42
 421	val_421
 424	val_424
 429	val_429
+430	val_430
+431	val_431
 437	val_437
 438	val_438
 44	val_44
+444	val_444
 446	val_446
 448	val_448
+449	val_449
+452	val_452
+454	val_454
+457	val_457
 458	val_458
+463	val_463
+466	val_466
 467	val_467
 468	val_468
 469	val_469
+470	val_470
+475	val_475
 480	val_480
+481	val_481
 483	val_483
 484	val_484
 487	val_487
+489	val_489
 490	val_490
+491	val_491
 492	val_492
 498	val_498
 51	val_51
 53	val_53
+57	val_57
+65	val_65
+66	val_66
 69	val_69
 72	val_72
-82	val_82
-87	val_87
+74	val_74
+76	val_76
+78	val_78
+82	val_82
+87	val_87
+9	val_9
+92	val_92
+95	val_95
 96	val_96
 PREHOOK: query: CREATE TABLE DEST1_n96(key STRING, value STRING) STORED AS TEXTFILE
 PREHOOK: type: CREATETABLE
@@ -3799,19 +3799,6 @@ POSTHOOK: Input: default@dst_union22_delta_n0@ds=1
 POSTHOOK: Input: default@dst_union22_n0
 POSTHOOK: Input: default@dst_union22_n0@ds=1
 POSTHOOK: Output: default@dst_union22_n0@ds=2
-OPTIMIZED SQL: SELECT `k1`, `k2`, `k3`, `k4`
-FROM (SELECT `k1`, `k2`, `k3`, `k4`
-FROM `default`.`dst_union22_delta_n0`
-WHERE `ds` = '1' AND `k0` <= 50
-UNION ALL
-SELECT `t2`.`k1`, `t2`.`k2`, `t4`.`k3`, `t4`.`k4`
-FROM (SELECT `k1`, `k2`, `ds`
-FROM `default`.`dst_union22_n0`
-WHERE `k1` > 20) AS `t2`
-LEFT JOIN (SELECT `k1`, `k3`, `k4`
-FROM `default`.`dst_union22_delta_n0`
-WHERE `ds` = '1' AND `k0` > 50 AND `k1` > 20) AS `t4` ON `t2`.`k1` = `t4`.`k1` AND `t2`.`ds` = '1')
-GROUP BY `k1`, `k2`, `k3`, `k4`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -3925,16 +3912,16 @@ STAGE PLANS:
                     predicate: (UDFToDouble(k1) > 20.0D) (type: boolean)
                     Statistics: Num rows: 166 Data size: 60092 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: k1 (type: string), k2 (type: string), ds (type: string)
+                      expressions: k1 (type: string), k2 (type: string), (ds = '1') (type: boolean)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 166 Data size: 60092 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 166 Data size: 30212 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Left Outer Join 0 to 1
                         filter mappings:
                           0 [1, 1]
                         filter predicates:
-                          0 {(_col2 = '1')}
+                          0 {_col2}
                           1 
                         Estimated key counts: Map 6 => 55
                         keys:
@@ -4288,25 +4275,46 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@dst_union22_n0
 POSTHOOK: Input: default@dst_union22_n0@ds=2
 POSTHOOK: Output: hdfs://### HDFS PATH ###
+104	val_104	104	val_104	2
 11	val_11	11	val_11	2
 111	val_111	111	val_111	2
+113	val_113	113	val_113	2
+114	val_114	114	val_114	2
+116	val_116	116	val_116	2
+119	val_119	119	val_119	2
+125	val_125	125	val_125	2
 126	val_126	126	val_126	2
+134	val_134	134	val_134	2
+136	val_136	136	val_136	2
+137	val_137	137	val_137	2
 143	val_143	143	val_143	2
+153	val_153	153	val_153	2
 160	val_160	160	val_160	2
+162	val_162	162	val_162	2
 165	val_165	165	val_165	2
 166	val_166	166	val_166	2
+167	val_167	167	val_167	2
+168	val_168	168	val_168	2
+17	val_17	17	val_17	2
 175	val_175	175	val_175	2
+178	val_178	178	val_178	2
 18	val_18	18	val_18	2
+180	val_180	180	val_180	2
 183	val_183	183	val_183	2
+186	val_186	186	val_186	2
 187	val_187	187	val_187	2
 189	val_189	189	val_189	2
+191	val_191	191	val_191	2
 192	val_192	192	val_192	2
 193	val_193	193	val_193	2
 196	val_196	196	val_196	2
 197	val_197	197	val_197	2
 199	val_199	199	val_199	2
+2	val_2	2	val_2	2
+200	val_200	200	val_200	2
 201	val_201	201	val_201	2
 202	val_202	202	val_202	2
+203	val_203	203	val_203	2
 205	val_205	205	val_205	2
 207	val_207	207	val_207	2
 216	val_216	216	val_216	2
@@ -4315,26 +4323,55 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 221	val_221	221	val_221	2
 226	val_226	226	val_226	2
 228	val_228	228	val_228	2
+230	val_230	230	val_230	2
 235	val_235	235	val_235	2
+239	val_239	239	val_239	2
+241	val_241	241	val_241	2
 242	val_242	242	val_242	2
+244	val_244	244	val_244	2
+247	val_247	247	val_247	2
+252	val_252	252	val_252	2
 255	val_255	255	val_255	2
+26	val_26	NULL	NULL	2
+263	val_263	263	val_263	2
+265	val_265	265	val_265	2
+27	val_27	NULL	NULL	2
 27	val_27	27	val_27	2
+274	val_274	274	val_274	2
 277	val_277	277	val_277	2
+278	val_278	278	val_278	2
+28	val_28	NULL	NULL	2
 28	val_28	28	val_28	2
 281	val_281	281	val_281	2
+282	val_282	282	val_282	2
 283	val_283	283	val_283	2
 285	val_285	285	val_285	2
+286	val_286	286	val_286	2
 291	val_291	291	val_291	2
 305	val_305	305	val_305	2
+306	val_306	306	val_306	2
+307	val_307	307	val_307	2
 308	val_308	308	val_308	2
+309	val_309	309	val_309	2
 311	val_311	311	val_311	2
+317	val_317	317	val_317	2
+318	val_318	318	val_318	2
+322	val_322	322	val_322	2
 327	val_327	327	val_327	2
+33	val_33	33	val_33	2
 333	val_333	333	val_333	2
+335	val_335	335	val_335	2
+336	val_336	336	val_336	2
+338	val_338	338	val_338	2
+34	val_34	NULL	NULL	2
 341	val_341	341	val_341	2
 348	val_348	348	val_348	2
 35	val_35	NULL	NULL	2
 35	val_35	35	val_35	2
+351	val_351	351	val_351	2
 360	val_360	360	val_360	2
+367	val_367	367	val_367	2
+369	val_369	369	val_369	2
 37	val_37	37	val_37	2
 373	val_373	373	val_373	2
 374	val_374	374	val_374	2
@@ -4342,24 +4379,37 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 384	val_384	384	val_384	2
 392	val_392	392	val_392	2
 393	val_393	393	val_393	2
+394	val_394	394	val_394	2
 395	val_395	395	val_395	2
+396	val_396	396	val_396	2
 397	val_397	397	val_397	2
 4	val_4	4	val_4	2
 400	val_400	400	val_400	2
+402	val_402	402	val_402	2
 403	val_403	403	val_403	2
 407	val_407	407	val_407	2
 411	val_411	411	val_411	2
+419	val_419	419	val_419	2
+421	val_421	421	val_421	2
+424	val_424	424	val_424	2
 427	val_427	427	val_427	2
 429	val_429	429	val_429	2
+435	val_435	435	val_435	2
+436	val_436	436	val_436	2
 439	val_439	439	val_439	2
 44	val_44	NULL	NULL	2
+446	val_446	446	val_446	2
 449	val_449	449	val_449	2
 452	val_452	452	val_452	2
 454	val_454	454	val_454	2
+458	val_458	458	val_458	2
+460	val_460	460	val_460	2
 462	val_462	462	val_462	2
 467	val_467	467	val_467	2
 47	val_47	47	val_47	2
 470	val_470	470	val_470	2
+477	val_477	477	val_477	2
+482	val_482	482	val_482	2
 483	val_483	483	val_483	2
 489	val_489	489	val_489	2
 490	val_490	490	val_490	2
@@ -4367,47 +4417,119 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 493	val_493	493	val_493	2
 497	val_497	497	val_497	2
 51	val_51	51	val_51	2
+53	val_53	53	val_53	2
 54	val_54	54	val_54	2
+57	val_57	57	val_57	2
+65	val_65	65	val_65	2
 67	val_67	67	val_67	2
+69	val_69	69	val_69	2
+70	val_70	70	val_70	2
 72	val_72	72	val_72	2
+74	val_74	74	val_74	2
+76	val_76	76	val_76	2
 77	val_77	77	val_77	2
+84	val_84	84	val_84	2
 9	val_9	9	val_9	2
+96	val_96	96	val_96	2
 0	val_0	0	val_0	2
+10	val_10	10	val_10	2
+100	val_100	100	val_100	2
 103	val_103	103	val_103	2
+105	val_105	105	val_105	2
+118	val_118	118	val_118	2
+12	val_12	12	val_12	2
+120	val_120	120	val_120	2
 128	val_128	128	val_128	2
+129	val_129	129	val_129	2
 131	val_131	131	val_131	2
 133	val_133	133	val_133	2
 138	val_138	138	val_138	2
+145	val_145	145	val_145	2
+146	val_146	146	val_146	2
 149	val_149	149	val_149	2
+15	val_15	15	val_15	2
+150	val_150	150	val_150	2
 152	val_152	152	val_152	2
+155	val_155	155	val_155	2
 156	val_156	156	val_156	2
+157	val_157	157	val_157	2
 158	val_158	158	val_158	2
 163	val_163	163	val_163	2
+164	val_164	164	val_164	2
 169	val_169	169	val_169	2
+170	val_170	170	val_170	2
+172	val_172	172	val_172	2
+174	val_174	174	val_174	2
 176	val_176	176	val_176	2
+177	val_177	177	val_177	2
+179	val_179	179	val_179	2
+181	val_181	181	val_181	2
+19	val_19	19	val_19	2
 190	val_190	190	val_190	2
+194	val_194	194	val_194	2
+195	val_195	195	val_195	2
 20	val_20	20	val_20	2
+208	val_208	208	val_208	2
+209	val_209	209	val_209	2
+213	val_213	213	val_213	2
 214	val_214	214	val_214	2
+217	val_217	217	val_217	2
+222	val_222	222	val_222	2
 223	val_223	223	val_223	2
+224	val_224	224	val_224	2
 229	val_229	229	val_229	2
+233	val_233	233	val_233	2
 237	val_237	237	val_237	2
 238	val_238	238	val_238	2
+24	val_24	NULL	NULL	2
+24	val_24	24	val_24	2
+248	val_248	248	val_248	2
+249	val_249	249	val_249	2
+256	val_256	256	val_256	2
+257	val_257	257	val_257	2
+258	val_258	258	val_258	2
 26	val_26	26	val_26	2
+260	val_260	260	val_260	2
 262	val_262	262	val_262	2
+266	val_266	266	val_266	2
 272	val_272	272	val_272	2
+273	val_273	273	val_273	2
 275	val_275	275	val_275	2
+280	val_280	280	val_280	2
+284	val_284	284	val_284	2
 287	val_287	287	val_287	2
+288	val_288	288	val_288	2
+289	val_289	289	val_289	2
+292	val_292	292	val_292	2
+296	val_296	296	val_296	2
+298	val_298	298	val_298	2
 30	val_30	NULL	NULL	2
+30	val_30	30	val_30	2
+302	val_302	302	val_302	2
 310	val_310	310	val_310	2
+315	val_315	315	val_315	2
+316	val_316	316	val_316	2
+321	val_321	321	val_321	2
+323	val_323	323	val_323	2
 325	val_325	325	val_325	2
 33	val_33	NULL	NULL	2
 331	val_331	331	val_331	2
 332	val_332	332	val_332	2
+339	val_339	339	val_339	2
 34	val_34	34	val_34	2
 342	val_342	342	val_342	2
+344	val_344	344	val_344	2
+345	val_345	345	val_345	2
 353	val_353	353	val_353	2
 356	val_356	356	val_356	2
 362	val_362	362	val_362	2
+364	val_364	364	val_364	2
+365	val_365	365	val_365	2
+366	val_366	366	val_366	2
+368	val_368	368	val_368	2
+37	val_37	NULL	NULL	2
+375	val_375	375	val_375	2
+378	val_378	378	val_378	2
 379	val_379	379	val_379	2
 382	val_382	382	val_382	2
 386	val_386	386	val_386	2
@@ -4415,201 +4537,66 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 399	val_399	399	val_399	2
 401	val_401	401	val_401	2
 404	val_404	404	val_404	2
+406	val_406	406	val_406	2
+409	val_409	409	val_409	2
+41	val_41	NULL	NULL	2
+41	val_41	41	val_41	2
+413	val_413	413	val_413	2
+414	val_414	414	val_414	2
 417	val_417	417	val_417	2
 418	val_418	418	val_418	2
 42	val_42	NULL	NULL	2
+42	val_42	42	val_42	2
 43	val_43	NULL	NULL	2
+43	val_43	43	val_43	2
 430	val_430	430	val_430	2
+431	val_431	431	val_431	2
+432	val_432	432	val_432	2
 437	val_437	437	val_437	2
 438	val_438	438	val_438	2
 44	val_44	44	val_44	2
+443	val_443	443	val_443	2
+444	val_444	444	val_444	2
 448	val_448	448	val_448	2
 453	val_453	453	val_453	2
 455	val_455	455	val_455	2
+457	val_457	457	val_457	2
 459	val_459	459	val_459	2
+463	val_463	463	val_463	2
+466	val_466	466	val_466	2
 468	val_468	468	val_468	2
 469	val_469	469	val_469	2
 47	val_47	NULL	NULL	2
+472	val_472	472	val_472	2
+475	val_475	475	val_475	2
+478	val_478	478	val_478	2
 479	val_479	479	val_479	2
 480	val_480	480	val_480	2
 481	val_481	481	val_481	2
+484	val_484	484	val_484	2
+485	val_485	485	val_485	2
 487	val_487	487	val_487	2
+492	val_492	492	val_492	2
+494	val_494	494	val_494	2
 495	val_495	495	val_495	2
 496	val_496	496	val_496	2
+498	val_498	498	val_498	2
+5	val_5	5	val_5	2
 58	val_58	58	val_58	2
 64	val_64	64	val_64	2
 66	val_66	66	val_66	2
 78	val_78	78	val_78	2
 8	val_8	8	val_8	2
+80	val_80	80	val_80	2
+82	val_82	82	val_82	2
 83	val_83	83	val_83	2
 85	val_85	85	val_85	2
+86	val_86	86	val_86	2
 87	val_87	87	val_87	2
 90	val_90	90	val_90	2
+92	val_92	92	val_92	2
 95	val_95	95	val_95	2
 97	val_97	97	val_97	2
-104	val_104	104	val_104	2
-113	val_113	113	val_113	2
-114	val_114	114	val_114	2
-116	val_116	116	val_116	2
-119	val_119	119	val_119	2
-125	val_125	125	val_125	2
-134	val_134	134	val_134	2
-136	val_136	136	val_136	2
-137	val_137	137	val_137	2
-153	val_153	153	val_153	2
-162	val_162	162	val_162	2
-167	val_167	167	val_167	2
-168	val_168	168	val_168	2
-17	val_17	17	val_17	2
-178	val_178	178	val_178	2
-180	val_180	180	val_180	2
-186	val_186	186	val_186	2
-191	val_191	191	val_191	2
-2	val_2	2	val_2	2
-200	val_200	200	val_200	2
-203	val_203	203	val_203	2
-230	val_230	230	val_230	2
-239	val_239	239	val_239	2
-241	val_241	241	val_241	2
-244	val_244	244	val_244	2
-247	val_247	247	val_247	2
-252	val_252	252	val_252	2
-26	val_26	NULL	NULL	2
-263	val_263	263	val_263	2
-265	val_265	265	val_265	2
-27	val_27	NULL	NULL	2
-274	val_274	274	val_274	2
-278	val_278	278	val_278	2
-28	val_28	NULL	NULL	2
-282	val_282	282	val_282	2
-286	val_286	286	val_286	2
-306	val_306	306	val_306	2
-307	val_307	307	val_307	2
-309	val_309	309	val_309	2
-317	val_317	317	val_317	2
-318	val_318	318	val_318	2
-322	val_322	322	val_322	2
-33	val_33	33	val_33	2
-335	val_335	335	val_335	2
-336	val_336	336	val_336	2
-338	val_338	338	val_338	2
-34	val_34	NULL	NULL	2
-351	val_351	351	val_351	2
-367	val_367	367	val_367	2
-369	val_369	369	val_369	2
-394	val_394	394	val_394	2
-396	val_396	396	val_396	2
-402	val_402	402	val_402	2
-419	val_419	419	val_419	2
-421	val_421	421	val_421	2
-424	val_424	424	val_424	2
-435	val_435	435	val_435	2
-436	val_436	436	val_436	2
-446	val_446	446	val_446	2
-458	val_458	458	val_458	2
-460	val_460	460	val_460	2
-477	val_477	477	val_477	2
-482	val_482	482	val_482	2
-53	val_53	53	val_53	2
-57	val_57	57	val_57	2
-65	val_65	65	val_65	2
-69	val_69	69	val_69	2
-70	val_70	70	val_70	2
-74	val_74	74	val_74	2
-76	val_76	76	val_76	2
-84	val_84	84	val_84	2
-96	val_96	96	val_96	2
-10	val_10	10	val_10	2
-100	val_100	100	val_100	2
-105	val_105	105	val_105	2
-118	val_118	118	val_118	2
-12	val_12	12	val_12	2
-120	val_120	120	val_120	2
-129	val_129	129	val_129	2
-145	val_145	145	val_145	2
-146	val_146	146	val_146	2
-15	val_15	15	val_15	2
-150	val_150	150	val_150	2
-155	val_155	155	val_155	2
-157	val_157	157	val_157	2
-164	val_164	164	val_164	2
-170	val_170	170	val_170	2
-172	val_172	172	val_172	2
-174	val_174	174	val_174	2
-177	val_177	177	val_177	2
-179	val_179	179	val_179	2
-181	val_181	181	val_181	2
-19	val_19	19	val_19	2
-194	val_194	194	val_194	2
-195	val_195	195	val_195	2
-208	val_208	208	val_208	2
-209	val_209	209	val_209	2
-213	val_213	213	val_213	2
-217	val_217	217	val_217	2
-222	val_222	222	val_222	2
-224	val_224	224	val_224	2
-233	val_233	233	val_233	2
-24	val_24	NULL	NULL	2
-24	val_24	24	val_24	2
-248	val_248	248	val_248	2
-249	val_249	249	val_249	2
-256	val_256	256	val_256	2
-257	val_257	257	val_257	2
-258	val_258	258	val_258	2
-260	val_260	260	val_260	2
-266	val_266	266	val_266	2
-273	val_273	273	val_273	2
-280	val_280	280	val_280	2
-284	val_284	284	val_284	2
-288	val_288	288	val_288	2
-289	val_289	289	val_289	2
-292	val_292	292	val_292	2
-296	val_296	296	val_296	2
-298	val_298	298	val_298	2
-30	val_30	30	val_30	2
-302	val_302	302	val_302	2
-315	val_315	315	val_315	2
-316	val_316	316	val_316	2
-321	val_321	321	val_321	2
-323	val_323	323	val_323	2
-339	val_339	339	val_339	2
-344	val_344	344	val_344	2
-345	val_345	345	val_345	2
-364	val_364	364	val_364	2
-365	val_365	365	val_365	2
-366	val_366	366	val_366	2
-368	val_368	368	val_368	2
-37	val_37	NULL	NULL	2
-375	val_375	375	val_375	2
-378	val_378	378	val_378	2
-406	val_406	406	val_406	2
-409	val_409	409	val_409	2
-41	val_41	NULL	NULL	2
-41	val_41	41	val_41	2
-413	val_413	413	val_413	2
-414	val_414	414	val_414	2
-42	val_42	42	val_42	2
-43	val_43	43	val_43	2
-431	val_431	431	val_431	2
-432	val_432	432	val_432	2
-443	val_443	443	val_443	2
-444	val_444	444	val_444	2
-457	val_457	457	val_457	2
-463	val_463	463	val_463	2
-466	val_466	466	val_466	2
-472	val_472	472	val_472	2
-475	val_475	475	val_475	2
-478	val_478	478	val_478	2
-484	val_484	484	val_484	2
-485	val_485	485	val_485	2
-492	val_492	492	val_492	2
-494	val_494	494	val_494	2
-498	val_498	498	val_498	2
-5	val_5	5	val_5	2
-80	val_80	80	val_80	2
-82	val_82	82	val_82	2
-86	val_86	86	val_86	2
-92	val_92	92	val_92	2
 98	val_98	98	val_98	2
 PREHOOK: query: explain
 select s.key2, s.value2
@@ -4733,314 +4720,314 @@ from (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: hdfs://### HDFS PATH ###
+100	val_100
 104	val_104
 105	val_105
 113	val_113
 118	val_118
+119	val_119
 12	val_12
 120	val_120
+128	val_128
+129	val_129
 133	val_133
 136	val_136
+145	val_145
 155	val_155
 158	val_158
 160	val_160
 162	val_162
+167	val_167
 168	val_168
 17	val_17
 170	val_170
+174	val_174
 175	val_175
+178	val_178
 18	val_18
 180	val_180
+181	val_181
 186	val_186
 19	val_19
+193	val_193
 197	val_197
+199	val_199
+20	val_20
 200	val_200
+201	val_201
+213	val_213
+214	val_214
 216	val_216
 218	val_218
+219	val_219
+221	val_221
 222	val_222
+223	val_223
 224	val_224
+226	val_226
 228	val_228
+233	val_233
 235	val_235
 237	val_237
 239	val_239
+241	val_241
 244	val_244
 247	val_247
+249	val_249
 256	val_256
+260	val_260
+262	val_262
 263	val_263
 273	val_273
+277	val_277
 28	val_28
+281	val_281
 283	val_283
 286	val_286
+287	val_287
+288	val_288
 292	val_292
+298	val_298
+302	val_302
 306	val_306
 308	val_308
+310	val_310
+323	val_323
 327	val_327
 33	val_33
+336	val_336
+341	val_341
+344	val_344
 348	val_348
+351	val_351
 353	val_353
 362	val_362
 366	val_366
+375	val_375
+382	val_382
+384	val_384
+393	val_393
+395	val_395
 396	val_396
 397	val_397
+399	val_399
 401	val_401
+403	val_403
+406	val_406
 409	val_409
 411	val_411
+418	val_418
 419	val_419
 427	val_427
 43	val_43
 432	val_432
+435	val_435
 436	val_436
 439	val_439
 443	val_443
 453	val_453
+455	val_455
+459	val_459
 460	val_460
 462	val_462
 47	val_47
 472	val_472
+477	val_477
+478	val_478
+479	val_479
+482	val_482
 485	val_485
+493	val_493
+494	val_494
+495	val_495
 496	val_496
+497	val_497
+5	val_5
 54	val_54
+58	val_58
 64	val_64
+67	val_67
 70	val_70
+77	val_77
 8	val_8
+80	val_80
 83	val_83
 84	val_84
 85	val_85
+86	val_86
 90	val_90
+97	val_97
+98	val_98
 0	val_0
+10	val_10
 103	val_103
+11	val_11
+111	val_111
 114	val_114
+116	val_116
 125	val_125
+126	val_126
+131	val_131
+134	val_134
+137	val_137
 138	val_138
+143	val_143
 146	val_146
+149	val_149
+15	val_15
 150	val_150
 152	val_152
 153	val_153
 156	val_156
 157	val_157
+163	val_163
+164	val_164
 165	val_165
+166	val_166
+169	val_169
 172	val_172
+176	val_176
 177	val_177
 179	val_179
+183	val_183
 187	val_187
+189	val_189
+190	val_190
+191	val_191
+192	val_192
+194	val_194
 195	val_195
 196	val_196
+2	val_2
+202	val_202
+203	val_203
+205	val_205
+207	val_207
+208	val_208
+209	val_209
 217	val_217
+229	val_229
+230	val_230
+238	val_238
+24	val_24
 242	val_242
 248	val_248
 252	val_252
+255	val_255
+257	val_257
+258	val_258
+26	val_26
 265	val_265
+266	val_266
 27	val_27
 272	val_272
+274	val_274
+275	val_275
+278	val_278
 280	val_280
+282	val_282
+284	val_284
+285	val_285
+289	val_289
 291	val_291
+296	val_296
+30	val_30
 305	val_305
+307	val_307
 309	val_309
 311	val_311
 315	val_315
+316	val_316
 317	val_317
+318	val_318
+321	val_321
 322	val_322
+325	val_325
+331	val_331
+332	val_332
 333	val_333
+335	val_335
+338	val_338
+339	val_339
 34	val_34
+342	val_342
 345	val_345
 35	val_35
 356	val_356
+360	val_360
 364	val_364
+365	val_365
+367	val_367
 368	val_368
 369	val_369
 37	val_37
 373	val_373
+374	val_374
 377	val_377
+378	val_378
+379	val_379
+386	val_386
+389	val_389
+392	val_392
+394	val_394
 4	val_4
+400	val_400
 402	val_402
 404	val_404
+407	val_407
+41	val_41
 413	val_413
+414	val_414
+417	val_417
 42	val_42
+421	val_421
+424	val_424
+429	val_429
 430	val_430
 431	val_431
+437	val_437
+438	val_438
+44	val_44
 444	val_444
+446	val_446
+448	val_448
 449	val_449
 452	val_452
 454	val_454
 457	val_457
+458	val_458
 463	val_463
 466	val_466
+467	val_467
+468	val_468
+469	val_469
 470	val_470
 475	val_475
+480	val_480
 481	val_481
+483	val_483
+484	val_484
+487	val_487
 489	val_489
+490	val_490
 491	val_491
+492	val_492
+498	val_498
+51	val_51
+53	val_53
 57	val_57
 65	val_65
 66	val_66
+69	val_69
+72	val_72
 74	val_74
 76	val_76
 78	val_78
+82	val_82
+87	val_87
 9	val_9
 92	val_92
 95	val_95
-100	val_100
-119	val_119
-128	val_128
-129	val_129
-145	val_145
-167	val_167
-174	val_174
-178	val_178
-181	val_181
-193	val_193
-199	val_199
-20	val_20
-201	val_201
-213	val_213
-214	val_214
-219	val_219
-221	val_221
-223	val_223
-226	val_226
-233	val_233
-241	val_241
-249	val_249
-260	val_260
-262	val_262
-277	val_277
-281	val_281
-287	val_287
-288	val_288
-298	val_298
-302	val_302
-310	val_310
-323	val_323
-336	val_336
-341	val_341
-344	val_344
-351	val_351
-375	val_375
-382	val_382
-384	val_384
-393	val_393
-395	val_395
-399	val_399
-403	val_403
-406	val_406
-418	val_418
-435	val_435
-455	val_455
-459	val_459
-477	val_477
-478	val_478
-479	val_479
-482	val_482
-493	val_493
-494	val_494
-495	val_495
-497	val_497
-5	val_5
-58	val_58
-67	val_67
-77	val_77
-80	val_80
-86	val_86
-97	val_97
-98	val_98
-10	val_10
-11	val_11
-111	val_111
-116	val_116
-126	val_126
-131	val_131
-134	val_134
-137	val_137
-143	val_143
-149	val_149
-15	val_15
-163	val_163
-164	val_164
-166	val_166
-169	val_169
-176	val_176
-183	val_183
-189	val_189
-190	val_190
-191	val_191
-192	val_192
-194	val_194
-2	val_2
-202	val_202
-203	val_203
-205	val_205
-207	val_207
-208	val_208
-209	val_209
-229	val_229
-230	val_230
-238	val_238
-24	val_24
-255	val_255
-257	val_257
-258	val_258
-26	val_26
-266	val_266
-274	val_274
-275	val_275
-278	val_278
-282	val_282
-284	val_284
-285	val_285
-289	val_289
-296	val_296
-30	val_30
-307	val_307
-316	val_316
-318	val_318
-321	val_321
-325	val_325
-331	val_331
-332	val_332
-335	val_335
-338	val_338
-339	val_339
-342	val_342
-360	val_360
-365	val_365
-367	val_367
-374	val_374
-378	val_378
-379	val_379
-386	val_386
-389	val_389
-392	val_392
-394	val_394
-400	val_400
-407	val_407
-41	val_41
-414	val_414
-417	val_417
-421	val_421
-424	val_424
-429	val_429
-437	val_437
-438	val_438
-44	val_44
-446	val_446
-448	val_448
-458	val_458
-467	val_467
-468	val_468
-469	val_469
-480	val_480
-483	val_483
-484	val_484
-487	val_487
-490	val_490
-492	val_492
-498	val_498
-51	val_51
-53	val_53
-69	val_69
-72	val_72
-82	val_82
-87	val_87
 96	val_96
 PREHOOK: query: create table src2_n2 as select key, count(1) as count from src group by key
 PREHOOK: type: CREATETABLE_AS_SELECT
@@ -7314,544 +7301,185 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 1	280	val_280
 1	281	val_281
 1	282	val_282
-1	283	val_283
-1	284	val_284
-1	285	val_285
-1	286	val_286
-1	287	val_287
-1	288	val_288
-1	289	val_289
-1	291	val_291
-1	292	val_292
-1	296	val_296
-1	298	val_298
-1	30	val_30
-1	302	val_302
-1	305	val_305
-1	306	val_306
-1	307	val_307
-1	308	val_308
-1	309	val_309
-1	310	val_310
-1	311	val_311
-1	315	val_315
-1	316	val_316
-1	317	val_317
-1	318	val_318
-1	321	val_321
-1	322	val_322
-1	323	val_323
-1	325	val_325
-1	327	val_327
-1	33	val_33
-1	331	val_331
-1	332	val_332
-1	333	val_333
-1	335	val_335
-1	336	val_336
-1	338	val_338
-1	339	val_339
-1	34	val_34
-1	341	val_341
-1	342	val_342
-1	344	val_344
-1	345	val_345
-1	348	val_348
-1	35	val_35
-1	351	val_351
-1	353	val_353
-1	356	val_356
-1	360	val_360
-1	362	val_362
-1	364	val_364
-1	365	val_365
-1	366	val_366
-1	367	val_367
-1	368	val_368
-1	369	val_369
-1	37	val_37
-1	373	val_373
-1	374	val_374
-1	375	val_375
-1	377	val_377
-1	378	val_378
-1	379	val_379
-1	382	val_382
-1	384	val_384
-1	386	val_386
-1	389	val_389
-1	392	val_392
-1	393	val_393
-1	394	val_394
-1	395	val_395
-1	396	val_396
-1	397	val_397
-1	399	val_399
-1	4	val_4
-1	400	val_400
-1	401	val_401
-1	402	val_402
-1	403	val_403
-1	404	val_404
-1	406	val_406
-1	407	val_407
-1	409	val_409
-1	41	val_41
-1	411	val_411
-1	413	val_413
-1	414	val_414
-1	417	val_417
-1	418	val_418
-1	419	val_419
-1	42	val_42
-1	421	val_421
-1	424	val_424
-1	427	val_427
-1	429	val_429
-1	43	val_43
-1	430	val_430
-1	431	val_431
-1	432	val_432
-1	435	val_435
-1	436	val_436
-1	437	val_437
-1	438	val_438
-1	439	val_439
-1	44	val_44
-1	443	val_443
-1	444	val_444
-1	446	val_446
-1	448	val_448
-1	449	val_449
-1	452	val_452
-1	453	val_453
-1	454	val_454
-1	455	val_455
-1	457	val_457
-1	458	val_458
-1	459	val_459
-1	460	val_460
-1	462	val_462
-1	463	val_463
-1	466	val_466
-1	467	val_467
-1	468	val_468
-1	469	val_469
-1	47	val_47
-1	470	val_470
-1	472	val_472
-1	475	val_475
-1	477	val_477
-1	478	val_478
-1	479	val_479
-1	480	val_480
-1	481	val_481
-1	482	val_482
-1	483	val_483
-1	484	val_484
-1	485	val_485
-1	487	val_487
-1	489	val_489
-1	490	val_490
-1	491	val_491
-1	492	val_492
-1	493	val_493
-1	494	val_494
-1	495	val_495
-1	496	val_496
-1	497	val_497
-1	498	val_498
-1	5	val_5
-1	51	val_51
-1	53	val_53
-1	54	val_54
-1	57	val_57
-1	58	val_58
-1	64	val_64
-1	65	val_65
-1	66	val_66
-1	67	val_67
-1	69	val_69
-1	70	val_70
-1	72	val_72
-1	74	val_74
-1	76	val_76
-1	77	val_77
-1	78	val_78
-1	8	val_8
-1	80	val_80
-1	82	val_82
-1	83	val_83
-1	84	val_84
-1	85	val_85
-1	86	val_86
-1	87	val_87
-1	9	val_9
-1	90	val_90
-1	92	val_92
-1	95	val_95
-1	96	val_96
-1	97	val_97
-1	98	val_98
-PREHOOK: query: SELECT 
-count(1) as counts,
-key,
-value
-FROM
-(
-
-SELECT
-a.key, a.value
-FROM srcpart a JOIN srcpart b 
-ON a.ds='2008-04-08' and a.hr='11' and b.ds='2008-04-08' and b.hr='12'
-AND a.key = b.key 
-
-UNION DISTINCT
-
-select key, value 
-FROM srcpart LATERAL VIEW explode(array(1,2,3)) myTable AS myCol
-WHERE ds='2008-04-08' and hr='11'
-) a
-group by key, value
-PREHOOK: type: QUERY
-PREHOOK: Input: default@srcpart
-PREHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
-PREHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
-PREHOOK: Output: hdfs://### HDFS PATH ###
-POSTHOOK: query: SELECT 
-count(1) as counts,
-key,
-value
-FROM
-(
-
-SELECT
-a.key, a.value
-FROM srcpart a JOIN srcpart b 
-ON a.ds='2008-04-08' and a.hr='11' and b.ds='2008-04-08' and b.hr='12'
-AND a.key = b.key 
-
-UNION DISTINCT
-
-select key, value 
-FROM srcpart LATERAL VIEW explode(array(1,2,3)) myTable AS myCol
-WHERE ds='2008-04-08' and hr='11'
-) a
-group by key, value
-POSTHOOK: type: QUERY
-POSTHOOK: Input: default@srcpart
-POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
-POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
-POSTHOOK: Output: hdfs://### HDFS PATH ###
-1	104	val_104
-1	105	val_105
-1	113	val_113
-1	118	val_118
-1	12	val_12
-1	120	val_120
-1	133	val_133
-1	136	val_136
-1	155	val_155
-1	158	val_158
-1	160	val_160
-1	162	val_162
-1	168	val_168
-1	17	val_17
-1	170	val_170
-1	175	val_175
-1	18	val_18
-1	180	val_180
-1	186	val_186
-1	19	val_19
-1	197	val_197
-1	200	val_200
-1	216	val_216
-1	218	val_218
-1	222	val_222
-1	224	val_224
-1	228	val_228
-1	235	val_235
-1	237	val_237
-1	239	val_239
-1	244	val_244
-1	247	val_247
-1	256	val_256
-1	263	val_263
-1	273	val_273
-1	28	val_28
-1	283	val_283
-1	286	val_286
-1	292	val_292
-1	306	val_306
-1	308	val_308
-1	327	val_327
-1	33	val_33
-1	348	val_348
-1	353	val_353
-1	362	val_362
-1	366	val_366
-1	396	val_396
-1	397	val_397
-1	401	val_401
-1	409	val_409
-1	411	val_411
-1	419	val_419
-1	427	val_427
-1	43	val_43
-1	432	val_432
-1	436	val_436
-1	439	val_439
-1	443	val_443
-1	453	val_453
-1	460	val_460
-1	462	val_462
-1	47	val_47
-1	472	val_472
-1	485	val_485
-1	496	val_496
-1	54	val_54
-1	64	val_64
-1	70	val_70
-1	8	val_8
-1	83	val_83
-1	84	val_84
-1	85	val_85
-1	90	val_90
-1	0	val_0
-1	103	val_103
-1	114	val_114
-1	125	val_125
-1	138	val_138
-1	146	val_146
-1	150	val_150
-1	152	val_152
-1	153	val_153
-1	156	val_156
-1	157	val_157
-1	165	val_165
-1	172	val_172
-1	177	val_177
-1	179	val_179
-1	187	val_187
-1	195	val_195
-1	196	val_196
-1	217	val_217
-1	242	val_242
-1	248	val_248
-1	252	val_252
-1	265	val_265
-1	27	val_27
-1	272	val_272
-1	280	val_280
-1	291	val_291
-1	305	val_305
-1	309	val_309
-1	311	val_311
-1	315	val_315
-1	317	val_317
-1	322	val_322
-1	333	val_333
-1	34	val_34
-1	345	val_345
-1	35	val_35
-1	356	val_356
-1	364	val_364
-1	368	val_368
-1	369	val_369
-1	37	val_37
-1	373	val_373
-1	377	val_377
-1	4	val_4
-1	402	val_402
-1	404	val_404
-1	413	val_413
-1	42	val_42
-1	430	val_430
-1	431	val_431
-1	444	val_444
-1	449	val_449
-1	452	val_452
-1	454	val_454
-1	457	val_457
-1	463	val_463
-1	466	val_466
-1	470	val_470
-1	475	val_475
-1	481	val_481
-1	489	val_489
-1	491	val_491
-1	57	val_57
-1	65	val_65
-1	66	val_66
-1	74	val_74
-1	76	val_76
-1	78	val_78
-1	9	val_9
-1	92	val_92
-1	95	val_95
-1	100	val_100
-1	119	val_119
-1	128	val_128
-1	129	val_129
-1	145	val_145
-1	167	val_167
-1	174	val_174
-1	178	val_178
-1	181	val_181
-1	193	val_193
-1	199	val_199
-1	20	val_20
-1	201	val_201
-1	213	val_213
-1	214	val_214
-1	219	val_219
-1	221	val_221
-1	223	val_223
-1	226	val_226
-1	233	val_233
-1	241	val_241
-1	249	val_249
-1	260	val_260
-1	262	val_262
-1	277	val_277
-1	281	val_281
-1	287	val_287
-1	288	val_288
-1	298	val_298
-1	302	val_302
-1	310	val_310
-1	323	val_323
-1	336	val_336
-1	341	val_341
-1	344	val_344
-1	351	val_351
-1	375	val_375
-1	382	val_382
-1	384	val_384
-1	393	val_393
-1	395	val_395
-1	399	val_399
-1	403	val_403
-1	406	val_406
-1	418	val_418
-1	435	val_435
-1	455	val_455
-1	459	val_459
-1	477	val_477
-1	478	val_478
-1	479	val_479
-1	482	val_482
-1	493	val_493
-1	494	val_494
-1	495	val_495
-1	497	val_497
-1	5	val_5
-1	58	val_58
-1	67	val_67
-1	77	val_77
-1	80	val_80
-1	86	val_86
-1	97	val_97
-1	98	val_98
-1	10	val_10
-1	11	val_11
-1	111	val_111
-1	116	val_116
-1	126	val_126
-1	131	val_131
-1	134	val_134
-1	137	val_137
-1	143	val_143
-1	149	val_149
-1	15	val_15
-1	163	val_163
-1	164	val_164
-1	166	val_166
-1	169	val_169
-1	176	val_176
-1	183	val_183
-1	189	val_189
-1	190	val_190
-1	191	val_191
-1	192	val_192
-1	194	val_194
-1	2	val_2
-1	202	val_202
-1	203	val_203
-1	205	val_205
-1	207	val_207
-1	208	val_208
-1	209	val_209
-1	229	val_229
-1	230	val_230
-1	238	val_238
-1	24	val_24
-1	255	val_255
-1	257	val_257
-1	258	val_258
-1	26	val_26
-1	266	val_266
-1	274	val_274
-1	275	val_275
-1	278	val_278
-1	282	val_282
+1	283	val_283
 1	284	val_284
 1	285	val_285
+1	286	val_286
+1	287	val_287
+1	288	val_288
 1	289	val_289
+1	291	val_291
+1	292	val_292
 1	296	val_296
+1	298	val_298
 1	30	val_30
+1	302	val_302
+1	305	val_305
+1	306	val_306
 1	307	val_307
+1	308	val_308
+1	309	val_309
+1	310	val_310
+1	311	val_311
+1	315	val_315
 1	316	val_316
+1	317	val_317
 1	318	val_318
 1	321	val_321
+1	322	val_322
+1	323	val_323
 1	325	val_325
+1	327	val_327
+1	33	val_33
 1	331	val_331
 1	332	val_332
+1	333	val_333
 1	335	val_335
+1	336	val_336
 1	338	val_338
 1	339	val_339
+1	34	val_34
+1	341	val_341
 1	342	val_342
+1	344	val_344
+1	345	val_345
+1	348	val_348
+1	35	val_35
+1	351	val_351
+1	353	val_353
+1	356	val_356
 1	360	val_360
+1	362	val_362
+1	364	val_364
 1	365	val_365
+1	366	val_366
 1	367	val_367
+1	368	val_368
+1	369	val_369
+1	37	val_37
+1	373	val_373
 1	374	val_374
+1	375	val_375
+1	377	val_377
 1	378	val_378
 1	379	val_379
+1	382	val_382
+1	384	val_384
 1	386	val_386
 1	389	val_389
 1	392	val_392
+1	393	val_393
 1	394	val_394
+1	395	val_395
+1	396	val_396
+1	397	val_397
+1	399	val_399
+1	4	val_4
 1	400	val_400
+1	401	val_401
+1	402	val_402
+1	403	val_403
+1	404	val_404
+1	406	val_406
 1	407	val_407
+1	409	val_409
 1	41	val_41
+1	411	val_411
+1	413	val_413
 1	414	val_414
 1	417	val_417
+1	418	val_418
+1	419	val_419
+1	42	val_42
 1	421	val_421
 1	424	val_424
+1	427	val_427
 1	429	val_429
+1	43	val_43
+1	430	val_430
+1	431	val_431
+1	432	val_432
+1	435	val_435
+1	436	val_436
 1	437	val_437
 1	438	val_438
+1	439	val_439
 1	44	val_44
+1	443	val_443
+1	444	val_444
 1	446	val_446
 1	448	val_448
+1	449	val_449
+1	452	val_452
+1	453	val_453
+1	454	val_454
+1	455	val_455
+1	457	val_457
 1	458	val_458
+1	459	val_459
+1	460	val_460
+1	462	val_462
+1	463	val_463
+1	466	val_466
 1	467	val_467
 1	468	val_468
 1	469	val_469
+1	47	val_47
+1	470	val_470
+1	472	val_472
+1	475	val_475
+1	477	val_477
+1	478	val_478
+1	479	val_479
 1	480	val_480
+1	481	val_481
+1	482	val_482
 1	483	val_483
 1	484	val_484
+1	485	val_485
 1	487	val_487
+1	489	val_489
 1	490	val_490
+1	491	val_491
 1	492	val_492
+1	493	val_493
+1	494	val_494
+1	495	val_495
+1	496	val_496
+1	497	val_497
 1	498	val_498
+1	5	val_5
 1	51	val_51
 1	53	val_53
+1	54	val_54
+1	57	val_57
+1	58	val_58
+1	64	val_64
+1	65	val_65
+1	66	val_66
+1	67	val_67
 1	69	val_69
+1	70	val_70
 1	72	val_72
+1	74	val_74
+1	76	val_76
+1	77	val_77
+1	78	val_78
+1	8	val_8
+1	80	val_80
 1	82	val_82
+1	83	val_83
+1	84	val_84
+1	85	val_85
+1	86	val_86
 1	87	val_87
+1	9	val_9
+1	90	val_90
+1	92	val_92
+1	95	val_95
 1	96	val_96
+1	97	val_97
+1	98	val_98
 PREHOOK: query: SELECT 
 count(1) as counts,
 key,
@@ -7902,238 +7530,543 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 POSTHOOK: Output: hdfs://### HDFS PATH ###
+1	100	val_100
 1	104	val_104
 1	105	val_105
 1	113	val_113
 1	118	val_118
+1	119	val_119
 1	12	val_12
 1	120	val_120
+1	128	val_128
+1	129	val_129
 1	133	val_133
 1	136	val_136
+1	145	val_145
 1	155	val_155
 1	158	val_158
 1	160	val_160
 1	162	val_162
+1	167	val_167
 1	168	val_168
 1	17	val_17
 1	170	val_170
+1	174	val_174
 1	175	val_175
+1	178	val_178
 1	18	val_18
 1	180	val_180
+1	181	val_181
 1	186	val_186
 1	19	val_19
+1	193	val_193
 1	197	val_197
+1	199	val_199
+1	20	val_20
 1	200	val_200
+1	201	val_201
+1	213	val_213
+1	214	val_214
 1	216	val_216
 1	218	val_218
+1	219	val_219
+1	221	val_221
 1	222	val_222
+1	223	val_223
 1	224	val_224
+1	226	val_226
 1	228	val_228
+1	233	val_233
 1	235	val_235
 1	237	val_237
 1	239	val_239
+1	241	val_241
 1	244	val_244
 1	247	val_247
+1	249	val_249
 1	256	val_256
+1	260	val_260
+1	262	val_262
 1	263	val_263
 1	273	val_273
+1	277	val_277
 1	28	val_28
+1	281	val_281
 1	283	val_283
 1	286	val_286
+1	287	val_287
+1	288	val_288
 1	292	val_292
+1	298	val_298
+1	302	val_302
 1	306	val_306
 1	308	val_308
+1	310	val_310
+1	323	val_323
 1	327	val_327
 1	33	val_33
+1	336	val_336
+1	341	val_341
+1	344	val_344
 1	348	val_348
+1	351	val_351
 1	353	val_353
 1	362	val_362
 1	366	val_366
+1	375	val_375
+1	382	val_382
+1	384	val_384
+1	393	val_393
+1	395	val_395
 1	396	val_396
 1	397	val_397
+1	399	val_399
 1	401	val_401
+1	403	val_403
+1	406	val_406
 1	409	val_409
 1	411	val_411
+1	418	val_418
 1	419	val_419
 1	427	val_427
 1	43	val_43
 1	432	val_432
+1	435	val_435
 1	436	val_436
 1	439	val_439
 1	443	val_443
 1	453	val_453
+1	455	val_455
+1	459	val_459
 1	460	val_460
 1	462	val_462
 1	47	val_47
 1	472	val_472
+1	477	val_477
+1	478	val_478
+1	479	val_479
+1	482	val_482
 1	485	val_485
+1	493	val_493
+1	494	val_494
+1	495	val_495
 1	496	val_496
+1	497	val_497
+1	5	val_5
 1	54	val_54
+1	58	val_58
 1	64	val_64
+1	67	val_67
 1	70	val_70
+1	77	val_77
 1	8	val_8
+1	80	val_80
 1	83	val_83
 1	84	val_84
 1	85	val_85
+1	86	val_86
 1	90	val_90
+1	97	val_97
+1	98	val_98
 1	0	val_0
+1	10	val_10
 1	103	val_103
+1	11	val_11
+1	111	val_111
 1	114	val_114
+1	116	val_116
 1	125	val_125
+1	126	val_126
+1	131	val_131
+1	134	val_134
+1	137	val_137
 1	138	val_138
+1	143	val_143
 1	146	val_146
+1	149	val_149
+1	15	val_15
 1	150	val_150
 1	152	val_152
 1	153	val_153
 1	156	val_156
 1	157	val_157
+1	163	val_163
+1	164	val_164
 1	165	val_165
+1	166	val_166
+1	169	val_169
 1	172	val_172
+1	176	val_176
 1	177	val_177
 1	179	val_179
+1	183	val_183
 1	187	val_187
+1	189	val_189
+1	190	val_190
+1	191	val_191
+1	192	val_192
+1	194	val_194
 1	195	val_195
 1	196	val_196
+1	2	val_2
+1	202	val_202
+1	203	val_203
+1	205	val_205
+1	207	val_207
+1	208	val_208
+1	209	val_209
 1	217	val_217
+1	229	val_229
+1	230	val_230
+1	238	val_238
+1	24	val_24
 1	242	val_242
 1	248	val_248
 1	252	val_252
+1	255	val_255
+1	257	val_257
+1	258	val_258
+1	26	val_26
 1	265	val_265
+1	266	val_266
 1	27	val_27
 1	272	val_272
+1	274	val_274
+1	275	val_275
+1	278	val_278
 1	280	val_280
+1	282	val_282
+1	284	val_284
+1	285	val_285
+1	289	val_289
 1	291	val_291
+1	296	val_296
+1	30	val_30
 1	305	val_305
+1	307	val_307
 1	309	val_309
 1	311	val_311
 1	315	val_315
+1	316	val_316
 1	317	val_317
+1	318	val_318
+1	321	val_321
 1	322	val_322
+1	325	val_325
+1	331	val_331
+1	332	val_332
 1	333	val_333
+1	335	val_335
+1	338	val_338
+1	339	val_339
 1	34	val_34
+1	342	val_342
 1	345	val_345
 1	35	val_35
 1	356	val_356
+1	360	val_360
 1	364	val_364
+1	365	val_365
+1	367	val_367
 1	368	val_368
 1	369	val_369
 1	37	val_37
 1	373	val_373
+1	374	val_374
 1	377	val_377
+1	378	val_378
+1	379	val_379
+1	386	val_386
+1	389	val_389
+1	392	val_392
+1	394	val_394
 1	4	val_4
+1	400	val_400
 1	402	val_402
 1	404	val_404
+1	407	val_407
+1	41	val_41
 1	413	val_413
+1	414	val_414
+1	417	val_417
 1	42	val_42
+1	421	val_421
+1	424	val_424
+1	429	val_429
 1	430	val_430
 1	431	val_431
+1	437	val_437
+1	438	val_438
+1	44	val_44
 1	444	val_444
+1	446	val_446
+1	448	val_448
 1	449	val_449
 1	452	val_452
 1	454	val_454
 1	457	val_457
+1	458	val_458
 1	463	val_463
 1	466	val_466
+1	467	val_467
+1	468	val_468
+1	469	val_469
 1	470	val_470
 1	475	val_475
+1	480	val_480
 1	481	val_481
+1	483	val_483
+1	484	val_484
+1	487	val_487
 1	489	val_489
+1	490	val_490
 1	491	val_491
+1	492	val_492
+1	498	val_498
+1	51	val_51
+1	53	val_53
 1	57	val_57
 1	65	val_65
 1	66	val_66
+1	69	val_69
+1	72	val_72
 1	74	val_74
 1	76	val_76
 1	78	val_78
+1	82	val_82
+1	87	val_87
 1	9	val_9
 1	92	val_92
 1	95	val_95
+1	96	val_96
+PREHOOK: query: SELECT 
+count(1) as counts,
+key,
+value
+FROM
+(
+
+SELECT
+a.key, a.value
+FROM srcpart a JOIN srcpart b 
+ON a.ds='2008-04-08' and a.hr='11' and b.ds='2008-04-08' and b.hr='12'
+AND a.key = b.key 
+
+UNION DISTINCT
+
+select key, value 
+FROM srcpart LATERAL VIEW explode(array(1,2,3)) myTable AS myCol
+WHERE ds='2008-04-08' and hr='11'
+) a
+group by key, value
+PREHOOK: type: QUERY
+PREHOOK: Input: default@srcpart
+PREHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
+PREHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
+PREHOOK: Output: hdfs://### HDFS PATH ###
+POSTHOOK: query: SELECT 
+count(1) as counts,
+key,
+value
+FROM
+(
+
+SELECT
+a.key, a.value
+FROM srcpart a JOIN srcpart b 
+ON a.ds='2008-04-08' and a.hr='11' and b.ds='2008-04-08' and b.hr='12'
+AND a.key = b.key 
+
+UNION DISTINCT
+
+select key, value 
+FROM srcpart LATERAL VIEW explode(array(1,2,3)) myTable AS myCol
+WHERE ds='2008-04-08' and hr='11'
+) a
+group by key, value
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@srcpart
+POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
+POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
+POSTHOOK: Output: hdfs://### HDFS PATH ###
 1	100	val_100
+1	104	val_104
+1	105	val_105
+1	113	val_113
+1	118	val_118
 1	119	val_119
+1	12	val_12
+1	120	val_120
 1	128	val_128
 1	129	val_129
+1	133	val_133
+1	136	val_136
 1	145	val_145
+1	155	val_155
+1	158	val_158
+1	160	val_160
+1	162	val_162
 1	167	val_167
+1	168	val_168
+1	17	val_17
+1	170	val_170
 1	174	val_174
+1	175	val_175
 1	178	val_178
+1	18	val_18
+1	180	val_180
 1	181	val_181
+1	186	val_186
+1	19	val_19
 1	193	val_193
+1	197	val_197
 1	199	val_199
 1	20	val_20
+1	200	val_200
 1	201	val_201
 1	213	val_213
 1	214	val_214
+1	216	val_216
+1	218	val_218
 1	219	val_219
 1	221	val_221
+1	222	val_222
 1	223	val_223
+1	224	val_224
 1	226	val_226
+1	228	val_228
 1	233	val_233
+1	235	val_235
+1	237	val_237
+1	239	val_239
 1	241	val_241
+1	244	val_244
+1	247	val_247
 1	249	val_249
+1	256	val_256
 1	260	val_260
 1	262	val_262
+1	263	val_263
+1	273	val_273
 1	277	val_277
+1	28	val_28
 1	281	val_281
+1	283	val_283
+1	286	val_286
 1	287	val_287
 1	288	val_288
+1	292	val_292
 1	298	val_298
 1	302	val_302
+1	306	val_306
+1	308	val_308
 1	310	val_310
 1	323	val_323
+1	327	val_327
+1	33	val_33
 1	336	val_336
 1	341	val_341
 1	344	val_344
+1	348	val_348
 1	351	val_351
+1	353	val_353
+1	362	val_362
+1	366	val_366
 1	375	val_375
 1	382	val_382
 1	384	val_384
 1	393	val_393
 1	395	val_395
+1	396	val_396
+1	397	val_397
 1	399	val_399
+1	401	val_401
 1	403	val_403
 1	406	val_406
+1	409	val_409
+1	411	val_411
 1	418	val_418
+1	419	val_419
+1	427	val_427
+1	43	val_43
+1	432	val_432
 1	435	val_435
+1	436	val_436
+1	439	val_439
+1	443	val_443
+1	453	val_453
 1	455	val_455
 1	459	val_459
+1	460	val_460
+1	462	val_462
+1	47	val_47
+1	472	val_472
 1	477	val_477
 1	478	val_478
 1	479	val_479
 1	482	val_482
+1	485	val_485
 1	493	val_493
 1	494	val_494
 1	495	val_495
+1	496	val_496
 1	497	val_497
 1	5	val_5
+1	54	val_54
 1	58	val_58
+1	64	val_64
 1	67	val_67
+1	70	val_70
 1	77	val_77
+1	8	val_8
 1	80	val_80
+1	83	val_83
+1	84	val_84
+1	85	val_85
 1	86	val_86
+1	90	val_90
 1	97	val_97
 1	98	val_98
+1	0	val_0
 1	10	val_10
+1	103	val_103
 1	11	val_11
 1	111	val_111
+1	114	val_114
 1	116	val_116
+1	125	val_125
 1	126	val_126
 1	131	val_131
 1	134	val_134
 1	137	val_137
+1	138	val_138
 1	143	val_143
+1	146	val_146
 1	149	val_149
 1	15	val_15
+1	150	val_150
+1	152	val_152
+1	153	val_153
+1	156	val_156
+1	157	val_157
 1	163	val_163
 1	164	val_164
+1	165	val_165
 1	166	val_166
 1	169	val_169
+1	172	val_172
 1	176	val_176
+1	177	val_177
+1	179	val_179
 1	183	val_183
+1	187	val_187
 1	189	val_189
 1	190	val_190
 1	191	val_191
 1	192	val_192
 1	194	val_194
+1	195	val_195
+1	196	val_196
 1	2	val_2
 1	202	val_202
 1	203	val_203
@@ -8141,75 +8074,129 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 1	207	val_207
 1	208	val_208
 1	209	val_209
+1	217	val_217
 1	229	val_229
 1	230	val_230
 1	238	val_238
 1	24	val_24
+1	242	val_242
+1	248	val_248
+1	252	val_252
 1	255	val_255
 1	257	val_257
 1	258	val_258
 1	26	val_26
+1	265	val_265
 1	266	val_266
+1	27	val_27
+1	272	val_272
 1	274	val_274
 1	275	val_275
 1	278	val_278
+1	280	val_280
 1	282	val_282
 1	284	val_284
 1	285	val_285
 1	289	val_289
+1	291	val_291
 1	296	val_296
 1	30	val_30
+1	305	val_305
 1	307	val_307
+1	309	val_309
+1	311	val_311
+1	315	val_315
 1	316	val_316
+1	317	val_317
 1	318	val_318
 1	321	val_321
+1	322	val_322
 1	325	val_325
 1	331	val_331
 1	332	val_332
+1	333	val_333
 1	335	val_335
 1	338	val_338
 1	339	val_339
+1	34	val_34
 1	342	val_342
+1	345	val_345
+1	35	val_35
+1	356	val_356
 1	360	val_360
+1	364	val_364
 1	365	val_365
 1	367	val_367
+1	368	val_368
+1	369	val_369
+1	37	val_37
+1	373	val_373
 1	374	val_374
+1	377	val_377
 1	378	val_378
 1	379	val_379
 1	386	val_386
 1	389	val_389
 1	392	val_392
 1	394	val_394
+1	4	val_4
 1	400	val_400
+1	402	val_402
+1	404	val_404
 1	407	val_407
 1	41	val_41
+1	413	val_413
 1	414	val_414
 1	417	val_417
+1	42	val_42
 1	421	val_421
 1	424	val_424
 1	429	val_429
+1	430	val_430
+1	431	val_431
 1	437	val_437
 1	438	val_438
 1	44	val_44
+1	444	val_444
 1	446	val_446
 1	448	val_448
+1	449	val_449
+1	452	val_452
+1	454	val_454
+1	457	val_457
 1	458	val_458
+1	463	val_463
+1	466	val_466
 1	467	val_467
 1	468	val_468
 1	469	val_469
+1	470	val_470
+1	475	val_475
 1	480	val_480
+1	481	val_481
 1	483	val_483
 1	484	val_484
 1	487	val_487
+1	489	val_489
 1	490	val_490
+1	491	val_491
 1	492	val_492
 1	498	val_498
 1	51	val_51
 1	53	val_53
+1	57	val_57
+1	65	val_65
+1	66	val_66
 1	69	val_69
 1	72	val_72
+1	74	val_74
+1	76	val_76
+1	78	val_78
 1	82	val_82
 1	87	val_87
+1	9	val_9
+1	92	val_92
+1	95	val_95
 1	96	val_96
 PREHOOK: query: create table jackson_sev_same as select * from src
 PREHOOK: type: CREATETABLE_AS_SELECT
@@ -9269,9 +9256,9 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@union_out
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 1
+2
 3
 4
-2
 PREHOOK: query: create table union_subq_union30(key int, value string)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
@@ -10895,8 +10882,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToLong(key) (type: bigint)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -10904,13 +10891,13 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0
+                        outputColumnNames: _col1
                         input vertices:
                           1 Map 4
                         Statistics: Num rows: 11 Data size: 2024 Basic stats: COMPLETE Column stats: NONE
                         HybridGraceHashJoin: true
                         Select Operator
-                          expressions: UDFToDouble(UDFToLong(_col0)) (type: double)
+                          expressions: UDFToDouble(_col1) (type: double)
                           outputColumnNames: _col0
                           Statistics: Num rows: 11 Data size: 2024 Basic stats: COMPLETE Column stats: NONE
                           Group By Operator
@@ -11071,8 +11058,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToLong(key) (type: bigint)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -11080,13 +11067,13 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0
+                        outputColumnNames: _col1
                         input vertices:
                           1 Map 5
                         Statistics: Num rows: 11 Data size: 2024 Basic stats: COMPLETE Column stats: NONE
                         HybridGraceHashJoin: true
                         Select Operator
-                          expressions: UDFToDouble(UDFToLong(_col0)) (type: double)
+                          expressions: UDFToDouble(_col1) (type: double)
                           outputColumnNames: _col0
                           Statistics: Num rows: 11 Data size: 2024 Basic stats: COMPLETE Column stats: NONE
                           Group By Operator
@@ -11207,8 +11194,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToLong(key) (type: bigint)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -11216,13 +11203,13 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col1
+                        outputColumnNames: _col1, _col2
                         input vertices:
                           1 Map 4
                         Statistics: Num rows: 11 Data size: 2024 Basic stats: COMPLETE Column stats: NONE
                         HybridGraceHashJoin: true
                         Select Operator
-                          expressions: UDFToDouble(UDFToLong(_col0)) (type: double), _col1 (type: string)
+                          expressions: UDFToDouble(_col1) (type: double), _col2 (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 11 Data size: 2024 Basic stats: COMPLETE Column stats: NONE
                           Group By Operator
@@ -11383,8 +11370,8 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToLong(key) (type: bigint)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
@@ -11392,13 +11379,13 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col1
+                        outputColumnNames: _col1, _col3
                         input vertices:
                           1 Map 5
                         Statistics: Num rows: 11 Data size: 2024 Basic stats: COMPLETE Column stats: NONE
                         HybridGraceHashJoin: true
                         Select Operator
-                          expressions: UDFToDouble(UDFToLong(_col0)) (type: double), CAST( CAST( _col1 AS varchar(20)) AS STRING) (type: string)
+                          expressions: UDFToDouble(_col1) (type: double), CAST( _col3 AS STRING) (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 11 Data size: 2024 Basic stats: COMPLETE Column stats: NONE
                           Group By Operator
@@ -11422,14 +11409,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), CAST( key AS varchar(20)) (type: varchar(20))
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: varchar(20))
             Execution mode: vectorized
         Reducer 3 
             Execution mode: vectorized
@@ -12206,14 +12194,14 @@ POSTHOOK: Input: default@src10_3
 POSTHOOK: Input: default@src10_4
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 409	val_409
-165	val_165
-27	val_27
-311	val_311
 86	val_86
 98	val_98
+165	val_165
 238	val_238
 255	val_255
+27	val_27
 278	val_278
+311	val_311
 484	val_484
 PREHOOK: query: explain
 SELECT * FROM (
@@ -12421,12 +12409,12 @@ POSTHOOK: Input: default@src10_3
 POSTHOOK: Input: default@src10_4
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 409	val_409
-165	val_165
-27	val_27
-311	val_311
 86	val_86
 98	val_98
+165	val_165
 238	val_238
 255	val_255
+27	val_27
 278	val_278
+311	val_311
 484	val_484

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_between_columns.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_between_columns.q.out b/ql/src/test/results/clientpositive/llap/vector_between_columns.q.out
index 47bb172..fca136b 100644
--- a/ql/src/test/results/clientpositive/llap/vector_between_columns.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_between_columns.q.out
@@ -154,12 +154,12 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: rnum (type: int), csint (type: smallint)
-                    outputColumnNames: _col0, _col1
+                    expressions: rnum (type: int), csint (type: smallint), UDFToInteger(csint) (type: int)
+                    outputColumnNames: _col0, _col1, _col2
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1]
+                        projectedOutputColumnNums: [0, 1, 1]
                     Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       sort order: 
@@ -168,7 +168,7 @@ STAGE PLANS:
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                       Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int), _col1 (type: smallint)
+                      value expressions: _col0 (type: int), _col1 (type: smallint), _col2 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -189,10 +189,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 36 Data size: 612 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), _col2 (type: int), _col1 (type: int), _col3 (type: smallint), CASE WHEN (_col1 BETWEEN UDFToInteger(_col3) AND UDFToInteger(_col3)) THEN ('Ok') ELSE ('NoOk') END (type: string)
+                  expressions: _col0 (type: int), _col2 (type: int), _col1 (type: int), _col3 (type: smallint), CASE WHEN (_col1 BETWEEN _col4 AND _col4) THEN ('Ok') ELSE ('NoOk') END (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4
                   Statistics: Num rows: 36 Data size: 612 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
@@ -332,12 +332,12 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: rnum (type: int), csint (type: smallint)
-                    outputColumnNames: _col0, _col1
+                    expressions: rnum (type: int), csint (type: smallint), UDFToInteger(csint) (type: int)
+                    outputColumnNames: _col0, _col1, _col2
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1]
+                        projectedOutputColumnNums: [0, 1, 1]
                     Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       sort order: 
@@ -346,7 +346,7 @@ STAGE PLANS:
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                       Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int), _col1 (type: smallint)
+                      value expressions: _col0 (type: int), _col1 (type: smallint), _col2 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -367,10 +367,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 36 Data size: 612 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: _col1 BETWEEN UDFToInteger(_col3) AND UDFToInteger(_col3) (type: boolean)
+                  predicate: _col1 BETWEEN _col4 AND _col4 (type: boolean)
                   Statistics: Num rows: 4 Data size: 68 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col0 (type: int), _col2 (type: int), _col1 (type: int), _col3 (type: smallint)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_char_mapjoin1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_char_mapjoin1.q.out b/ql/src/test/results/clientpositive/llap/vector_char_mapjoin1.q.out
index 6cbf417..23024d3 100644
--- a/ql/src/test/results/clientpositive/llap/vector_char_mapjoin1.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_char_mapjoin1.q.out
@@ -519,17 +519,17 @@ STAGE PLANS:
                     predicate: c2 is not null (type: boolean)
                     Statistics: Num rows: 3 Data size: 294 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: c1 (type: int), c2 (type: char(10))
-                      outputColumnNames: _col0, _col1
+                      expressions: c1 (type: int), c2 (type: char(10)), CAST( c2 AS STRING) (type: string)
+                      outputColumnNames: _col0, _col1, _col2
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
-                          projectedOutputColumnNums: [0, 1]
+                          projectedOutputColumnNums: [0, 1, 1]
                       Statistics: Num rows: 3 Data size: 294 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: CAST( _col1 AS STRING) (type: string)
+                        key expressions: _col2 (type: string)
                         sort order: +
-                        Map-reduce partition columns: CAST( _col1 AS STRING) (type: string)
+                        Map-reduce partition columns: _col2 (type: string)
                         Reduce Sink Vectorization:
                             className: VectorReduceSinkStringOperator
                             native: true
@@ -574,26 +574,34 @@ STAGE PLANS:
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 CAST( _col1 AS STRING) (type: string)
+                          0 _col2 (type: string)
                           1 _col1 (type: string)
                         Map Join Vectorization:
                             className: VectorMapJoinInnerStringOperator
                             native: true
                             nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Optimized Table and Supports Key Types IS true
                             hashTableImplementationType: OPTIMIZED
-                        outputColumnNames: _col0, _col1, _col2, _col3
+                        outputColumnNames: _col0, _col1, _col3, _col4
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 3 Data size: 323 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: int)
-                          sort order: +
-                          Reduce Sink Vectorization:
-                              className: VectorReduceSinkObjectHashOperator
+                        Select Operator
+                          expressions: _col0 (type: int), _col1 (type: char(10)), _col3 (type: int), _col4 (type: string)
+                          outputColumnNames: _col0, _col1, _col2, _col3
+                          Select Vectorization:
+                              className: VectorSelectOperator
                               native: true
-                              nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                              projectedOutputColumnNums: [3, 4, 0, 1]
                           Statistics: Num rows: 3 Data size: 323 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col1 (type: char(10)), _col2 (type: int), _col3 (type: string)
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int)
+                            sort order: +
+                            Reduce Sink Vectorization:
+                                className: VectorReduceSinkObjectHashOperator
+                                native: true
+                                nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                            Statistics: Num rows: 3 Data size: 323 Basic stats: COMPLETE Column stats: NONE
+                            value expressions: _col1 (type: char(10)), _col2 (type: int), _col3 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_coalesce_3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_coalesce_3.q.out b/ql/src/test/results/clientpositive/llap/vector_coalesce_3.q.out
index bf52ccf..493cfca 100644
--- a/ql/src/test/results/clientpositive/llap/vector_coalesce_3.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_coalesce_3.q.out
@@ -119,13 +119,12 @@ STAGE PLANS:
                         1 Map 2
                       Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                       Select Operator
-                        expressions: _col0 (type: bigint), CASE WHEN (CASE WHEN (_col2 is not null) THEN ((_col2 > 1L)) ELSE (true) END) THEN (_col2) ELSE (null) END (type: bigint)
+                        expressions: _col0 (type: bigint), _col2 (type: bigint)
                         outputColumnNames: _col0, _col1
                         Select Vectorization:
                             className: VectorSelectOperator
                             native: true
-                            projectedOutputColumnNums: [0, 7]
-                            selectExpressions: IfExprColumnNull(col 6:boolean, col 2:bigint, null)(children: IfExprCondExprColumn(col 3:boolean, col 4:boolean, col 5:boolean)(children: IsNotNull(col 2:bigint) -> 3:boolean, LongColGreaterLongScalar(col 2:bigint, val 1) -> 4:boolean, ConstantVectorExpression(val 1) -> 5:boolean) -> 6:boolean, col 2:bigint) -> 7:bigint
+                            projectedOutputColumnNums: [0, 2]
                         Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                         File Output Operator
                           compressed: false
@@ -153,7 +152,7 @@ STAGE PLANS:
                     includeColumns: [0]
                     dataColumns: member:bigint
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, bigint, bigint]
+                    scratchColumnTypeNames: [bigint]
         Map 2 
             Map Operator Tree:
                 TableScan
@@ -163,12 +162,13 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:member:bigint, 1:attr:bigint, 2:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: member (type: bigint), attr (type: bigint)
+                    expressions: member (type: bigint), CASE WHEN (CASE WHEN (attr is not null) THEN ((attr > 1L)) ELSE (true) END) THEN (attr) ELSE (null) END (type: bigint)
                     outputColumnNames: _col0, _col1
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1]
+                        projectedOutputColumnNums: [0, 7]
+                        selectExpressions: IfExprColumnNull(col 6:boolean, col 1:bigint, null)(children: IfExprCondExprColumn(col 3:boolean, col 4:boolean, col 5:boolean)(children: IsNotNull(col 1:bigint) -> 3:boolean, LongColGreaterLongScalar(col 1:bigint, val 1) -> 4:boolean, ConstantVectorExpression(val 1) -> 5:boolean) -> 6:boolean, col 1:bigint) -> 7:bigint
                     Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: bigint)
@@ -179,7 +179,7 @@ STAGE PLANS:
                           keyColumns: 0:bigint
                           native: true
                           nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                          valueColumns: 1:bigint
+                          valueColumns: 7:bigint
                       Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: bigint)
             Execution mode: vectorized, llap
@@ -198,7 +198,7 @@ STAGE PLANS:
                     includeColumns: [0, 1]
                     dataColumns: member:bigint, attr:bigint
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: []
+                    scratchColumnTypeNames: [bigint, bigint, bigint, bigint, bigint]
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_complex_join.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_complex_join.q.out b/ql/src/test/results/clientpositive/llap/vector_complex_join.q.out
index 4c05f7c..ed445b7 100644
--- a/ql/src/test/results/clientpositive/llap/vector_complex_join.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_complex_join.q.out
@@ -262,7 +262,7 @@ STAGE PLANS:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int)
-                          1 _col0[1] (type: int)
+                          1 _col2 (type: int)
                         Map Join Vectorization:
                             className: VectorMapJoinInnerLongOperator
                             native: true
@@ -309,20 +309,20 @@ STAGE PLANS:
                     predicate: a[1] is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 124 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: a (type: array<int>), index (type: int)
-                      outputColumnNames: _col0, _col1
+                      expressions: a (type: array<int>), index (type: int), a[1] (type: int)
+                      outputColumnNames: _col0, _col1, _col2
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
-                          projectedOutputColumnNums: [0, 1]
+                          projectedOutputColumnNums: [0, 1, 3]
+                          selectExpressions: ListIndexColScalar(col 0:array<int>, col 1:int) -> 3:int
                       Statistics: Num rows: 1 Data size: 124 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0[1] (type: int)
+                        key expressions: _col2 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col0[1] (type: int)
+                        Map-reduce partition columns: _col2 (type: int)
                         Reduce Sink Vectorization:
                             className: VectorReduceSinkLongOperator
-                            keyExpressions: ListIndexColScalar(col 0:array<int>, col 1:int) -> 3:int
                             native: true
                             nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                         Statistics: Num rows: 1 Data size: 124 Basic stats: COMPLETE Column stats: NONE
@@ -414,7 +414,7 @@ STAGE PLANS:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int)
-                          1 _col0[_col1] (type: int)
+                          1 _col2 (type: int)
                         Map Join Vectorization:
                             className: VectorMapJoinInnerLongOperator
                             native: true
@@ -461,20 +461,20 @@ STAGE PLANS:
                     predicate: a[index] is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 124 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: a (type: array<int>), index (type: int)
-                      outputColumnNames: _col0, _col1
+                      expressions: a (type: array<int>), index (type: int), a[index] (type: int)
+                      outputColumnNames: _col0, _col1, _col2
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
-                          projectedOutputColumnNums: [0, 1]
+                          projectedOutputColumnNums: [0, 1, 3]
+                          selectExpressions: ListIndexColColumn(col 0:array<int>, col 1:int) -> 3:int
                       Statistics: Num rows: 1 Data size: 124 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0[_col1] (type: int)
+                        key expressions: _col2 (type: int)
                         sort order: +
-                        Map-reduce partition columns: _col0[_col1] (type: int)
+                        Map-reduce partition columns: _col2 (type: int)
                         Reduce Sink Vectorization:
                             className: VectorReduceSinkLongOperator
-                            keyExpressions: ListIndexColColumn(col 0:array<int>, col 1:int) -> 3:int
                             native: true
                             nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                         Statistics: Num rows: 1 Data size: 124 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_inner_join.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_inner_join.q.out b/ql/src/test/results/clientpositive/llap/vector_inner_join.q.out
index 53d5d8b..f7ddc53 100644
--- a/ql/src/test/results/clientpositive/llap/vector_inner_join.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_inner_join.q.out
@@ -817,13 +817,14 @@ STAGE PLANS:
                     predicate: (c > 2) (type: boolean)
                     Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: c (type: int), v2 (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: c (type: int), v2 (type: string), (c * 5) (type: int)
+                      outputColumnNames: _col0, _col1, _col2
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
-                          projectedOutputColumnNums: [0, 1]
-                      Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
+                          projectedOutputColumnNums: [0, 1, 3]
+                          selectExpressions: LongColMultiplyLongScalar(col 0:int, val 5) -> 3:int
+                      Statistics: Num rows: 1 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
@@ -832,27 +833,26 @@ STAGE PLANS:
                           1 _col1 (type: int)
                         Map Join Vectorization:
                             bigTableKeyColumns: 0:int
-                            bigTableRetainColumnNums: [0, 1]
-                            bigTableValueColumns: 0:int, 1:string
+                            bigTableRetainColumnNums: [1, 3]
+                            bigTableValueColumns: 1:string, 3:int
                             className: VectorMapJoinInnerLongOperator
                             native: true
                             nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Optimized Table and Supports Key Types IS true
                             nonOuterSmallTableKeyMapping: []
-                            projectedOutput: 0:int, 1:string, 3:string, 0:int
-                            smallTableValueMapping: 3:string
+                            projectedOutput: 1:string, 3:int, 4:string, 5:int
+                            smallTableValueMapping: 4:string, 5:int
                             hashTableImplementationType: OPTIMIZED
-                        outputColumnNames: _col0, _col1, _col2, _col3
+                        outputColumnNames: _col1, _col2, _col3, _col5
                         input vertices:
                           1 Map 2
                         Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col2 (type: string), (_col3 * 2) (type: int), (_col0 * 5) (type: int), _col1 (type: string)
+                          expressions: _col3 (type: string), _col5 (type: int), _col2 (type: int), _col1 (type: string)
                           outputColumnNames: _col0, _col1, _col2, _col3
                           Select Vectorization:
                               className: VectorSelectOperator
                               native: true
-                              projectedOutputColumnNums: [3, 4, 5, 1]
-                              selectExpressions: LongColMultiplyLongScalar(col 0:int, val 2) -> 4:int, LongColMultiplyLongScalar(col 0:int, val 5) -> 5:int
+                              projectedOutputColumnNums: [4, 5, 3, 1]
                           Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
                           File Output Operator
                             compressed: false
@@ -880,7 +880,7 @@ STAGE PLANS:
                     includeColumns: [0, 1]
                     dataColumns: c:int, v2:string
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [string, bigint, bigint]
+                    scratchColumnTypeNames: [bigint, string, bigint]
         Map 2 
             Map Operator Tree:
                 TableScan
@@ -898,13 +898,14 @@ STAGE PLANS:
                     predicate: (a > 2) (type: boolean)
                     Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: v1 (type: string), a (type: int)
-                      outputColumnNames: _col0, _col1
+                      expressions: v1 (type: string), a (type: int), (a * 2) (type: int)
+                      outputColumnNames: _col0, _col1, _col2
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
-                          projectedOutputColumnNums: [0, 1]
-                      Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
+                          projectedOutputColumnNums: [0, 1, 3]
+                          selectExpressions: LongColMultiplyLongScalar(col 1:int, val 2) -> 3:int
+                      Statistics: Num rows: 1 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: int)
                         sort order: +
@@ -914,9 +915,9 @@ STAGE PLANS:
                             keyColumns: 1:int
                             native: true
                             nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                            valueColumns: 0:string
-                        Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: string)
+                            valueColumns: 0:string, 3:int
+                        Statistics: Num rows: 1 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: string), _col2 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -933,7 +934,7 @@ STAGE PLANS:
                     includeColumns: [0, 1]
                     dataColumns: v1:string, a:int
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: []
+                    scratchColumnTypeNames: [bigint]
 
   Stage: Stage-0
     Fetch Operator


[17/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query85.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query85.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query85.q.out
index 50474bc..f5a71b4 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query85.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query85.q.out
@@ -184,36 +184,36 @@ CBO PLAN:
 HiveProject(_o__c0=[$0], _o__c1=[$1], _o__c2=[$2], _o__c3=[$3])
   HiveSortLimit(sort0=[$7], sort1=[$4], sort2=[$5], sort3=[$6], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], fetch=[100])
     HiveProject(_o__c0=[substr($0, 1, 20)], _o__c1=[/(CAST($1):DOUBLE, $2)], _o__c2=[/($3, $4)], _o__c3=[/($5, $6)], (tok_function avg (tok_table_or_col ws_quantity))=[/(CAST($1):DOUBLE, $2)], (tok_function avg (tok_table_or_col wr_refunded_cash))=[/($3, $4)], (tok_function avg (tok_table_or_col wr_fee))=[/($5, $6)], (tok_function substr (tok_table_or_col r_reason_desc) 1 20)=[substr($0, 1, 20)])
-      HiveAggregate(group=[{7}], agg#0=[sum($26)], agg#1=[count($26)], agg#2=[sum($21)], agg#3=[count($21)], agg#4=[sum($20)], agg#5=[count($20)])
-        HiveJoin(condition=[AND(AND(=($0, $17), =($4, $1)), =($5, $2))], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2], cd_education_status=[$3])
+      HiveAggregate(group=[{14}], agg#0=[sum($32)], agg#1=[count($32)], agg#2=[sum($27)], agg#3=[count($27)], agg#4=[sum($26)], agg#5=[count($26)])
+        HiveJoin(condition=[AND(AND(AND(=($1, $18), =($2, $19)), =($0, $21)), OR(AND($3, $4, $36), AND($5, $6, $37), AND($7, $8, $38)))], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2], cd_education_status=[$3], ==[=($2, _UTF-16LE'M')], =4=[=($3, _UTF-16LE'4 yr Degree')], =5=[=($2, _UTF-16LE'D')], =6=[=($3, _UTF-16LE'Primary')], =7=[=($2, _UTF-16LE'U')], =8=[=($3, _UTF-16LE'Advanced Degree')])
             HiveFilter(condition=[AND(IN($3, _UTF-16LE'4 yr Degree', _UTF-16LE'Primary', _UTF-16LE'Advanced Degree'), IN($2, _UTF-16LE'M', _UTF-16LE'D', _UTF-16LE'U'), IS NOT NULL($0))])
-              HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd2])
-          HiveJoin(condition=[AND(=($0, $12), OR(AND(=($1, _UTF-16LE'M'), =($2, _UTF-16LE'4 yr Degree'), BETWEEN(false, $24, 100, 150)), AND(=($1, _UTF-16LE'D'), =($2, _UTF-16LE'Primary'), BETWEEN(false, $24, 50, 100)), AND(=($1, _UTF-16LE'U'), =($2, _UTF-16LE'Advanced Degree'), BETWEEN(false, $24, 150, 200))))], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2], cd_education_status=[$3])
-              HiveFilter(condition=[AND(IN($3, _UTF-16LE'4 yr Degree', _UTF-16LE'Primary', _UTF-16LE'Advanced Degree'), IN($2, _UTF-16LE'M', _UTF-16LE'D', _UTF-16LE'U'), IS NOT NULL($0))])
-                HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd1])
-            HiveJoin(condition=[=($0, $12)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd1])
+          HiveJoin(condition=[AND(=($0, $13), OR(AND($1, $24), AND($2, $25), AND($3, $26)))], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(ca_address_sk=[$0], IN=[IN($8, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM')], IN2=[IN($8, _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN')], IN3=[IN($8, _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV')])
+              HiveFilter(condition=[AND(IN($8, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM', _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN', _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV'), =($10, _UTF-16LE'United States'), IS NOT NULL($0))])
+                HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
+            HiveJoin(condition=[=($0, $11)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(r_reason_sk=[$0], r_reason_desc=[$2])
                 HiveFilter(condition=[IS NOT NULL($0)])
                   HiveTableScan(table=[[default, reason]], table:alias=[reason])
-              HiveJoin(condition=[=($14, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(d_date_sk=[$0], d_year=[CAST(1998):INTEGER])
-                  HiveFilter(condition=[AND(=($6, 1998), IS NOT NULL($0))])
-                    HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                HiveJoin(condition=[=($14, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject(wp_web_page_sk=[$0])
-                    HiveFilter(condition=[IS NOT NULL($0)])
-                      HiveTableScan(table=[[default, web_page]], table:alias=[web_page])
-                  HiveJoin(condition=[AND(=($0, $5), OR(AND(IN($1, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM'), BETWEEN(false, $17, 100, 200)), AND(IN($1, _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN'), BETWEEN(false, $17, 150, 300)), AND(IN($1, _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV'), BETWEEN(false, $17, 50, 250))))], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(ca_address_sk=[$0], ca_state=[$8], ca_country=[CAST(_UTF-16LE'United States'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
-                      HiveFilter(condition=[AND(IN($8, _UTF-16LE'KY', _UTF-16LE'GA', _UTF-16LE'NM', _UTF-16LE'MT', _UTF-16LE'OR', _UTF-16LE'IN', _UTF-16LE'WI', _UTF-16LE'MO', _UTF-16LE'WV'), =($10, _UTF-16LE'United States'), IS NOT NULL($0))])
-                        HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
+              HiveJoin(condition=[=($15, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(wp_web_page_sk=[$0])
+                  HiveFilter(condition=[IS NOT NULL($0)])
+                    HiveTableScan(table=[[default, web_page]], table:alias=[web_page])
+                HiveJoin(condition=[=($12, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveProject(d_date_sk=[$0])
+                    HiveFilter(condition=[AND(=($6, 1998), IS NOT NULL($0))])
+                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+                  HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2], cd_education_status=[$3])
+                      HiveFilter(condition=[AND(IN($3, _UTF-16LE'4 yr Degree', _UTF-16LE'Primary', _UTF-16LE'Advanced Degree'), IN($2, _UTF-16LE'M', _UTF-16LE'D', _UTF-16LE'U'), IS NOT NULL($0))])
+                        HiveTableScan(table=[[default, customer_demographics]], table:alias=[cd2])
                     HiveJoin(condition=[AND(=($9, $0), =($11, $5))], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(wr_item_sk=[$2], wr_refunded_cdemo_sk=[$4], wr_refunded_addr_sk=[$6], wr_returning_cdemo_sk=[$8], wr_reason_sk=[$12], wr_order_number=[$13], wr_fee=[$18], wr_refunded_cash=[$20])
                         HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($13), IS NOT NULL($4), IS NOT NULL($8), IS NOT NULL($6), IS NOT NULL($12))])
                           HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
-                      HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_web_page_sk=[$12], ws_order_number=[$17], ws_quantity=[$18], ws_sales_price=[$21], ws_net_profit=[$33])
+                      HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_web_page_sk=[$12], ws_order_number=[$17], ws_quantity=[$18], BETWEEN=[BETWEEN(false, $33, 100, 200)], BETWEEN6=[BETWEEN(false, $33, 150, 300)], BETWEEN7=[BETWEEN(false, $33, 50, 250)], BETWEEN8=[BETWEEN(false, $21, 100, 150)], BETWEEN9=[BETWEEN(false, $21, 50, 100)], BETWEEN10=[BETWEEN(false, $21, 150, 200)])
                         HiveFilter(condition=[AND(OR(BETWEEN(false, $21, 100, 150), BETWEEN(false, $21, 50, 100), BETWEEN(false, $21, 150, 200)), OR(BETWEEN(false, $33, 100, 200), BETWEEN(false, $33, 150, 300), BETWEEN(false, $33, 50, 250)), IS NOT NULL($3), IS NOT NULL($17), IS NOT NULL($12), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query87.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query87.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query87.q.out
index 35f319d..e030b3e 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query87.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query87.q.out
@@ -78,7 +78,7 @@ HiveAggregate(group=[{}], agg#0=[count()])
                                       HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3])
                                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($3))])
                                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                      HiveProject(d_date_sk=[$0], d_date=[$2], d_month_seq=[$3])
+                                      HiveProject(d_date_sk=[$0], d_date=[$2])
                                         HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                           HiveProject($f0=[$1], $f1=[$0], $f2=[$2], $f3=[1], $f4=[$3])
@@ -93,7 +93,7 @@ HiveAggregate(group=[{}], agg#0=[count()])
                                       HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3])
                                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($3))])
                                           HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                      HiveProject(d_date_sk=[$0], d_date=[$2], d_month_seq=[$3])
+                                      HiveProject(d_date_sk=[$0], d_date=[$2])
                                         HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
             HiveProject($f0=[$1], $f1=[$0], $f2=[$2], $f3=[1], $f4=[$3])
@@ -108,7 +108,7 @@ HiveAggregate(group=[{}], agg#0=[count()])
                         HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4])
                           HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($4))])
                             HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                        HiveProject(d_date_sk=[$0], d_date=[$2], d_month_seq=[$3])
+                        HiveProject(d_date_sk=[$0], d_date=[$2])
                           HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query88.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query88.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query88.q.out
index 1f86e3a..1f4471e 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query88.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query88.q.out
@@ -210,138 +210,138 @@ HiveProject($f0=[$0], $f00=[$7], $f01=[$6], $f02=[$5], $f03=[$4], $f04=[$3], $f0
               HiveJoin(condition=[true], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject($f0=[$0])
                   HiveAggregate(group=[{}], agg#0=[count()])
-                    HiveJoin(condition=[=($2, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                         HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                           HiveProject(ss_sold_time_sk=[$1], ss_hdemo_sk=[$5], ss_store_sk=[$7])
                             HiveFilter(condition=[AND(IS NOT NULL($5), IS NOT NULL($1), IS NOT NULL($7))])
                               HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                          HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+                          HiveProject(hd_demo_sk=[$0])
                             HiveFilter(condition=[AND(IN($3, 3, 0, 1), <=($4, 5), OR(AND(=($3, 3), IS NOT NULL($4)), AND(=($3, 0), <=($4, 2)), AND(=($3, 1), <=($4, 3))), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-                        HiveProject(t_time_sk=[$0], t_hour=[CAST(8):INTEGER], t_minute=[$4])
+                        HiveProject(t_time_sk=[$0])
                           HiveFilter(condition=[AND(=($3, 8), >=($4, 30), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-                      HiveProject(s_store_sk=[$0], s_store_name=[CAST(_UTF-16LE'ese'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                      HiveProject(s_store_sk=[$0])
                         HiveFilter(condition=[AND(=($5, _UTF-16LE'ese'), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, store]], table:alias=[store])
                 HiveProject($f0=[$0])
                   HiveAggregate(group=[{}], agg#0=[count()])
-                    HiveJoin(condition=[=($2, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                         HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                           HiveProject(ss_sold_time_sk=[$1], ss_hdemo_sk=[$5], ss_store_sk=[$7])
                             HiveFilter(condition=[AND(IS NOT NULL($5), IS NOT NULL($1), IS NOT NULL($7))])
                               HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                          HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+                          HiveProject(hd_demo_sk=[$0])
                             HiveFilter(condition=[AND(IN($3, 3, 0, 1), <=($4, 5), OR(AND(=($3, 3), IS NOT NULL($4)), AND(=($3, 0), <=($4, 2)), AND(=($3, 1), <=($4, 3))), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-                        HiveProject(t_time_sk=[$0], t_hour=[CAST(12):INTEGER], t_minute=[$4])
+                        HiveProject(t_time_sk=[$0])
                           HiveFilter(condition=[AND(=($3, 12), <($4, 30), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-                      HiveProject(s_store_sk=[$0], s_store_name=[CAST(_UTF-16LE'ese'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                      HiveProject(s_store_sk=[$0])
                         HiveFilter(condition=[AND(=($5, _UTF-16LE'ese'), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, store]], table:alias=[store])
               HiveProject($f0=[$0])
                 HiveAggregate(group=[{}], agg#0=[count()])
-                  HiveJoin(condition=[=($2, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                         HiveProject(ss_sold_time_sk=[$1], ss_hdemo_sk=[$5], ss_store_sk=[$7])
                           HiveFilter(condition=[AND(IS NOT NULL($5), IS NOT NULL($1), IS NOT NULL($7))])
                             HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                        HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+                        HiveProject(hd_demo_sk=[$0])
                           HiveFilter(condition=[AND(IN($3, 3, 0, 1), <=($4, 5), OR(AND(=($3, 3), IS NOT NULL($4)), AND(=($3, 0), <=($4, 2)), AND(=($3, 1), <=($4, 3))), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-                      HiveProject(t_time_sk=[$0], t_hour=[CAST(11):INTEGER], t_minute=[$4])
+                      HiveProject(t_time_sk=[$0])
                         HiveFilter(condition=[AND(=($3, 11), >=($4, 30), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-                    HiveProject(s_store_sk=[$0], s_store_name=[CAST(_UTF-16LE'ese'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                    HiveProject(s_store_sk=[$0])
                       HiveFilter(condition=[AND(=($5, _UTF-16LE'ese'), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, store]], table:alias=[store])
             HiveProject($f0=[$0])
               HiveAggregate(group=[{}], agg#0=[count()])
-                HiveJoin(condition=[=($2, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(ss_sold_time_sk=[$1], ss_hdemo_sk=[$5], ss_store_sk=[$7])
                         HiveFilter(condition=[AND(IS NOT NULL($5), IS NOT NULL($1), IS NOT NULL($7))])
                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                      HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+                      HiveProject(hd_demo_sk=[$0])
                         HiveFilter(condition=[AND(IN($3, 3, 0, 1), <=($4, 5), OR(AND(=($3, 3), IS NOT NULL($4)), AND(=($3, 0), <=($4, 2)), AND(=($3, 1), <=($4, 3))), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-                    HiveProject(t_time_sk=[$0], t_hour=[CAST(11):INTEGER], t_minute=[$4])
+                    HiveProject(t_time_sk=[$0])
                       HiveFilter(condition=[AND(=($3, 11), <($4, 30), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-                  HiveProject(s_store_sk=[$0], s_store_name=[CAST(_UTF-16LE'ese'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                  HiveProject(s_store_sk=[$0])
                     HiveFilter(condition=[AND(=($5, _UTF-16LE'ese'), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, store]], table:alias=[store])
           HiveProject($f0=[$0])
             HiveAggregate(group=[{}], agg#0=[count()])
-              HiveJoin(condition=[=($2, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(ss_sold_time_sk=[$1], ss_hdemo_sk=[$5], ss_store_sk=[$7])
                       HiveFilter(condition=[AND(IS NOT NULL($5), IS NOT NULL($1), IS NOT NULL($7))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+                    HiveProject(hd_demo_sk=[$0])
                       HiveFilter(condition=[AND(IN($3, 3, 0, 1), <=($4, 5), OR(AND(=($3, 3), IS NOT NULL($4)), AND(=($3, 0), <=($4, 2)), AND(=($3, 1), <=($4, 3))), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-                  HiveProject(t_time_sk=[$0], t_hour=[CAST(10):INTEGER], t_minute=[$4])
+                  HiveProject(t_time_sk=[$0])
                     HiveFilter(condition=[AND(=($3, 10), >=($4, 30), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-                HiveProject(s_store_sk=[$0], s_store_name=[CAST(_UTF-16LE'ese'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                HiveProject(s_store_sk=[$0])
                   HiveFilter(condition=[AND(=($5, _UTF-16LE'ese'), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store]], table:alias=[store])
         HiveProject($f0=[$0])
           HiveAggregate(group=[{}], agg#0=[count()])
-            HiveJoin(condition=[=($2, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_time_sk=[$1], ss_hdemo_sk=[$5], ss_store_sk=[$7])
                     HiveFilter(condition=[AND(IS NOT NULL($5), IS NOT NULL($1), IS NOT NULL($7))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+                  HiveProject(hd_demo_sk=[$0])
                     HiveFilter(condition=[AND(IN($3, 3, 0, 1), <=($4, 5), OR(AND(=($3, 3), IS NOT NULL($4)), AND(=($3, 0), <=($4, 2)), AND(=($3, 1), <=($4, 3))), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-                HiveProject(t_time_sk=[$0], t_hour=[CAST(10):INTEGER], t_minute=[$4])
+                HiveProject(t_time_sk=[$0])
                   HiveFilter(condition=[AND(=($3, 10), <($4, 30), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-              HiveProject(s_store_sk=[$0], s_store_name=[CAST(_UTF-16LE'ese'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+              HiveProject(s_store_sk=[$0])
                 HiveFilter(condition=[AND(=($5, _UTF-16LE'ese'), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, store]], table:alias=[store])
       HiveProject($f0=[$0])
         HiveAggregate(group=[{}], agg#0=[count()])
-          HiveJoin(condition=[=($2, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(ss_sold_time_sk=[$1], ss_hdemo_sk=[$5], ss_store_sk=[$7])
                   HiveFilter(condition=[AND(IS NOT NULL($5), IS NOT NULL($1), IS NOT NULL($7))])
                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+                HiveProject(hd_demo_sk=[$0])
                   HiveFilter(condition=[AND(IN($3, 3, 0, 1), <=($4, 5), OR(AND(=($3, 3), IS NOT NULL($4)), AND(=($3, 0), <=($4, 2)), AND(=($3, 1), <=($4, 3))), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-              HiveProject(t_time_sk=[$0], t_hour=[CAST(9):INTEGER], t_minute=[$4])
+              HiveProject(t_time_sk=[$0])
                 HiveFilter(condition=[AND(=($3, 9), >=($4, 30), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-            HiveProject(s_store_sk=[$0], s_store_name=[CAST(_UTF-16LE'ese'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+            HiveProject(s_store_sk=[$0])
               HiveFilter(condition=[AND(=($5, _UTF-16LE'ese'), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, store]], table:alias=[store])
     HiveProject($f0=[$0])
       HiveAggregate(group=[{}], agg#0=[count()])
-        HiveJoin(condition=[=($2, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(ss_sold_time_sk=[$1], ss_hdemo_sk=[$5], ss_store_sk=[$7])
                 HiveFilter(condition=[AND(IS NOT NULL($5), IS NOT NULL($1), IS NOT NULL($7))])
                   HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-              HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+              HiveProject(hd_demo_sk=[$0])
                 HiveFilter(condition=[AND(IN($3, 3, 0, 1), <=($4, 5), OR(AND(=($3, 3), IS NOT NULL($4)), AND(=($3, 0), <=($4, 2)), AND(=($3, 1), <=($4, 3))), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-            HiveProject(t_time_sk=[$0], t_hour=[CAST(9):INTEGER], t_minute=[$4])
+            HiveProject(t_time_sk=[$0])
               HiveFilter(condition=[AND(=($3, 9), <($4, 30), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-          HiveProject(s_store_sk=[$0], s_store_name=[CAST(_UTF-16LE'ese'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+          HiveProject(s_store_sk=[$0])
             HiveFilter(condition=[AND(=($5, _UTF-16LE'ese'), IS NOT NULL($0))])
               HiveTableScan(table=[[default, store]], table:alias=[store])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query89.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query89.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query89.q.out
index 72f22b6..7cfb3ec 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query89.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query89.q.out
@@ -69,8 +69,8 @@ HiveProject(i_category=[$0], i_class=[$1], i_brand=[$2], s_store_name=[$3], s_co
       HiveFilter(condition=[CASE(<>($7, 0), >(/(ABS(-($6, $7)), $7), 0.1), null)])
         HiveProject((tok_table_or_col i_category)=[$2], (tok_table_or_col i_class)=[$1], (tok_table_or_col i_brand)=[$0], (tok_table_or_col s_store_name)=[$4], (tok_table_or_col s_company_name)=[$5], (tok_table_or_col d_moy)=[$3], (tok_function sum (tok_table_or_col ss_sales_price))=[$6], avg_window_0=[avg($6) OVER (PARTITION BY $2, $0, $4, $5 ORDER BY $2 NULLS FIRST, $0 NULLS FIRST, $4 NULLS FIRST, $5 NULLS FIRST ROWS BETWEEN 2147483647 FOLLOWING AND 2147483647 PRECEDING)])
           HiveProject(i_brand=[$0], i_class=[$1], i_category=[$2], d_moy=[$3], s_store_name=[$4], s_company_name=[$5], $f6=[$6])
-            HiveAggregate(group=[{5, 6, 7, 10, 12, 13}], agg#0=[sum($3)])
-              HiveJoin(condition=[=($2, $11)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveAggregate(group=[{5, 6, 7, 9, 11, 12}], agg#0=[sum($3)])
+              HiveJoin(condition=[=($2, $10)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($0, $8)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_store_sk=[$7], ss_sales_price=[$13])
@@ -79,7 +79,7 @@ HiveProject(i_category=[$0], i_class=[$1], i_brand=[$2], s_store_name=[$3], s_co
                     HiveProject(i_item_sk=[$0], i_brand=[$8], i_class=[$10], i_category=[$12])
                       HiveFilter(condition=[AND(IN($10, _UTF-16LE'wallpaper', _UTF-16LE'parenting', _UTF-16LE'musical', _UTF-16LE'womens', _UTF-16LE'birdal', _UTF-16LE'pants'), IN($12, _UTF-16LE'Home', _UTF-16LE'Books', _UTF-16LE'Electronics', _UTF-16LE'Shoes', _UTF-16LE'Jewelry', _UTF-16LE'Men'), OR(AND(IN($12, _UTF-16LE'Home', _UTF-16LE'Books', _UTF-16LE'Electronics'), IN($10, _UTF-16LE'wallpaper', _UTF-16LE'parenting', _UTF-16LE'musical')), AND(IN($12, _UTF-16LE'Shoes', _UTF-16LE'Jewelry', _UTF-16LE'Men'), IN($10, _UTF-16LE'womens', _UTF-16LE'birdal', _UTF-16LE'pants'))), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, item]], table:alias=[item])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER], d_moy=[$8])
+                  HiveProject(d_date_sk=[$0], d_moy=[$8])
                     HiveFilter(condition=[AND(=($6, 2000), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject(s_store_sk=[$0], s_store_name=[$5], s_company_name=[$17])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query9.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query9.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query9.q.out
index 3ec1916..3a1e199 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query9.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query9.q.out
@@ -118,7 +118,7 @@ POSTHOOK: Input: default@reason
 POSTHOOK: Input: default@store_sales
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
-HiveProject(bucket1=[CASE(>($1, 409437), $2, $3)], bucket2=[CASE(>($4, 4595804), $5, $6)], bucket3=[CASE(>($7, 7887297), $8, $9)], bucket4=[CASE(>($10, 10872978), $11, $12)], bucket5=[CASE(>($13, 43571537), $14, $15)])
+HiveProject(bucket1=[CASE($1, $2, $3)], bucket2=[CASE($4, $5, $6)], bucket3=[CASE($7, $8, $9)], bucket4=[CASE($10, $11, $12)], bucket5=[CASE($13, $14, $15)])
   HiveJoin(condition=[true], joinType=[left], algorithm=[none], cost=[not available])
     HiveJoin(condition=[true], joinType=[left], algorithm=[none], cost=[not available])
       HiveJoin(condition=[true], joinType=[left], algorithm=[none], cost=[not available])
@@ -137,7 +137,7 @@ HiveProject(bucket1=[CASE(>($1, 409437), $2, $3)], bucket2=[CASE(>($4, 4595804),
                                 HiveProject(r_reason_sk=[CAST(1):INTEGER])
                                   HiveFilter(condition=[=($0, 1)])
                                     HiveTableScan(table=[[default, reason]], table:alias=[reason])
-                                HiveProject($f0=[$0])
+                                HiveProject(>=[>($0, 409437)])
                                   HiveAggregate(group=[{}], agg#0=[count()])
                                     HiveFilter(condition=[BETWEEN(false, $10, 1, 20)])
                                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
@@ -149,7 +149,7 @@ HiveProject(bucket1=[CASE(>($1, 409437), $2, $3)], bucket2=[CASE(>($4, 4595804),
                               HiveAggregate(group=[{}], agg#0=[sum($21)], agg#1=[count($21)])
                                 HiveFilter(condition=[BETWEEN(false, $10, 1, 20)])
                                   HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                          HiveProject($f0=[$0])
+                          HiveProject(>=[>($0, 4595804)])
                             HiveAggregate(group=[{}], agg#0=[count()])
                               HiveFilter(condition=[BETWEEN(false, $10, 21, 40)])
                                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
@@ -161,7 +161,7 @@ HiveProject(bucket1=[CASE(>($1, 409437), $2, $3)], bucket2=[CASE(>($4, 4595804),
                         HiveAggregate(group=[{}], agg#0=[sum($21)], agg#1=[count($21)])
                           HiveFilter(condition=[BETWEEN(false, $10, 21, 40)])
                             HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject($f0=[$0])
+                    HiveProject(>=[>($0, 7887297)])
                       HiveAggregate(group=[{}], agg#0=[count()])
                         HiveFilter(condition=[BETWEEN(false, $10, 41, 60)])
                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
@@ -173,7 +173,7 @@ HiveProject(bucket1=[CASE(>($1, 409437), $2, $3)], bucket2=[CASE(>($4, 4595804),
                   HiveAggregate(group=[{}], agg#0=[sum($21)], agg#1=[count($21)])
                     HiveFilter(condition=[BETWEEN(false, $10, 41, 60)])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-              HiveProject($f0=[$0])
+              HiveProject(>=[>($0, 10872978)])
                 HiveAggregate(group=[{}], agg#0=[count()])
                   HiveFilter(condition=[BETWEEN(false, $10, 61, 80)])
                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
@@ -185,7 +185,7 @@ HiveProject(bucket1=[CASE(>($1, 409437), $2, $3)], bucket2=[CASE(>($4, 4595804),
             HiveAggregate(group=[{}], agg#0=[sum($21)], agg#1=[count($21)])
               HiveFilter(condition=[BETWEEN(false, $10, 61, 80)])
                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-        HiveProject($f0=[$0])
+        HiveProject(>=[>($0, 43571537)])
           HiveAggregate(group=[{}], agg#0=[count()])
             HiveFilter(condition=[BETWEEN(false, $10, 81, 100)])
               HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query90.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query90.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query90.q.out
index c1567c7..123b3c2 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query90.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query90.q.out
@@ -57,36 +57,36 @@ HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
     HiveJoin(condition=[true], joinType=[inner], algorithm=[none], cost=[not available])
       HiveProject($f0=[$0])
         HiveAggregate(group=[{}], agg#0=[count()])
-          HiveJoin(condition=[=($1, $7)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($1, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($2, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(ws_sold_time_sk=[$1], ws_ship_hdemo_sk=[$10], ws_web_page_sk=[$12])
                   HiveFilter(condition=[AND(IS NOT NULL($10), IS NOT NULL($1), IS NOT NULL($12))])
                     HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                HiveProject(wp_web_page_sk=[$0], wp_char_count=[$10])
+                HiveProject(wp_web_page_sk=[$0])
                   HiveFilter(condition=[AND(BETWEEN(false, $10, 5000, 5200), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, web_page]], table:alias=[web_page])
-              HiveProject(t_time_sk=[$0], t_hour=[$3])
+              HiveProject(t_time_sk=[$0])
                 HiveFilter(condition=[AND(BETWEEN(false, $3, 6, 7), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-            HiveProject(hd_demo_sk=[$0], hd_dep_count=[CAST(8):INTEGER])
+            HiveProject(hd_demo_sk=[$0])
               HiveFilter(condition=[AND(=($3, 8), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
       HiveProject($f0=[$0])
         HiveAggregate(group=[{}], agg#0=[count()])
-          HiveJoin(condition=[=($1, $7)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($1, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($2, $3)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(ws_sold_time_sk=[$1], ws_ship_hdemo_sk=[$10], ws_web_page_sk=[$12])
                   HiveFilter(condition=[AND(IS NOT NULL($10), IS NOT NULL($1), IS NOT NULL($12))])
                     HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                HiveProject(wp_web_page_sk=[$0], wp_char_count=[$10])
+                HiveProject(wp_web_page_sk=[$0])
                   HiveFilter(condition=[AND(BETWEEN(false, $10, 5000, 5200), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, web_page]], table:alias=[web_page])
-              HiveProject(t_time_sk=[$0], t_hour=[$3])
+              HiveProject(t_time_sk=[$0])
                 HiveFilter(condition=[AND(BETWEEN(false, $3, 14, 15), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-            HiveProject(hd_demo_sk=[$0], hd_dep_count=[CAST(8):INTEGER])
+            HiveProject(hd_demo_sk=[$0])
               HiveFilter(condition=[AND(=($3, 8), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query91.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query91.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query91.q.out
index 6b58ccc..e6fe23f 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query91.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query91.q.out
@@ -78,11 +78,11 @@ CBO PLAN:
 HiveProject(call_center=[$0], call_center_name=[$1], manager=[$2], returns_loss=[$3])
   HiveSortLimit(sort0=[$4], dir0=[DESC-nulls-last])
     HiveProject(call_center=[$2], call_center_name=[$3], manager=[$4], returns_loss=[$5], (tok_function sum (tok_table_or_col cr_net_loss))=[$5])
-      HiveAggregate(group=[{7, 8, 17, 18, 19}], agg#0=[sum($12)])
-        HiveJoin(condition=[=($20, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveJoin(condition=[=($10, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveProject(ca_address_sk=[$0], ca_gmt_offset=[CAST(-7):DECIMAL(5, 2)])
+      HiveAggregate(group=[{6, 7, 14, 15, 16}], agg#0=[sum($11)])
+        HiveJoin(condition=[=($17, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($9, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveProject(ca_address_sk=[$0])
                 HiveFilter(condition=[AND(=($11, -7), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
               HiveJoin(condition=[=($4, $1)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -92,19 +92,19 @@ HiveProject(call_center=[$0], call_center_name=[$1], manager=[$2], returns_loss=
                 HiveProject(cd_demo_sk=[$0], cd_marital_status=[$2], cd_education_status=[$3])
                   HiveFilter(condition=[AND(IN($3, _UTF-16LE'Unknown', _UTF-16LE'Advanced Degree'), IN($2, _UTF-16LE'M', _UTF-16LE'W'), IN(ROW($2, $3), ROW(_UTF-16LE'M', _UTF-16LE'Unknown'), ROW(_UTF-16LE'W', _UTF-16LE'Advanced Degree')), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, customer_demographics]], table:alias=[customer_demographics])
-            HiveProject(cr_returned_date_sk=[$0], cr_returning_customer_sk=[$1], cr_call_center_sk=[$2], cr_net_loss=[$3], d_date_sk=[$4], d_year=[$5], d_moy=[$6], cc_call_center_sk=[$7], cc_call_center_id=[$8], cc_name=[$9], cc_manager=[$10])
-              HiveJoin(condition=[=($2, $7)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(cr_returned_date_sk=[$0], cr_returning_customer_sk=[$1], cr_call_center_sk=[$2], cr_net_loss=[$3], d_date_sk=[$4], cc_call_center_sk=[$5], cc_call_center_id=[$6], cc_name=[$7], cc_manager=[$8])
+              HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(cr_returned_date_sk=[$0], cr_returning_customer_sk=[$7], cr_call_center_sk=[$11], cr_net_loss=[$26])
                     HiveFilter(condition=[AND(IS NOT NULL($11), IS NOT NULL($0), IS NOT NULL($7))])
                       HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(1999):INTEGER], d_moy=[CAST(11):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($6, 1999), =($8, 11), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                 HiveProject(cc_call_center_sk=[$0], cc_call_center_id=[$1], cc_name=[$6], cc_manager=[$11])
                   HiveFilter(condition=[IS NOT NULL($0)])
                     HiveTableScan(table=[[default, call_center]], table:alias=[call_center])
-          HiveProject(hd_demo_sk=[$0], hd_buy_potential=[$2])
+          HiveProject(hd_demo_sk=[$0])
             HiveFilter(condition=[AND(LIKE($2, _UTF-16LE'0-500%'), IS NOT NULL($0))])
               HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query92.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query92.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query92.q.out
index 5a0e1da..2a21fba 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query92.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query92.q.out
@@ -69,26 +69,26 @@ HiveProject(excess discount amount=[$0])
   HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
     HiveProject(excess discount amount=[$0], (tok_function sum (tok_table_or_col ws_ext_discount_amt))=[$0])
       HiveAggregate(group=[{}], agg#0=[sum($2)])
-        HiveJoin(condition=[AND(>($2, CAST(*(1.3, $6)):DECIMAL(14, 7)), =($7, $1))], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[AND(>($2, $5), =($6, $1))], joinType=[inner], algorithm=[none], cost=[not available])
           HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_ext_discount_amt=[$22])
               HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-            HiveProject(d_date_sk=[$0], d_date=[$2])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-03-18 00:00:00, 1998-06-16 00:00:00), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(ws_item_sk=[$0], $f1=[$1], i_item_sk=[$2], i_manufact_id=[$3])
+          HiveProject(ws_item_sk=[$0], CAST=[$1], i_item_sk=[$2])
             HiveJoin(condition=[=($0, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveProject(ws_item_sk=[$0], $f1=[/($1, $2)])
+              HiveProject(ws_item_sk=[$0], CAST=[CAST(*(1.3, /($1, $2))):DECIMAL(14, 7)])
                 HiveAggregate(group=[{1}], agg#0=[sum($2)], agg#1=[count($2)])
                   HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_ext_discount_amt=[$22])
                       HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                    HiveProject(d_date_sk=[$0], d_date=[$2])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-03-18 00:00:00, 1998-06-16 00:00:00), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-              HiveProject(i_item_sk=[$0], i_manufact_id=[CAST(269):INTEGER])
+              HiveProject(i_item_sk=[$0])
                 HiveFilter(condition=[AND(=($13, 269), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, item]], table:alias=[item])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query93.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query93.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query93.q.out
index 60b7557..6a8ed39 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query93.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query93.q.out
@@ -44,16 +44,16 @@ CBO PLAN:
 HiveSortLimit(sort0=[$1], sort1=[$0], dir0=[ASC], dir1=[ASC], fetch=[100])
   HiveProject(ss_customer_sk=[$0], $f1=[$1])
     HiveAggregate(group=[{0}], agg#0=[sum($1)])
-      HiveProject(ss_customer_sk=[$1], act_sales=[CASE(IS NOT NULL($8), *(CAST(-($3, $8)):DECIMAL(10, 0), $4), *(CAST($3):DECIMAL(10, 0), $4))])
-        HiveJoin(condition=[AND(=($5, $0), =($7, $2))], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveProject(ss_item_sk=[$2], ss_customer_sk=[$3], ss_ticket_number=[$9], ss_quantity=[$10], ss_sales_price=[$13])
+      HiveProject(ss_customer_sk=[$1], act_sales=[CASE($10, *(CAST(-($3, $9)):DECIMAL(10, 0), $4), $5)])
+        HiveJoin(condition=[AND(=($6, $0), =($8, $2))], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveProject(ss_item_sk=[$2], ss_customer_sk=[$3], ss_ticket_number=[$9], ss_quantity=[$10], ss_sales_price=[$13], *=[*(CAST($10):DECIMAL(10, 0), $13)])
             HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($9))])
               HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-          HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveProject(sr_item_sk=[$2], sr_reason_sk=[$8], sr_ticket_number=[$9], sr_return_quantity=[$10])
+          HiveJoin(condition=[=($1, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(sr_item_sk=[$2], sr_reason_sk=[$8], sr_ticket_number=[$9], sr_return_quantity=[$10], IS NOT NULL=[IS NOT NULL($10)])
               HiveFilter(condition=[AND(IS NOT NULL($8), IS NOT NULL($2), IS NOT NULL($9))])
                 HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-            HiveProject(r_reason_sk=[$0], r_reason_desc=[CAST(_UTF-16LE'Did not like the warranty'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+            HiveProject(r_reason_sk=[$0])
               HiveFilter(condition=[AND(=($2, _UTF-16LE'Did not like the warranty'), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, reason]], table:alias=[reason])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query95.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query95.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query95.q.out
index c248890..6a20165 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query95.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query95.q.out
@@ -76,8 +76,8 @@ CBO PLAN:
 HiveProject(order count=[$0], total shipping cost=[$1], total net profit=[$2])
   HiveSortLimit(sort0=[$3], dir0=[ASC], fetch=[100])
     HiveProject(order count=[$0], total shipping cost=[$1], total net profit=[$2], (tok_functiondi count (tok_table_or_col ws_order_number))=[$0])
-      HiveAggregate(group=[{}], agg#0=[count(DISTINCT $7)], agg#1=[sum($8)], agg#2=[sum($9)])
-        HiveJoin(condition=[=($7, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveAggregate(group=[{}], agg#0=[count(DISTINCT $6)], agg#1=[sum($7)], agg#2=[sum($8)])
+        HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(wr_order_number=[$0])
             HiveAggregate(group=[{14}])
               HiveJoin(condition=[=($14, $0)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -92,7 +92,7 @@ HiveProject(order count=[$0], total shipping cost=[$1], total net profit=[$2])
                 HiveProject(wr_returned_date_sk=[$0], wr_returned_time_sk=[$1], wr_item_sk=[$2], wr_refunded_customer_sk=[$3], wr_refunded_cdemo_sk=[$4], wr_refunded_hdemo_sk=[$5], wr_refunded_addr_sk=[$6], wr_returning_customer_sk=[$7], wr_returning_cdemo_sk=[$8], wr_returning_hdemo_sk=[$9], wr_returning_addr_sk=[$10], wr_web_page_sk=[$11], wr_reason_sk=[$12], wr_order_number=[$13], wr_return_quantity=[$14], wr_return_amt=[$15], wr_return_tax=[$16], wr_return_amt_inc_tax=[$17], wr_fee=[$18], wr_return_ship_cost=[$19], wr_refunded_cash=[$20], wr_reversed_charge=[$21], wr_account_credit=[$22], wr_net_loss=[$23], BLOCK__OFFSET__INSIDE__FILE=[$24], INPUT__FILE__NAME=[$25], ROW__ID=[$26])
                   HiveFilter(condition=[IS NOT NULL($13)])
                     HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
-          HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject(ws_order_number=[$0])
               HiveAggregate(group=[{1}])
                 HiveJoin(condition=[AND(=($1, $3), <>($0, $2))], joinType=[inner], algorithm=[none], cost=[not available])
@@ -102,9 +102,9 @@ HiveProject(order count=[$0], total shipping cost=[$1], total net profit=[$2])
                   HiveProject(ws_warehouse_sk=[$15], ws_order_number=[$17])
                     HiveFilter(condition=[IS NOT NULL($17)])
                       HiveTableScan(table=[[default, web_sales]], table:alias=[ws2])
-            HiveJoin(condition=[=($4, $10)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(ca_address_sk=[$0], ca_state=[CAST(_UTF-16LE'TX'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+            HiveJoin(condition=[=($3, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(ca_address_sk=[$0])
                   HiveFilter(condition=[AND(=($8, _UTF-16LE'TX'), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
                 HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -114,7 +114,7 @@ HiveProject(order count=[$0], total shipping cost=[$1], total net profit=[$2])
                   HiveProject(d_date_sk=[$0], d_date=[$2])
                     HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1999-05-01 00:00:00, 1999-06-30 00:00:00), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-              HiveProject(web_site_sk=[$0], web_company_name=[CAST(_UTF-16LE'pri'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+              HiveProject(web_site_sk=[$0])
                 HiveFilter(condition=[AND(=($14, _UTF-16LE'pri'), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, web_site]], table:alias=[web_site])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query96.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query96.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query96.q.out
index 6367e98..ca9a51f 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query96.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query96.q.out
@@ -43,19 +43,19 @@ HiveProject(_o__c0=[$0])
   HiveSortLimit(sort0=[$1], dir0=[ASC], fetch=[100])
     HiveProject(_o__c0=[$0], (tok_functionstar count)=[$0])
       HiveAggregate(group=[{}], agg#0=[count()])
-        HiveJoin(condition=[=($2, $8)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveJoin(condition=[=($2, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(ss_sold_time_sk=[$1], ss_hdemo_sk=[$5], ss_store_sk=[$7])
                 HiveFilter(condition=[AND(IS NOT NULL($5), IS NOT NULL($1), IS NOT NULL($7))])
                   HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-              HiveProject(t_time_sk=[$0], t_hour=[CAST(8):INTEGER], t_minute=[$4])
+              HiveProject(t_time_sk=[$0])
                 HiveFilter(condition=[AND(=($3, 8), >=($4, 30), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, time_dim]], table:alias=[time_dim])
-            HiveProject(hd_demo_sk=[$0], hd_dep_count=[CAST(5):INTEGER])
+            HiveProject(hd_demo_sk=[$0])
               HiveFilter(condition=[AND(=($3, 5), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-          HiveProject(s_store_sk=[$0], s_store_name=[CAST(_UTF-16LE'ese'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+          HiveProject(s_store_sk=[$0])
             HiveFilter(condition=[AND(=($5, _UTF-16LE'ese'), IS NOT NULL($0))])
               HiveTableScan(table=[[default, store]], table:alias=[store])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query97.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query97.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query97.q.out
index 5cd8582..f79dffb 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query97.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query97.q.out
@@ -66,7 +66,7 @@ HiveSortLimit(fetch=[100])
                 HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3])
                   HiveFilter(condition=[IS NOT NULL($0)])
                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                HiveProject(d_date_sk=[$0], d_month_seq=[$3])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(cs_bill_customer_sk=[$0], cs_item_sk=[$1])
@@ -75,7 +75,7 @@ HiveSortLimit(fetch=[100])
                 HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_item_sk=[$15])
                   HiveFilter(condition=[IS NOT NULL($0)])
                     HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                HiveProject(d_date_sk=[$0], d_month_seq=[$3])
+                HiveProject(d_date_sk=[$0])
                   HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query98.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query98.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query98.q.out
index 804885c..374a6a0 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query98.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query98.q.out
@@ -81,7 +81,7 @@ HiveProject(i_item_desc=[$0], i_category=[$1], i_class=[$2], i_current_price=[$3
             HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ext_sales_price=[$15])
               HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-            HiveProject(d_date_sk=[$0], d_date=[$2])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 2001-01-12 00:00:00, 2001-02-11 00:00:00), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query99.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query99.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query99.q.out
index 75d0e60..8ca409d 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query99.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query99.q.out
@@ -81,26 +81,25 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveProject(_o__c0=[$0], sm_type=[$1], cc_name=[$2], 30 days=[$3], 31-60 days=[$4], 61-90 days=[$5], 91-120 days=[$6], >120 days=[$7])
   HiveSortLimit(sort0=[$8], sort1=[$1], sort2=[$2], dir0=[ASC], dir1=[ASC], dir2=[ASC], fetch=[100])
-    HiveProject(_o__c0=[$0], sm_type=[$1], cc_name=[$2], 30 days=[$3], 31-60 days=[$4], 61-90 days=[$5], 91-120 days=[$6], >120 days=[$7], (tok_function substr (tok_table_or_col w_warehouse_name) 1 20)=[$0])
-      HiveAggregate(group=[{0, 1, 2}], agg#0=[sum($3)], agg#1=[sum($4)], agg#2=[sum($5)], agg#3=[sum($6)], agg#4=[sum($7)])
-        HiveProject($f0=[substr($10, 1, 20)], $f1=[$12], $f2=[$8], $f3=[CASE(<=(-($1, $0), 30), 1, 0)], $f4=[CASE(AND(>(-($1, $0), 30), <=(-($1, $0), 60)), 1, 0)], $f5=[CASE(AND(>(-($1, $0), 60), <=(-($1, $0), 90)), 1, 0)], $f6=[CASE(AND(>(-($1, $0), 90), <=(-($1, $0), 120)), 1, 0)], $f7=[CASE(>(-($1, $0), 120), 1, 0)])
-          HiveJoin(condition=[=($3, $11)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveJoin(condition=[=($4, $9)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($2, $7)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveJoin(condition=[=($1, $5)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject(cs_sold_date_sk=[$0], cs_ship_date_sk=[$2], cs_call_center_sk=[$11], cs_ship_mode_sk=[$13], cs_warehouse_sk=[$14])
-                    HiveFilter(condition=[AND(IS NOT NULL($14), IS NOT NULL($13), IS NOT NULL($11), IS NOT NULL($2))])
-                      HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                  HiveProject(d_date_sk=[$0], d_month_seq=[$3])
-                    HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
-                      HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                HiveProject(cc_call_center_sk=[$0], cc_name=[$6])
-                  HiveFilter(condition=[IS NOT NULL($0)])
-                    HiveTableScan(table=[[default, call_center]], table:alias=[call_center])
-              HiveProject(w_warehouse_sk=[$0], w_warehouse_name=[$2])
+    HiveProject(_o__c0=[$1], sm_type=[$2], cc_name=[$0], 30 days=[$3], 31-60 days=[$4], 61-90 days=[$5], 91-120 days=[$6], >120 days=[$7], (tok_function substr (tok_table_or_col w_warehouse_name) 1 20)=[$1])
+      HiveAggregate(group=[{11, 13, 15}], agg#0=[sum($4)], agg#1=[sum($5)], agg#2=[sum($6)], agg#3=[sum($7)], agg#4=[sum($8)])
+        HiveJoin(condition=[=($2, $14)], joinType=[inner], algorithm=[none], cost=[not available])
+          HiveJoin(condition=[=($3, $12)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($1, $10)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($0, $9)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(cs_ship_date_sk=[$2], cs_call_center_sk=[$11], cs_ship_mode_sk=[$13], cs_warehouse_sk=[$14], CASE=[CASE(<=(-($2, $0), 30), 1, 0)], CASE5=[CASE(AND(>(-($2, $0), 30), <=(-($2, $0), 60)), 1, 0)], CASE6=[CASE(AND(>(-($2, $0), 60), <=(-($2, $0), 90)), 1, 0)], CASE7=[CASE(AND(>(-($2, $0), 90), <=(-($2, $0), 120)), 1, 0)], CASE8=[CASE(>(-($2, $0), 120), 1, 0)])
+                  HiveFilter(condition=[AND(IS NOT NULL($14), IS NOT NULL($13), IS NOT NULL($11), IS NOT NULL($2))])
+                    HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
+                HiveProject(d_date_sk=[$0])
+                  HiveFilter(condition=[AND(BETWEEN(false, $3, 1212, 1223), IS NOT NULL($0))])
+                    HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
+              HiveProject(cc_call_center_sk=[$0], cc_name=[$6])
                 HiveFilter(condition=[IS NOT NULL($0)])
-                  HiveTableScan(table=[[default, warehouse]], table:alias=[warehouse])
-            HiveProject(sm_ship_mode_sk=[$0], sm_type=[$2])
+                  HiveTableScan(table=[[default, call_center]], table:alias=[call_center])
+            HiveProject(w_warehouse_sk=[$0], substr=[substr($2, 1, 20)])
               HiveFilter(condition=[IS NOT NULL($0)])
-                HiveTableScan(table=[[default, ship_mode]], table:alias=[ship_mode])
+                HiveTableScan(table=[[default, warehouse]], table:alias=[warehouse])
+          HiveProject(sm_ship_mode_sk=[$0], sm_type=[$2])
+            HiveFilter(condition=[IS NOT NULL($0)])
+              HiveTableScan(table=[[default, ship_mode]], table:alias=[ship_mode])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query1.q.out b/ql/src/test/results/clientpositive/perf/tez/query1.q.out
index a3de5c6..5321336 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query1.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query1.q.out
@@ -83,14 +83,14 @@ Stage-0
               Select Operator [SEL_49] (rows=816091 width=100)
                 Output:["_col0"]
                 Filter Operator [FIL_48] (rows=816091 width=324)
-                  predicate:(_col2 > _col7)
+                  predicate:(_col2 > _col6)
                   Merge Join Operator [MERGEJOIN_134] (rows=2448274 width=324)
-                    Conds:RS_45._col1=RS_158._col1(Inner),Output:["_col2","_col6","_col7"]
+                    Conds:RS_45._col1=RS_158._col1(Inner),Output:["_col2","_col5","_col6"]
                   <-Reducer 5 [SIMPLE_EDGE]
                     SHUFFLE [RS_45]
                       PartitionCols:_col1
                       Merge Join Operator [MERGEJOIN_132] (rows=2369298 width=213)
-                        Conds:RS_42._col0=RS_153._col0(Inner),Output:["_col1","_col2","_col6"]
+                        Conds:RS_42._col0=RS_153._col0(Inner),Output:["_col1","_col2","_col5"]
                       <-Map 12 [SIMPLE_EDGE] vectorized
                         SHUFFLE [RS_153]
                           PartitionCols:_col0
@@ -108,7 +108,7 @@ Stage-0
                           <-Map 11 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_150]
                               PartitionCols:_col0
-                              Select Operator [SEL_149] (rows=35 width=90)
+                              Select Operator [SEL_149] (rows=35 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_148] (rows=35 width=90)
                                   predicate:((s_state = 'NM') and s_store_sk is not null)
@@ -140,7 +140,7 @@ Stage-0
                                       <-Map 10 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_143]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_142] (rows=652 width=8)
+                                          Select Operator [SEL_142] (rows=652 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_141] (rows=652 width=8)
                                               predicate:((d_year = 2000) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query10.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query10.q.out b/ql/src/test/results/clientpositive/perf/tez/query10.q.out
index b180cbd..4fc8123 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query10.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query10.q.out
@@ -243,7 +243,7 @@ Stage-0
                                             <-Map 16 [SIMPLE_EDGE] vectorized
                                               PARTITION_ONLY_SHUFFLE [RS_193]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_192] (rows=201 width=12)
+                                                Select Operator [SEL_192] (rows=201 width=4)
                                                   Output:["_col0"]
                                                   Filter Operator [FIL_191] (rows=201 width=12)
                                                     predicate:((d_year = 2002) and d_date_sk is not null and d_moy BETWEEN 4 AND 7)


[33/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vectorized_join46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_join46.q.out b/ql/src/test/results/clientpositive/llap/vectorized_join46.q.out
index bd40d8f..1b4d343 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_join46.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_join46.q.out
@@ -234,17 +234,18 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                        selectExpressions: LongColumnBetween(col 0:int, left 100, right 102) -> 4:boolean
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {_col0 BETWEEN 100 AND 102}
+                        0 {_col3}
                         1 
                       keys:
                         0 _col1 (type: int)
@@ -253,20 +254,27 @@ STAGE PLANS:
                           className: VectorMapJoinOuterLongOperator
                           native: true
                           nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Outer Join has keys IS true, Optimized Table and Supports Key Types IS true
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 8 Data size: 1049 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
-                        File Sink Vectorization:
-                            className: VectorFileSinkOperator
-                            native: false
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                        Select Vectorization:
+                            className: VectorSelectOperator
+                            native: true
                         Statistics: Num rows: 8 Data size: 1049 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          File Sink Vectorization:
+                              className: VectorFileSinkOperator
+                              native: false
+                          Statistics: Num rows: 8 Data size: 1049 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -396,17 +404,18 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                        selectExpressions: LongColumnBetween(col 0:int, left 100, right 102) -> 4:boolean
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {_col0 BETWEEN 100 AND 102}
+                        0 {_col3}
                         1 
                       keys:
                         0 
@@ -416,20 +425,27 @@ STAGE PLANS:
                           native: false
                           nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Optimized Table and Supports Key Types IS true
                           nativeConditionsNotMet: Outer Join has keys IS false
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 6 Data size: 1142 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
-                        File Sink Vectorization:
-                            className: VectorFileSinkOperator
-                            native: false
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                        Select Vectorization:
+                            className: VectorSelectOperator
+                            native: true
                         Statistics: Num rows: 6 Data size: 1142 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          File Sink Vectorization:
+                              className: VectorFileSinkOperator
+                              native: false
+                          Statistics: Num rows: 6 Data size: 1142 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -699,17 +715,18 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                        selectExpressions: LongColumnBetween(col 0:int, left 100, right 102) -> 4:boolean
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {_col0 BETWEEN 100 AND 102}
+                        0 {_col3}
                         1 
                       keys:
                         0 
@@ -719,20 +736,27 @@ STAGE PLANS:
                           native: false
                           nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Optimized Table and Supports Key Types IS true
                           nativeConditionsNotMet: Outer Join has keys IS false
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
-                        File Sink Vectorization:
-                            className: VectorFileSinkOperator
-                            native: false
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                        Select Vectorization:
+                            className: VectorSelectOperator
+                            native: true
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          File Sink Vectorization:
+                              className: VectorFileSinkOperator
+                              native: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -856,27 +880,31 @@ STAGE PLANS:
                   alias: test1_n14
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
-                      residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {((_col1 = _col5) or _col3 or _col4 BETWEEN 100 AND 102)}
+                      Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -1000,27 +1028,31 @@ STAGE PLANS:
                   alias: test1_n14
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
-                      residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {((_col1 = _col5) or _col3)}
+                      Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -1280,27 +1312,31 @@ STAGE PLANS:
                   alias: test1_n14
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
-                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
+                      Statistics: Num rows: 11 Data size: 1947 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -1454,27 +1490,31 @@ STAGE PLANS:
                   alias: test2_n9
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         0 Map 1
-                      residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col6)}
+                      Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -1737,27 +1777,31 @@ STAGE PLANS:
                   alias: test2_n9
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         0 Map 1
-                      residual filter predicates: {((_col1 = _col4) or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {((_col1 = _col4) or _col6)}
+                      Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -1879,27 +1923,31 @@ STAGE PLANS:
                   alias: test2_n9
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         0 Map 1
-                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
+                      Statistics: Num rows: 10 Data size: 1850 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
             Map Vectorization:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vectorized_multi_output_select.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_multi_output_select.q.out b/ql/src/test/results/clientpositive/llap/vectorized_multi_output_select.q.out
index 076e00f..d797e01 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_multi_output_select.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_multi_output_select.q.out
@@ -106,12 +106,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 1 Data size: 177 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 86 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 1 Data size: 177 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 86 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -126,12 +126,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 1 Data size: 177 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 86 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 1 Data size: 177 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 86 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/louter_join_ppr.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/louter_join_ppr.q.out b/ql/src/test/results/clientpositive/louter_join_ppr.q.out
index 8dcb3fe..de0fea6 100644
--- a/ql/src/test/results/clientpositive/louter_join_ppr.q.out
+++ b/ql/src/test/results/clientpositive/louter_join_ppr.q.out
@@ -26,11 +26,11 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
+OPTIMIZED SQL: SELECT *
 FROM (SELECT `key`, `value`
 FROM `default`.`src`
 WHERE `key` < 20 AND `key` > 15) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `key` > 15 AND `key` < 20) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -343,8 +343,8 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `key` < 20 AND `ds` = '2008-04-08' AND `key` > 15) AS `t0`
 INNER JOIN (SELECT `key`, `value`
@@ -563,34 +563,30 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
+#### A masked pattern was here ####
+            NumFilesPerFileSink: 1
             Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
-#### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-#### A masked pattern was here ####
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    columns _col0,_col1,_col2,_col3
-                    columns.types string:string:string:string
-                    escape.delim \
-                    hive.serialization.extend.additional.nesting.levels true
-                    serialization.escape.crlf true
-                    serialization.format 1
-                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+#### A masked pattern was here ####
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  columns _col0,_col1,_col2,_col3
+                  columns.types string:string:string:string
+                  escape.delim \
+                  hive.serialization.extend.additional.nesting.levels true
+                  serialization.escape.crlf true
+                  serialization.format 1
+                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator
@@ -664,11 +660,11 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
+OPTIMIZED SQL: SELECT *
 FROM (SELECT `key`, `value`
 FROM `default`.`src`
 WHERE `key` < 20 AND `key` > 15) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `key` > 15 AND `ds` = '2008-04-08' AND `key` < 20) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -981,8 +977,8 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `key` < 20 AND `ds` = '2008-04-08' AND `key` > 15) AS `t0`
 INNER JOIN (SELECT `key`, `value`
@@ -1201,34 +1197,30 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
+#### A masked pattern was here ####
+            NumFilesPerFileSink: 1
             Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
-#### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-#### A masked pattern was here ####
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    columns _col0,_col1,_col2,_col3
-                    columns.types string:string:string:string
-                    escape.delim \
-                    hive.serialization.extend.additional.nesting.levels true
-                    serialization.escape.crlf true
-                    serialization.format 1
-                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+#### A masked pattern was here ####
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  columns _col0,_col1,_col2,_col3
+                  columns.types string:string:string:string
+                  escape.delim \
+                  hive.serialization.extend.additional.nesting.levels true
+                  serialization.escape.crlf true
+                  serialization.format 1
+                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/mapjoin1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/mapjoin1.q.out b/ql/src/test/results/clientpositive/mapjoin1.q.out
index dcbef2a..f194bef 100644
--- a/ql/src/test/results/clientpositive/mapjoin1.q.out
+++ b/ql/src/test/results/clientpositive/mapjoin1.q.out
@@ -146,7 +146,7 @@ STAGE PLANS:
               HashTable Sink Operator
                 filter predicates:
                   0 
-                  1 {((UDFToDouble(_col0) * 10.0D) < 1000.0D)}
+                  1 {_col2}
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
@@ -158,15 +158,15 @@ STAGE PLANS:
             alias: b
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), ((UDFToDouble(key) * 10.0D) < 1000.0D) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
                      Right Outer Join 0 to 1
                 filter predicates:
                   0 
-                  1 {((UDFToDouble(_col0) * 10.0D) < 1000.0D)}
+                  1 {_col2}
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
@@ -245,7 +245,7 @@ STAGE PLANS:
               HashTable Sink Operator
                 filter predicates:
                   0 
-                  1 {(UDFToDouble(_col1.key) > 200.0D)}
+                  1 {_col2}
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
@@ -257,15 +257,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), named_struct('key',key,'value',value) (type: struct<key:string,value:string>)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), named_struct('key',key,'value',value) (type: struct<key:string,value:string>), (UDFToDouble(named_struct('key',key,'value',value).key) > 200.0D) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
                      Right Outer Join 0 to 1
                 filter predicates:
                   0 
-                  1 {(UDFToDouble(_col1.key) > 200.0D)}
+                  1 {_col2}
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
@@ -435,7 +435,7 @@ STAGE PLANS:
               HashTable Sink Operator
                 filter predicates:
                   0 
-                  1 {((UDFToDouble(_col0) * 10.0D) < 1000.0D)}
+                  1 {_col2}
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
@@ -447,15 +447,15 @@ STAGE PLANS:
             alias: b
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), ((UDFToDouble(key) * 10.0D) < 1000.0D) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
                      Right Outer Join 0 to 1
                 filter predicates:
                   0 
-                  1 {((UDFToDouble(_col0) * 10.0D) < 1000.0D)}
+                  1 {_col2}
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
@@ -534,7 +534,7 @@ STAGE PLANS:
               HashTable Sink Operator
                 filter predicates:
                   0 
-                  1 {(UDFToDouble(_col1.key) > 200.0D)}
+                  1 {_col2}
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
@@ -546,15 +546,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), named_struct('key',key,'value',value) (type: struct<key:string,value:string>)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), named_struct('key',key,'value',value) (type: struct<key:string,value:string>), (UDFToDouble(named_struct('key',key,'value',value).key) > 200.0D) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
                      Right Outer Join 0 to 1
                 filter predicates:
                   0 
-                  1 {(UDFToDouble(_col1.key) > 200.0D)}
+                  1 {_col2}
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/mapjoin46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/mapjoin46.q.out b/ql/src/test/results/clientpositive/mapjoin46.q.out
index bbdeaef..afc554c 100644
--- a/ql/src/test/results/clientpositive/mapjoin46.q.out
+++ b/ql/src/test/results/clientpositive/mapjoin46.q.out
@@ -185,7 +185,7 @@ STAGE PLANS:
                 Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   filter predicates:
-                    0 {_col0 BETWEEN 100 AND 102}
+                    0 {_col3}
                     1 
                   keys:
                     0 _col1 (type: int)
@@ -198,27 +198,31 @@ STAGE PLANS:
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {_col0 BETWEEN 100 AND 102}
+                  0 {_col3}
                   1 
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -298,7 +302,7 @@ STAGE PLANS:
                 Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   filter predicates:
-                    0 {_col0 BETWEEN 100 AND 102}
+                    0 {_col3}
                     1 
                   keys:
                     0 
@@ -311,27 +315,31 @@ STAGE PLANS:
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {_col0 BETWEEN 100 AND 102}
+                  0 {_col3}
                   1 
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -500,7 +508,7 @@ STAGE PLANS:
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 filter predicates:
-                  0 {_col0 BETWEEN 100 AND 102}
+                  0 {_col3}
                   1 
                 keys:
                   0 
@@ -513,27 +521,31 @@ STAGE PLANS:
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {_col0 BETWEEN 100 AND 102}
+                  0 {_col3}
                   1 
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -624,8 +636,8 @@ STAGE PLANS:
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -633,16 +645,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col5) or _col3 or _col4 BETWEEN 100 AND 102)}
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -736,8 +752,8 @@ STAGE PLANS:
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -745,16 +761,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col5) or _col3)}
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -952,8 +972,8 @@ STAGE PLANS:
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -961,16 +981,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
                 Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -1059,8 +1083,8 @@ STAGE PLANS:
             alias: test2_n2
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -1068,16 +1092,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col6)}
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -1278,8 +1306,8 @@ STAGE PLANS:
             alias: test2_n2
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -1287,16 +1315,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col4) or _col6)}
                 Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 476 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -1386,8 +1418,8 @@ STAGE PLANS:
             alias: test2_n2
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -1395,16 +1427,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
                 Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -2267,7 +2303,7 @@ POSTHOOK: Input: default@test2_n2
 NULL	NULL	NULL	104	3	Fli
 NULL	NULL	NULL	105	NULL	None
 NULL	NULL	None	NULL	NULL	NULL
-Warning: Shuffle Join JOIN[17][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[18][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM (
@@ -2323,14 +2359,14 @@ STAGE PLANS:
   Stage: Stage-8
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        $hdt$_0:test1_n4 
+        $hdt$_0:$hdt$_0:test1_n4 
           Fetch Operator
             limit: -1
-        $hdt$_2:$hdt$_3:test2_n2 
+        $hdt$_1:$hdt$_2:test2_n2 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        $hdt$_0:test1_n4 
+        $hdt$_0:$hdt$_0:test1_n4 
           TableScan
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
@@ -2342,7 +2378,7 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-        $hdt$_2:$hdt$_3:test2_n2 
+        $hdt$_1:$hdt$_2:test2_n2 
           TableScan
             alias: test2_n2
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
@@ -2362,8 +2398,8 @@ STAGE PLANS:
             alias: test2_n2
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -2371,19 +2407,23 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
                 Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  sort order: 
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
           TableScan
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -2391,13 +2431,17 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
                 Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  sort order: 
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
@@ -2424,7 +2468,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[17][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[18][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: SELECT *
 FROM (
   SELECT test1_n4.key AS key1, test1_n4.value AS value1, test1_n4.col_1 AS col_1,
@@ -2489,7 +2533,7 @@ NULL	NULL	NULL	105	NULL	None	98	NULL	None	NULL	NULL	NULL
 NULL	NULL	NULL	105	NULL	None	99	0	Alice	NULL	NULL	NULL
 NULL	NULL	NULL	105	NULL	None	99	2	Mat	102	2	Del
 NULL	NULL	NULL	105	NULL	None	NULL	NULL	None	NULL	NULL	NULL
-Warning: Shuffle Join JOIN[17][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[18][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM (
@@ -2545,14 +2589,14 @@ STAGE PLANS:
   Stage: Stage-8
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        $hdt$_0:test1_n4 
+        $hdt$_0:$hdt$_0:test1_n4 
           Fetch Operator
             limit: -1
-        $hdt$_2:$hdt$_3:test2_n2 
+        $hdt$_1:$hdt$_2:test2_n2 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        $hdt$_0:test1_n4 
+        $hdt$_0:$hdt$_0:test1_n4 
           TableScan
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
@@ -2564,7 +2608,7 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-        $hdt$_2:$hdt$_3:test2_n2 
+        $hdt$_1:$hdt$_2:test2_n2 
           TableScan
             alias: test2_n2
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
@@ -2584,8 +2628,8 @@ STAGE PLANS:
             alias: test2_n2
             Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_2 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 4 Data size: 38 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -2593,19 +2637,23 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
                 Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  sort order: 
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
           TableScan
             alias: test1_n4
             Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int), col_1 (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 6 Data size: 56 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -2613,13 +2661,17 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
                 Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  sort order: 
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 6 Data size: 61 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
@@ -2646,7 +2698,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join JOIN[17][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[18][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: SELECT *
 FROM (
   SELECT test1_n4.key AS key1, test1_n4.value AS value1, test1_n4.col_1 AS col_1,


[16/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query11.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query11.q.out b/ql/src/test/results/clientpositive/perf/tez/query11.q.out
index 2f453f3..da1c349 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query11.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query11.q.out
@@ -189,249 +189,241 @@ Stage-0
     limit:100
     Stage-1
       Reducer 8 vectorized
-      File Output Operator [FS_358]
-        Limit [LIM_357] (rows=100 width=85)
+      File Output Operator [FS_354]
+        Limit [LIM_353] (rows=100 width=85)
           Number of rows:100
-          Select Operator [SEL_356] (rows=12248093 width=85)
+          Select Operator [SEL_352] (rows=12248093 width=85)
             Output:["_col0"]
           <-Reducer 7 [SIMPLE_EDGE]
-            SHUFFLE [RS_97]
-              Select Operator [SEL_96] (rows=12248093 width=85)
+            SHUFFLE [RS_93]
+              Select Operator [SEL_92] (rows=12248093 width=85)
                 Output:["_col0"]
-                Filter Operator [FIL_95] (rows=12248093 width=533)
-                  predicate:CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col5 is not null) THEN (((_col1 / _col5) > (_col8 / _col3))) ELSE ((null > (_col8 / _col3))) END) ELSE (CASE WHEN (_col5 is not null) THEN (((_col1 / _col5) > null)) ELSE (null) END) END
-                  Merge Join Operator [MERGEJOIN_291] (rows=24496186 width=533)
-                    Conds:RS_92._col2=RS_355._col0(Inner),Output:["_col1","_col3","_col5","_col7","_col8"]
+                Filter Operator [FIL_91] (rows=12248093 width=537)
+                  predicate:CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col6) THEN (((_col1 / _col5) > (_col9 / _col3))) ELSE ((null > (_col9 / _col3))) END) ELSE (CASE WHEN (_col6) THEN (((_col1 / _col5) > null)) ELSE (null) END) END
+                  Merge Join Operator [MERGEJOIN_287] (rows=24496186 width=537)
+                    Conds:RS_88._col2=RS_351._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col8","_col9"]
                   <-Reducer 20 [SIMPLE_EDGE] vectorized
-                    SHUFFLE [RS_355]
+                    SHUFFLE [RS_351]
                       PartitionCols:_col0
-                      Select Operator [SEL_354] (rows=80000000 width=297)
+                      Select Operator [SEL_350] (rows=80000000 width=297)
                         Output:["_col0","_col1","_col2"]
-                        Group By Operator [GBY_353] (rows=80000000 width=764)
+                        Group By Operator [GBY_349] (rows=80000000 width=764)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                         <-Reducer 19 [SIMPLE_EDGE]
-                          SHUFFLE [RS_83]
+                          SHUFFLE [RS_79]
                             PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                            Group By Operator [GBY_82] (rows=80000000 width=764)
-                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                              Select Operator [SEL_80] (rows=187573258 width=847)
-                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                Merge Join Operator [MERGEJOIN_288] (rows=187573258 width=847)
-                                  Conds:RS_77._col1=RS_321._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
-                                <-Map 26 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_321]
-                                    PartitionCols:_col0
-                                    Select Operator [SEL_320] (rows=80000000 width=656)
-                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                      Filter Operator [FIL_319] (rows=80000000 width=656)
-                                        predicate:(c_customer_id is not null and c_customer_sk is not null)
-                                        TableScan [TS_71] (rows=80000000 width=656)
-                                          default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk","c_customer_id","c_first_name","c_last_name","c_preferred_cust_flag","c_birth_country","c_login","c_email_address"]
-                                <-Reducer 18 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_77]
-                                    PartitionCols:_col1
-                                    Merge Join Operator [MERGEJOIN_287] (rows=187573258 width=199)
-                                      Conds:RS_352._col0=RS_298._col0(Inner),Output:["_col1","_col2","_col3"]
-                                    <-Map 21 [SIMPLE_EDGE] vectorized
-                                      PARTITION_ONLY_SHUFFLE [RS_298]
-                                        PartitionCols:_col0
-                                        Select Operator [SEL_295] (rows=652 width=8)
-                                          Output:["_col0"]
-                                          Filter Operator [FIL_292] (rows=652 width=8)
-                                            predicate:((d_year = 2002) and d_date_sk is not null)
-                                            TableScan [TS_68] (rows=73049 width=8)
-                                              default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                                    <-Map 17 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_352]
-                                        PartitionCols:_col0
-                                        Select Operator [SEL_351] (rows=525327388 width=221)
-                                          Output:["_col0","_col1","_col2","_col3"]
-                                          Filter Operator [FIL_350] (rows=525327388 width=221)
-                                            predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_75_date_dim_d_date_sk_min) AND DynamicValue(RS_75_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_75_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
-                                            TableScan [TS_65] (rows=575995635 width=221)
-                                              default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_ext_discount_amt","ss_ext_list_price"]
-                                            <-Reducer 22 [BROADCAST_EDGE] vectorized
-                                              BROADCAST [RS_349]
-                                                Group By Operator [GBY_348] (rows=1 width=12)
-                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                  PARTITION_ONLY_SHUFFLE [RS_310]
-                                                    Group By Operator [GBY_306] (rows=1 width=12)
-                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                      Select Operator [SEL_299] (rows=652 width=4)
-                                                        Output:["_col0"]
-                                                         Please refer to the previous Select Operator [SEL_295]
+                            Group By Operator [GBY_78] (rows=80000000 width=764)
+                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                              Merge Join Operator [MERGEJOIN_284] (rows=187573258 width=764)
+                                Conds:RS_74._col1=RS_317._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                              <-Map 26 [SIMPLE_EDGE] vectorized
+                                SHUFFLE [RS_317]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_316] (rows=80000000 width=656)
+                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                                    Filter Operator [FIL_315] (rows=80000000 width=656)
+                                      predicate:(c_customer_id is not null and c_customer_sk is not null)
+                                      TableScan [TS_68] (rows=80000000 width=656)
+                                        default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk","c_customer_id","c_first_name","c_last_name","c_preferred_cust_flag","c_birth_country","c_login","c_email_address"]
+                              <-Reducer 18 [SIMPLE_EDGE]
+                                SHUFFLE [RS_74]
+                                  PartitionCols:_col1
+                                  Merge Join Operator [MERGEJOIN_283] (rows=187573258 width=115)
+                                    Conds:RS_348._col0=RS_294._col0(Inner),Output:["_col1","_col2"]
+                                  <-Map 21 [SIMPLE_EDGE] vectorized
+                                    PARTITION_ONLY_SHUFFLE [RS_294]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_291] (rows=652 width=4)
+                                        Output:["_col0"]
+                                        Filter Operator [FIL_288] (rows=652 width=8)
+                                          predicate:((d_year = 2002) and d_date_sk is not null)
+                                          TableScan [TS_65] (rows=73049 width=8)
+                                            default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                  <-Map 17 [SIMPLE_EDGE] vectorized
+                                    SHUFFLE [RS_348]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_347] (rows=525327388 width=119)
+                                        Output:["_col0","_col1","_col2"]
+                                        Filter Operator [FIL_346] (rows=525327388 width=221)
+                                          predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_72_date_dim_d_date_sk_min) AND DynamicValue(RS_72_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_72_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
+                                          TableScan [TS_62] (rows=575995635 width=221)
+                                            default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_ext_discount_amt","ss_ext_list_price"]
+                                          <-Reducer 22 [BROADCAST_EDGE] vectorized
+                                            BROADCAST [RS_345]
+                                              Group By Operator [GBY_344] (rows=1 width=12)
+                                                Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                              <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                PARTITION_ONLY_SHUFFLE [RS_306]
+                                                  Group By Operator [GBY_302] (rows=1 width=12)
+                                                    Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                    Select Operator [SEL_295] (rows=652 width=4)
+                                                      Output:["_col0"]
+                                                       Please refer to the previous Select Operator [SEL_291]
                   <-Reducer 6 [ONE_TO_ONE_EDGE]
-                    FORWARD [RS_92]
+                    FORWARD [RS_88]
                       PartitionCols:_col2
-                      Merge Join Operator [MERGEJOIN_290] (rows=20485011 width=436)
-                        Conds:RS_89._col2=RS_347._col0(Inner),Output:["_col1","_col2","_col3","_col5"]
+                      Merge Join Operator [MERGEJOIN_286] (rows=20485011 width=440)
+                        Conds:RS_85._col2=RS_343._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
                       <-Reducer 16 [SIMPLE_EDGE] vectorized
-                        SHUFFLE [RS_347]
+                        SHUFFLE [RS_343]
                           PartitionCols:_col0
-                          Select Operator [SEL_346] (rows=17130654 width=212)
-                            Output:["_col0","_col1"]
-                            Filter Operator [FIL_345] (rows=17130654 width=212)
+                          Select Operator [SEL_342] (rows=17130654 width=216)
+                            Output:["_col0","_col1","_col2"]
+                            Filter Operator [FIL_341] (rows=17130654 width=212)
                               predicate:(_col7 > 0)
-                              Select Operator [SEL_344] (rows=51391963 width=212)
+                              Select Operator [SEL_340] (rows=51391963 width=212)
                                 Output:["_col0","_col7"]
-                                Group By Operator [GBY_343] (rows=51391963 width=764)
+                                Group By Operator [GBY_339] (rows=51391963 width=764)
                                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                                 <-Reducer 15 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_61]
+                                  SHUFFLE [RS_58]
                                     PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                    Group By Operator [GBY_60] (rows=51391963 width=764)
-                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                      Select Operator [SEL_58] (rows=51391963 width=875)
-                                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                        Merge Join Operator [MERGEJOIN_286] (rows=51391963 width=875)
-                                          Conds:RS_55._col1=RS_324._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
-                                        <-Map 26 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_324]
-                                            PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_320]
-                                        <-Reducer 14 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_55]
-                                            PartitionCols:_col1
-                                            Merge Join Operator [MERGEJOIN_285] (rows=51391963 width=227)
-                                              Conds:RS_342._col0=RS_304._col0(Inner),Output:["_col1","_col2","_col3"]
-                                            <-Map 21 [SIMPLE_EDGE] vectorized
-                                              PARTITION_ONLY_SHUFFLE [RS_304]
-                                                PartitionCols:_col0
-                                                Select Operator [SEL_297] (rows=652 width=8)
-                                                  Output:["_col0"]
-                                                  Filter Operator [FIL_294] (rows=652 width=8)
-                                                    predicate:((d_year = 2001) and d_date_sk is not null)
-                                                     Please refer to the previous TableScan [TS_68]
-                                            <-Map 13 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_342]
-                                                PartitionCols:_col0
-                                                Select Operator [SEL_341] (rows=143930993 width=231)
-                                                  Output:["_col0","_col1","_col2","_col3"]
-                                                  Filter Operator [FIL_340] (rows=143930993 width=231)
-                                                    predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_53_date_dim_d_date_sk_min) AND DynamicValue(RS_53_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_53_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_sold_date_sk is not null)
-                                                    TableScan [TS_43] (rows=144002668 width=231)
-                                                      default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_customer_sk","ws_ext_discount_amt","ws_ext_list_price"]
-                                                    <-Reducer 25 [BROADCAST_EDGE] vectorized
-                                                      BROADCAST [RS_339]
-                                                        Group By Operator [GBY_338] (rows=1 width=12)
-                                                          Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                        <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                          PARTITION_ONLY_SHUFFLE [RS_313]
-                                                            Group By Operator [GBY_309] (rows=1 width=12)
-                                                              Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                              Select Operator [SEL_305] (rows=652 width=4)
-                                                                Output:["_col0"]
-                                                                 Please refer to the previous Select Operator [SEL_297]
+                                    Group By Operator [GBY_57] (rows=51391963 width=764)
+                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                                      Merge Join Operator [MERGEJOIN_282] (rows=51391963 width=764)
+                                        Conds:RS_53._col1=RS_320._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                                      <-Map 26 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_320]
+                                          PartitionCols:_col0
+                                           Please refer to the previous Select Operator [SEL_316]
+                                      <-Reducer 14 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_53]
+                                          PartitionCols:_col1
+                                          Merge Join Operator [MERGEJOIN_281] (rows=51391963 width=115)
+                                            Conds:RS_338._col0=RS_300._col0(Inner),Output:["_col1","_col2"]
+                                          <-Map 21 [SIMPLE_EDGE] vectorized
+                                            PARTITION_ONLY_SHUFFLE [RS_300]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_293] (rows=652 width=4)
+                                                Output:["_col0"]
+                                                Filter Operator [FIL_290] (rows=652 width=8)
+                                                  predicate:((d_year = 2001) and d_date_sk is not null)
+                                                   Please refer to the previous TableScan [TS_65]
+                                          <-Map 13 [SIMPLE_EDGE] vectorized
+                                            SHUFFLE [RS_338]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_337] (rows=143930993 width=119)
+                                                Output:["_col0","_col1","_col2"]
+                                                Filter Operator [FIL_336] (rows=143930993 width=231)
+                                                  predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_51_date_dim_d_date_sk_min) AND DynamicValue(RS_51_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_51_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_sold_date_sk is not null)
+                                                  TableScan [TS_41] (rows=144002668 width=231)
+                                                    default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_customer_sk","ws_ext_discount_amt","ws_ext_list_price"]
+                                                  <-Reducer 25 [BROADCAST_EDGE] vectorized
+                                                    BROADCAST [RS_335]
+                                                      Group By Operator [GBY_334] (rows=1 width=12)
+                                                        Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                      <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                        PARTITION_ONLY_SHUFFLE [RS_309]
+                                                          Group By Operator [GBY_305] (rows=1 width=12)
+                                                            Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                            Select Operator [SEL_301] (rows=652 width=4)
+                                                              Output:["_col0"]
+                                                               Please refer to the previous Select Operator [SEL_293]
                       <-Reducer 5 [ONE_TO_ONE_EDGE]
-                        FORWARD [RS_89]
+                        FORWARD [RS_85]
                           PartitionCols:_col2
-                          Merge Join Operator [MERGEJOIN_289] (rows=31888273 width=324)
-                            Conds:RS_327._col0=RS_337._col0(Inner),Output:["_col1","_col2","_col3"]
+                          Merge Join Operator [MERGEJOIN_285] (rows=31888273 width=324)
+                            Conds:RS_323._col0=RS_333._col0(Inner),Output:["_col1","_col2","_col3"]
                           <-Reducer 12 [SIMPLE_EDGE] vectorized
-                            SHUFFLE [RS_337]
+                            SHUFFLE [RS_333]
                               PartitionCols:_col0
-                              Select Operator [SEL_336] (rows=26666666 width=212)
+                              Select Operator [SEL_332] (rows=26666666 width=212)
                                 Output:["_col0","_col1"]
-                                Filter Operator [FIL_335] (rows=26666666 width=212)
+                                Filter Operator [FIL_331] (rows=26666666 width=212)
                                   predicate:(_col7 > 0)
-                                  Select Operator [SEL_334] (rows=80000000 width=212)
+                                  Select Operator [SEL_330] (rows=80000000 width=212)
                                     Output:["_col0","_col7"]
-                                    Group By Operator [GBY_333] (rows=80000000 width=764)
+                                    Group By Operator [GBY_329] (rows=80000000 width=764)
                                       Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                                     <-Reducer 11 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_39]
+                                      SHUFFLE [RS_37]
                                         PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                        Group By Operator [GBY_38] (rows=80000000 width=764)
-                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                          Select Operator [SEL_36] (rows=187573258 width=847)
-                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                            Merge Join Operator [MERGEJOIN_284] (rows=187573258 width=847)
-                                              Conds:RS_33._col1=RS_323._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
-                                            <-Map 26 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_323]
-                                                PartitionCols:_col0
-                                                 Please refer to the previous Select Operator [SEL_320]
-                                            <-Reducer 10 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_33]
-                                                PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_283] (rows=187573258 width=199)
-                                                  Conds:RS_332._col0=RS_302._col0(Inner),Output:["_col1","_col2","_col3"]
-                                                <-Map 21 [SIMPLE_EDGE] vectorized
-                                                  PARTITION_ONLY_SHUFFLE [RS_302]
-                                                    PartitionCols:_col0
-                                                    Select Operator [SEL_296] (rows=652 width=8)
-                                                      Output:["_col0"]
-                                                      Filter Operator [FIL_293] (rows=652 width=8)
-                                                        predicate:((d_year = 2001) and d_date_sk is not null)
-                                                         Please refer to the previous TableScan [TS_68]
-                                                <-Map 9 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_332]
-                                                    PartitionCols:_col0
-                                                    Select Operator [SEL_331] (rows=525327388 width=221)
-                                                      Output:["_col0","_col1","_col2","_col3"]
-                                                      Filter Operator [FIL_330] (rows=525327388 width=221)
-                                                        predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_31_date_dim_d_date_sk_min) AND DynamicValue(RS_31_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_31_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
-                                                        TableScan [TS_21] (rows=575995635 width=221)
-                                                          default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_ext_discount_amt","ss_ext_list_price"]
-                                                        <-Reducer 24 [BROADCAST_EDGE] vectorized
-                                                          BROADCAST [RS_329]
-                                                            Group By Operator [GBY_328] (rows=1 width=12)
-                                                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                            <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                              PARTITION_ONLY_SHUFFLE [RS_312]
-                                                                Group By Operator [GBY_308] (rows=1 width=12)
-                                                                  Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                  Select Operator [SEL_303] (rows=652 width=4)
-                                                                    Output:["_col0"]
-                                                                     Please refer to the previous Select Operator [SEL_296]
+                                        Group By Operator [GBY_36] (rows=80000000 width=764)
+                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                                          Merge Join Operator [MERGEJOIN_280] (rows=187573258 width=764)
+                                            Conds:RS_32._col1=RS_319._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                                          <-Map 26 [SIMPLE_EDGE] vectorized
+                                            SHUFFLE [RS_319]
+                                              PartitionCols:_col0
+                                               Please refer to the previous Select Operator [SEL_316]
+                                          <-Reducer 10 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_32]
+                                              PartitionCols:_col1
+                                              Merge Join Operator [MERGEJOIN_279] (rows=187573258 width=115)
+                                                Conds:RS_328._col0=RS_298._col0(Inner),Output:["_col1","_col2"]
+                                              <-Map 21 [SIMPLE_EDGE] vectorized
+                                                PARTITION_ONLY_SHUFFLE [RS_298]
+                                                  PartitionCols:_col0
+                                                  Select Operator [SEL_292] (rows=652 width=4)
+                                                    Output:["_col0"]
+                                                    Filter Operator [FIL_289] (rows=652 width=8)
+                                                      predicate:((d_year = 2001) and d_date_sk is not null)
+                                                       Please refer to the previous TableScan [TS_65]
+                                              <-Map 9 [SIMPLE_EDGE] vectorized
+                                                SHUFFLE [RS_328]
+                                                  PartitionCols:_col0
+                                                  Select Operator [SEL_327] (rows=525327388 width=119)
+                                                    Output:["_col0","_col1","_col2"]
+                                                    Filter Operator [FIL_326] (rows=525327388 width=221)
+                                                      predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_30_date_dim_d_date_sk_min) AND DynamicValue(RS_30_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_30_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
+                                                      TableScan [TS_20] (rows=575995635 width=221)
+                                                        default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_ext_discount_amt","ss_ext_list_price"]
+                                                      <-Reducer 24 [BROADCAST_EDGE] vectorized
+                                                        BROADCAST [RS_325]
+                                                          Group By Operator [GBY_324] (rows=1 width=12)
+                                                            Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                          <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                            PARTITION_ONLY_SHUFFLE [RS_308]
+                                                              Group By Operator [GBY_304] (rows=1 width=12)
+                                                                Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                Select Operator [SEL_299] (rows=652 width=4)
+                                                                  Output:["_col0"]
+                                                                   Please refer to the previous Select Operator [SEL_292]
                           <-Reducer 4 [SIMPLE_EDGE] vectorized
-                            SHUFFLE [RS_327]
+                            SHUFFLE [RS_323]
                               PartitionCols:_col0
-                              Select Operator [SEL_326] (rows=51391963 width=212)
+                              Select Operator [SEL_322] (rows=51391963 width=212)
                                 Output:["_col0","_col1"]
-                                Group By Operator [GBY_325] (rows=51391963 width=764)
+                                Group By Operator [GBY_321] (rows=51391963 width=764)
                                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6
                                 <-Reducer 3 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_18]
+                                  SHUFFLE [RS_17]
                                     PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                    Group By Operator [GBY_17] (rows=51391963 width=764)
-                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col7)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6
-                                      Select Operator [SEL_15] (rows=51391963 width=875)
-                                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                        Merge Join Operator [MERGEJOIN_282] (rows=51391963 width=875)
-                                          Conds:RS_12._col1=RS_322._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
-                                        <-Map 26 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_322]
-                                            PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_320]
-                                        <-Reducer 2 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_12]
-                                            PartitionCols:_col1
-                                            Merge Join Operator [MERGEJOIN_281] (rows=51391963 width=227)
-                                              Conds:RS_318._col0=RS_300._col0(Inner),Output:["_col1","_col2","_col3"]
-                                            <-Map 21 [SIMPLE_EDGE] vectorized
-                                              PARTITION_ONLY_SHUFFLE [RS_300]
-                                                PartitionCols:_col0
-                                                 Please refer to the previous Select Operator [SEL_295]
-                                            <-Map 1 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_318]
-                                                PartitionCols:_col0
-                                                Select Operator [SEL_317] (rows=143930993 width=231)
-                                                  Output:["_col0","_col1","_col2","_col3"]
-                                                  Filter Operator [FIL_316] (rows=143930993 width=231)
-                                                    predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_10_date_dim_d_date_sk_min) AND DynamicValue(RS_10_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_10_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_sold_date_sk is not null)
-                                                    TableScan [TS_0] (rows=144002668 width=231)
-                                                      default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_customer_sk","ws_ext_discount_amt","ws_ext_list_price"]
-                                                    <-Reducer 23 [BROADCAST_EDGE] vectorized
-                                                      BROADCAST [RS_315]
-                                                        Group By Operator [GBY_314] (rows=1 width=12)
-                                                          Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                        <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                          PARTITION_ONLY_SHUFFLE [RS_311]
-                                                            Group By Operator [GBY_307] (rows=1 width=12)
-                                                              Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                              Select Operator [SEL_301] (rows=652 width=4)
-                                                                Output:["_col0"]
-                                                                 Please refer to the previous Select Operator [SEL_295]
+                                    Group By Operator [GBY_16] (rows=51391963 width=764)
+                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)"],keys:_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                                      Merge Join Operator [MERGEJOIN_278] (rows=51391963 width=764)
+                                        Conds:RS_12._col1=RS_318._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                                      <-Map 26 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_318]
+                                          PartitionCols:_col0
+                                           Please refer to the previous Select Operator [SEL_316]
+                                      <-Reducer 2 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_12]
+                                          PartitionCols:_col1
+                                          Merge Join Operator [MERGEJOIN_277] (rows=51391963 width=115)
+                                            Conds:RS_314._col0=RS_296._col0(Inner),Output:["_col1","_col2"]
+                                          <-Map 21 [SIMPLE_EDGE] vectorized
+                                            PARTITION_ONLY_SHUFFLE [RS_296]
+                                              PartitionCols:_col0
+                                               Please refer to the previous Select Operator [SEL_291]
+                                          <-Map 1 [SIMPLE_EDGE] vectorized
+                                            SHUFFLE [RS_314]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_313] (rows=143930993 width=119)
+                                                Output:["_col0","_col1","_col2"]
+                                                Filter Operator [FIL_312] (rows=143930993 width=231)
+                                                  predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_10_date_dim_d_date_sk_min) AND DynamicValue(RS_10_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_10_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_sold_date_sk is not null)
+                                                  TableScan [TS_0] (rows=144002668 width=231)
+                                                    default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_bill_customer_sk","ws_ext_discount_amt","ws_ext_list_price"]
+                                                  <-Reducer 23 [BROADCAST_EDGE] vectorized
+                                                    BROADCAST [RS_311]
+                                                      Group By Operator [GBY_310] (rows=1 width=12)
+                                                        Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                      <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                        PARTITION_ONLY_SHUFFLE [RS_307]
+                                                          Group By Operator [GBY_303] (rows=1 width=12)
+                                                            Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                            Select Operator [SEL_297] (rows=652 width=4)
+                                                              Output:["_col0"]
+                                                               Please refer to the previous Select Operator [SEL_291]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query12.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query12.q.out b/ql/src/test/results/clientpositive/perf/tez/query12.q.out
index 75156be..b6e4999 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query12.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query12.q.out
@@ -109,9 +109,9 @@ Stage-0
                         SHUFFLE [RS_17]
                           PartitionCols:_col0, _col1, _col2, _col3, _col4
                           Group By Operator [GBY_16] (rows=138600 width=689)
-                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)"],keys:_col10, _col9, _col6, _col7, _col8
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)"],keys:_col9, _col8, _col5, _col6, _col7
                             Merge Join Operator [MERGEJOIN_58] (rows=4798568 width=689)
-                              Conds:RS_12._col1=RS_69._col0(Inner),Output:["_col2","_col6","_col7","_col8","_col9","_col10"]
+                              Conds:RS_12._col1=RS_69._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9"]
                             <-Map 9 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_69]
                                 PartitionCols:_col0
@@ -129,7 +129,7 @@ Stage-0
                                 <-Map 7 [SIMPLE_EDGE] vectorized
                                   PARTITION_ONLY_SHUFFLE [RS_61]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_60] (rows=8116 width=98)
+                                    Select Operator [SEL_60] (rows=8116 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_59] (rows=8116 width=98)
                                         predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'2001-01-12 00:00:00' AND TIMESTAMP'2001-02-11 00:00:00' and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query13.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query13.q.out b/ql/src/test/results/clientpositive/perf/tez/query13.q.out
index 0e02e9a..d6e86c4 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query13.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query13.q.out
@@ -115,17 +115,17 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Map 8 <- Reducer 10 (BROADCAST_EDGE), Reducer 12 (BROADCAST_EDGE), Reducer 14 (BROADCAST_EDGE), Reducer 16 (BROADCAST_EDGE)
-Reducer 10 <- Map 9 (CUSTOM_SIMPLE_EDGE)
+Map 9 <- Reducer 12 (BROADCAST_EDGE), Reducer 14 (BROADCAST_EDGE), Reducer 16 (BROADCAST_EDGE), Reducer 8 (BROADCAST_EDGE)
 Reducer 12 <- Map 11 (CUSTOM_SIMPLE_EDGE)
 Reducer 14 <- Map 13 (CUSTOM_SIMPLE_EDGE)
 Reducer 16 <- Map 15 (CUSTOM_SIMPLE_EDGE)
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
-Reducer 3 <- Map 9 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 9 (SIMPLE_EDGE)
+Reducer 3 <- Map 10 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
 Reducer 4 <- Map 11 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
 Reducer 5 <- Map 13 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
 Reducer 6 <- Map 15 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
 Reducer 7 <- Reducer 6 (CUSTOM_SIMPLE_EDGE)
+Reducer 8 <- Map 1 (CUSTOM_SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
@@ -140,131 +140,131 @@ Stage-0
           <-Reducer 6 [CUSTOM_SIMPLE_EDGE]
             PARTITION_ONLY_SHUFFLE [RS_37]
               Group By Operator [GBY_36] (rows=1 width=256)
-                Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col6)","count(_col6)","sum(_col8)","count(_col8)","sum(_col9)","count(_col9)"]
-                Select Operator [SEL_35] (rows=4851 width=183)
-                  Output:["_col6","_col8","_col9"]
-                  Filter Operator [FIL_34] (rows=4851 width=183)
-                    predicate:(((_col19 = 'D') and (_col20 = 'Primary') and _col7 BETWEEN 50 AND 100 and (_col14 = 1)) or ((_col19 = 'M') and (_col20 = '4 yr Degree') and _col7 BETWEEN 100 AND 150 and (_col14 = 3)) or ((_col19 = 'U') and (_col20 = 'Advanced Degree') and _col7 BETWEEN 150 AND 200 and (_col14 = 1)))
-                    Merge Join Operator [MERGEJOIN_121] (rows=58239 width=183)
-                      Conds:RS_31._col2=RS_151._col0(Inner),Output:["_col6","_col7","_col8","_col9","_col14","_col19","_col20"]
+                Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col6)","count(_col6)","sum(_col7)","count(_col7)","sum(_col8)","count(_col8)"]
+                Select Operator [SEL_35] (rows=40950 width=44)
+                  Output:["_col6","_col7","_col8"]
+                  Filter Operator [FIL_34] (rows=40950 width=44)
+                    predicate:((_col24 and _col25 and _col12 and _col17) or (_col26 and _col27 and _col13 and _col18) or (_col28 and _col29 and _col14 and _col18))
+                    Merge Join Operator [MERGEJOIN_121] (rows=218403 width=44)
+                      Conds:RS_31._col2=RS_148._col0(Inner),Output:["_col6","_col7","_col8","_col12","_col13","_col14","_col17","_col18","_col24","_col25","_col26","_col27","_col28","_col29"]
                     <-Map 15 [SIMPLE_EDGE] vectorized
-                      SHUFFLE [RS_151]
+                      SHUFFLE [RS_148]
                         PartitionCols:_col0
-                        Select Operator [SEL_150] (rows=265971 width=183)
-                          Output:["_col0","_col1","_col2"]
-                          Filter Operator [FIL_149] (rows=265971 width=183)
+                        Select Operator [SEL_147] (rows=265971 width=28)
+                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                          Filter Operator [FIL_146] (rows=265971 width=183)
                             predicate:((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null)
                             TableScan [TS_15] (rows=1861800 width=183)
                               default@customer_demographics,customer_demographics,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_marital_status","cd_education_status"]
                     <-Reducer 5 [SIMPLE_EDGE]
                       SHUFFLE [RS_31]
                         PartitionCols:_col2
-                        Filter Operator [FIL_30] (rows=58239 width=90)
-                          predicate:(((_col16) IN ('KY', 'GA', 'NM') and _col10 BETWEEN 100 AND 200) or ((_col16) IN ('MT', 'OR', 'IN') and _col10 BETWEEN 150 AND 300) or ((_col16) IN ('WI', 'MO', 'WV') and _col10 BETWEEN 50 AND 250))
-                          Merge Join Operator [MERGEJOIN_120] (rows=291204 width=90)
-                            Conds:RS_27._col4=RS_143._col0(Inner),Output:["_col2","_col6","_col7","_col8","_col9","_col10","_col14","_col16"]
+                        Filter Operator [FIL_30] (rows=218403 width=44)
+                          predicate:((_col20 and _col9) or (_col21 and _col10) or (_col22 and _col11))
+                          Merge Join Operator [MERGEJOIN_120] (rows=291204 width=44)
+                            Conds:RS_27._col4=RS_140._col0(Inner),Output:["_col2","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col17","_col18","_col20","_col21","_col22"]
                           <-Map 13 [SIMPLE_EDGE] vectorized
-                            SHUFFLE [RS_143]
+                            SHUFFLE [RS_140]
                               PartitionCols:_col0
-                              Select Operator [SEL_142] (rows=3529412 width=187)
-                                Output:["_col0","_col1"]
-                                Filter Operator [FIL_141] (rows=3529412 width=187)
+                              Select Operator [SEL_139] (rows=3529412 width=16)
+                                Output:["_col0","_col1","_col2","_col3"]
+                                Filter Operator [FIL_138] (rows=3529412 width=187)
                                   predicate:((ca_country = 'United States') and (ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is not null)
                                   TableScan [TS_12] (rows=40000000 width=187)
                                     default@customer_address,customer_address,Tbl:COMPLETE,Col:COMPLETE,Output:["ca_address_sk","ca_state","ca_country"]
                           <-Reducer 4 [SIMPLE_EDGE]
                             SHUFFLE [RS_27]
                               PartitionCols:_col4
-                              Merge Join Operator [MERGEJOIN_119] (rows=3300311 width=145)
-                                Conds:RS_24._col3=RS_135._col0(Inner),Output:["_col2","_col4","_col6","_col7","_col8","_col9","_col10","_col14"]
+                              Merge Join Operator [MERGEJOIN_119] (rows=3300311 width=104)
+                                Conds:RS_24._col3=RS_132._col0(Inner),Output:["_col2","_col4","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col17","_col18"]
                               <-Map 11 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_135]
+                                SHUFFLE [RS_132]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_134] (rows=1309 width=8)
-                                    Output:["_col0","_col1"]
-                                    Filter Operator [FIL_133] (rows=1309 width=8)
+                                  Select Operator [SEL_131] (rows=1309 width=12)
+                                    Output:["_col0","_col1","_col2"]
+                                    Filter Operator [FIL_130] (rows=1309 width=8)
                                       predicate:((hd_dep_count) IN (3, 1) and hd_demo_sk is not null)
                                       TableScan [TS_9] (rows=7200 width=8)
                                         default@household_demographics,household_demographics,Tbl:COMPLETE,Col:COMPLETE,Output:["hd_demo_sk","hd_dep_count"]
                               <-Reducer 3 [SIMPLE_EDGE]
                                 SHUFFLE [RS_24]
                                   PartitionCols:_col3
-                                  Merge Join Operator [MERGEJOIN_118] (rows=18152968 width=405)
-                                    Conds:RS_21._col1=RS_127._col0(Inner),Output:["_col2","_col3","_col4","_col6","_col7","_col8","_col9","_col10"]
-                                  <-Map 9 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_127]
+                                  Merge Join Operator [MERGEJOIN_118] (rows=18152968 width=233)
+                                    Conds:RS_21._col5=RS_159._col0(Inner),Output:["_col2","_col3","_col4","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14"]
+                                  <-Map 10 [SIMPLE_EDGE] vectorized
+                                    SHUFFLE [RS_159]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_126] (rows=652 width=8)
+                                      Select Operator [SEL_158] (rows=1704 width=4)
                                         Output:["_col0"]
-                                        Filter Operator [FIL_125] (rows=652 width=8)
-                                          predicate:((d_year = 2001) and d_date_sk is not null)
-                                          TableScan [TS_6] (rows=73049 width=8)
-                                            default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                        Filter Operator [FIL_157] (rows=1704 width=4)
+                                          predicate:s_store_sk is not null
+                                          TableScan [TS_6] (rows=1704 width=4)
+                                            default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk"]
                                   <-Reducer 2 [SIMPLE_EDGE]
                                     SHUFFLE [RS_21]
-                                      PartitionCols:_col1
-                                      Merge Join Operator [MERGEJOIN_117] (rows=50840141 width=446)
-                                        Conds:RS_124._col0=RS_159._col4(Inner),Output:["_col1","_col2","_col3","_col4","_col6","_col7","_col8","_col9","_col10"]
+                                      PartitionCols:_col5
+                                      Merge Join Operator [MERGEJOIN_117] (rows=18152968 width=237)
+                                        Conds:RS_124._col0=RS_156._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14"]
                                       <-Map 1 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_124]
+                                        PARTITION_ONLY_SHUFFLE [RS_124]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_123] (rows=1704 width=4)
+                                          Select Operator [SEL_123] (rows=652 width=4)
                                             Output:["_col0"]
-                                            Filter Operator [FIL_122] (rows=1704 width=4)
-                                              predicate:s_store_sk is not null
-                                              TableScan [TS_0] (rows=1704 width=4)
-                                                default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk"]
-                                      <-Map 8 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_159]
-                                          PartitionCols:_col4
-                                          Select Operator [SEL_158] (rows=50840141 width=450)
-                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
-                                            Filter Operator [FIL_157] (rows=50840141 width=450)
-                                              predicate:((ss_addr_sk BETWEEN DynamicValue(RS_28_customer_address_ca_address_sk_min) AND DynamicValue(RS_28_customer_address_ca_address_sk_max) and in_bloom_filter(ss_addr_sk, DynamicValue(RS_28_customer_address_ca_address_sk_bloom_filter))) and (ss_cdemo_sk BETWEEN DynamicValue(RS_32_customer_demographics_cd_demo_sk_min) AND DynamicValue(RS_32_customer_demographics_cd_demo_sk_max) and in_bloom_filter(ss_cdemo_sk, DynamicValue(RS_32_customer_demographics_cd_demo_sk_bloom_filter))) and (ss_hdemo_sk BETWEEN DynamicValue(RS_25_household_demographics_hd_demo_sk_min) AND DynamicValue(RS_25_household_demographics_hd_demo_sk_max) and in_bloom_filter(ss_hdemo_sk, DynamicValue(RS_25_household_demographics_hd_demo_sk_bloom_filter))) and (ss_net_profit BETWEEN 100 AND 200 or ss_net_profit BETWEEN 150 AND 300 or ss_net_profit BETWEEN 50 AND 250) and (ss_sales_price BETWEEN 100 AND 150 or ss_sales_price BETWEEN 50 AND 100 or ss_sales_price BETWEEN 1
 50 AND 200) and (ss_sold_date_sk BETWEEN DynamicValue(RS_22_date_dim_d_date_sk_min) AND DynamicValue(RS_22_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_22_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_cdemo_sk is not null and ss_hdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
+                                            Filter Operator [FIL_122] (rows=652 width=8)
+                                              predicate:((d_year = 2001) and d_date_sk is not null)
+                                              TableScan [TS_0] (rows=73049 width=8)
+                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                      <-Map 9 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_156]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_155] (rows=50840141 width=260)
+                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13"]
+                                            Filter Operator [FIL_154] (rows=50840141 width=450)
+                                              predicate:((ss_addr_sk BETWEEN DynamicValue(RS_28_customer_address_ca_address_sk_min) AND DynamicValue(RS_28_customer_address_ca_address_sk_max) and in_bloom_filter(ss_addr_sk, DynamicValue(RS_28_customer_address_ca_address_sk_bloom_filter))) and (ss_cdemo_sk BETWEEN DynamicValue(RS_32_customer_demographics_cd_demo_sk_min) AND DynamicValue(RS_32_customer_demographics_cd_demo_sk_max) and in_bloom_filter(ss_cdemo_sk, DynamicValue(RS_32_customer_demographics_cd_demo_sk_bloom_filter))) and (ss_hdemo_sk BETWEEN DynamicValue(RS_25_household_demographics_hd_demo_sk_min) AND DynamicValue(RS_25_household_demographics_hd_demo_sk_max) and in_bloom_filter(ss_hdemo_sk, DynamicValue(RS_25_household_demographics_hd_demo_sk_bloom_filter))) and (ss_net_profit BETWEEN 100 AND 200 or ss_net_profit BETWEEN 150 AND 300 or ss_net_profit BETWEEN 50 AND 250) and (ss_sales_price BETWEEN 100 AND 150 or ss_sales_price BETWEEN 50 AND 100 or ss_sales_price BETWEEN 1
 50 AND 200) and (ss_sold_date_sk BETWEEN DynamicValue(RS_18_date_dim_d_date_sk_min) AND DynamicValue(RS_18_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_18_date_dim_d_date_sk_bloom_filter))) and ss_addr_sk is not null and ss_cdemo_sk is not null and ss_hdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
                                               TableScan [TS_3] (rows=575995635 width=450)
                                                 default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_cdemo_sk","ss_hdemo_sk","ss_addr_sk","ss_store_sk","ss_quantity","ss_sales_price","ss_ext_sales_price","ss_ext_wholesale_cost","ss_net_profit"]
-                                              <-Reducer 10 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_132]
-                                                  Group By Operator [GBY_131] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                  <-Map 9 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_130]
-                                                      Group By Operator [GBY_129] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_128] (rows=652 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_126]
                                               <-Reducer 12 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_140]
-                                                  Group By Operator [GBY_139] (rows=1 width=12)
+                                                BROADCAST [RS_137]
+                                                  Group By Operator [GBY_136] (rows=1 width=12)
                                                     Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                   <-Map 11 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_138]
-                                                      Group By Operator [GBY_137] (rows=1 width=12)
+                                                    SHUFFLE [RS_135]
+                                                      Group By Operator [GBY_134] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_136] (rows=1309 width=4)
+                                                        Select Operator [SEL_133] (rows=1309 width=4)
                                                           Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_134]
+                                                           Please refer to the previous Select Operator [SEL_131]
                                               <-Reducer 14 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_148]
-                                                  Group By Operator [GBY_147] (rows=1 width=12)
+                                                BROADCAST [RS_145]
+                                                  Group By Operator [GBY_144] (rows=1 width=12)
                                                     Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=3529412)"]
                                                   <-Map 13 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_146]
-                                                      Group By Operator [GBY_145] (rows=1 width=12)
+                                                    SHUFFLE [RS_143]
+                                                      Group By Operator [GBY_142] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=3529412)"]
-                                                        Select Operator [SEL_144] (rows=3529412 width=4)
+                                                        Select Operator [SEL_141] (rows=3529412 width=4)
                                                           Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_142]
+                                                           Please refer to the previous Select Operator [SEL_139]
                                               <-Reducer 16 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_156]
-                                                  Group By Operator [GBY_155] (rows=1 width=12)
+                                                BROADCAST [RS_153]
+                                                  Group By Operator [GBY_152] (rows=1 width=12)
                                                     Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                   <-Map 15 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_154]
-                                                      Group By Operator [GBY_153] (rows=1 width=12)
+                                                    SHUFFLE [RS_151]
+                                                      Group By Operator [GBY_150] (rows=1 width=12)
+                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                        Select Operator [SEL_149] (rows=265971 width=4)
+                                                          Output:["_col0"]
+                                                           Please refer to the previous Select Operator [SEL_147]
+                                              <-Reducer 8 [BROADCAST_EDGE] vectorized
+                                                BROADCAST [RS_129]
+                                                  Group By Operator [GBY_128] (rows=1 width=12)
+                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                  <-Map 1 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                    PARTITION_ONLY_SHUFFLE [RS_127]
+                                                      Group By Operator [GBY_126] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_152] (rows=265971 width=4)
+                                                        Select Operator [SEL_125] (rows=652 width=4)
                                                           Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_150]
+                                                           Please refer to the previous Select Operator [SEL_123]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query14.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query14.q.out b/ql/src/test/results/clientpositive/perf/tez/query14.q.out
index 2c28023..2e99363 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query14.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query14.q.out
@@ -376,7 +376,7 @@ Stage-0
                                                           <-Map 96 [SIMPLE_EDGE] vectorized
                                                             PARTITION_ONLY_SHUFFLE [RS_1623]
                                                               PartitionCols:_col0
-                                                              Select Operator [SEL_1612] (rows=1957 width=8)
+                                                              Select Operator [SEL_1612] (rows=1957 width=4)
                                                                 Output:["_col0"]
                                                                 Filter Operator [FIL_1611] (rows=1957 width=8)
                                                                   predicate:(d_date_sk is not null and d_year BETWEEN 1999 AND 2001)
@@ -415,7 +415,7 @@ Stage-0
                                                           <-Map 24 [SIMPLE_EDGE] vectorized
                                                             SHUFFLE [RS_1763]
                                                               PartitionCols:_col0
-                                                              Select Operator [SEL_1758] (rows=1957 width=8)
+                                                              Select Operator [SEL_1758] (rows=1957 width=4)
                                                                 Output:["_col0"]
                                                                 Filter Operator [FIL_1757] (rows=1957 width=8)
                                                                   predicate:(d_date_sk is not null and d_year BETWEEN 1998 AND 2000)
@@ -454,7 +454,7 @@ Stage-0
                                                           <-Map 40 [SIMPLE_EDGE] vectorized
                                                             SHUFFLE [RS_1791]
                                                               PartitionCols:_col0
-                                                              Select Operator [SEL_1786] (rows=1957 width=8)
+                                                              Select Operator [SEL_1786] (rows=1957 width=4)
                                                                 Output:["_col0"]
                                                                 Filter Operator [FIL_1785] (rows=1957 width=8)
                                                                   predicate:(d_date_sk is not null and d_year BETWEEN 1998 AND 2000)
@@ -601,7 +601,7 @@ Stage-0
                                         Select Operator [SEL_368] (rows=1 width=128)
                                           Output:["_col0","_col1","_col2","_col3"]
                                           Merge Join Operator [MERGEJOIN_1438] (rows=1 width=128)
-                                            Conds:RS_365._col1=RS_366._col0(Left Semi),Output:["_col2","_col3","_col8","_col9","_col10"]
+                                            Conds:RS_365._col1=RS_366._col0(Left Semi),Output:["_col2","_col3","_col6","_col7","_col8"]
                                           <-Reducer 79 [SIMPLE_EDGE]
                                             PARTITION_ONLY_SHUFFLE [RS_366]
                                               PartitionCols:_col0
@@ -639,9 +639,9 @@ Stage-0
                                                                   SHUFFLE [RS_302]
                                                                     PartitionCols:_col0, _col1, _col2
                                                                     Group By Operator [GBY_110] (rows=121728 width=19)
-                                                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col5, _col6, _col7
+                                                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col5, _col6
                                                                       Merge Join Operator [MERGEJOIN_1401] (rows=14628613 width=11)
-                                                                        Conds:RS_106._col1=RS_1689._col0(Inner),Output:["_col5","_col6","_col7"]
+                                                                        Conds:RS_106._col1=RS_1689._col0(Inner),Output:["_col4","_col5","_col6"]
                                                                       <-Map 69 [SIMPLE_EDGE] vectorized
                                                                         SHUFFLE [RS_1689]
                                                                           PartitionCols:_col0
@@ -690,9 +690,9 @@ Stage-0
                                                                   SHUFFLE [RS_322]
                                                                     PartitionCols:_col0, _col1, _col2
                                                                     Group By Operator [GBY_130] (rows=121728 width=19)
-                                                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col5, _col6, _col7
+                                                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col5, _col6
                                                                       Merge Join Operator [MERGEJOIN_1403] (rows=7620440 width=11)
-                                                                        Conds:RS_126._col1=RS_1690._col0(Inner),Output:["_col5","_col6","_col7"]
+                                                                        Conds:RS_126._col1=RS_1690._col0(Inner),Output:["_col4","_col5","_col6"]
                                                                       <-Map 69 [SIMPLE_EDGE] vectorized
                                                                         SHUFFLE [RS_1690]
                                                                           PartitionCols:_col0
@@ -741,9 +741,9 @@ Stage-0
                                                                   SHUFFLE [RS_343]
                                                                     PartitionCols:_col0, _col1, _col2
                                                                     Group By Operator [GBY_151] (rows=121728 width=19)
-                                                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col5, _col6, _col7
+                                                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col5, _col6
                                                                       Merge Join Operator [MERGEJOIN_1405] (rows=3828623 width=11)
-                                                                        Conds:RS_147._col1=RS_1691._col0(Inner),Output:["_col5","_col6","_col7"]
+                                                                        Conds:RS_147._col1=RS_1691._col0(Inner),Output:["_col4","_col5","_col6"]
                                                                       <-Map 69 [SIMPLE_EDGE] vectorized
                                                                         SHUFFLE [RS_1691]
                                                                           PartitionCols:_col0
@@ -785,7 +785,7 @@ Stage-0
                                             FORWARD [RS_365]
                                               PartitionCols:_col1
                                               Merge Join Operator [MERGEJOIN_1414] (rows=7790806 width=110)
-                                                Conds:RS_360._col1=RS_1692._col0(Inner),Output:["_col1","_col2","_col3","_col8","_col9","_col10"]
+                                                Conds:RS_360._col1=RS_1692._col0(Inner),Output:["_col1","_col2","_col3","_col6","_col7","_col8"]
                                               <-Map 69 [SIMPLE_EDGE] vectorized
                                                 SHUFFLE [RS_1692]
                                                   PartitionCols:_col0
@@ -802,7 +802,7 @@ Stage-0
                                                   <-Map 57 [SIMPLE_EDGE] vectorized
                                                     PARTITION_ONLY_SHUFFLE [RS_1657]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1654] (rows=50 width=12)
+                                                      Select Operator [SEL_1654] (rows=50 width=4)
                                                         Output:["_col0"]
                                                         Filter Operator [FIL_1653] (rows=50 width=12)
                                                           predicate:((d_moy = 11) and (d_year = 2000) and d_date_sk is not null)
@@ -994,7 +994,7 @@ Stage-0
                                         Select Operator [SEL_560] (rows=1 width=128)
                                           Output:["_col0","_col1","_col2","_col3"]
                                           Merge Join Operator [MERGEJOIN_1439] (rows=1 width=128)
-                                            Conds:RS_557._col1=RS_558._col0(Left Semi),Output:["_col2","_col3","_col8","_col9","_col10"]
+                                            Conds:RS_557._col1=RS_558._col0(Left Semi),Output:["_col2","_col3","_col6","_col7","_col8"]
                                           <-Reducer 84 [SIMPLE_EDGE]
                                             PARTITION_ONLY_SHUFFLE [RS_558]
                                               PartitionCols:_col0
@@ -1057,7 +1057,7 @@ Stage-0
                                             FORWARD [RS_557]
                                               PartitionCols:_col1
                                               Merge Join Operator [MERGEJOIN_1429] (rows=3942084 width=130)
-                                                Conds:RS_552._col1=RS_1694._col0(Inner),Output:["_col1","_col2","_col3","_col8","_col9","_col10"]
+                                                Conds:RS_552._col1=RS_1694._col0(Inner),Output:["_col1","_col2","_col3","_col6","_col7","_col8"]
                                               <-Map 69 [SIMPLE_EDGE] vectorized
                                                 SHUFFLE [RS_1694]
                                                   PartitionCols:_col0
@@ -1261,7 +1261,7 @@ Stage-0
                                         Select Operator [SEL_177] (rows=1 width=128)
                                           Output:["_col0","_col1","_col2","_col3"]
                                           Merge Join Operator [MERGEJOIN_1437] (rows=1 width=128)
-                                            Conds:RS_174._col1=RS_175._col0(Left Semi),Output:["_col2","_col3","_col8","_col9","_col10"]
+                                            Conds:RS_174._col1=RS_175._col0(Left Semi),Output:["_col2","_col3","_col6","_col7","_col8"]
                                           <-Reducer 70 [SIMPLE_EDGE]
                                             PARTITION_ONLY_SHUFFLE [RS_175]
                                               PartitionCols:_col0
@@ -1324,7 +1324,7 @@ Stage-0
                                             FORWARD [RS_174]
                                               PartitionCols:_col1
                                               Merge Join Operator [MERGEJOIN_1399] (rows=15062131 width=15)
-                                                Conds:RS_169._col1=RS_1687._col0(Inner),Output:["_col1","_col2","_col3","_col8","_col9","_col10"]
+                                                Conds:RS_169._col1=RS_1687._col0(Inner),Output:["_col1","_col2","_col3","_col6","_col7","_col8"]
                                               <-Map 69 [SIMPLE_EDGE] vectorized
                                                 SHUFFLE [RS_1687]
                                                   PartitionCols:_col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query15.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query15.q.out b/ql/src/test/results/clientpositive/perf/tez/query15.q.out
index 565f101..c3c08a1 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query15.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query15.q.out
@@ -74,21 +74,21 @@ Stage-0
               <-Reducer 3 [SIMPLE_EDGE]
                 SHUFFLE [RS_25]
                   PartitionCols:_col0
-                  Group By Operator [GBY_24] (rows=56210 width=201)
-                    Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col4
-                    Top N Key Operator [TNK_44] (rows=20154874 width=279)
-                      keys:_col4,sort order:+,top n:100
-                      Select Operator [SEL_23] (rows=20154874 width=279)
-                        Output:["_col4","_col7"]
-                        Filter Operator [FIL_22] (rows=20154874 width=279)
-                          predicate:((_col3) IN ('CA', 'WA', 'GA') or (_col7 > 500) or (substr(_col4, 1, 5)) IN ('85669', '86197', '88274', '83405', '86475', '85392', '85460', '80348', '81792'))
-                          Merge Join Operator [MERGEJOIN_77] (rows=20154874 width=279)
-                            Conds:RS_19._col0=RS_20._col1(Inner),Output:["_col3","_col4","_col7"]
+                  Group By Operator [GBY_24] (rows=43435 width=201)
+                    Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col3
+                    Top N Key Operator [TNK_44] (rows=20154874 width=205)
+                      keys:_col3,sort order:+,top n:100
+                      Select Operator [SEL_23] (rows=20154874 width=205)
+                        Output:["_col3","_col8"]
+                        Filter Operator [FIL_22] (rows=20154874 width=205)
+                          predicate:(_col4 or _col5 or _col9)
+                          Merge Join Operator [MERGEJOIN_77] (rows=20154874 width=205)
+                            Conds:RS_19._col0=RS_20._col1(Inner),Output:["_col3","_col4","_col5","_col8","_col9"]
                           <-Reducer 2 [SIMPLE_EDGE]
                             SHUFFLE [RS_19]
                               PartitionCols:_col0
-                              Merge Join Operator [MERGEJOIN_75] (rows=80000000 width=179)
-                                Conds:RS_80._col1=RS_83._col0(Inner),Output:["_col0","_col3","_col4"]
+                              Merge Join Operator [MERGEJOIN_75] (rows=80000000 width=101)
+                                Conds:RS_80._col1=RS_83._col0(Inner),Output:["_col0","_col3","_col4","_col5"]
                               <-Map 1 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_80]
                                   PartitionCols:_col1
@@ -101,8 +101,8 @@ Stage-0
                               <-Map 6 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_83]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_82] (rows=40000000 width=179)
-                                    Output:["_col0","_col1","_col2"]
+                                  Select Operator [SEL_82] (rows=40000000 width=101)
+                                    Output:["_col0","_col1","_col2","_col3"]
                                     Filter Operator [FIL_81] (rows=40000000 width=179)
                                       predicate:ca_address_sk is not null
                                       TableScan [TS_3] (rows=40000000 width=179)
@@ -110,12 +110,12 @@ Stage-0
                           <-Reducer 8 [SIMPLE_EDGE]
                             SHUFFLE [RS_20]
                               PartitionCols:_col1
-                              Merge Join Operator [MERGEJOIN_76] (rows=20154874 width=107)
-                                Conds:RS_94._col0=RS_86._col0(Inner),Output:["_col1","_col2"]
+                              Merge Join Operator [MERGEJOIN_76] (rows=20154874 width=111)
+                                Conds:RS_94._col0=RS_86._col0(Inner),Output:["_col1","_col2","_col3"]
                               <-Map 9 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_86]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_85] (rows=130 width=12)
+                                  Select Operator [SEL_85] (rows=130 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_84] (rows=130 width=12)
                                       predicate:((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null)
@@ -124,8 +124,8 @@ Stage-0
                               <-Map 7 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_94]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_93] (rows=285117831 width=119)
-                                    Output:["_col0","_col1","_col2"]
+                                  Select Operator [SEL_93] (rows=285117831 width=123)
+                                    Output:["_col0","_col1","_col2","_col3"]
                                     Filter Operator [FIL_92] (rows=285117831 width=119)
                                       predicate:((cs_sold_date_sk BETWEEN DynamicValue(RS_13_date_dim_d_date_sk_min) AND DynamicValue(RS_13_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_13_date_dim_d_date_sk_bloom_filter))) and cs_bill_customer_sk is not null and cs_sold_date_sk is not null)
                                       TableScan [TS_6] (rows=287989836 width=119)


[42/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/explainuser_1.q.out b/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
index 067a43c..c86450a 100644
--- a/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/explainuser_1.q.out
@@ -457,16 +457,16 @@ Stage-0
                 SHUFFLE [RS_23]
                   PartitionCols:_col0, _col1
                   Group By Operator [GBY_22] (rows=1 width=20)
-                    Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col4, _col1
-                    Select Operator [SEL_21] (rows=2 width=20)
-                      Output:["_col1","_col4"]
-                      Merge Join Operator [MERGEJOIN_57] (rows=2 width=20)
-                        Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col3","_col4","_col6"],residual filter predicates:{((_col3 > 0) or (_col1 >= 0))} {((_col3 + _col6) >= 0)}
+                    Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col5, _col1
+                    Select Operator [SEL_21] (rows=1 width=24)
+                      Output:["_col1","_col5"]
+                      Merge Join Operator [MERGEJOIN_57] (rows=1 width=24)
+                        Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col2","_col4","_col5","_col7"],residual filter predicates:{((_col4 > 0) or _col2)} {((_col4 + _col7) >= 0)}
                       <-Map 1 [SIMPLE_EDGE] llap
                         SHUFFLE [RS_17]
                           PartitionCols:_col0
-                          Select Operator [SEL_2] (rows=18 width=84)
-                            Output:["_col0","_col1"]
+                          Select Operator [SEL_2] (rows=18 width=88)
+                            Output:["_col0","_col1","_col2"]
                             Filter Operator [FIL_36] (rows=18 width=84)
                               predicate:key is not null
                               TableScan [TS_0] (rows=20 width=84)
@@ -547,16 +547,16 @@ Stage-0
                 SHUFFLE [RS_23]
                   PartitionCols:_col0, _col1
                   Group By Operator [GBY_22] (rows=1 width=20)
-                    Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col4
-                    Select Operator [SEL_21] (rows=1 width=20)
-                      Output:["_col1","_col4"]
-                      Merge Join Operator [MERGEJOIN_57] (rows=1 width=20)
-                        Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col3","_col4","_col6"],residual filter predicates:{((_col3 > 0) or _col1 is not null)} {((_col1 >= 1) or (_col4 >= 1L))} {((UDFToLong(_col1) + _col4) >= 0)} {((_col3 + _col6) >= 0)}
+                    Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col7
+                    Select Operator [SEL_21] (rows=1 width=36)
+                      Output:["_col1","_col7"]
+                      Merge Join Operator [MERGEJOIN_57] (rows=1 width=36)
+                        Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col6","_col7","_col9"],residual filter predicates:{((_col6 > 0) or _col2)} {(_col3 or (_col7 >= 1L))} {((_col4 + _col7) >= 0)} {((_col6 + _col9) >= 0)}
                       <-Map 1 [SIMPLE_EDGE] llap
                         SHUFFLE [RS_17]
                           PartitionCols:_col0
-                          Select Operator [SEL_2] (rows=18 width=84)
-                            Output:["_col0","_col1"]
+                          Select Operator [SEL_2] (rows=18 width=99)
+                            Output:["_col0","_col1","_col2","_col3","_col4"]
                             Filter Operator [FIL_36] (rows=18 width=84)
                               predicate:((c_int > 0) and key is not null)
                               TableScan [TS_0] (rows=20 width=84)
@@ -630,16 +630,16 @@ Stage-0
           SHUFFLE [RS_23]
             PartitionCols:_col0, _col1
             Group By Operator [GBY_22] (rows=1 width=20)
-              Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col4
-              Select Operator [SEL_21] (rows=1 width=20)
-                Output:["_col1","_col4"]
-                Merge Join Operator [MERGEJOIN_54] (rows=1 width=20)
-                  Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col3","_col4","_col6"],residual filter predicates:{((_col3 > 0) or (_col1 >= 0))} {((_col3 + _col6) >= 2)}
+              Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col5
+              Select Operator [SEL_21] (rows=1 width=24)
+                Output:["_col1","_col5"]
+                Merge Join Operator [MERGEJOIN_54] (rows=1 width=24)
+                  Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col2","_col4","_col5","_col7"],residual filter predicates:{((_col4 > 0) or _col2)} {((_col4 + _col7) >= 2)}
                 <-Map 1 [SIMPLE_EDGE] llap
                   SHUFFLE [RS_17]
                     PartitionCols:_col0
-                    Select Operator [SEL_2] (rows=18 width=84)
-                      Output:["_col0","_col1"]
+                    Select Operator [SEL_2] (rows=18 width=88)
+                      Output:["_col0","_col1","_col2"]
                       Filter Operator [FIL_33] (rows=18 width=84)
                         predicate:key is not null
                         TableScan [TS_0] (rows=20 width=84)
@@ -718,16 +718,16 @@ Stage-0
               SHUFFLE [RS_23]
                 PartitionCols:_col0, _col1
                 Group By Operator [GBY_22] (rows=1 width=20)
-                  Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col4
-                  Select Operator [SEL_21] (rows=1 width=20)
-                    Output:["_col1","_col4"]
-                    Merge Join Operator [MERGEJOIN_56] (rows=1 width=20)
-                      Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col3","_col4","_col6"],residual filter predicates:{((_col3 > 0) or _col1 is not null)} {((_col1 >= 1) or (_col4 >= 1L))} {((UDFToLong(_col1) + _col4) >= 0)} {((_col3 + _col6) >= 0)}
+                  Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col7
+                  Select Operator [SEL_21] (rows=1 width=36)
+                    Output:["_col1","_col7"]
+                    Merge Join Operator [MERGEJOIN_56] (rows=1 width=36)
+                      Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col6","_col7","_col9"],residual filter predicates:{((_col6 > 0) or _col2)} {(_col3 or (_col7 >= 1L))} {((_col4 + _col7) >= 0)} {((_col6 + _col9) >= 0)}
                     <-Map 1 [SIMPLE_EDGE] llap
                       SHUFFLE [RS_17]
                         PartitionCols:_col0
-                        Select Operator [SEL_2] (rows=18 width=84)
-                          Output:["_col0","_col1"]
+                        Select Operator [SEL_2] (rows=18 width=99)
+                          Output:["_col0","_col1","_col2","_col3","_col4"]
                           Filter Operator [FIL_35] (rows=18 width=84)
                             predicate:((c_int > 0) and key is not null)
                             TableScan [TS_0] (rows=20 width=84)
@@ -801,16 +801,16 @@ Stage-0
           SHUFFLE [RS_23]
             PartitionCols:_col0, _col1
             Group By Operator [GBY_22] (rows=1 width=20)
-              Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col4
-              Select Operator [SEL_21] (rows=1 width=20)
-                Output:["_col1","_col4"]
-                Merge Join Operator [MERGEJOIN_54] (rows=1 width=20)
-                  Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col3","_col4","_col6"],residual filter predicates:{((_col3 > 0) or (_col1 >= 0))} {((_col3 + _col6) >= 0)}
+              Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col1, _col5
+              Select Operator [SEL_21] (rows=1 width=24)
+                Output:["_col1","_col5"]
+                Merge Join Operator [MERGEJOIN_54] (rows=1 width=24)
+                  Conds:RS_17._col0=RS_18._col0(Inner),RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col2","_col4","_col5","_col7"],residual filter predicates:{((_col4 > 0) or _col2)} {((_col4 + _col7) >= 0)}
                 <-Map 1 [SIMPLE_EDGE] llap
                   SHUFFLE [RS_17]
                     PartitionCols:_col0
-                    Select Operator [SEL_2] (rows=18 width=84)
-                      Output:["_col0","_col1"]
+                    Select Operator [SEL_2] (rows=18 width=88)
+                      Output:["_col0","_col1","_col2"]
                       Filter Operator [FIL_33] (rows=18 width=84)
                         predicate:key is not null
                         TableScan [TS_0] (rows=20 width=84)
@@ -1307,8 +1307,8 @@ Stage-0
       File Output Operator [FS_14]
         Select Operator [SEL_13] (rows=24 width=101)
           Output:["_col0","_col1","_col2","_col3","_col4"]
-          Merge Join Operator [MERGEJOIN_42] (rows=24 width=101)
-            Conds:RS_9._col0=RS_10._col0(Inner),RS_9._col0=RS_11._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col6"],residual filter predicates:{((_col1 + _col4) = 2)} {((_col1 > 0) or (_col6 >= 0))}
+          Merge Join Operator [MERGEJOIN_42] (rows=24 width=105)
+            Conds:RS_9._col0=RS_10._col0(Inner),RS_9._col0=RS_11._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col6","_col7"],residual filter predicates:{((_col1 + _col4) = 2)} {((_col1 > 0) or _col7)} {((_col1 > 0) or (_col6 >= 0))}
           <-Map 1 [SIMPLE_EDGE] llap
             SHUFFLE [RS_9]
               PartitionCols:_col0
@@ -1330,8 +1330,8 @@ Stage-0
           <-Map 4 [SIMPLE_EDGE] llap
             SHUFFLE [RS_11]
               PartitionCols:_col0
-              Select Operator [SEL_8] (rows=18 width=84)
-                Output:["_col0","_col1"]
+              Select Operator [SEL_8] (rows=18 width=88)
+                Output:["_col0","_col1","_col2"]
                 Filter Operator [FIL_23] (rows=18 width=84)
                   predicate:key is not null
                   TableScan [TS_6] (rows=20 width=84)
@@ -1366,8 +1366,8 @@ Stage-0
       File Output Operator [FS_14]
         Select Operator [SEL_13] (rows=24 width=101)
           Output:["_col0","_col1","_col2","_col3","_col4"]
-          Merge Join Operator [MERGEJOIN_42] (rows=24 width=101)
-            Conds:RS_9._col0=RS_10._col0(Inner),RS_9._col0=RS_11._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col6"],residual filter predicates:{((_col1 + _col4) = 2)} {((_col1 > 0) or (_col6 >= 0))}
+          Merge Join Operator [MERGEJOIN_42] (rows=24 width=105)
+            Conds:RS_9._col0=RS_10._col0(Inner),RS_9._col0=RS_11._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col6","_col7"],residual filter predicates:{((_col1 + _col4) = 2)} {((_col1 > 0) or _col7)} {((_col1 > 0) or (_col6 >= 0))}
           <-Map 1 [SIMPLE_EDGE] llap
             SHUFFLE [RS_9]
               PartitionCols:_col0
@@ -1389,8 +1389,8 @@ Stage-0
           <-Map 4 [SIMPLE_EDGE] llap
             SHUFFLE [RS_11]
               PartitionCols:_col0
-              Select Operator [SEL_8] (rows=18 width=84)
-                Output:["_col0","_col1"]
+              Select Operator [SEL_8] (rows=18 width=88)
+                Output:["_col0","_col1","_col2"]
                 Filter Operator [FIL_23] (rows=18 width=84)
                   predicate:key is not null
                   TableScan [TS_6] (rows=20 width=84)
@@ -1605,16 +1605,16 @@ Stage-0
                   SHUFFLE [RS_35]
                     PartitionCols:_col0, _col1
                     Group By Operator [GBY_34] (rows=1 width=20)
-                      Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col4, _col6
-                      Select Operator [SEL_33] (rows=2 width=20)
-                        Output:["_col4","_col6"]
-                        Merge Join Operator [MERGEJOIN_64] (rows=2 width=20)
-                          Conds:RS_29._col0=RS_30._col0(Inner),RS_30._col0=RS_31._col0(Inner),Output:["_col1","_col3","_col4","_col6"],residual filter predicates:{((_col3 + _col1) >= 0)} {((_col3 > 0) or (_col6 >= 0))}
+                      Output:["_col0","_col1","_col2"],aggregations:["count()"],keys:_col4, _col7
+                      Select Operator [SEL_33] (rows=2 width=28)
+                        Output:["_col4","_col7"]
+                        Merge Join Operator [MERGEJOIN_64] (rows=2 width=28)
+                          Conds:RS_29._col0=RS_30._col0(Inner),RS_30._col0=RS_31._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col7","_col8"],residual filter predicates:{((_col3 + _col1) >= 0)} {(_col5 or _col8)}
                         <-Map 10 [SIMPLE_EDGE] llap
                           SHUFFLE [RS_31]
                             PartitionCols:_col0
-                            Select Operator [SEL_28] (rows=18 width=84)
-                              Output:["_col0","_col1"]
+                            Select Operator [SEL_28] (rows=18 width=88)
+                              Output:["_col0","_col1","_col2"]
                               Filter Operator [FIL_53] (rows=18 width=84)
                                 predicate:key is not null
                                 TableScan [TS_26] (rows=20 width=84)
@@ -1646,27 +1646,29 @@ Stage-0
                         <-Reducer 9 [SIMPLE_EDGE] llap
                           SHUFFLE [RS_30]
                             PartitionCols:_col0
-                            Filter Operator [FIL_24] (rows=2 width=97)
-                              predicate:_col0 is not null
-                              Limit [LIM_22] (rows=3 width=97)
-                                Number of rows:5
-                                Select Operator [SEL_21] (rows=3 width=97)
-                                  Output:["_col0","_col1","_col2"]
-                                <-Reducer 8 [SIMPLE_EDGE] llap
-                                  SHUFFLE [RS_20]
-                                    Select Operator [SEL_19] (rows=3 width=97)
-                                      Output:["_col0","_col1","_col2"]
-                                      Group By Operator [GBY_18] (rows=3 width=101)
-                                        Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                      <-Map 7 [SIMPLE_EDGE] llap
-                                        SHUFFLE [RS_17]
-                                          PartitionCols:_col0, _col1, _col2
-                                          Group By Operator [GBY_16] (rows=3 width=101)
-                                            Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
-                                            Filter Operator [FIL_52] (rows=6 width=93)
-                                              predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0)))
-                                              TableScan [TS_13] (rows=20 width=88)
-                                                default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
+                            Select Operator [SEL_25] (rows=2 width=101)
+                              Output:["_col0","_col1","_col2","_col3"]
+                              Filter Operator [FIL_24] (rows=2 width=97)
+                                predicate:_col0 is not null
+                                Limit [LIM_22] (rows=3 width=97)
+                                  Number of rows:5
+                                  Select Operator [SEL_21] (rows=3 width=97)
+                                    Output:["_col0","_col1","_col2"]
+                                  <-Reducer 8 [SIMPLE_EDGE] llap
+                                    SHUFFLE [RS_20]
+                                      Select Operator [SEL_19] (rows=3 width=97)
+                                        Output:["_col0","_col1","_col2"]
+                                        Group By Operator [GBY_18] (rows=3 width=101)
+                                          Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
+                                        <-Map 7 [SIMPLE_EDGE] llap
+                                          SHUFFLE [RS_17]
+                                            PartitionCols:_col0, _col1, _col2
+                                            Group By Operator [GBY_16] (rows=3 width=101)
+                                              Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(c_int)"],keys:key, c_int, c_float
+                                              Filter Operator [FIL_52] (rows=6 width=93)
+                                                predicate:(((c_int + 1) >= 0) and ((c_int > 0) or (c_float >= 0.0)))
+                                                TableScan [TS_13] (rows=20 width=88)
+                                                  default@cbo_t1,cbo_t1,Tbl:COMPLETE,Col:COMPLETE,Output:["key","c_int","c_float"]
 
 PREHOOK: query: explain select cbo_t1.c_int           from cbo_t1 left semi join   cbo_t2 on cbo_t1.key=cbo_t2.key where (cbo_t1.c_int + 1 == 2) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0)
 PREHOOK: type: QUERY
@@ -6134,35 +6136,33 @@ Stage-0
     limit:-1
     Stage-1
       Reducer 4 llap
-      File Output Operator [FS_16]
-        Group By Operator [GBY_14] (rows=1 width=24)
+      File Output Operator [FS_15]
+        Group By Operator [GBY_13] (rows=1 width=24)
           Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"]
         <-Reducer 3 [CUSTOM_SIMPLE_EDGE] llap
-          PARTITION_ONLY_SHUFFLE [RS_13]
-            Group By Operator [GBY_12] (rows=1 width=24)
+          PARTITION_ONLY_SHUFFLE [RS_12]
+            Group By Operator [GBY_11] (rows=1 width=24)
               Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"]
             <-Map 2 [CUSTOM_SIMPLE_EDGE] llap
-              PARTITION_ONLY_SHUFFLE [RS_11]
+              PARTITION_ONLY_SHUFFLE [RS_10]
                 PartitionCols:rand()
-                Select Operator [SEL_9] (rows=550 width=87)
-                  Output:["_col0","_col1","_col2"]
-                  Map Join Operator [MAPJOIN_26] (rows=550 width=87)
-                    Conds:RS_6.UDFToDouble(_col0)=SEL_5.(UDFToDouble(_col0) + 1.0D)(Inner),Output:["_col0","_col1","_col2"]
-                  <-Map 1 [BROADCAST_EDGE] llap
-                    BROADCAST [RS_6]
-                      PartitionCols:UDFToDouble(_col0)
-                      Select Operator [SEL_2] (rows=1 width=368)
-                        Output:["_col0","_col1"]
-                        Filter Operator [FIL_19] (rows=1 width=368)
-                          predicate:key is not null
-                          TableScan [TS_0] (rows=1 width=368)
-                            default@t1_n119,a,Tbl:COMPLETE,Col:NONE,Output:["key","val"]
-                  <-Select Operator [SEL_5] (rows=500 width=87)
-                      Output:["_col0"]
-                      Filter Operator [FIL_20] (rows=500 width=87)
+                Map Join Operator [MAPJOIN_25] (rows=550 width=12)
+                  Conds:RS_6._col2=SEL_5._col1(Inner),Output:["_col0","_col1","_col3"]
+                <-Map 1 [BROADCAST_EDGE] llap
+                  BROADCAST [RS_6]
+                    PartitionCols:_col2
+                    Select Operator [SEL_2] (rows=1 width=368)
+                      Output:["_col0","_col1","_col2"]
+                      Filter Operator [FIL_18] (rows=1 width=368)
                         predicate:key is not null
-                        TableScan [TS_3] (rows=500 width=87)
-                          default@src,c,Tbl:COMPLETE,Col:COMPLETE,Output:["key"]
+                        TableScan [TS_0] (rows=1 width=368)
+                          default@t1_n119,a,Tbl:COMPLETE,Col:NONE,Output:["key","val"]
+                <-Select Operator [SEL_5] (rows=500 width=12)
+                    Output:["_col0","_col1"]
+                    Filter Operator [FIL_19] (rows=500 width=87)
+                      predicate:key is not null
+                      TableScan [TS_3] (rows=500 width=87)
+                        default@src,c,Tbl:COMPLETE,Col:COMPLETE,Output:["key"]
 
 PREHOOK: query: FROM T1_n119 a JOIN src c ON c.key+1=a.key select /*+ STREAMTABLE(a) */ sum(hash(a.key)), sum(hash(a.val)), sum(hash(c.key))
 PREHOOK: type: QUERY
@@ -6245,35 +6245,33 @@ Stage-0
     limit:-1
     Stage-1
       Reducer 3 llap
-      File Output Operator [FS_16]
-        Group By Operator [GBY_14] (rows=1 width=16)
+      File Output Operator [FS_15]
+        Group By Operator [GBY_13] (rows=1 width=16)
           Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"]
         <-Reducer 2 [CUSTOM_SIMPLE_EDGE] llap
-          PARTITION_ONLY_SHUFFLE [RS_13]
-            Group By Operator [GBY_12] (rows=1 width=16)
+          PARTITION_ONLY_SHUFFLE [RS_12]
+            Group By Operator [GBY_11] (rows=1 width=16)
               Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"]
             <-Map 1 [CUSTOM_SIMPLE_EDGE] llap
-              PARTITION_ONLY_SHUFFLE [RS_11]
+              PARTITION_ONLY_SHUFFLE [RS_10]
                 PartitionCols:rand()
-                Select Operator [SEL_9] (rows=1 width=202)
-                  Output:["_col0","_col1"]
-                  Map Join Operator [MAPJOIN_31] (rows=1 width=202)
-                    Conds:SEL_2._col0=RS_7._col0(Inner),Output:["_col0","_col1"]
-                  <-Map 4 [BROADCAST_EDGE] llap
-                    BROADCAST [RS_7]
-                      PartitionCols:_col0
-                      Select Operator [SEL_5] (rows=1 width=184)
-                        Output:["_col0"]
-                        Filter Operator [FIL_20] (rows=1 width=184)
-                          predicate:val is not null
-                          TableScan [TS_3] (rows=1 width=184)
-                            default@t1_n119,v,Tbl:COMPLETE,Col:NONE,Output:["val"]
-                  <-Select Operator [SEL_2] (rows=1 width=184)
-                      Output:["_col0"]
+                Map Join Operator [MAPJOIN_30] (rows=1 width=202)
+                  Conds:SEL_2._col0=RS_7._col0(Inner),Output:["_col1","_col3"]
+                <-Map 4 [BROADCAST_EDGE] llap
+                  BROADCAST [RS_7]
+                    PartitionCols:_col0
+                    Select Operator [SEL_5] (rows=1 width=184)
+                      Output:["_col0","_col1"]
                       Filter Operator [FIL_19] (rows=1 width=184)
-                        predicate:key is not null
-                        TableScan [TS_0] (rows=1 width=184)
-                          default@t1_n119,k,Tbl:COMPLETE,Col:NONE,Output:["key"]
+                        predicate:val is not null
+                        TableScan [TS_3] (rows=1 width=184)
+                          default@t1_n119,v,Tbl:COMPLETE,Col:NONE,Output:["val"]
+                <-Select Operator [SEL_2] (rows=1 width=184)
+                    Output:["_col0","_col1"]
+                    Filter Operator [FIL_18] (rows=1 width=184)
+                      predicate:key is not null
+                      TableScan [TS_0] (rows=1 width=184)
+                        default@t1_n119,k,Tbl:COMPLETE,Col:NONE,Output:["key"]
 
 PREHOOK: query: explain select sum(hash(k.key)), sum(hash(v.val)) from T1_n119 k join T1_n119 v on k.key=v.key
 PREHOOK: type: QUERY
@@ -6295,35 +6293,33 @@ Stage-0
     limit:-1
     Stage-1
       Reducer 4 llap
-      File Output Operator [FS_16]
-        Group By Operator [GBY_14] (rows=1 width=16)
+      File Output Operator [FS_15]
+        Group By Operator [GBY_13] (rows=1 width=16)
           Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"]
         <-Reducer 3 [CUSTOM_SIMPLE_EDGE] llap
-          PARTITION_ONLY_SHUFFLE [RS_13]
-            Group By Operator [GBY_12] (rows=1 width=16)
+          PARTITION_ONLY_SHUFFLE [RS_12]
+            Group By Operator [GBY_11] (rows=1 width=16)
               Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"]
             <-Map 2 [CUSTOM_SIMPLE_EDGE] llap
-              PARTITION_ONLY_SHUFFLE [RS_11]
+              PARTITION_ONLY_SHUFFLE [RS_10]
                 PartitionCols:rand()
-                Select Operator [SEL_9] (rows=1 width=202)
-                  Output:["_col0","_col1"]
-                  Map Join Operator [MAPJOIN_31] (rows=1 width=202)
-                    Conds:RS_6._col0=SEL_5._col0(Inner),Output:["_col0","_col2"]
-                  <-Map 1 [BROADCAST_EDGE] llap
-                    BROADCAST [RS_6]
-                      PartitionCols:_col0
-                      Select Operator [SEL_2] (rows=1 width=184)
-                        Output:["_col0"]
-                        Filter Operator [FIL_19] (rows=1 width=184)
-                          predicate:key is not null
-                          TableScan [TS_0] (rows=1 width=184)
-                            default@t1_n119,k,Tbl:COMPLETE,Col:NONE,Output:["key"]
-                  <-Select Operator [SEL_5] (rows=1 width=368)
+                Map Join Operator [MAPJOIN_30] (rows=1 width=202)
+                  Conds:RS_6._col0=SEL_5._col0(Inner),Output:["_col1","_col3"]
+                <-Map 1 [BROADCAST_EDGE] llap
+                  BROADCAST [RS_6]
+                    PartitionCols:_col0
+                    Select Operator [SEL_2] (rows=1 width=184)
                       Output:["_col0","_col1"]
-                      Filter Operator [FIL_20] (rows=1 width=368)
+                      Filter Operator [FIL_18] (rows=1 width=184)
                         predicate:key is not null
-                        TableScan [TS_3] (rows=1 width=368)
-                          default@t1_n119,v,Tbl:COMPLETE,Col:NONE,Output:["key","val"]
+                        TableScan [TS_0] (rows=1 width=184)
+                          default@t1_n119,k,Tbl:COMPLETE,Col:NONE,Output:["key"]
+                <-Select Operator [SEL_5] (rows=1 width=368)
+                    Output:["_col0","_col1"]
+                    Filter Operator [FIL_19] (rows=1 width=368)
+                      predicate:key is not null
+                      TableScan [TS_3] (rows=1 width=368)
+                        default@t1_n119,v,Tbl:COMPLETE,Col:NONE,Output:["key","val"]
 
 PREHOOK: query: explain select count(1) from  T1_n119 a join T1_n119 b on a.key = b.key
 PREHOOK: type: QUERY
@@ -6408,16 +6404,16 @@ Stage-0
                 Select Operator [SEL_7] (rows=1 width=404)
                   Output:["_col0","_col1","_col2"]
                   Map Join Operator [MAPJOIN_22] (rows=1 width=404)
-                    Conds:SEL_1.UDFToDouble(_col0)=RS_5.(UDFToDouble(_col0) + 1.0D)(Left Outer),Output:["_col0","_col1","_col2"]
+                    Conds:SEL_1._col2=RS_5._col1(Left Outer),Output:["_col0","_col1","_col3"]
                   <-Map 4 [BROADCAST_EDGE] llap
                     BROADCAST [RS_5]
-                      PartitionCols:(UDFToDouble(_col0) + 1.0D)
+                      PartitionCols:_col1
                       Select Operator [SEL_3] (rows=1 width=184)
-                        Output:["_col0"]
+                        Output:["_col0","_col1"]
                         TableScan [TS_2] (rows=1 width=184)
                           default@t2_n70,c,Tbl:COMPLETE,Col:NONE,Output:["key"]
                   <-Select Operator [SEL_1] (rows=1 width=368)
-                      Output:["_col0","_col1"]
+                      Output:["_col0","_col1","_col2"]
                       TableScan [TS_0] (rows=1 width=368)
                         default@t1_n119,a,Tbl:COMPLETE,Col:NONE,Output:["key","val"]
 
@@ -6456,16 +6452,16 @@ Stage-0
                 Select Operator [SEL_7] (rows=1 width=404)
                   Output:["_col0","_col1","_col2"]
                   Map Join Operator [MAPJOIN_17] (rows=1 width=404)
-                    Conds:RS_4.UDFToDouble(_col0)=SEL_3.(UDFToDouble(_col0) + 1.0D)(Right Outer),Output:["_col0","_col1","_col2"]
+                    Conds:RS_4._col2=SEL_3._col1(Right Outer),Output:["_col0","_col1","_col3"]
                   <-Map 1 [BROADCAST_EDGE] llap
                     BROADCAST [RS_4]
-                      PartitionCols:UDFToDouble(_col0)
+                      PartitionCols:_col2
                       Select Operator [SEL_1] (rows=1 width=368)
-                        Output:["_col0","_col1"]
+                        Output:["_col0","_col1","_col2"]
                         TableScan [TS_0] (rows=1 width=368)
                           default@t1_n119,a,Tbl:COMPLETE,Col:NONE,Output:["key","val"]
                   <-Select Operator [SEL_3] (rows=1 width=184)
-                      Output:["_col0"]
+                      Output:["_col0","_col1"]
                       TableScan [TS_2] (rows=1 width=184)
                         default@t2_n70,c,Tbl:COMPLETE,Col:NONE,Output:["key"]
 
@@ -6504,19 +6500,19 @@ Stage-0
                 Select Operator [SEL_7] (rows=1 width=404)
                   Output:["_col0","_col1","_col2"]
                   Merge Join Operator [MERGEJOIN_15] (rows=1 width=404)
-                    Conds:RS_4.UDFToDouble(_col0)=RS_5.(UDFToDouble(_col0) + 1.0D)(Outer),Output:["_col0","_col1","_col2"]
+                    Conds:RS_4._col2=RS_5._col1(Outer),Output:["_col0","_col1","_col3"]
                   <-Map 1 [SIMPLE_EDGE] llap
                     SHUFFLE [RS_4]
-                      PartitionCols:UDFToDouble(_col0)
+                      PartitionCols:_col2
                       Select Operator [SEL_1] (rows=1 width=368)
-                        Output:["_col0","_col1"]
+                        Output:["_col0","_col1","_col2"]
                         TableScan [TS_0] (rows=1 width=368)
                           default@t1_n119,a,Tbl:COMPLETE,Col:NONE,Output:["key","val"]
                   <-Map 5 [SIMPLE_EDGE] llap
                     SHUFFLE [RS_5]
-                      PartitionCols:(UDFToDouble(_col0) + 1.0D)
+                      PartitionCols:_col1
                       Select Operator [SEL_3] (rows=1 width=184)
-                        Output:["_col0"]
+                        Output:["_col0","_col1"]
                         TableScan [TS_2] (rows=1 width=184)
                           default@t2_n70,c,Tbl:COMPLETE,Col:NONE,Output:["key"]
 
@@ -6553,16 +6549,16 @@ Stage-0
                 Select Operator [SEL_7] (rows=1 width=202)
                   Output:["_col0","_col1"]
                   Map Join Operator [MAPJOIN_17] (rows=1 width=202)
-                    Conds:SEL_1.(UDFToDouble(_col0) + 1.0D)=RS_5.UDFToDouble(_col0)(Left Outer),Output:["_col0","_col2"]
+                    Conds:SEL_1._col1=RS_5._col1(Left Outer),Output:["_col0","_col2"]
                   <-Map 4 [BROADCAST_EDGE] llap
                     BROADCAST [RS_5]
-                      PartitionCols:UDFToDouble(_col0)
+                      PartitionCols:_col1
                       Select Operator [SEL_3] (rows=1 width=368)
                         Output:["_col0","_col1"]
                         TableScan [TS_2] (rows=1 width=368)
                           default@t1_n119,v,Tbl:COMPLETE,Col:NONE,Output:["key","val"]
                   <-Select Operator [SEL_1] (rows=1 width=184)
-                      Output:["_col0"]
+                      Output:["_col0","_col1"]
                       TableScan [TS_0] (rows=1 width=184)
                         default@t1_n119,k,Tbl:COMPLETE,Col:NONE,Output:["key"]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/explainuser_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/explainuser_2.q.out b/ql/src/test/results/clientpositive/llap/explainuser_2.q.out
index fd89f4a..1dd9a0f 100644
--- a/ql/src/test/results/clientpositive/llap/explainuser_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/explainuser_2.q.out
@@ -209,7 +209,7 @@ Stage-0
           <-Map 5 [SIMPLE_EDGE] vectorized, llap
             SHUFFLE [RS_55]
               PartitionCols:_col0
-              Select Operator [SEL_54] (rows=500 width=369)
+              Select Operator [SEL_54] (rows=500 width=91)
                 Output:["_col0"]
                 Filter Operator [FIL_53] (rows=500 width=91)
                   predicate:value is not null
@@ -348,27 +348,27 @@ Stage-0
                 SHUFFLE [RS_49]
                   PartitionCols:_col0, _col1, _col2
                   Group By Operator [GBY_48] (rows=2 width=285)
-                    Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["count(_col11)","count(_col21)","count(_col3)"],keys:_col10, _col20, _col2
+                    Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["count(_col8)","count(_col15)","count(_col3)"],keys:_col7, _col14, _col2
                     Top N Key Operator [TNK_91] (rows=28 width=534)
-                      keys:_col10, _col20, _col2,sort order:+++,top n:100
+                      keys:_col7, _col14, _col2,sort order:+++,top n:100
                       Merge Join Operator [MERGEJOIN_188] (rows=28 width=534)
-                        Conds:RS_44._col1, _col3=RS_45._col15, _col17(Inner),Output:["_col2","_col3","_col10","_col11","_col20","_col21"]
+                        Conds:RS_44._col1, _col3=RS_45._col10, _col12(Inner),Output:["_col2","_col3","_col7","_col8","_col14","_col15"]
                       <-Reducer 10 [SIMPLE_EDGE] llap
                         SHUFFLE [RS_45]
-                          PartitionCols:_col15, _col17
+                          PartitionCols:_col10, _col12
                           Select Operator [SEL_40] (rows=2 width=447)
-                            Output:["_col4","_col5","_col14","_col15","_col17"]
+                            Output:["_col2","_col3","_col9","_col10","_col12"]
                             Merge Join Operator [MERGEJOIN_187] (rows=2 width=447)
-                              Conds:RS_37._col4, _col2=RS_38._col4, _col2(Inner),Output:["_col0","_col1","_col14","_col15","_col17"]
+                              Conds:RS_37._col2, _col4=RS_38._col1, _col3(Inner),Output:["_col0","_col1","_col9","_col10","_col12"]
                             <-Reducer 11 [SIMPLE_EDGE] llap
                               SHUFFLE [RS_38]
-                                PartitionCols:_col4, _col2
+                                PartitionCols:_col1, _col3
                                 Merge Join Operator [MERGEJOIN_186] (rows=5 width=356)
-                                  Conds:RS_212._col0=RS_200._col0(Inner),Output:["_col2","_col3","_col4","_col5"]
+                                  Conds:RS_212._col0=RS_200._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
                                 <-Map 6 [SIMPLE_EDGE] vectorized, llap
                                   SHUFFLE [RS_200]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_197] (rows=5 width=178)
+                                    Select Operator [SEL_197] (rows=5 width=87)
                                       Output:["_col0"]
                                       Filter Operator [FIL_194] (rows=5 width=178)
                                         predicate:((value) IN ('2000Q1', '2000Q2', '2000Q3') and key is not null)
@@ -377,22 +377,22 @@ Stage-0
                                 <-Map 15 [SIMPLE_EDGE] vectorized, llap
                                   SHUFFLE [RS_212]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_211] (rows=7 width=531)
-                                      Output:["_col0","_col2","_col3","_col4","_col5"]
+                                    Select Operator [SEL_211] (rows=7 width=443)
+                                      Output:["_col0","_col1","_col2","_col3","_col4"]
                                       Filter Operator [FIL_210] (rows=7 width=534)
                                         predicate:((v1 = 'srv1') and k1 is not null and k2 is not null and k3 is not null and v2 is not null and v3 is not null)
                                         TableScan [TS_18] (rows=85 width=534)
                                           default@sr,sr,Tbl:COMPLETE,Col:COMPLETE,Output:["k1","v1","k2","v2","k3","v3"]
                             <-Reducer 9 [SIMPLE_EDGE] llap
                               SHUFFLE [RS_37]
-                                PartitionCols:_col4, _col2
+                                PartitionCols:_col2, _col4
                                 Merge Join Operator [MERGEJOIN_185] (rows=2 width=352)
-                                  Conds:RS_34._col1=RS_209._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
+                                  Conds:RS_34._col1=RS_209._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
                                 <-Map 14 [SIMPLE_EDGE] vectorized, llap
                                   SHUFFLE [RS_209]
-                                    PartitionCols:_col1
-                                    Select Operator [SEL_208] (rows=2 width=180)
-                                      Output:["_col1"]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_208] (rows=2 width=89)
+                                      Output:["_col0"]
                                       Filter Operator [FIL_207] (rows=2 width=175)
                                         predicate:((key = 'src1key') and value is not null)
                                         TableScan [TS_15] (rows=25 width=175)
@@ -401,12 +401,12 @@ Stage-0
                                   SHUFFLE [RS_34]
                                     PartitionCols:_col1
                                     Merge Join Operator [MERGEJOIN_184] (rows=2 width=352)
-                                      Conds:RS_31._col3=RS_206._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
+                                      Conds:RS_31._col3=RS_206._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
                                     <-Map 13 [SIMPLE_EDGE] vectorized, llap
                                       SHUFFLE [RS_206]
-                                        PartitionCols:_col1
-                                        Select Operator [SEL_205] (rows=6 width=185)
-                                          Output:["_col1"]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_205] (rows=6 width=91)
+                                          Output:["_col0"]
                                           Filter Operator [FIL_204] (rows=6 width=178)
                                             predicate:((key = 'srcpartkey') and value is not null)
                                             TableScan [TS_12] (rows=2000 width=178)
@@ -419,7 +419,7 @@ Stage-0
                                         <-Map 6 [SIMPLE_EDGE] vectorized, llap
                                           SHUFFLE [RS_199]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_196] (rows=2 width=178)
+                                            Select Operator [SEL_196] (rows=2 width=87)
                                               Output:["_col0"]
                                               Filter Operator [FIL_193] (rows=2 width=178)
                                                 predicate:((value = 'd1value') and key is not null)
@@ -427,7 +427,7 @@ Stage-0
                                         <-Map 12 [SIMPLE_EDGE] vectorized, llap
                                           SHUFFLE [RS_203]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_202] (rows=7 width=531)
+                                            Select Operator [SEL_202] (rows=7 width=443)
                                               Output:["_col0","_col1","_col2","_col3","_col4"]
                                               Filter Operator [FIL_201] (rows=7 width=534)
                                                 predicate:((v3 = 'ssv3') and k1 is not null and k2 is not null and k3 is not null and v1 is not null and v2 is not null)
@@ -441,7 +441,7 @@ Stage-0
                           <-Map 6 [SIMPLE_EDGE] vectorized, llap
                             SHUFFLE [RS_198]
                               PartitionCols:_col0
-                              Select Operator [SEL_195] (rows=5 width=178)
+                              Select Operator [SEL_195] (rows=5 width=87)
                                 Output:["_col0"]
                                 Filter Operator [FIL_192] (rows=5 width=178)
                                   predicate:((value) IN ('2000Q1', '2000Q2', '2000Q3') and key is not null)
@@ -512,12 +512,12 @@ Stage-0
                 Select Operator [SEL_127] (rows=39 width=268)
                   Output:["_col0","_col1","_col2"]
                   Merge Join Operator [MERGEJOIN_126] (rows=39 width=268)
-                    Conds:RS_22._col3=RS_170._col1(Inner),Output:["_col1","_col2","_col5"]
+                    Conds:RS_22._col3=RS_170._col0(Inner),Output:["_col1","_col2","_col4"]
                   <-Reducer 11 [SIMPLE_EDGE] vectorized, llap
                     SHUFFLE [RS_170]
-                      PartitionCols:_col1
-                      Select Operator [SEL_169] (rows=262 width=178)
-                        Output:["_col1"]
+                      PartitionCols:_col0
+                      Select Operator [SEL_169] (rows=262 width=91)
+                        Output:["_col0"]
                         Group By Operator [GBY_168] (rows=262 width=178)
                           Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                         <-Union 10 [SIMPLE_EDGE]
@@ -574,12 +574,12 @@ Stage-0
                 Select Operator [SEL_132] (rows=39 width=268)
                   Output:["_col0","_col1","_col2"]
                   Merge Join Operator [MERGEJOIN_131] (rows=39 width=268)
-                    Conds:RS_48._col3=RS_175._col1(Inner),Output:["_col1","_col2","_col5"]
+                    Conds:RS_48._col3=RS_175._col0(Inner),Output:["_col1","_col2","_col4"]
                   <-Reducer 15 [SIMPLE_EDGE] vectorized, llap
                     SHUFFLE [RS_175]
-                      PartitionCols:_col1
-                      Select Operator [SEL_174] (rows=262 width=178)
-                        Output:["_col1"]
+                      PartitionCols:_col0
+                      Select Operator [SEL_174] (rows=262 width=91)
+                        Output:["_col0"]
                         Group By Operator [GBY_173] (rows=262 width=178)
                           Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                         <-Union 14 [SIMPLE_EDGE]
@@ -702,12 +702,12 @@ Stage-0
                         Select Operator [SEL_246] (rows=48 width=177)
                           Output:["_col0","_col1"]
                           Merge Join Operator [MERGEJOIN_245] (rows=48 width=177)
-                            Conds:RS_58._col3=RS_340._col1(Inner),Output:["_col1","_col2"]
+                            Conds:RS_58._col3=RS_340._col0(Inner),Output:["_col1","_col2"]
                           <-Reducer 20 [SIMPLE_EDGE] vectorized, llap
                             SHUFFLE [RS_340]
-                              PartitionCols:_col1
-                              Select Operator [SEL_339] (rows=381 width=178)
-                                Output:["_col1"]
+                              PartitionCols:_col0
+                              Select Operator [SEL_339] (rows=381 width=91)
+                                Output:["_col0"]
                                 Group By Operator [GBY_338] (rows=381 width=178)
                                   Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                 <-Union 19 [SIMPLE_EDGE]
@@ -785,7 +785,7 @@ Stage-0
                         Select Operator [SEL_232] (rows=39 width=177)
                           Output:["_col0","_col1"]
                           Merge Join Operator [MERGEJOIN_231] (rows=39 width=177)
-                            Conds:RS_22._col3=RS_329._col1(Inner),Output:["_col1","_col2"]
+                            Conds:RS_22._col3=RS_329._col0(Inner),Output:["_col1","_col2"]
                           <-Reducer 2 [SIMPLE_EDGE] llap
                             SHUFFLE [RS_22]
                               PartitionCols:_col3
@@ -801,9 +801,9 @@ Stage-0
                                    Please refer to the previous Select Operator [SEL_324]
                           <-Reducer 14 [SIMPLE_EDGE] vectorized, llap
                             SHUFFLE [RS_329]
-                              PartitionCols:_col1
-                              Select Operator [SEL_328] (rows=262 width=178)
-                                Output:["_col1"]
+                              PartitionCols:_col0
+                              Select Operator [SEL_328] (rows=262 width=91)
+                                Output:["_col0"]
                                 Group By Operator [GBY_327] (rows=262 width=178)
                                   Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                 <-Union 13 [SIMPLE_EDGE]
@@ -837,16 +837,16 @@ Stage-0
                 Select Operator [SEL_241] (rows=55 width=177)
                   Output:["_col0","_col1"]
                   Merge Join Operator [MERGEJOIN_240] (rows=55 width=177)
-                    Conds:RS_111._col3=RS_337._col1(Inner),Output:["_col1","_col2"]
+                    Conds:RS_111._col3=RS_337._col0(Inner),Output:["_col1","_col2"]
                   <-Reducer 2 [SIMPLE_EDGE] llap
                     SHUFFLE [RS_111]
                       PartitionCols:_col3
                        Please refer to the previous Merge Join Operator [MERGEJOIN_225]
                   <-Reducer 29 [SIMPLE_EDGE] vectorized, llap
                     SHUFFLE [RS_337]
-                      PartitionCols:_col1
-                      Select Operator [SEL_336] (rows=440 width=178)
-                        Output:["_col1"]
+                      PartitionCols:_col0
+                      Select Operator [SEL_336] (rows=440 width=91)
+                        Output:["_col0"]
                         Group By Operator [GBY_335] (rows=440 width=178)
                           Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                         <-Union 28 [SIMPLE_EDGE]
@@ -1083,11 +1083,11 @@ Stage-0
                 SHUFFLE [RS_229]
                   PartitionCols:_col0, _col1, _col2
                   Group By Operator [GBY_228] (rows=1464 width=10)
-                    Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["count(_col11)","count(_col21)","count(_col3)"],keys:_col10, _col20, _col2
+                    Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["count(_col8)","count(_col15)","count(_col3)"],keys:_col7, _col14, _col2
                     Top N Key Operator [TNK_227] (rows=1464 width=10)
-                      keys:_col10, _col20, _col2,sort order:+++,top n:100
+                      keys:_col7, _col14, _col2,sort order:+++,top n:100
                       Map Join Operator [MAPJOIN_226] (rows=1464 width=10)
-                        Conds:RS_209._col1, _col3=SEL_225._col15, _col17(Inner),Output:["_col2","_col3","_col10","_col11","_col20","_col21"]
+                        Conds:RS_209._col1, _col3=SEL_225._col10, _col12(Inner),Output:["_col2","_col3","_col7","_col8","_col14","_col15"]
                       <-Map 2 [BROADCAST_EDGE] vectorized, llap
                         BROADCAST [RS_209]
                           PartitionCols:_col1, _col3
@@ -1109,19 +1109,19 @@ Stage-0
                                 TableScan [TS_3] (rows=500 width=10)
                                   default@src,d3,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                       <-Select Operator [SEL_225] (rows=1331 width=10)
-                          Output:["_col4","_col5","_col14","_col15","_col17"]
+                          Output:["_col2","_col3","_col9","_col10","_col12"]
                           Map Join Operator [MAPJOIN_224] (rows=1331 width=10)
-                            Conds:MAPJOIN_223._col4, _col2=RS_219._col4, _col2(Inner),Output:["_col0","_col1","_col14","_col15","_col17"]
+                            Conds:MAPJOIN_223._col2, _col4=RS_219._col1, _col3(Inner),Output:["_col0","_col1","_col9","_col10","_col12"]
                           <-Map 10 [BROADCAST_EDGE] vectorized, llap
                             BROADCAST [RS_219]
-                              PartitionCols:_col4, _col2
+                              PartitionCols:_col1, _col3
                               Map Join Operator [MAPJOIN_218] (rows=550 width=10)
-                                Conds:RS_215._col0=SEL_217._col0(Inner),Output:["_col2","_col3","_col4","_col5"]
+                                Conds:RS_215._col0=SEL_217._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
                               <-Map 9 [BROADCAST_EDGE] vectorized, llap
                                 BROADCAST [RS_215]
                                   PartitionCols:_col0
                                   Select Operator [SEL_214] (rows=42 width=34)
-                                    Output:["_col0","_col2","_col3","_col4","_col5"]
+                                    Output:["_col0","_col1","_col2","_col3","_col4"]
                                     Filter Operator [FIL_213] (rows=42 width=34)
                                       predicate:((v1 = 'srv1') and k1 is not null and k2 is not null and k3 is not null and v2 is not null and v3 is not null)
                                       TableScan [TS_18] (rows=85 width=34)
@@ -1133,18 +1133,18 @@ Stage-0
                                     TableScan [TS_21] (rows=500 width=10)
                                       default@src,d2,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                           <-Map Join Operator [MAPJOIN_223] (rows=1210 width=10)
-                              Conds:MAPJOIN_222._col1=RS_212._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
+                              Conds:MAPJOIN_222._col1=RS_212._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
                             <-Map 8 [BROADCAST_EDGE] vectorized, llap
                               BROADCAST [RS_212]
-                                PartitionCols:_col1
+                                PartitionCols:_col0
                                 Select Operator [SEL_211] (rows=12 width=7)
-                                  Output:["_col1"]
+                                  Output:["_col0"]
                                   Filter Operator [FIL_210] (rows=12 width=7)
                                     predicate:((key = 'src1key') and value is not null)
                                     TableScan [TS_15] (rows=25 width=7)
                                       default@src1,src1,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                             <-Map Join Operator [MAPJOIN_222] (rows=1100 width=10)
-                                Conds:RS_202._col3=SEL_221._col1(Inner),Output:["_col0","_col1","_col2","_col4"]
+                                Conds:RS_202._col3=SEL_221._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
                               <-Map 4 [BROADCAST_EDGE] vectorized, llap
                                 BROADCAST [RS_202]
                                   PartitionCols:_col3
@@ -1166,7 +1166,7 @@ Stage-0
                                         TableScan [TS_9] (rows=500 width=10)
                                           default@src,d1,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                               <-Select Operator [SEL_221] (rows=1000 width=10)
-                                  Output:["_col1"]
+                                  Output:["_col0"]
                                   Filter Operator [FIL_220] (rows=1000 width=10)
                                     predicate:((key = 'srcpartkey') and value is not null)
                                     TableScan [TS_12] (rows=2000 width=10)
@@ -1226,7 +1226,7 @@ Stage-0
                 Select Operator [SEL_205] (rows=605 width=10)
                   Output:["_col0","_col1","_col2"]
                   Map Join Operator [MAPJOIN_204] (rows=605 width=10)
-                    Conds:RS_201._col3=SEL_203._col1(Inner),Output:["_col1","_col2","_col5"]
+                    Conds:RS_201._col3=SEL_203._col0(Inner),Output:["_col1","_col2","_col4"]
                   <-Map 9 [BROADCAST_EDGE] vectorized, llap
                     BROADCAST [RS_201]
                       PartitionCols:_col3
@@ -1248,7 +1248,7 @@ Stage-0
                             TableScan [TS_26] (rows=500 width=10)
                               default@src,y,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                   <-Select Operator [SEL_203] (rows=262 width=10)
-                      Output:["_col1"]
+                      Output:["_col0"]
                       Group By Operator [GBY_202] (rows=262 width=10)
                         Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                       <-Union 11 [SIMPLE_EDGE]
@@ -1282,7 +1282,7 @@ Stage-0
                 Select Operator [SEL_185] (rows=605 width=10)
                   Output:["_col0","_col1","_col2"]
                   Map Join Operator [MAPJOIN_184] (rows=605 width=10)
-                    Conds:RS_181._col3=SEL_183._col1(Inner),Output:["_col1","_col2","_col5"]
+                    Conds:RS_181._col3=SEL_183._col0(Inner),Output:["_col1","_col2","_col4"]
                   <-Map 1 [BROADCAST_EDGE] vectorized, llap
                     BROADCAST [RS_181]
                       PartitionCols:_col3
@@ -1299,7 +1299,7 @@ Stage-0
                             TableScan [TS_0] (rows=500 width=10)
                               default@src,y,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                   <-Select Operator [SEL_183] (rows=262 width=10)
-                      Output:["_col1"]
+                      Output:["_col0"]
                       Group By Operator [GBY_182] (rows=262 width=10)
                         Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                       <-Union 4 [SIMPLE_EDGE]
@@ -1398,7 +1398,7 @@ Stage-0
                 Select Operator [SEL_402] (rows=605 width=10)
                   Output:["_col0","_col1"]
                   Map Join Operator [MAPJOIN_401] (rows=605 width=10)
-                    Conds:RS_345._col3=SEL_400._col1(Inner),Output:["_col1","_col2"]
+                    Conds:RS_345._col3=SEL_400._col0(Inner),Output:["_col1","_col2"]
                   <-Map 1 [BROADCAST_EDGE] vectorized, llap
                     BROADCAST [RS_345]
                       PartitionCols:_col3
@@ -1420,7 +1420,7 @@ Stage-0
                             TableScan [TS_0] (rows=500 width=10)
                               default@src,y,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                   <-Select Operator [SEL_400] (rows=440 width=10)
-                      Output:["_col1"]
+                      Output:["_col0"]
                       Group By Operator [GBY_399] (rows=440 width=10)
                         Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                       <-Union 24 [SIMPLE_EDGE]
@@ -1504,7 +1504,7 @@ Stage-0
                         Select Operator [SEL_376] (rows=605 width=10)
                           Output:["_col0","_col1"]
                           Map Join Operator [MAPJOIN_375] (rows=605 width=10)
-                            Conds:RS_372._col3=SEL_374._col1(Inner),Output:["_col1","_col2"]
+                            Conds:RS_372._col3=SEL_374._col0(Inner),Output:["_col1","_col2"]
                           <-Map 11 [BROADCAST_EDGE] vectorized, llap
                             BROADCAST [RS_372]
                               PartitionCols:_col3
@@ -1521,7 +1521,7 @@ Stage-0
                                     TableScan [TS_26] (rows=500 width=10)
                                       default@src,y,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                           <-Select Operator [SEL_374] (rows=381 width=10)
-                              Output:["_col1"]
+                              Output:["_col0"]
                               Group By Operator [GBY_373] (rows=381 width=10)
                                 Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                               <-Union 15 [SIMPLE_EDGE]
@@ -1576,13 +1576,13 @@ Stage-0
                         Select Operator [SEL_349] (rows=605 width=10)
                           Output:["_col0","_col1"]
                           Map Join Operator [MAPJOIN_348] (rows=605 width=10)
-                            Conds:RS_344._col3=SEL_347._col1(Inner),Output:["_col1","_col2"]
+                            Conds:RS_344._col3=SEL_347._col0(Inner),Output:["_col1","_col2"]
                           <-Map 1 [BROADCAST_EDGE] vectorized, llap
                             BROADCAST [RS_344]
                               PartitionCols:_col3
                                Please refer to the previous Map Join Operator [MAPJOIN_343]
                           <-Select Operator [SEL_347] (rows=262 width=10)
-                              Output:["_col1"]
+                              Output:["_col0"]
                               Group By Operator [GBY_346] (rows=262 width=10)
                                 Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                               <-Union 4 [SIMPLE_EDGE]
@@ -2406,7 +2406,7 @@ Stage-0
                 Select Operator [SEL_393] (rows=484 width=10)
                   Output:["_col0","_col1"]
                   Map Join Operator [MAPJOIN_392] (rows=484 width=10)
-                    Conds:RS_332._col1=SEL_391._col1(Inner),Output:["_col0","_col3"]
+                    Conds:RS_332._col1=SEL_391._col0(Inner),Output:["_col0","_col3"]
                   <-Map 9 [BROADCAST_EDGE] vectorized, llap
                     BROADCAST [RS_332]
                       PartitionCols:_col1
@@ -2428,7 +2428,7 @@ Stage-0
                             TableScan [TS_3] (rows=25 width=7)
                               default@src1,x,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                   <-Select Operator [SEL_391] (rows=440 width=10)
-                      Output:["_col1"]
+                      Output:["_col0"]
                       Group By Operator [GBY_390] (rows=440 width=10)
                         Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                       <-Union 28 [SIMPLE_EDGE]
@@ -2512,7 +2512,7 @@ Stage-0
                         Select Operator [SEL_235] (rows=605 width=10)
                           Output:["_col0","_col1"]
                           Merge Join Operator [MERGEJOIN_234] (rows=605 width=10)
-                            Conds:RS_339._col3=RS_342._col1(Inner),Output:["_col1","_col2"]
+                            Conds:RS_339._col3=RS_342._col0(Inner),Output:["_col1","_col2"]
                           <-Map 1 [SIMPLE_EDGE] vectorized, llap
                             SHUFFLE [RS_339]
                               PartitionCols:_col3
@@ -2530,9 +2530,9 @@ Stage-0
                                       default@src,y,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                           <-Reducer 12 [SIMPLE_EDGE] vectorized, llap
                             SHUFFLE [RS_342]
-                              PartitionCols:_col1
+                              PartitionCols:_col0
                               Select Operator [SEL_341] (rows=262 width=10)
-                                Output:["_col1"]
+                                Output:["_col0"]
                                 Group By Operator [GBY_340] (rows=262 width=10)
                                   Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                 <-Union 11 [SIMPLE_EDGE]
@@ -2566,12 +2566,12 @@ Stage-0
                         Select Operator [SEL_244] (rows=605 width=10)
                           Output:["_col0","_col1"]
                           Merge Join Operator [MERGEJOIN_243] (rows=605 width=10)
-                            Conds:RS_58._col1=RS_353._col1(Inner),Output:["_col0","_col3"]
+                            Conds:RS_58._col1=RS_353._col0(Inner),Output:["_col0","_col3"]
                           <-Reducer 19 [SIMPLE_EDGE] vectorized, llap
                             SHUFFLE [RS_353]
-                              PartitionCols:_col1
+                              PartitionCols:_col0
                               Select Operator [SEL_352] (rows=381 width=10)
-                                Output:["_col1"]
+                                Output:["_col0"]
                                 Group By Operator [GBY_351] (rows=381 width=10)
                                   Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                 <-Union 18 [SIMPLE_EDGE]
@@ -3196,7 +3196,7 @@ Stage-5
                                 Select Operator [SEL_424] (rows=484 width=10)
                                   Output:["_col0","_col1"]
                                   Map Join Operator [MAPJOIN_423] (rows=484 width=10)
-                                    Conds:RS_358._col1=SEL_422._col1(Inner),Output:["_col0","_col3"]
+                                    Conds:RS_358._col1=SEL_422._col0(Inner),Output:["_col0","_col3"]
                                   <-Map 12 [BROADCAST_EDGE] vectorized, llap
                                     BROADCAST [RS_358]
                                       PartitionCols:_col1
@@ -3218,7 +3218,7 @@ Stage-5
                                             TableScan [TS_3] (rows=25 width=7)
                                               default@src1,x,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                                   <-Select Operator [SEL_422] (rows=440 width=10)
-                                      Output:["_col1"]
+                                      Output:["_col0"]
                                       Group By Operator [GBY_421] (rows=440 width=10)
                                         Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                       <-Union 31 [SIMPLE_EDGE]
@@ -3302,7 +3302,7 @@ Stage-5
                                         Select Operator [SEL_270] (rows=605 width=10)
                                           Output:["_col0","_col1"]
                                           Merge Join Operator [MERGEJOIN_269] (rows=605 width=10)
-                                            Conds:RS_58._col1=RS_384._col1(Inner),Output:["_col0","_col3"]
+                                            Conds:RS_58._col1=RS_384._col0(Inner),Output:["_col0","_col3"]
                                           <-Reducer 10 [SIMPLE_EDGE] llap
                                             SHUFFLE [RS_58]
                                               PartitionCols:_col1
@@ -3328,9 +3328,9 @@ Stage-5
                                                         default@src,y,Tbl:COMPLETE,Col:NONE,Output:["key","value"]
                                           <-Reducer 22 [SIMPLE_EDGE] vectorized, llap
                                             SHUFFLE [RS_384]
-                                              PartitionCols:_col1
+                                              PartitionCols:_col0
                                               Select Operator [SEL_383] (rows=381 width=10)
-                                                Output:["_col1"]
+                                                Output:["_col0"]
                                                 Group By Operator [GBY_382] (rows=381 width=10)
                                                   Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                                 <-Union 21 [SIMPLE_EDGE]
@@ -3385,7 +3385,7 @@ Stage-5
                                         Select Operator [SEL_261] (rows=605 width=10)
                                           Output:["_col0","_col1"]
                                           Merge Join Operator [MERGEJOIN_260] (rows=605 width=10)
-                                            Conds:RS_365._col3=RS_368._col1(Inner),Output:["_col1","_col2"]
+                                            Conds:RS_365._col3=RS_368._col0(Inner),Output:["_col1","_col2"]
                                           <-Map 1 [SIMPLE_EDGE] vectorized, llap
                                             SHUFFLE [RS_365]
                                               PartitionCols:_col3
@@ -3402,9 +3402,9 @@ Stage-5
                                                      Please refer to the previous TableScan [TS_0]
                                           <-Reducer 15 [SIMPLE_EDGE] vectorized, llap
                                             SHUFFLE [RS_368]
-                                              PartitionCols:_col1
+                                              PartitionCols:_col0
                                               Select Operator [SEL_367] (rows=262 width=10)
-                                                Output:["_col1"]
+                                                Output:["_col0"]
                                                 Group By Operator [GBY_366] (rows=262 width=10)
                                                   Output:["_col0","_col1"],keys:KEY._col0, KEY._col1
                                                 <-Union 14 [SIMPLE_EDGE]

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/explainuser_4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/explainuser_4.q.out b/ql/src/test/results/clientpositive/llap/explainuser_4.q.out
index bf20c3d..8de8379 100644
--- a/ql/src/test/results/clientpositive/llap/explainuser_4.q.out
+++ b/ql/src/test/results/clientpositive/llap/explainuser_4.q.out
@@ -133,7 +133,7 @@ Stage-0
               <-Map 4 [SIMPLE_EDGE] vectorized, llap
                 SHUFFLE [RS_35]
                   PartitionCols:_col0
-                  Select Operator [SEL_34] (rows=1019 width=8)
+                  Select Operator [SEL_34] (rows=1019 width=2)
                     Output:["_col0"]
                     Filter Operator [FIL_33] (rows=1019 width=8)
                       predicate:(cbigint is not null and cint BETWEEN 1000000 AND 3000000)
@@ -217,7 +217,7 @@ Stage-0
                   <-Map 5 [SIMPLE_EDGE] vectorized, llap
                     SHUFFLE [RS_37]
                       PartitionCols:_col0
-                      Select Operator [SEL_36] (rows=1019 width=8)
+                      Select Operator [SEL_36] (rows=1019 width=2)
                         Output:["_col0"]
                         Filter Operator [FIL_35] (rows=1019 width=8)
                           predicate:(cbigint is not null and cint BETWEEN 1000000 AND 3000000)
@@ -526,18 +526,20 @@ Stage-0
     Stage-1
       Reducer 2 llap
       File Output Operator [FS_8]
-        Merge Join Operator [MERGEJOIN_9] (rows=150994944 width=474)
-          Conds:(Left Outer),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col20","_col21","_col22","_col23"],residual filter predicates:{((_col2 = _col14) or UDFToInteger(_col1) BETWEEN 1 AND 10)}
-        <-Map 1 [CUSTOM_SIMPLE_EDGE] vectorized, llap
-          PARTITION_ONLY_SHUFFLE [RS_11]
-            Select Operator [SEL_10] (rows=12288 width=236)
-              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
-              TableScan [TS_0] (rows=12288 width=236)
-                default@alltypesorc,a,Tbl:COMPLETE,Col:NONE,Output:["ctinyint","csmallint","cint","cbigint","cfloat","cdouble","cstring1","cstring2","ctimestamp1","ctimestamp2","cboolean1","cboolean2"]
-        <-Map 3 [CUSTOM_SIMPLE_EDGE] vectorized, llap
-          PARTITION_ONLY_SHUFFLE [RS_13]
-            Select Operator [SEL_12] (rows=12288 width=236)
-              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
-              TableScan [TS_2] (rows=12288 width=236)
-                default@alltypesorc,b,Tbl:COMPLETE,Col:NONE,Output:["ctinyint","csmallint","cint","cbigint","cfloat","cdouble","cstring1","cstring2","ctimestamp1","ctimestamp2","cboolean1","cboolean2"]
+        Select Operator [SEL_7] (rows=150994944 width=474)
+          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col20","_col21","_col22","_col23"]
+          Merge Join Operator [MERGEJOIN_9] (rows=150994944 width=474)
+            Conds:(Left Outer),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col20","_col21","_col22","_col23","_col24"],residual filter predicates:{((_col2 = _col15) or _col12)}
+          <-Map 1 [CUSTOM_SIMPLE_EDGE] vectorized, llap
+            PARTITION_ONLY_SHUFFLE [RS_11]
+              Select Operator [SEL_10] (rows=12288 width=236)
+                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12"]
+                TableScan [TS_0] (rows=12288 width=236)
+                  default@alltypesorc,a,Tbl:COMPLETE,Col:NONE,Output:["ctinyint","csmallint","cint","cbigint","cfloat","cdouble","cstring1","cstring2","ctimestamp1","ctimestamp2","cboolean1","cboolean2"]
+          <-Map 3 [CUSTOM_SIMPLE_EDGE] vectorized, llap
+            PARTITION_ONLY_SHUFFLE [RS_13]
+              Select Operator [SEL_12] (rows=12288 width=236)
+                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                TableScan [TS_2] (rows=12288 width=236)
+                  default@alltypesorc,b,Tbl:COMPLETE,Col:NONE,Output:["ctinyint","csmallint","cint","cbigint","cfloat","cdouble","cstring1","cstring2","ctimestamp1","ctimestamp2","cboolean1","cboolean2"]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/external_jdbc_table.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/external_jdbc_table.q.out b/ql/src/test/results/clientpositive/llap/external_jdbc_table.q.out
index 1bb41dd..8db779c 100644
--- a/ql/src/test/results/clientpositive/llap/external_jdbc_table.q.out
+++ b/ql/src/test/results/clientpositive/llap/external_jdbc_table.q.out
@@ -381,13 +381,13 @@ STAGE PLANS:
         TableScan
           alias: ext_simple_derby_table1
           properties:
-            hive.sql.query SELECT "t"."fkey", "t0"."dkey"
-FROM (SELECT *
+            hive.sql.query SELECT "t0"."fkey", "t2"."dkey"
+FROM (SELECT "ikey", "fkey"
 FROM "SIMPLE_DERBY_TABLE1"
-WHERE "ikey" IS NOT NULL) AS "t"
-INNER JOIN (SELECT *
+WHERE "ikey" IS NOT NULL) AS "t0"
+INNER JOIN (SELECT "ikey", "dkey"
 FROM "SIMPLE_DERBY_TABLE2"
-WHERE "ikey" IS NOT NULL) AS "t0" ON "t"."ikey" = "t0"."ikey"
+WHERE "ikey" IS NOT NULL) AS "t2" ON "t0"."ikey" = "t2"."ikey"
             hive.sql.query.fieldNames fkey,dkey
             hive.sql.query.fieldTypes float,double
             hive.sql.query.split false
@@ -460,11 +460,11 @@ STAGE PLANS:
                 TableScan
                   alias: ext_simple_derby_table2
                   properties:
-                    hive.sql.query SELECT "ikey", "bkey", "fkey", "dkey"
+                    hive.sql.query SELECT "ikey", "dkey"
 FROM "SIMPLE_DERBY_TABLE2"
 WHERE "ikey" IS NOT NULL
-                    hive.sql.query.fieldNames ikey,bkey,fkey,dkey
-                    hive.sql.query.fieldTypes int,bigint,float,double
+                    hive.sql.query.fieldNames ikey,dkey
+                    hive.sql.query.fieldTypes int,double
                     hive.sql.query.split true
                   Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
@@ -484,10 +484,10 @@ WHERE "ikey" IS NOT NULL
                 keys:
                   0 _col0 (type: int)
                   1 ikey (type: int)
-                outputColumnNames: _col1, _col5
+                outputColumnNames: _col1, _col3
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col1 (type: float), _col5 (type: double)
+                  expressions: _col1 (type: float), _col3 (type: double)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/filter_join_breaktask.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/filter_join_breaktask.q.out b/ql/src/test/results/clientpositive/llap/filter_join_breaktask.q.out
index c8afea6..78ef416 100644
--- a/ql/src/test/results/clientpositive/llap/filter_join_breaktask.q.out
+++ b/ql/src/test/results/clientpositive/llap/filter_join_breaktask.q.out
@@ -35,13 +35,13 @@ POSTHOOK: Input: default@filter_join_breaktask
 POSTHOOK: Input: default@filter_join_breaktask@ds=2008-04-08
 #### A masked pattern was here ####
 OPTIMIZED SQL: SELECT `t2`.`key`, `t0`.`value`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM (SELECT `value`
 FROM `default`.`filter_join_breaktask`
 WHERE `ds` = '2008-04-08' AND `value` <> '') AS `t0`
-INNER JOIN ((SELECT `key`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN ((SELECT `key`
 FROM `default`.`filter_join_breaktask`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`filter_join_breaktask`
 WHERE `ds` = '2008-04-08' AND `value` <> '' AND `key` IS NOT NULL) AS `t4` ON `t2`.`key` = `t4`.`key`) ON `t0`.`value` = `t4`.`value`
 STAGE DEPENDENCIES:
@@ -71,13 +71,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 15 Data size: 1450 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 15 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 15 Data size: 1450 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 15 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                         tag: 0
                         auto parallelism: true
             Execution mode: vectorized, llap
@@ -149,13 +149,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 15 Data size: 2785 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 15 Data size: 1375 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 15 Data size: 2785 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 15 Data size: 1375 Basic stats: COMPLETE Column stats: COMPLETE
                         tag: 1
                         value expressions: _col1 (type: string)
                         auto parallelism: true
@@ -228,13 +228,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: value (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 25 Data size: 4575 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 25 Data size: 2225 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 25 Data size: 4575 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 25 Data size: 2225 Basic stats: COMPLETE Column stats: COMPLETE
                         tag: 1
                         auto parallelism: true
             Execution mode: vectorized, llap
@@ -302,14 +302,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col3
+                outputColumnNames: _col0, _col2
                 Position of Big Table: 1
                 Statistics: Num rows: 15 Data size: 1375 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
-                  key expressions: _col3 (type: string)
+                  key expressions: _col2 (type: string)
                   null sort order: a
                   sort order: +
-                  Map-reduce partition columns: _col3 (type: string)
+                  Map-reduce partition columns: _col2 (type: string)
                   Statistics: Num rows: 15 Data size: 1375 Basic stats: COMPLETE Column stats: COMPLETE
                   tag: 0
                   value expressions: _col0 (type: int)
@@ -322,13 +322,13 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col3 (type: string)
+                  0 _col2 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col5
+                outputColumnNames: _col0, _col3
                 Position of Big Table: 1
                 Statistics: Num rows: 19 Data size: 1747 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), _col5 (type: string)
+                  expressions: _col0 (type: int), _col3 (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 19 Data size: 1747 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/hybridgrace_hashjoin_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/hybridgrace_hashjoin_1.q.out b/ql/src/test/results/clientpositive/llap/hybridgrace_hashjoin_1.q.out
index 7a603e4..4247205 100644
--- a/ql/src/test/results/clientpositive/llap/hybridgrace_hashjoin_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/hybridgrace_hashjoin_1.q.out
@@ -1410,10 +1410,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 25 Data size: 5535 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: 6981 (type: int), 6981 (type: int), _col0 (type: decimal(20,10)), _col2 (type: decimal(23,14))
+                  expressions: 6981 (type: int), 6981 (type: int), _col0 (type: decimal(20,10)), _col1 (type: decimal(23,14))
                   outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 25 Data size: 5535 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
@@ -1619,10 +1619,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 25 Data size: 5535 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: 6981 (type: int), 6981 (type: int), _col0 (type: decimal(20,10)), _col2 (type: decimal(23,14))
+                  expressions: 6981 (type: int), 6981 (type: int), _col0 (type: decimal(20,10)), _col1 (type: decimal(23,14))
                   outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 25 Data size: 5535 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/join32_lessSize.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/join32_lessSize.q.out b/ql/src/test/results/clientpositive/llap/join32_lessSize.q.out
index 16274f3..3bd60fd 100644
--- a/ql/src/test/results/clientpositive/llap/join32_lessSize.q.out
+++ b/ql/src/test/results/clientpositive/llap/join32_lessSize.q.out
@@ -37,7 +37,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j1_n21
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`
@@ -246,7 +246,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: value (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 184500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 45500 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
@@ -1205,7 +1205,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j2_n1
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t4`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`
@@ -1414,7 +1414,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: value (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 184500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 45500 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
@@ -1749,7 +1749,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j2_n1
 OPTIMIZED SQL: SELECT `t2`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`
@@ -1939,7 +1939,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: value (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 184500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 45500 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
@@ -2387,7 +2387,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: value (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 184500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 45500 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
@@ -2680,7 +2680,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: value (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 184500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 45500 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1


[41/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/join46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/join46.q.out b/ql/src/test/results/clientpositive/llap/join46.q.out
index fcd0d83..ec58429 100644
--- a/ql/src/test/results/clientpositive/llap/join46.q.out
+++ b/ql/src/test/results/clientpositive/llap/join46.q.out
@@ -187,15 +187,15 @@ STAGE PLANS:
                   alias: test1_n2
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
-                      Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -226,20 +226,24 @@ STAGE PLANS:
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {VALUE._col0 BETWEEN 100 AND 102}
+                  0 {VALUE._col2}
                   1 
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 8 Data size: 1049 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 8 Data size: 1049 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 8 Data size: 1049 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -308,13 +312,13 @@ STAGE PLANS:
                   alias: test1_n2
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -343,20 +347,24 @@ STAGE PLANS:
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {VALUE._col0 BETWEEN 100 AND 102}
+                  0 {VALUE._col3}
                   1 
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 6 Data size: 1142 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 6 Data size: 1142 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 6 Data size: 1142 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -529,13 +537,13 @@ STAGE PLANS:
                   alias: test1_n2
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -560,20 +568,24 @@ STAGE PLANS:
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {VALUE._col0 BETWEEN 100 AND 102}
+                  0 {VALUE._col3}
                   1 
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -647,13 +659,13 @@ STAGE PLANS:
                   alias: test1_n2
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -680,16 +692,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col5) or _col3 or _col4 BETWEEN 100 AND 102)}
+                Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -766,13 +782,13 @@ STAGE PLANS:
                   alias: test1_n2
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -799,16 +815,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102)}
-                Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col5) or _col3)}
+                Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -996,15 +1016,15 @@ STAGE PLANS:
                   alias: test1_n2
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
-                      Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -1033,16 +1053,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
+                Statistics: Num rows: 11 Data size: 1947 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1245,13 +1269,13 @@ STAGE PLANS:
                   alias: test2_n0
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1263,16 +1287,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col6)}
+                Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1478,13 +1506,13 @@ STAGE PLANS:
                   alias: test2_n0
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1496,16 +1524,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {((_col1 = _col4) or _col3 BETWEEN 100 AND 102)}
-                Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {((_col1 = _col4) or _col6)}
+                Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -1595,15 +1627,15 @@ STAGE PLANS:
                   alias: test2_n0
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
-                      Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1615,16 +1647,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
+                Statistics: Num rows: 10 Data size: 1850 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -2126,7 +2162,7 @@ NULL	NULL	None	NULL	NULL	NULL
 101	2	Car	102	2	Del
 101	2	Car	103	2	Ema
 NULL	NULL	NULL	104	3	Fli
-Warning: Shuffle Join MERGEJOIN[36][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
+Warning: Shuffle Join MERGEJOIN[37][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 3' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM (
@@ -2203,15 +2239,15 @@ STAGE PLANS:
                       Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col0 (type: int), _col2 (type: string)
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
-                      Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -2220,15 +2256,15 @@ STAGE PLANS:
                   alias: test2_n0
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
-                      Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
                   Select Operator
                     expressions: key (type: int), value (type: int), col_2 (type: string)
                     outputColumnNames: _col0, _col1, _col2
@@ -2250,13 +2286,17 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  sort order: 
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
+                Statistics: Num rows: 10 Data size: 1850 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -2285,13 +2325,17 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  sort order: 
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
+                residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
+                Statistics: Num rows: 11 Data size: 1947 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
 
   Stage: Stage-0
     Fetch Operator
@@ -2299,7 +2343,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join MERGEJOIN[36][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
+Warning: Shuffle Join MERGEJOIN[37][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 3' is a cross product
 PREHOOK: query: SELECT *
 FROM (
   SELECT test1_n2.key AS key1, test1_n2.value AS value1, test1_n2.col_1 AS col_1,

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/join_emit_interval.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/join_emit_interval.q.out b/ql/src/test/results/clientpositive/llap/join_emit_interval.q.out
index fd98f5c..05424ad 100644
--- a/ql/src/test/results/clientpositive/llap/join_emit_interval.q.out
+++ b/ql/src/test/results/clientpositive/llap/join_emit_interval.q.out
@@ -74,15 +74,15 @@ STAGE PLANS:
                   alias: test1_n7
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
-                      Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -109,20 +109,24 @@ STAGE PLANS:
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {VALUE._col0 BETWEEN 100 AND 102}
+                  0 {VALUE._col2}
                   1 
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -186,13 +190,13 @@ STAGE PLANS:
                   alias: test1_n7
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string)
+                      Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -217,20 +221,24 @@ STAGE PLANS:
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {VALUE._col0 BETWEEN 100 AND 102}
+                  0 {VALUE._col3}
                   1 
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                 Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/lineage3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/lineage3.q.out b/ql/src/test/results/clientpositive/llap/lineage3.q.out
index 22d1cdb..bfd82cd 100644
--- a/ql/src/test/results/clientpositive/llap/lineage3.q.out
+++ b/ql/src/test/results/clientpositive/llap/lineage3.q.out
@@ -86,7 +86,7 @@ order by a.ctinyint, a.cint
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-{"version":"1.0","engine":"tez","database":"default","hash":"5e30ab16eecf1f308b78f727a59292c7","queryText":"select a.ctinyint, a.cint, count(a.cdouble)\n  over(partition by a.ctinyint order by a.cint desc\n    rows between 1 preceding and 1 following)\nfrom alltypesorc a inner join alltypesorc b on a.cint = b.cbigint\norder by a.ctinyint, a.cint","edges":[{"sources":[3],"targets":[0],"edgeType":"PROJECTION"},{"sources":[4],"targets":[1],"edgeType":"PROJECTION"},{"sources":[3,4,5,6],"targets":[2],"expression":"(tok_function count (. (tok_table_or_col $hdt$_0) cdouble) (tok_windowspec (tok_partitioningspec (tok_distributeby (. (tok_table_or_col $hdt$_0) ctinyint)) (tok_orderby (tok_tabsortcolnamedesc (tok_nulls_last (. (tok_table_or_col $hdt$_0) cint))))) (tok_windowrange (preceding 1) (following 1))))","edgeType":"PROJECTION"},{"sources":[4],"targets":[0,1,2],"expression":"a.cint is not null","edgeType":"PREDICATE"},{"sources":[4,6],"targets":[0,1,2],"expression":"(UDFToLong(a.cint) 
 = b.cbigint)","edgeType":"PREDICATE"},{"sources":[6],"targets":[0,1,2],"expression":"b.cbigint is not null","edgeType":"PREDICATE"}],"vertices":[{"id":0,"vertexType":"COLUMN","vertexId":"a.ctinyint"},{"id":1,"vertexType":"COLUMN","vertexId":"a.cint"},{"id":2,"vertexType":"COLUMN","vertexId":"count_window_0"},{"id":3,"vertexType":"COLUMN","vertexId":"default.alltypesorc.ctinyint"},{"id":4,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cint"},{"id":5,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cdouble"},{"id":6,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cbigint"}]}
+{"version":"1.0","engine":"tez","database":"default","hash":"5e30ab16eecf1f308b78f727a59292c7","queryText":"select a.ctinyint, a.cint, count(a.cdouble)\n  over(partition by a.ctinyint order by a.cint desc\n    rows between 1 preceding and 1 following)\nfrom alltypesorc a inner join alltypesorc b on a.cint = b.cbigint\norder by a.ctinyint, a.cint","edges":[{"sources":[3],"targets":[0],"edgeType":"PROJECTION"},{"sources":[4],"targets":[1],"edgeType":"PROJECTION"},{"sources":[3,4,5,6],"targets":[2],"expression":"(tok_function count (. (tok_table_or_col $hdt$_0) cdouble) (tok_windowspec (tok_partitioningspec (tok_distributeby (. (tok_table_or_col $hdt$_0) ctinyint)) (tok_orderby (tok_tabsortcolnamedesc (tok_nulls_last (. (tok_table_or_col $hdt$_0) cint))))) (tok_windowrange (preceding 1) (following 1))))","edgeType":"PROJECTION"},{"sources":[4],"targets":[0,1,2],"expression":"a.cint is not null","edgeType":"PREDICATE"},{"sources":[4],"targets":[0,1,2],"expression":"UDFToLong(a.cint) is 
 not null","edgeType":"PREDICATE"},{"sources":[4,6],"targets":[0,1,2],"expression":"(UDFToLong(a.cint) = b.cbigint)","edgeType":"PREDICATE"},{"sources":[6],"targets":[0,1,2],"expression":"b.cbigint is not null","edgeType":"PREDICATE"}],"vertices":[{"id":0,"vertexType":"COLUMN","vertexId":"a.ctinyint"},{"id":1,"vertexType":"COLUMN","vertexId":"a.cint"},{"id":2,"vertexType":"COLUMN","vertexId":"count_window_0"},{"id":3,"vertexType":"COLUMN","vertexId":"default.alltypesorc.ctinyint"},{"id":4,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cint"},{"id":5,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cdouble"},{"id":6,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cbigint"}]}
 PREHOOK: query: with v2 as
   (select cdouble, count(cint) over() a,
     sum(cint + cbigint) over(partition by cboolean1) b
@@ -297,7 +297,7 @@ PREHOOK: type: CREATEVIEW
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Output: database:default
 PREHOOK: Output: default@dest_v3
-{"version":"1.0","engine":"tez","database":"default","hash":"9848a9a38a4f6f031dc669e7e495f9ee","queryText":"create view dest_v3 (a1, a2, a3, a4, a5, a6, a7) as\n  select x.csmallint, x.cbigint bint1, x.ctinyint, c.cbigint bint2, x.cint, x.cfloat, c.cstring1\n  from alltypesorc c\n  join (\n     select a.csmallint csmallint, a.ctinyint ctinyint, a.cstring2 cstring2,\n           a.cint cint, a.cstring1 ctring1, b.cfloat cfloat, b.cbigint cbigint\n     from ( select * from alltypesorc a where cboolean1=true ) a\n     join alltypesorc b on (a.csmallint = b.cint)\n   ) x on (x.ctinyint = c.cbigint)\n  where x.csmallint=11\n  and x.cint > 899\n  and x.cfloat > 4.5\n  and c.cstring1 < '7'\n  and x.cint + x.cfloat + length(c.cstring1) < 1000","edges":[{"sources":[],"targets":[0],"expression":"11S","edgeType":"PROJECTION"},{"sources":[7],"targets":[1,2],"edgeType":"PROJECTION"},{"sources":[8],"targets":[3],"edgeType":"PROJECTION"},{"sources":[9],"targets":[4],"edgeType":"PROJECTION"},{"sourc
 es":[10],"targets":[5],"edgeType":"PROJECTION"},{"sources":[11],"targets":[6],"edgeType":"PROJECTION"},{"sources":[11,7],"targets":[0,1,3,2,4,5,6],"expression":"((c.cstring1 < '7') and c.cbigint is not null)","edgeType":"PREDICATE"},{"sources":[7,8],"targets":[0,1,3,2,4,5,6],"expression":"(c.cbigint = UDFToLong(a.ctinyint))","edgeType":"PREDICATE"},{"sources":[10,9],"targets":[0,1,3,2,4,5,6],"expression":"((b.cfloat > 4.5) and (b.cint = 11))","edgeType":"PREDICATE"},{"sources":[12,13,9,8],"targets":[0,1,3,2,4,5,6],"expression":"(a.cboolean1 and (a.csmallint = 11S) and (a.cint > 899) and a.ctinyint is not null)","edgeType":"PREDICATE"}],"vertices":[{"id":0,"vertexType":"COLUMN","vertexId":"default.dest_v3.csmallint"},{"id":1,"vertexType":"COLUMN","vertexId":"default.dest_v3.bint1"},{"id":2,"vertexType":"COLUMN","vertexId":"default.dest_v3.bint2"},{"id":3,"vertexType":"COLUMN","vertexId":"default.dest_v3.ctinyint"},{"id":4,"vertexType":"COLUMN","vertexId":"default.dest_v3.cint"},{"id"
 :5,"vertexType":"COLUMN","vertexId":"default.dest_v3.cfloat"},{"id":6,"vertexType":"COLUMN","vertexId":"default.dest_v3.cstring1"},{"id":7,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cbigint"},{"id":8,"vertexType":"COLUMN","vertexId":"default.alltypesorc.ctinyint"},{"id":9,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cint"},{"id":10,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cfloat"},{"id":11,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cstring1"},{"id":12,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cboolean1"},{"id":13,"vertexType":"COLUMN","vertexId":"default.alltypesorc.csmallint"}]}
+{"version":"1.0","engine":"tez","database":"default","hash":"9848a9a38a4f6f031dc669e7e495f9ee","queryText":"create view dest_v3 (a1, a2, a3, a4, a5, a6, a7) as\n  select x.csmallint, x.cbigint bint1, x.ctinyint, c.cbigint bint2, x.cint, x.cfloat, c.cstring1\n  from alltypesorc c\n  join (\n     select a.csmallint csmallint, a.ctinyint ctinyint, a.cstring2 cstring2,\n           a.cint cint, a.cstring1 ctring1, b.cfloat cfloat, b.cbigint cbigint\n     from ( select * from alltypesorc a where cboolean1=true ) a\n     join alltypesorc b on (a.csmallint = b.cint)\n   ) x on (x.ctinyint = c.cbigint)\n  where x.csmallint=11\n  and x.cint > 899\n  and x.cfloat > 4.5\n  and c.cstring1 < '7'\n  and x.cint + x.cfloat + length(c.cstring1) < 1000","edges":[{"sources":[],"targets":[0],"expression":"11S","edgeType":"PROJECTION"},{"sources":[7],"targets":[1,2],"edgeType":"PROJECTION"},{"sources":[8],"targets":[3],"edgeType":"PROJECTION"},{"sources":[9],"targets":[4],"edgeType":"PROJECTION"},{"sourc
 es":[10],"targets":[5],"edgeType":"PROJECTION"},{"sources":[11],"targets":[6],"edgeType":"PROJECTION"},{"sources":[11,7],"targets":[0,1,3,2,4,5,6],"expression":"((c.cstring1 < '7') and c.cbigint is not null)","edgeType":"PREDICATE"},{"sources":[7,8],"targets":[0,1,3,2,4,5,6],"expression":"(c.cbigint = UDFToLong(a.ctinyint))","edgeType":"PREDICATE"},{"sources":[12,13,9,8],"targets":[0,1,3,2,4,5,6],"expression":"(a.cboolean1 and (a.csmallint = 11S) and (a.cint > 899) and a.ctinyint is not null)","edgeType":"PREDICATE"},{"sources":[10,9],"targets":[0,1,3,2,4,5,6],"expression":"((b.cfloat > 4.5) and (b.cint = 11))","edgeType":"PREDICATE"}],"vertices":[{"id":0,"vertexType":"COLUMN","vertexId":"default.dest_v3.csmallint"},{"id":1,"vertexType":"COLUMN","vertexId":"default.dest_v3.bint1"},{"id":2,"vertexType":"COLUMN","vertexId":"default.dest_v3.bint2"},{"id":3,"vertexType":"COLUMN","vertexId":"default.dest_v3.ctinyint"},{"id":4,"vertexType":"COLUMN","vertexId":"default.dest_v3.cint"},{"id"
 :5,"vertexType":"COLUMN","vertexId":"default.dest_v3.cfloat"},{"id":6,"vertexType":"COLUMN","vertexId":"default.dest_v3.cstring1"},{"id":7,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cbigint"},{"id":8,"vertexType":"COLUMN","vertexId":"default.alltypesorc.ctinyint"},{"id":9,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cint"},{"id":10,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cfloat"},{"id":11,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cstring1"},{"id":12,"vertexType":"COLUMN","vertexId":"default.alltypesorc.cboolean1"},{"id":13,"vertexType":"COLUMN","vertexId":"default.alltypesorc.csmallint"}]}
 PREHOOK: query: alter view dest_v3 as
   select * from (
     select sum(a.ctinyint) over (partition by a.csmallint order by a.csmallint) a,

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/llap_smb_ptf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/llap_smb_ptf.q.out b/ql/src/test/results/clientpositive/llap/llap_smb_ptf.q.out
index 4ba8dd6..26217d1 100644
--- a/ql/src/test/results/clientpositive/llap/llap_smb_ptf.q.out
+++ b/ql/src/test/results/clientpositive/llap/llap_smb_ptf.q.out
@@ -635,12 +635,12 @@ STAGE PLANS:
                   0 _col4 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
-                Statistics: Num rows: 1 Data size: 252 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 1 Data size: 277 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col4 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col4 (type: int)
-                  Statistics: Num rows: 1 Data size: 252 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 1 Data size: 277 Basic stats: PARTIAL Column stats: NONE
                   value expressions: _col0 (type: smallint), _col1 (type: string), _col2 (type: smallint), _col3 (type: string), _col5 (type: smallint), _col6 (type: string), _col7 (type: int)
         Reducer 4 
             Execution mode: llap
@@ -651,18 +651,18 @@ STAGE PLANS:
                 keys:
                   0 _col4 (type: int)
                   1 _col5 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col5, _col6, _col7, _col9, _col10, _col11, _col12, _col13
-                Statistics: Num rows: 2 Data size: 1008 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                Statistics: Num rows: 1 Data size: 304 Basic stats: PARTIAL Column stats: NONE
                 Select Operator
-                  expressions: _col7 (type: int), _col0 (type: smallint), _col1 (type: string), _col2 (type: smallint), _col3 (type: string), _col5 (type: smallint), _col6 (type: string), _col9 (type: smallint), _col10 (type: smallint), _col11 (type: string), _col12 (type: string), _col13 (type: string)
-                  outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col7, _col8, _col9, _col10, _col11, _col12, _col13
-                  Statistics: Num rows: 2 Data size: 1008 Basic stats: COMPLETE Column stats: COMPLETE
+                  expressions: _col7 (type: int), _col0 (type: smallint), _col1 (type: string), _col2 (type: smallint), _col3 (type: string), _col5 (type: smallint), _col6 (type: string), _col8 (type: smallint), _col9 (type: smallint), _col10 (type: string), _col11 (type: string), _col12 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, _col7, _col8, _col9, _col10, _col11, _col12
+                  Statistics: Num rows: 1 Data size: 304 Basic stats: PARTIAL Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 2 Data size: 1008 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col2 (type: smallint), _col3 (type: string), _col4 (type: smallint), _col5 (type: string), _col7 (type: smallint), _col8 (type: string), _col9 (type: smallint), _col10 (type: smallint), _col11 (type: string), _col12 (type: string), _col13 (type: string)
+                    Statistics: Num rows: 1 Data size: 304 Basic stats: PARTIAL Column stats: NONE
+                    value expressions: _col1 (type: smallint), _col2 (type: string), _col3 (type: smallint), _col4 (type: string), _col6 (type: smallint), _col7 (type: string), _col8 (type: smallint), _col9 (type: smallint), _col10 (type: string), _col11 (type: string), _col12 (type: string)
         Reducer 5 
             Execution mode: llap
             Reduce Operator Tree:
@@ -672,22 +672,22 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col15
-                Statistics: Num rows: 2 Data size: 1008 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col14
+                Statistics: Num rows: 1 Data size: 334 Basic stats: PARTIAL Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), _col2 (type: smallint), _col3 (type: string), _col4 (type: smallint), _col5 (type: string), _col7 (type: smallint), _col8 (type: string), _col9 (type: smallint), _col10 (type: smallint), _col12 (type: string), _col13 (type: string), _col11 (type: string), _col15 (type: int)
+                  expressions: _col0 (type: int), _col1 (type: smallint), _col2 (type: string), _col3 (type: smallint), _col4 (type: string), _col6 (type: smallint), _col7 (type: string), _col8 (type: smallint), _col9 (type: smallint), _col11 (type: string), _col12 (type: string), _col10 (type: string), _col14 (type: int)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
-                  Statistics: Num rows: 2 Data size: 1008 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 1 Data size: 334 Basic stats: PARTIAL Column stats: NONE
                   Filter Operator
                     predicate: _col12 is null (type: boolean)
-                    Statistics: Num rows: 1 Data size: 504 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 1 Data size: 334 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
                       expressions: _col0 (type: int), _col1 (type: smallint), _col2 (type: string), _col3 (type: smallint), _col4 (type: string), _col5 (type: smallint), _col6 (type: string), _col7 (type: smallint), _col8 (type: smallint), _col9 (type: string), _col10 (type: string), _col11 (type: string), '201611160940' (type: string)
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
-                      Statistics: Num rows: 1 Data size: 600 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 334 Basic stats: PARTIAL Column stats: NONE
                       File Output Operator
                         compressed: false
-                        Statistics: Num rows: 1 Data size: 600 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 334 Basic stats: PARTIAL Column stats: NONE
                         table:
                             input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                             output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -703,12 +703,12 @@ STAGE PLANS:
                 Select Operator
                   expressions: _col0 (type: int)
                   outputColumnNames: _col0
-                  Statistics: Num rows: 1 Data size: 84 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col0 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 1 Data size: 84 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: COMPLETE
         Reducer 9 
             Execution mode: llap
             Reduce Operator Tree:


[18/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query72.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query72.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query72.q.out
index fca31ef..e49b44b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query72.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query72.q.out
@@ -82,10 +82,10 @@ CBO PLAN:
 HiveSortLimit(sort0=[$5], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC], dir2=[ASC], dir3=[ASC], fetch=[100])
   HiveProject($f0=[$0], $f1=[$1], $f2=[$2], $f3=[$3], $f4=[$4], $f5=[$5])
     HiveAggregate(group=[{0, 1, 2}], agg#0=[count($3)], agg#1=[count($4)], agg#2=[count()])
-      HiveProject($f0=[$15], $f1=[$13], $f2=[$22], $f3=[CASE(IS NULL($28), 1, 0)], $f4=[CASE(IS NOT NULL($28), 1, 0)])
-        HiveJoin(condition=[AND(=($29, $4), =($30, $6))], joinType=[left], algorithm=[none], cost=[not available])
-          HiveProject(cs_sold_date_sk=[$10], cs_ship_date_sk=[$11], cs_bill_cdemo_sk=[$12], cs_bill_hdemo_sk=[$13], cs_item_sk=[$14], cs_promo_sk=[$15], cs_order_number=[$16], cs_quantity=[$17], inv_date_sk=[$0], inv_item_sk=[$1], inv_warehouse_sk=[$2], inv_quantity_on_hand=[$3], w_warehouse_sk=[$4], w_warehouse_name=[$5], i_item_sk=[$8], i_item_desc=[$9], cd_demo_sk=[$22], cd_marital_status=[$23], hd_demo_sk=[$24], hd_buy_potential=[$25], d_date_sk=[$18], d_date=[$19], d_week_seq=[$20], d_year=[$21], d_date_sk0=[$27], d_week_seq0=[$28], d_date_sk1=[$6], d_date0=[$7], p_promo_sk=[$26])
-            HiveJoin(condition=[AND(=($0, $27), =($20, $28))], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveProject($f0=[$15], $f1=[$13], $f2=[$19], $f3=[CASE(IS NULL($25), 1, 0)], $f4=[CASE(IS NOT NULL($25), 1, 0)])
+        HiveJoin(condition=[AND(=($26, $4), =($27, $6))], joinType=[left], algorithm=[none], cost=[not available])
+          HiveProject(cs_sold_date_sk=[$10], cs_ship_date_sk=[$11], cs_bill_cdemo_sk=[$12], cs_bill_hdemo_sk=[$13], cs_item_sk=[$14], cs_promo_sk=[$15], cs_order_number=[$16], cs_quantity=[$17], inv_date_sk=[$0], inv_item_sk=[$1], inv_warehouse_sk=[$2], inv_quantity_on_hand=[$3], w_warehouse_sk=[$4], w_warehouse_name=[$5], i_item_sk=[$8], i_item_desc=[$9], cd_demo_sk=[$21], hd_demo_sk=[$22], d_date_sk=[$18], d_week_seq=[$19], +=[$20], d_date_sk0=[$24], d_week_seq0=[$25], d_date_sk1=[$6], CAST=[$7], p_promo_sk=[$23])
+            HiveJoin(condition=[AND(=($0, $24), =($19, $25))], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[AND(=($14, $1), <($3, $17))], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($4, $2)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], inv_warehouse_sk=[$2], inv_quantity_on_hand=[$3])
@@ -94,29 +94,29 @@ HiveSortLimit(sort0=[$5], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-l
                   HiveProject(w_warehouse_sk=[$0], w_warehouse_name=[$2])
                     HiveFilter(condition=[IS NOT NULL($0)])
                       HiveTableScan(table=[[default, warehouse]], table:alias=[warehouse])
-                HiveProject(d_date_sk=[$0], d_date=[$1], i_item_sk=[$2], i_item_desc=[$3], cs_sold_date_sk=[$4], cs_ship_date_sk=[$5], cs_bill_cdemo_sk=[$6], cs_bill_hdemo_sk=[$7], cs_item_sk=[$8], cs_promo_sk=[$9], cs_order_number=[$10], cs_quantity=[$11], d_date_sk0=[$12], d_date0=[$13], d_week_seq=[$14], d_year=[$15], cd_demo_sk=[$16], cd_marital_status=[$17], hd_demo_sk=[$18], hd_buy_potential=[$19], p_promo_sk=[$20])
-                  HiveJoin(condition=[AND(=($5, $0), >(CAST($1):DOUBLE, +(CAST($13):DOUBLE, 5)))], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(d_date_sk=[$0], d_date=[$2])
+                HiveProject(d_date_sk=[$0], CAST=[$1], i_item_sk=[$2], i_item_desc=[$3], cs_sold_date_sk=[$4], cs_ship_date_sk=[$5], cs_bill_cdemo_sk=[$6], cs_bill_hdemo_sk=[$7], cs_item_sk=[$8], cs_promo_sk=[$9], cs_order_number=[$10], cs_quantity=[$11], d_date_sk0=[$12], d_week_seq=[$13], +=[$14], cd_demo_sk=[$15], hd_demo_sk=[$16], p_promo_sk=[$17])
+                  HiveJoin(condition=[AND(=($5, $0), >($1, $14))], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(d_date_sk=[$0], CAST=[CAST($2):DOUBLE])
                       HiveFilter(condition=[IS NOT NULL($0)])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[d3])
                     HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(i_item_sk=[$0], i_item_desc=[$4])
                         HiveFilter(condition=[IS NOT NULL($0)])
                           HiveTableScan(table=[[default, item]], table:alias=[item])
-                      HiveJoin(condition=[=($5, $16)], joinType=[left], algorithm=[none], cost=[not available])
-                        HiveJoin(condition=[=($3, $14)], joinType=[inner], algorithm=[none], cost=[not available])
-                          HiveJoin(condition=[=($2, $12)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveJoin(condition=[=($5, $13)], joinType=[left], algorithm=[none], cost=[not available])
+                        HiveJoin(condition=[=($3, $12)], joinType=[inner], algorithm=[none], cost=[not available])
+                          HiveJoin(condition=[=($2, $11)], joinType=[inner], algorithm=[none], cost=[not available])
                             HiveJoin(condition=[=($0, $8)], joinType=[inner], algorithm=[none], cost=[not available])
                               HiveProject(cs_sold_date_sk=[$0], cs_ship_date_sk=[$2], cs_bill_cdemo_sk=[$4], cs_bill_hdemo_sk=[$5], cs_item_sk=[$15], cs_promo_sk=[$16], cs_order_number=[$17], cs_quantity=[$18])
                                 HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($4), IS NOT NULL($5), IS NOT NULL($0), IS NOT NULL($2))])
                                   HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                              HiveProject(d_date_sk=[$0], d_date=[$2], d_week_seq=[$4], d_year=[CAST(2001):INTEGER])
+                              HiveProject(d_date_sk=[$0], d_week_seq=[$4], +=[+(CAST($2):DOUBLE, 5)])
                                 HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0), IS NOT NULL($4))])
                                   HiveTableScan(table=[[default, date_dim]], table:alias=[d1])
-                            HiveProject(cd_demo_sk=[$0], cd_marital_status=[CAST(_UTF-16LE'M'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                            HiveProject(cd_demo_sk=[$0])
                               HiveFilter(condition=[AND(=($2, _UTF-16LE'M'), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, customer_demographics]], table:alias=[customer_demographics])
-                          HiveProject(hd_demo_sk=[$0], hd_buy_potential=[CAST(_UTF-16LE'1001-5000'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                          HiveProject(hd_demo_sk=[$0])
                             HiveFilter(condition=[AND(=($2, _UTF-16LE'1001-5000'), IS NOT NULL($0))])
                               HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
                         HiveProject(p_promo_sk=[$0])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query73.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query73.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query73.q.out
index d28a896..2639cf2 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query73.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query73.q.out
@@ -75,19 +75,19 @@ HiveSortLimit(sort0=[$5], dir0=[DESC-nulls-last])
         HiveFilter(condition=[BETWEEN(false, $2, 1, 5)])
           HiveProject(ss_ticket_number=[$1], ss_customer_sk=[$0], $f2=[$2])
             HiveAggregate(group=[{1, 4}], agg#0=[count()])
-              HiveJoin(condition=[=($3, $12)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveJoin(condition=[=($2, $8)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($3, $7)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveJoin(condition=[=($2, $6)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_hdemo_sk=[$5], ss_store_sk=[$7], ss_ticket_number=[$9])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($5), IS NOT NULL($3))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[$6], d_dom=[$9])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(IN($6, 2000, 2001, 2002), BETWEEN(false, $9, 1, 2), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                  HiveProject(hd_demo_sk=[$0], hd_buy_potential=[$2], hd_dep_count=[$3], hd_vehicle_count=[$4])
+                  HiveProject(hd_demo_sk=[$0])
                     HiveFilter(condition=[AND(IN($2, _UTF-16LE'>10000', _UTF-16LE'unknown'), >($4, 0), CASE(>($4, 0), >(/(CAST($3):DOUBLE, CAST($4):DOUBLE), 1), null), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-                HiveProject(s_store_sk=[$0], s_county=[$23])
+                HiveProject(s_store_sk=[$0])
                   HiveFilter(condition=[AND(IN($23, _UTF-16LE'Mobile County', _UTF-16LE'Maverick County', _UTF-16LE'Huron County', _UTF-16LE'Kittitas County'), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store]], table:alias=[store])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query74.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query74.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query74.q.out
index 32d6e03..4a9a112 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query74.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query74.q.out
@@ -131,9 +131,9 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$1], sort1=[$0], sort2=[$2], dir0=[ASC], dir1=[ASC], dir2=[ASC], fetch=[100])
   HiveProject(customer_id=[$0], customer_first_name=[$1], customer_last_name=[$2])
-    HiveJoin(condition=[AND(=($0, $6), CASE(CAST(IS NOT NULL($7)):BOOLEAN, CASE(CAST(IS NOT NULL($9)):BOOLEAN, >(/($5, $9), /($3, $7)), >(null, /($3, $7))), CASE(CAST(IS NOT NULL($9)):BOOLEAN, >(/($5, $9), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
-      HiveProject(customer_id=[$0], customer_first_name=[$1], customer_last_name=[$2], year_total=[$4])
-        HiveAggregate(group=[{1, 2, 3, 8}], agg#0=[max($6)])
+    HiveJoin(condition=[AND(=($0, $6), CASE(CAST(IS NOT NULL($7)):BOOLEAN, CASE($10, >(/($5, $9), /($3, $7)), >(null, /($3, $7))), CASE($10, >(/($5, $9), null), null)))], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveProject(c_customer_id=[$0], c_first_name=[$1], c_last_name=[$2], $f3=[$3])
+        HiveAggregate(group=[{1, 2, 3}], agg#0=[max($6)])
           HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9])
               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
@@ -142,13 +142,13 @@ HiveSortLimit(sort0=[$1], sort1=[$0], sort2=[$2], dir0=[ASC], dir1=[ASC], dir2=[
               HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_net_paid=[$20])
                 HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-              HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
+              HiveProject(d_date_sk=[$0])
                 HiveFilter(condition=[AND(IN($6, 2001, 2002), =($6, 2002), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
       HiveJoin(condition=[=($2, $4)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-          HiveProject(customer_id=[$0], year_total=[$4])
-            HiveAggregate(group=[{1, 2, 3, 8}], agg#0=[max($6)])
+          HiveProject($f0=[$0], $f4=[$3])
+            HiveAggregate(group=[{1, 2, 3}], agg#0=[max($6)])
               HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9])
                   HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
@@ -157,12 +157,12 @@ HiveSortLimit(sort0=[$1], sort1=[$0], sort2=[$2], dir0=[ASC], dir1=[ASC], dir2=[
                   HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], ws_net_paid=[$29])
                     HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(IN($6, 2001, 2002), =($6, 2002), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(customer_id=[$0], year_total=[$4])
-            HiveFilter(condition=[>($4, 0)])
-              HiveAggregate(group=[{1, 2, 3, 8}], agg#0=[max($6)])
+          HiveProject($f0=[$0], $f4=[$3])
+            HiveFilter(condition=[>($3, 0)])
+              HiveAggregate(group=[{1, 2, 3}], agg#0=[max($6)])
                 HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
@@ -171,12 +171,12 @@ HiveSortLimit(sort0=[$1], sort1=[$0], sort2=[$2], dir0=[ASC], dir1=[ASC], dir2=[
                     HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_net_paid=[$20])
                       HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(IN($6, 2001, 2002), =($6, 2001), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-        HiveProject(customer_id=[$0], year_total=[$4])
-          HiveFilter(condition=[>($4, 0)])
-            HiveAggregate(group=[{1, 2, 3, 8}], agg#0=[max($6)])
+        HiveProject(customer_id=[$0], year_total=[$3], CAST=[CAST(IS NOT NULL($3)):BOOLEAN])
+          HiveFilter(condition=[>($3, 0)])
+            HiveAggregate(group=[{1, 2, 3}], agg#0=[max($6)])
               HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_first_name=[$8], c_last_name=[$9])
                   HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
@@ -185,7 +185,7 @@ HiveSortLimit(sort0=[$1], sort1=[$0], sort2=[$2], dir0=[ASC], dir1=[ASC], dir2=[
                   HiveProject(ws_sold_date_sk=[$0], ws_bill_customer_sk=[$4], ws_net_paid=[$29])
                     HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(IN($6, 2001, 2002), =($6, 2001), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query75.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query75.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query75.q.out
index 3d87d1b..8c445d9 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query75.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query75.q.out
@@ -169,52 +169,52 @@ HiveProject(prev_year=[CAST(2001):INTEGER], year=[CAST(2002):INTEGER], i_brand_i
                       HiveAggregate(group=[{0, 1, 2, 3, 4, 5}])
                         HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], i_manufact_id=[$3], sales_cnt=[$4], sales_amt=[$5])
                           HiveUnion(all=[true])
-                            HiveProject(i_brand_id=[$12], i_class_id=[$13], i_category_id=[$14], i_manufact_id=[$16], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
+                            HiveProject(i_brand_id=[$11], i_class_id=[$12], i_category_id=[$13], i_manufact_id=[$14], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
                               HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[right], algorithm=[none], cost=[not available])
                                 HiveProject(cr_item_sk=[$2], cr_order_number=[$16], cr_return_quantity=[$17], cr_return_amount=[$18])
                                   HiveFilter(condition=[IS NOT NULL($2)])
                                     HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
-                                HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
                                   HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                                     HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15], cs_order_number=[$17], cs_quantity=[$18], cs_ext_sales_price=[$23])
                                       HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                    HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+                                    HiveProject(d_date_sk=[$0])
                                       HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                                  HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_category=[CAST(_UTF-16LE'Sports'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], i_manufact_id=[$13])
+                                  HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_manufact_id=[$13])
                                     HiveFilter(condition=[AND(=($12, _UTF-16LE'Sports'), IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11), IS NOT NULL($13))])
                                       HiveTableScan(table=[[default, item]], table:alias=[item])
-                            HiveProject(i_brand_id=[$12], i_class_id=[$13], i_category_id=[$14], i_manufact_id=[$16], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
+                            HiveProject(i_brand_id=[$11], i_class_id=[$12], i_category_id=[$13], i_manufact_id=[$14], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
                               HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[right], algorithm=[none], cost=[not available])
                                 HiveProject(sr_item_sk=[$2], sr_ticket_number=[$9], sr_return_quantity=[$10], sr_return_amt=[$11])
                                   HiveFilter(condition=[IS NOT NULL($2)])
                                     HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                                HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
                                   HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                                     HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ticket_number=[$9], ss_quantity=[$10], ss_ext_sales_price=[$15])
                                       HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                    HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+                                    HiveProject(d_date_sk=[$0])
                                       HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                                  HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_category=[CAST(_UTF-16LE'Sports'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], i_manufact_id=[$13])
+                                  HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_manufact_id=[$13])
                                     HiveFilter(condition=[AND(=($12, _UTF-16LE'Sports'), IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11), IS NOT NULL($13))])
                                       HiveTableScan(table=[[default, item]], table:alias=[item])
-                    HiveProject(i_brand_id=[$12], i_class_id=[$13], i_category_id=[$14], i_manufact_id=[$16], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
+                    HiveProject(i_brand_id=[$11], i_class_id=[$12], i_category_id=[$13], i_manufact_id=[$14], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
                       HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[right], algorithm=[none], cost=[not available])
                         HiveProject(wr_item_sk=[$2], wr_order_number=[$13], wr_return_quantity=[$14], wr_return_amt=[$15])
                           HiveFilter(condition=[IS NOT NULL($2)])
                             HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
-                        HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
                           HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                             HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_order_number=[$17], ws_quantity=[$18], ws_ext_sales_price=[$23])
                               HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[CAST(2001):INTEGER])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(=($6, 2001), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_category=[CAST(_UTF-16LE'Sports'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], i_manufact_id=[$13])
+                          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_manufact_id=[$13])
                             HiveFilter(condition=[AND(=($12, _UTF-16LE'Sports'), IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11), IS NOT NULL($13))])
                               HiveTableScan(table=[[default, item]], table:alias=[item])
         HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], i_manufact_id=[$3], $f4=[$4], $f5=[$5])
@@ -227,52 +227,52 @@ HiveProject(prev_year=[CAST(2001):INTEGER], year=[CAST(2002):INTEGER], i_brand_i
                       HiveAggregate(group=[{0, 1, 2, 3, 4, 5}])
                         HiveProject(i_brand_id=[$0], i_class_id=[$1], i_category_id=[$2], i_manufact_id=[$3], sales_cnt=[$4], sales_amt=[$5])
                           HiveUnion(all=[true])
-                            HiveProject(i_brand_id=[$12], i_class_id=[$13], i_category_id=[$14], i_manufact_id=[$16], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
+                            HiveProject(i_brand_id=[$11], i_class_id=[$12], i_category_id=[$13], i_manufact_id=[$14], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
                               HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[right], algorithm=[none], cost=[not available])
                                 HiveProject(cr_item_sk=[$2], cr_order_number=[$16], cr_return_quantity=[$17], cr_return_amount=[$18])
                                   HiveFilter(condition=[IS NOT NULL($2)])
                                     HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
-                                HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
                                   HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                                     HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15], cs_order_number=[$17], cs_quantity=[$18], cs_ext_sales_price=[$23])
                                       HiveFilter(condition=[AND(IS NOT NULL($15), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                                    HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
+                                    HiveProject(d_date_sk=[$0])
                                       HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                                  HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_category=[CAST(_UTF-16LE'Sports'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], i_manufact_id=[$13])
+                                  HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_manufact_id=[$13])
                                     HiveFilter(condition=[AND(=($12, _UTF-16LE'Sports'), IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11), IS NOT NULL($13))])
                                       HiveTableScan(table=[[default, item]], table:alias=[item])
-                            HiveProject(i_brand_id=[$12], i_class_id=[$13], i_category_id=[$14], i_manufact_id=[$16], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
+                            HiveProject(i_brand_id=[$11], i_class_id=[$12], i_category_id=[$13], i_manufact_id=[$14], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
                               HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[right], algorithm=[none], cost=[not available])
                                 HiveProject(sr_item_sk=[$2], sr_ticket_number=[$9], sr_return_quantity=[$10], sr_return_amt=[$11])
                                   HiveFilter(condition=[IS NOT NULL($2)])
                                     HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                                HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+                                HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
                                   HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                                     HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ticket_number=[$9], ss_quantity=[$10], ss_ext_sales_price=[$15])
                                       HiveFilter(condition=[AND(IS NOT NULL($2), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                                    HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
+                                    HiveProject(d_date_sk=[$0])
                                       HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
                                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                                  HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_category=[CAST(_UTF-16LE'Sports'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], i_manufact_id=[$13])
+                                  HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_manufact_id=[$13])
                                     HiveFilter(condition=[AND(=($12, _UTF-16LE'Sports'), IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11), IS NOT NULL($13))])
                                       HiveTableScan(table=[[default, item]], table:alias=[item])
-                    HiveProject(i_brand_id=[$12], i_class_id=[$13], i_category_id=[$14], i_manufact_id=[$16], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
+                    HiveProject(i_brand_id=[$11], i_class_id=[$12], i_category_id=[$13], i_manufact_id=[$14], sales_cnt=[-($7, CASE(IS NOT NULL($2), $2, 0))], sales_amt=[-($8, CASE(IS NOT NULL($3), $3, 0))])
                       HiveJoin(condition=[AND(=($6, $1), =($5, $0))], joinType=[right], algorithm=[none], cost=[not available])
                         HiveProject(wr_item_sk=[$2], wr_order_number=[$13], wr_return_quantity=[$14], wr_return_amt=[$15])
                           HiveFilter(condition=[IS NOT NULL($2)])
                             HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
-                        HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
                           HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                             HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_order_number=[$17], ws_quantity=[$18], ws_ext_sales_price=[$23])
                               HiveFilter(condition=[AND(IS NOT NULL($3), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                            HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER])
+                            HiveProject(d_date_sk=[$0])
                               HiveFilter(condition=[AND(=($6, 2002), IS NOT NULL($0))])
                                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_category=[CAST(_UTF-16LE'Sports'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], i_manufact_id=[$13])
+                          HiveProject(i_item_sk=[$0], i_brand_id=[$7], i_class_id=[$9], i_category_id=[$11], i_manufact_id=[$13])
                             HiveFilter(condition=[AND(=($12, _UTF-16LE'Sports'), IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($9), IS NOT NULL($11), IS NOT NULL($13))])
                               HiveTableScan(table=[[default, item]], table:alias=[item])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query76.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query76.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query76.q.out
index 74f888c..740d038 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query76.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query76.q.out
@@ -62,7 +62,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], dir0=[
     HiveAggregate(group=[{0, 1, 2, 3, 4}], agg#0=[count()], agg#1=[sum($5)])
       HiveProject(channel=[$0], col_name=[$1], d_year=[$2], d_qoy=[$3], i_category=[$4], ext_sales_price=[$5])
         HiveUnion(all=[true])
-          HiveProject(channel=[_UTF-16LE'store'], col_name=[_UTF-16LE'ss_addr_sk'], d_year=[$1], d_qoy=[$2], i_category=[$4], ext_sales_price=[$8])
+          HiveProject(channel=[_UTF-16LE'store'], col_name=[_UTF-16LE'ss_addr_sk'], d_year=[$1], d_qoy=[$2], i_category=[$4], ext_sales_price=[$7])
             HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveProject(d_date_sk=[$0], d_year=[$6], d_qoy=[$10])
                 HiveFilter(condition=[IS NOT NULL($0)])
@@ -71,13 +71,13 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], dir0=[
                 HiveProject(i_item_sk=[$0], i_category=[$12])
                   HiveFilter(condition=[IS NOT NULL($0)])
                     HiveTableScan(table=[[default, item]], table:alias=[item])
-                HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_addr_sk=[null], ss_ext_sales_price=[$15])
+                HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_ext_sales_price=[$15])
                   HiveFilter(condition=[AND(IS NULL($6), IS NOT NULL($2), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-          HiveProject(channel=[_UTF-16LE'web'], col_name=[_UTF-16LE'ws_web_page_sk'], d_year=[$7], d_qoy=[$8], i_category=[$5], ext_sales_price=[$3])
-            HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($1, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_web_page_sk=[null], ws_ext_sales_price=[$23])
+          HiveProject(channel=[_UTF-16LE'web'], col_name=[_UTF-16LE'ws_web_page_sk'], d_year=[$6], d_qoy=[$7], i_category=[$4], ext_sales_price=[$2])
+            HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_ext_sales_price=[$23])
                   HiveFilter(condition=[AND(IS NULL($12), IS NOT NULL($3), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
                 HiveProject(i_item_sk=[$0], i_category=[$12])
@@ -86,10 +86,10 @@ HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], dir0=[
               HiveProject(d_date_sk=[$0], d_year=[$6], d_qoy=[$10])
                 HiveFilter(condition=[IS NOT NULL($0)])
                   HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-          HiveProject(channel=[_UTF-16LE'catalog'], col_name=[_UTF-16LE'cs_warehouse_sk'], d_year=[$7], d_qoy=[$8], i_category=[$5], ext_sales_price=[$3])
-            HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($2, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-                HiveProject(cs_sold_date_sk=[$0], cs_warehouse_sk=[null], cs_item_sk=[$15], cs_ext_sales_price=[$23])
+          HiveProject(channel=[_UTF-16LE'catalog'], col_name=[_UTF-16LE'cs_warehouse_sk'], d_year=[$6], d_qoy=[$7], i_category=[$4], ext_sales_price=[$2])
+            HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveProject(cs_sold_date_sk=[$0], cs_item_sk=[$15], cs_ext_sales_price=[$23])
                   HiveFilter(condition=[AND(IS NULL($14), IS NOT NULL($15), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
                 HiveProject(i_item_sk=[$0], i_category=[$12])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query77.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query77.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query77.q.out
index 2c42995..91ad054 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query77.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query77.q.out
@@ -240,13 +240,13 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
           HiveProject(channel=[_UTF-16LE'store channel'], id=[$0], sales=[$1], returns=[CASE(IS NOT NULL($4), $4, 0)], profit=[-($2, CASE(IS NOT NULL($5), $5, 0))])
             HiveJoin(condition=[=($0, $3)], joinType=[left], algorithm=[none], cost=[not available])
               HiveProject(s_store_sk=[$0], $f1=[$1], $f2=[$2])
-                HiveAggregate(group=[{6}], agg#0=[sum($2)], agg#1=[sum($3)])
-                  HiveJoin(condition=[=($1, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+                HiveAggregate(group=[{5}], agg#0=[sum($2)], agg#1=[sum($3)])
+                  HiveJoin(condition=[=($1, $5)], joinType=[inner], algorithm=[none], cost=[not available])
                     HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
                       HiveProject(ss_sold_date_sk=[$0], ss_store_sk=[$7], ss_ext_sales_price=[$15], ss_net_profit=[$22])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                           HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                      HiveProject(d_date_sk=[$0], d_date=[$2])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-09-03 00:00:00), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                     HiveProject(s_store_sk=[$0])
@@ -262,7 +262,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                       HiveProject(sr_returned_date_sk=[$0], sr_store_sk=[$7], sr_return_amt=[$11], sr_net_loss=[$19])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
                           HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                      HiveProject(d_date_sk=[$0], d_date=[$2])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-09-03 00:00:00), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(channel=[_UTF-16LE'catalog channel'], id=[$0], sales=[$1], returns=[$3], profit=[-($2, $4)])
@@ -273,7 +273,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                     HiveProject(cs_sold_date_sk=[$0], cs_call_center_sk=[$11], cs_ext_sales_price=[$23], cs_net_profit=[$33])
                       HiveFilter(condition=[IS NOT NULL($0)])
                         HiveTableScan(table=[[default, catalog_sales]], table:alias=[catalog_sales])
-                    HiveProject(d_date_sk=[$0], d_date=[$2])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-09-03 00:00:00), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
               HiveProject($f0=[$0], $f1=[$1])
@@ -282,7 +282,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                     HiveProject(cr_returned_date_sk=[$0], cr_return_amount=[$18], cr_net_loss=[$26])
                       HiveFilter(condition=[IS NOT NULL($0)])
                         HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
-                    HiveProject(d_date_sk=[$0], d_date=[$2])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-09-03 00:00:00), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
           HiveProject(channel=[_UTF-16LE'web channel'], id=[$0], sales=[$1], returns=[CASE(IS NOT NULL($4), $4, 0)], profit=[-($2, CASE(IS NOT NULL($5), $5, 0))])
@@ -297,7 +297,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                       HiveProject(ws_sold_date_sk=[$0], ws_web_page_sk=[$12], ws_ext_sales_price=[$23], ws_net_profit=[$33])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($12))])
                           HiveTableScan(table=[[default, web_sales]], table:alias=[web_sales])
-                      HiveProject(d_date_sk=[$0], d_date=[$2])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-09-03 00:00:00), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
               HiveProject(wp_web_page_sk=[$0], $f1=[$1], $f2=[$2])
@@ -310,7 +310,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                       HiveProject(wr_returned_date_sk=[$0], wr_web_page_sk=[$11], wr_return_amt=[$15], wr_net_loss=[$23])
                         HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($11))])
                           HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
-                      HiveProject(d_date_sk=[$0], d_date=[$2])
+                      HiveProject(d_date_sk=[$0])
                         HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-09-03 00:00:00), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query78.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query78.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query78.q.out
index 66b345c..0263582 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query78.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query78.q.out
@@ -139,12 +139,12 @@ HiveSortLimit(fetch=[100])
               HiveFilter(condition=[CASE(IS NOT NULL($7), >($7, 0), false)])
                 HiveJoin(condition=[AND(=($5, $0), =($6, $1))], joinType=[left], algorithm=[none], cost=[not available])
                   HiveProject(ss_item_sk=[$0], ss_customer_sk=[$1], $f2=[$2], $f3=[$3], $f4=[$4])
-                    HiveAggregate(group=[{3, 4}], agg#0=[sum($6)], agg#1=[sum($7)], agg#2=[sum($8)])
-                      HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                        HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER])
+                    HiveAggregate(group=[{2, 3}], agg#0=[sum($4)], agg#1=[sum($5)], agg#2=[sum($6)])
+                      HiveJoin(condition=[=($1, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveProject(d_date_sk=[$0])
                           HiveFilter(condition=[AND(=($6, 2000), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                        HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$1], ss_customer_sk=[$2], ss_ticket_number=[$3], ss_quantity=[$4], ss_wholesale_cost=[$5], ss_sales_price=[$6], sr_item_sk=[$7], sr_ticket_number=[$8])
+                        HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$1], ss_customer_sk=[$2], ss_quantity=[$4], ss_wholesale_cost=[$5], ss_sales_price=[$6])
                           HiveFilter(condition=[IS NULL($8)])
                             HiveJoin(condition=[AND(=($8, $3), =($1, $7))], joinType=[left], algorithm=[none], cost=[not available])
                               HiveProject(ss_sold_date_sk=[$0], ss_item_sk=[$2], ss_customer_sk=[$3], ss_ticket_number=[$9], ss_quantity=[$10], ss_wholesale_cost=[$11], ss_sales_price=[$13])
@@ -153,12 +153,12 @@ HiveSortLimit(fetch=[100])
                               HiveProject(sr_item_sk=[$2], sr_ticket_number=[$9])
                                 HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
                   HiveProject(ws_item_sk=[$0], ws_bill_customer_sk=[$1], $f2=[$2], $f3=[$3], $f4=[$4])
-                    HiveAggregate(group=[{3, 4}], agg#0=[sum($6)], agg#1=[sum($7)], agg#2=[sum($8)])
-                      HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                        HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER])
+                    HiveAggregate(group=[{2, 3}], agg#0=[sum($4)], agg#1=[sum($5)], agg#2=[sum($6)])
+                      HiveJoin(condition=[=($1, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                        HiveProject(d_date_sk=[$0])
                           HiveFilter(condition=[AND(=($6, 2000), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                        HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$1], ws_bill_customer_sk=[$2], ws_order_number=[$3], ws_quantity=[$4], ws_wholesale_cost=[$5], ws_sales_price=[$6], wr_item_sk=[$7], wr_order_number=[$8])
+                        HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$1], ws_bill_customer_sk=[$2], ws_quantity=[$4], ws_wholesale_cost=[$5], ws_sales_price=[$6])
                           HiveFilter(condition=[IS NULL($8)])
                             HiveJoin(condition=[AND(=($8, $3), =($1, $7))], joinType=[left], algorithm=[none], cost=[not available])
                               HiveProject(ws_sold_date_sk=[$0], ws_item_sk=[$3], ws_bill_customer_sk=[$4], ws_order_number=[$17], ws_quantity=[$18], ws_wholesale_cost=[$19], ws_sales_price=[$21])
@@ -167,12 +167,12 @@ HiveSortLimit(fetch=[100])
                               HiveProject(wr_item_sk=[$2], wr_order_number=[$13])
                                 HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
             HiveProject($f2=[$0], $f3=[$2], $f4=[$3], $f5=[$4])
-              HiveAggregate(group=[{3, 4}], agg#0=[sum($6)], agg#1=[sum($7)], agg#2=[sum($8)])
-                HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveProject(d_date_sk=[$0], d_year=[CAST(2000):INTEGER])
+              HiveAggregate(group=[{2, 3}], agg#0=[sum($4)], agg#1=[sum($5)], agg#2=[sum($6)])
+                HiveJoin(condition=[=($1, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(=($6, 2000), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                  HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$1], cs_item_sk=[$2], cs_order_number=[$3], cs_quantity=[$4], cs_wholesale_cost=[$5], cs_sales_price=[$6], cr_item_sk=[$7], cr_order_number=[$8])
+                  HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$1], cs_item_sk=[$2], cs_quantity=[$4], cs_wholesale_cost=[$5], cs_sales_price=[$6])
                     HiveFilter(condition=[IS NULL($8)])
                       HiveJoin(condition=[AND(=($8, $3), =($2, $7))], joinType=[left], algorithm=[none], cost=[not available])
                         HiveProject(cs_sold_date_sk=[$0], cs_bill_customer_sk=[$3], cs_item_sk=[$15], cs_order_number=[$17], cs_quantity=[$18], cs_wholesale_cost=[$19], cs_sales_price=[$21])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query79.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query79.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query79.q.out
index 6da8ac2..4317c1b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query79.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query79.q.out
@@ -57,26 +57,26 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveProject(c_last_name=[$0], c_first_name=[$1], _o__c2=[$2], ss_ticket_number=[$3], amt=[$4], profit=[$5])
   HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$6], sort3=[$5], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], fetch=[100])
-    HiveProject(c_last_name=[$2], c_first_name=[$1], _o__c2=[substr($5, 1, 30)], ss_ticket_number=[$3], amt=[$6], profit=[$7], (tok_function substr (tok_table_or_col s_city) 1 30)=[substr($5, 1, 30)])
+    HiveProject(c_last_name=[$2], c_first_name=[$1], _o__c2=[$8], ss_ticket_number=[$3], amt=[$6], profit=[$7], (tok_function substr (tok_table_or_col s_city) 1 30)=[substr($5, 1, 30)])
       HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveProject(c_customer_sk=[$0], c_first_name=[$8], c_last_name=[$9])
           HiveFilter(condition=[IS NOT NULL($0)])
             HiveTableScan(table=[[default, customer]], table:alias=[customer])
-        HiveProject(ss_ticket_number=[$2], ss_customer_sk=[$0], s_city=[$3], amt=[$4], profit=[$5])
-          HiveAggregate(group=[{1, 3, 5, 13}], agg#0=[sum($6)], agg#1=[sum($7)])
-            HiveJoin(condition=[=($2, $14)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveJoin(condition=[=($4, $11)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject(ss_ticket_number=[$2], ss_customer_sk=[$0], s_city=[$3], amt=[$4], profit=[$5], substr=[substr($3, 1, 30)])
+          HiveAggregate(group=[{1, 3, 5, 10}], agg#0=[sum($6)], agg#1=[sum($7)])
+            HiveJoin(condition=[=($2, $11)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveJoin(condition=[=($4, $9)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveJoin(condition=[=($0, $8)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(ss_sold_date_sk=[$0], ss_customer_sk=[$3], ss_hdemo_sk=[$5], ss_addr_sk=[$6], ss_store_sk=[$7], ss_ticket_number=[$9], ss_coupon_amt=[$19], ss_net_profit=[$22])
                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7), IS NOT NULL($5), IS NOT NULL($3))])
                       HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-                  HiveProject(d_date_sk=[$0], d_year=[$6], d_dow=[CAST(1):INTEGER])
+                  HiveProject(d_date_sk=[$0])
                     HiveFilter(condition=[AND(IN($6, 1998, 1999, 2000), =($7, 1), IS NOT NULL($0))])
                       HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                HiveProject(s_store_sk=[$0], s_number_employees=[$6], s_city=[$22])
+                HiveProject(s_store_sk=[$0], s_city=[$22])
                   HiveFilter(condition=[AND(BETWEEN(false, $6, 200, 295), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, store]], table:alias=[store])
-              HiveProject(hd_demo_sk=[$0], hd_dep_count=[$3], hd_vehicle_count=[$4])
+              HiveProject(hd_demo_sk=[$0])
                 HiveFilter(condition=[AND(OR(=($3, 8), >($4, 0)), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query8.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query8.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query8.q.out
index 5c4f7a2..d80d336 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query8.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query8.q.out
@@ -227,18 +227,18 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
   HiveProject(s_store_name=[$0], $f1=[$1])
-    HiveAggregate(group=[{8}], agg#0=[sum($2)])
-      HiveJoin(condition=[=($1, $7)], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveAggregate(group=[{6}], agg#0=[sum($2)])
+      HiveJoin(condition=[=($1, $5)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($0, $3)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(ss_sold_date_sk=[$0], ss_store_sk=[$7], ss_net_profit=[$22])
             HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($7))])
               HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-          HiveProject(d_date_sk=[$0], d_year=[CAST(2002):INTEGER], d_qoy=[CAST(1):INTEGER])
+          HiveProject(d_date_sk=[$0])
             HiveFilter(condition=[AND(=($10, 1), =($6, 2002), IS NOT NULL($0))])
               HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-        HiveProject($f0=[$0], s_store_sk=[$1], s_store_name=[$2], s_zip=[$3])
-          HiveJoin(condition=[=(substr($3, 1, 2), substr($0, 1, 2))], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveProject($f0=[$0])
+        HiveProject(substr=[$0], s_store_sk=[$1], s_store_name=[$2], substr0=[$3])
+          HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(substr=[substr($0, 1, 2)])
               HiveFilter(condition=[=($1, 2)])
                 HiveAggregate(group=[{0}], agg#0=[count($1)])
                   HiveProject(ca_zip=[$0], $f1=[$1])
@@ -257,10 +257,10 @@ HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
                                   HiveProject(ca_address_sk=[$0], ca_zip=[$9])
                                     HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL(substr(substr($9, 1, 5), 1, 2)))])
                                       HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-                                  HiveProject(c_current_addr_sk=[$4], c_preferred_cust_flag=[CAST(_UTF-16LE'Y'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                                  HiveProject(c_current_addr_sk=[$4])
                                     HiveFilter(condition=[AND(=($10, _UTF-16LE'Y'), IS NOT NULL($4))])
                                       HiveTableScan(table=[[default, customer]], table:alias=[customer])
-            HiveProject(s_store_sk=[$0], s_store_name=[$5], s_zip=[$25])
+            HiveProject(s_store_sk=[$0], s_store_name=[$5], substr=[substr($25, 1, 2)])
               HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL(substr($25, 1, 2)))])
                 HiveTableScan(table=[[default, store]], table:alias=[store])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query80.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query80.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query80.q.out
index 9c43294..334f09c 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query80.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query80.q.out
@@ -222,14 +222,14 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
         HiveUnion(all=[true])
           HiveProject(channel=[_UTF-16LE'store channel'], id=[||(_UTF-16LE'store', $0)], sales=[$1], returns=[$2], profit=[$3])
             HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)], agg#2=[sum($3)])
-              HiveProject($f0=[$1], $f1=[$9], $f2=[CASE(IS NOT NULL($13), $13, 0)], $f3=[-($10, CASE(IS NOT NULL($14), $14, 0))])
-                HiveJoin(condition=[=($6, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveProject($f0=[$1], $f1=[$8], $f2=[CASE(IS NOT NULL($12), $12, 0)], $f3=[-($9, CASE(IS NOT NULL($13), $13, 0))])
+                HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(s_store_sk=[$0], s_store_id=[$1])
                     HiveFilter(condition=[IS NOT NULL($0)])
                       HiveTableScan(table=[[default, store]], table:alias=[store])
-                  HiveJoin(condition=[=($5, $15)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveProject(i_item_sk=[$0], i_current_price=[$5])
+                  HiveJoin(condition=[=($4, $13)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveProject(i_item_sk=[$0])
                         HiveFilter(condition=[AND(>($5, 50), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, item]], table:alias=[item])
                       HiveJoin(condition=[=($0, $11)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -240,22 +240,22 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                           HiveProject(sr_item_sk=[$2], sr_ticket_number=[$9], sr_return_amt=[$11], sr_net_loss=[$19])
                             HiveFilter(condition=[IS NOT NULL($2)])
                               HiveTableScan(table=[[default, store_returns]], table:alias=[store_returns])
-                        HiveProject(d_date_sk=[$0], d_date=[$2])
+                        HiveProject(d_date_sk=[$0])
                           HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-09-03 00:00:00), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                    HiveProject(p_promo_sk=[$0], p_channel_tv=[CAST(_UTF-16LE'N'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                    HiveProject(p_promo_sk=[$0])
                       HiveFilter(condition=[AND(=($11, _UTF-16LE'N'), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
           HiveProject(channel=[_UTF-16LE'catalog channel'], id=[||(_UTF-16LE'catalog_page', $0)], sales=[$1], returns=[$2], profit=[$3])
             HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)], agg#2=[sum($3)])
-              HiveProject($f0=[$1], $f1=[$9], $f2=[CASE(IS NOT NULL($13), $13, 0)], $f3=[-($10, CASE(IS NOT NULL($14), $14, 0))])
-                HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveProject($f0=[$1], $f1=[$8], $f2=[CASE(IS NOT NULL($12), $12, 0)], $f3=[-($9, CASE(IS NOT NULL($13), $13, 0))])
+                HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
                   HiveProject(cp_catalog_page_sk=[$0], cp_catalog_page_id=[$1])
                     HiveFilter(condition=[IS NOT NULL($0)])
                       HiveTableScan(table=[[default, catalog_page]], table:alias=[catalog_page])
-                  HiveJoin(condition=[=($5, $15)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveJoin(condition=[=($4, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveProject(i_item_sk=[$0], i_current_price=[$5])
+                  HiveJoin(condition=[=($4, $13)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveProject(i_item_sk=[$0])
                         HiveFilter(condition=[AND(>($5, 50), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, item]], table:alias=[item])
                       HiveJoin(condition=[=($0, $11)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -266,22 +266,22 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                           HiveProject(cr_item_sk=[$2], cr_order_number=[$16], cr_return_amount=[$18], cr_net_loss=[$26])
                             HiveFilter(condition=[IS NOT NULL($2)])
                               HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
-                        HiveProject(d_date_sk=[$0], d_date=[$2])
+                        HiveProject(d_date_sk=[$0])
                           HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-09-03 00:00:00), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-                    HiveProject(p_promo_sk=[$0], p_channel_tv=[CAST(_UTF-16LE'N'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+                    HiveProject(p_promo_sk=[$0])
                       HiveFilter(condition=[AND(=($11, _UTF-16LE'N'), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
           HiveProject(channel=[_UTF-16LE'web channel'], id=[||(_UTF-16LE'web_site', $0)], sales=[$1], returns=[$2], profit=[$3])
             HiveAggregate(group=[{0}], agg#0=[sum($1)], agg#1=[sum($2)], agg#2=[sum($3)])
-              HiveProject($f0=[$18], $f1=[$9], $f2=[CASE(IS NOT NULL($13), $13, 0)], $f3=[-($10, CASE(IS NOT NULL($14), $14, 0))])
-                HiveJoin(condition=[=($6, $17)], joinType=[inner], algorithm=[none], cost=[not available])
-                  HiveJoin(condition=[=($7, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                    HiveProject(p_promo_sk=[$0], p_channel_tv=[CAST(_UTF-16LE'N'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+              HiveProject($f0=[$15], $f1=[$7], $f2=[CASE(IS NOT NULL($11), $11, 0)], $f3=[-($8, CASE(IS NOT NULL($12), $12, 0))])
+                HiveJoin(condition=[=($4, $14)], joinType=[inner], algorithm=[none], cost=[not available])
+                  HiveJoin(condition=[=($5, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                    HiveProject(p_promo_sk=[$0])
                       HiveFilter(condition=[AND(=($11, _UTF-16LE'N'), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, promotion]], table:alias=[promotion])
-                    HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-                      HiveProject(i_item_sk=[$0], i_current_price=[$5])
+                    HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+                      HiveProject(i_item_sk=[$0])
                         HiveFilter(condition=[AND(>($5, 50), IS NOT NULL($0))])
                           HiveTableScan(table=[[default, item]], table:alias=[item])
                       HiveJoin(condition=[=($0, $11)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -292,7 +292,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                           HiveProject(wr_item_sk=[$2], wr_order_number=[$13], wr_return_amt=[$15], wr_net_loss=[$23])
                             HiveFilter(condition=[IS NOT NULL($2)])
                               HiveTableScan(table=[[default, web_returns]], table:alias=[web_returns])
-                        HiveProject(d_date_sk=[$0], d_date=[$2])
+                        HiveProject(d_date_sk=[$0])
                           HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 1998-08-04 00:00:00, 1998-09-03 00:00:00), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
                   HiveProject(web_site_sk=[$0], web_site_id=[$1])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query81.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query81.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query81.q.out
index e13017f..0adb555 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query81.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query81.q.out
@@ -71,13 +71,13 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveProject(c_customer_id=[$0], c_salutation=[$1], c_first_name=[$2], c_last_name=[$3], ca_street_number=[$4], ca_street_name=[$5], ca_street_type=[$6], ca_suite_number=[$7], ca_city=[$8], ca_county=[$9], ca_state=[CAST(_UTF-16LE'IL'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], ca_zip=[$10], ca_country=[$11], ca_gmt_offset=[$12], ca_location_type=[$13], ctr_total_return=[$14])
   HiveSortLimit(sort0=[$0], sort1=[$1], sort2=[$2], sort3=[$3], sort4=[$4], sort5=[$5], sort6=[$6], sort7=[$7], sort8=[$8], sort9=[$9], sort10=[$10], sort11=[$11], sort12=[$12], sort13=[$13], sort14=[$14], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], dir4=[ASC], dir5=[ASC], dir6=[ASC], dir7=[ASC], dir8=[ASC], dir9=[ASC], dir10=[ASC], dir11=[ASC], dir12=[ASC], dir13=[ASC], dir14=[ASC], fetch=[100])
-    HiveProject(c_customer_id=[$1], c_salutation=[$3], c_first_name=[$4], c_last_name=[$5], ca_street_number=[$7], ca_street_name=[$8], ca_street_type=[$9], ca_suite_number=[$10], ca_city=[$11], ca_county=[$12], ca_zip=[$14], ca_country=[$15], ca_gmt_offset=[$16], ca_location_type=[$17], ctr_total_return=[$20])
-      HiveJoin(condition=[=($18, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+    HiveProject(c_customer_id=[$1], c_salutation=[$3], c_first_name=[$4], c_last_name=[$5], ca_street_number=[$7], ca_street_name=[$8], ca_street_type=[$9], ca_suite_number=[$10], ca_city=[$11], ca_county=[$12], ca_zip=[$13], ca_country=[$14], ca_gmt_offset=[$15], ca_location_type=[$16], ctr_total_return=[$19])
+      HiveJoin(condition=[=($17, $0)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($6, $2)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(c_customer_sk=[$0], c_customer_id=[$1], c_current_addr_sk=[$4], c_salutation=[$7], c_first_name=[$8], c_last_name=[$9])
             HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($0))])
               HiveTableScan(table=[[default, customer]], table:alias=[customer])
-          HiveProject(ca_address_sk=[$0], ca_street_number=[$2], ca_street_name=[$3], ca_street_type=[$4], ca_suite_number=[$5], ca_city=[$6], ca_county=[$7], ca_state=[CAST(_UTF-16LE'IL'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"], ca_zip=[$9], ca_country=[$10], ca_gmt_offset=[$11], ca_location_type=[$12])
+          HiveProject(ca_address_sk=[$0], ca_street_number=[$2], ca_street_name=[$3], ca_street_type=[$4], ca_suite_number=[$5], ca_city=[$6], ca_county=[$7], ca_zip=[$9], ca_country=[$10], ca_gmt_offset=[$11], ca_location_type=[$12])
             HiveFilter(condition=[AND(=($8, _UTF-16LE'IL'), IS NOT NULL($0))])
               HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
         HiveProject(cr_returning_customer_sk=[$0], ca_state=[$1], $f2=[$2], _o__c0=[$3], ctr_state=[$4])
@@ -92,7 +92,7 @@ HiveProject(c_customer_id=[$0], c_salutation=[$1], c_first_name=[$2], c_last_nam
                     HiveProject(cr_returned_date_sk=[$0], cr_returning_customer_sk=[$7], cr_returning_addr_sk=[$10], cr_return_amt_inc_tax=[$20])
                       HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($10), IS NOT NULL($7))])
                         HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
-                    HiveProject(d_date_sk=[$0], d_year=[CAST(1998):INTEGER])
+                    HiveProject(d_date_sk=[$0])
                       HiveFilter(condition=[AND(=($6, 1998), IS NOT NULL($0))])
                         HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
             HiveProject(_o__c0=[*(/($1, $2), 1.2)], ctr_state=[$0])
@@ -107,7 +107,7 @@ HiveProject(c_customer_id=[$0], c_salutation=[$1], c_first_name=[$2], c_last_nam
                         HiveProject(cr_returned_date_sk=[$0], cr_returning_customer_sk=[$7], cr_returning_addr_sk=[$10], cr_return_amt_inc_tax=[$20])
                           HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($10))])
                             HiveTableScan(table=[[default, catalog_returns]], table:alias=[catalog_returns])
-                        HiveProject(d_date_sk=[$0], d_year=[CAST(1998):INTEGER])
+                        HiveProject(d_date_sk=[$0])
                           HiveFilter(condition=[AND(=($6, 1998), IS NOT NULL($0))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query82.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query82.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query82.q.out
index 08d9992..a60312f 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query82.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query82.q.out
@@ -44,20 +44,20 @@ CBO PLAN:
 HiveSortLimit(sort0=[$0], dir0=[ASC], fetch=[100])
   HiveProject(i_item_id=[$0], i_item_desc=[$1], i_current_price=[$2])
     HiveAggregate(group=[{2, 3, 4}])
-      HiveJoin(condition=[=($7, $1)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveJoin(condition=[=($6, $1)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($0, $1)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(ss_item_sk=[$2])
             HiveFilter(condition=[IS NOT NULL($2)])
               HiveTableScan(table=[[default, store_sales]], table:alias=[store_sales])
-          HiveProject(i_item_sk=[$0], i_item_id=[$1], i_item_desc=[$4], i_current_price=[$5], i_manufact_id=[$13])
+          HiveProject(i_item_sk=[$0], i_item_id=[$1], i_item_desc=[$4], i_current_price=[$5])
             HiveFilter(condition=[AND(IN($13, 437, 129, 727, 663), BETWEEN(false, $5, 30, 60), IS NOT NULL($0))])
               HiveTableScan(table=[[default, item]], table:alias=[item])
-        HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], inv_quantity_on_hand=[$2], d_date_sk=[$3], d_date=[$4])
-          HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], inv_quantity_on_hand=[$3])
+        HiveProject(inv_date_sk=[$0], inv_item_sk=[$1], d_date_sk=[$2])
+          HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveProject(inv_date_sk=[$0], inv_item_sk=[$1])
               HiveFilter(condition=[AND(BETWEEN(false, $3, 100, 500), IS NOT NULL($1), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, inventory]], table:alias=[inventory])
-            HiveProject(d_date_sk=[$0], d_date=[$2])
+            HiveProject(d_date_sk=[$0])
               HiveFilter(condition=[AND(BETWEEN(false, CAST($2):TIMESTAMP(9), 2002-05-30 00:00:00, 2002-07-29 00:00:00), IS NOT NULL($0))])
                 HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query83.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query83.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query83.q.out
index d5a3d66..0e61e45 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query83.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query83.q.out
@@ -144,10 +144,10 @@ POSTHOOK: Input: default@web_returns
 POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
-  HiveProject(item_id=[$0], sr_item_qty=[$3], sr_dev=[*(/(/(CAST($3):DOUBLE, CAST(+(+($3, $1), $5)):DOUBLE), CAST(3):DOUBLE), CAST(100):DOUBLE)], cr_item_qty=[$1], cr_dev=[*(/(/(CAST($1):DOUBLE, CAST(+(+($3, $1), $5)):DOUBLE), CAST(3):DOUBLE), CAST(100):DOUBLE)], wr_item_qty=[$5], wr_dev=[*(/(/(CAST($5):DOUBLE, CAST(+(+($3, $1), $5)):DOUBLE), CAST(3):DOUBLE), CAST(100):DOUBLE)], average=[/(CAST(+(+($3, $1), $5)):DECIMAL(19, 0), 3)])
-    HiveJoin(condition=[=($0, $4)], joinType=[inner], algorithm=[none], cost=[not available])
-      HiveJoin(condition=[=($2, $0)], joinType=[inner], algorithm=[none], cost=[not available])
-        HiveProject(i_item_id=[$0], $f1=[$1])
+  HiveProject(item_id=[$0], sr_item_qty=[$4], sr_dev=[*(/(/($5, CAST(+(+($4, $1), $7)):DOUBLE), CAST(3):DOUBLE), CAST(100):DOUBLE)], cr_item_qty=[$1], cr_dev=[*(/(/($2, CAST(+(+($4, $1), $7)):DOUBLE), CAST(3):DOUBLE), CAST(100):DOUBLE)], wr_item_qty=[$7], wr_dev=[*(/(/($8, CAST(+(+($4, $1), $7)):DOUBLE), CAST(3):DOUBLE), CAST(100):DOUBLE)], average=[/(CAST(+(+($4, $1), $7)):DECIMAL(19, 0), 3)])
+    HiveJoin(condition=[=($0, $6)], joinType=[inner], algorithm=[none], cost=[not available])
+      HiveJoin(condition=[=($3, $0)], joinType=[inner], algorithm=[none], cost=[not available])
+        HiveProject($f0=[$0], $f1=[$1], CAST=[CAST($1):DOUBLE])
           HiveAggregate(group=[{4}], agg#0=[sum($2)])
             HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -171,7 +171,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                         HiveProject(d_date_sk=[$0], d_date_id=[$1], d_date=[$2], d_month_seq=[$3], d_week_seq=[$4], d_quarter_seq=[$5], d_year=[$6], d_dow=[$7], d_moy=[$8], d_dom=[$9], d_qoy=[$10], d_fy_year=[$11], d_fy_quarter_seq=[$12], d_fy_week_seq=[$13], d_day_name=[$14], d_quarter_name=[$15], d_holiday=[$16], d_weekend=[$17], d_following_holiday=[$18], d_first_dom=[$19], d_last_dom=[$20], d_same_day_ly=[$21], d_same_day_lq=[$22], d_current_day=[$23], d_current_week=[$24], d_current_month=[$25], d_current_quarter=[$26], d_current_year=[$27], BLOCK__OFFSET__INSIDE__FILE=[$28], INPUT__FILE__NAME=[$29], ROW__ID=[$30])
                           HiveFilter(condition=[AND(IN($2, _UTF-16LE'1998-01-02', _UTF-16LE'1998-10-15', _UTF-16LE'1998-11-10'), IS NOT NULL($4))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-        HiveProject(i_item_id=[$0], $f1=[$1])
+        HiveProject($f0=[$0], $f1=[$1], CAST=[CAST($1):DOUBLE])
           HiveAggregate(group=[{4}], agg#0=[sum($2)])
             HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
               HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
@@ -195,7 +195,7 @@ HiveSortLimit(sort0=[$0], sort1=[$1], dir0=[ASC], dir1=[ASC], fetch=[100])
                         HiveProject(d_date_sk=[$0], d_date_id=[$1], d_date=[$2], d_month_seq=[$3], d_week_seq=[$4], d_quarter_seq=[$5], d_year=[$6], d_dow=[$7], d_moy=[$8], d_dom=[$9], d_qoy=[$10], d_fy_year=[$11], d_fy_quarter_seq=[$12], d_fy_week_seq=[$13], d_day_name=[$14], d_quarter_name=[$15], d_holiday=[$16], d_weekend=[$17], d_following_holiday=[$18], d_first_dom=[$19], d_last_dom=[$20], d_same_day_ly=[$21], d_same_day_lq=[$22], d_current_day=[$23], d_current_week=[$24], d_current_month=[$25], d_current_quarter=[$26], d_current_year=[$27], BLOCK__OFFSET__INSIDE__FILE=[$28], INPUT__FILE__NAME=[$29], ROW__ID=[$30])
                           HiveFilter(condition=[AND(IN($2, _UTF-16LE'1998-01-02', _UTF-16LE'1998-10-15', _UTF-16LE'1998-11-10'), IS NOT NULL($4))])
                             HiveTableScan(table=[[default, date_dim]], table:alias=[date_dim])
-      HiveProject(i_item_id=[$0], $f1=[$1])
+      HiveProject($f0=[$0], $f1=[$1], CAST=[CAST($1):DOUBLE])
         HiveAggregate(group=[{4}], agg#0=[sum($2)])
           HiveJoin(condition=[=($0, $5)], joinType=[inner], algorithm=[none], cost=[not available])
             HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/cbo_query84.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query84.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query84.q.out
index de765ab..006f703 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query84.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query84.q.out
@@ -55,7 +55,7 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 CBO PLAN:
 HiveProject(customer_id=[$0], customername=[$1])
   HiveSortLimit(sort0=[$2], dir0=[ASC], fetch=[100])
-    HiveProject(customer_id=[$2], customername=[||(||($7, _UTF-16LE', '), $6)], c_customer_id=[$2])
+    HiveProject(customer_id=[$2], customername=[$6], c_customer_id=[$2])
       HiveJoin(condition=[=($1, $3)], joinType=[inner], algorithm=[none], cost=[not available])
         HiveJoin(condition=[=($0, $1)], joinType=[inner], algorithm=[none], cost=[not available])
           HiveProject(sr_cdemo_sk=[$4])
@@ -64,21 +64,21 @@ HiveProject(customer_id=[$0], customername=[$1])
           HiveProject(cd_demo_sk=[$0])
             HiveFilter(condition=[IS NOT NULL($0)])
               HiveTableScan(table=[[default, customer_demographics]], table:alias=[customer_demographics])
-        HiveProject(c_customer_id=[$0], c_current_cdemo_sk=[$1], c_current_hdemo_sk=[$2], c_current_addr_sk=[$3], c_first_name=[$4], c_last_name=[$5], ca_address_sk=[$6], ca_city=[$7], hd_demo_sk=[$8], hd_income_band_sk=[$9], ib_income_band_sk=[$10], ib_lower_bound=[$11], ib_upper_bound=[$12])
-          HiveJoin(condition=[=($8, $2)], joinType=[inner], algorithm=[none], cost=[not available])
-            HiveJoin(condition=[=($3, $6)], joinType=[inner], algorithm=[none], cost=[not available])
-              HiveProject(c_customer_id=[$1], c_current_cdemo_sk=[$2], c_current_hdemo_sk=[$3], c_current_addr_sk=[$4], c_first_name=[$8], c_last_name=[$9])
+        HiveProject(c_customer_id=[$0], c_current_cdemo_sk=[$1], c_current_hdemo_sk=[$2], c_current_addr_sk=[$3], ||=[$4], ca_address_sk=[$5], hd_demo_sk=[$6], hd_income_band_sk=[$7], ib_income_band_sk=[$8])
+          HiveJoin(condition=[=($6, $2)], joinType=[inner], algorithm=[none], cost=[not available])
+            HiveJoin(condition=[=($3, $5)], joinType=[inner], algorithm=[none], cost=[not available])
+              HiveProject(c_customer_id=[$1], c_current_cdemo_sk=[$2], c_current_hdemo_sk=[$3], c_current_addr_sk=[$4], ||=[||(||($9, _UTF-16LE', '), $8)])
                 HiveFilter(condition=[AND(IS NOT NULL($4), IS NOT NULL($2), IS NOT NULL($3))])
                   HiveTableScan(table=[[default, customer]], table:alias=[customer])
-              HiveProject(ca_address_sk=[$0], ca_city=[CAST(_UTF-16LE'Hopewell'):VARCHAR(2147483647) CHARACTER SET "UTF-16LE" COLLATE "ISO-8859-1$en_US$primary"])
+              HiveProject(ca_address_sk=[$0])
                 HiveFilter(condition=[AND(=($6, _UTF-16LE'Hopewell'), IS NOT NULL($0))])
                   HiveTableScan(table=[[default, customer_address]], table:alias=[customer_address])
-            HiveProject(hd_demo_sk=[$0], hd_income_band_sk=[$1], ib_income_band_sk=[$2], ib_lower_bound=[$3], ib_upper_bound=[$4])
+            HiveProject(hd_demo_sk=[$0], hd_income_band_sk=[$1], ib_income_band_sk=[$2])
               HiveJoin(condition=[=($2, $1)], joinType=[inner], algorithm=[none], cost=[not available])
                 HiveProject(hd_demo_sk=[$0], hd_income_band_sk=[$1])
                   HiveFilter(condition=[AND(IS NOT NULL($0), IS NOT NULL($1))])
                     HiveTableScan(table=[[default, household_demographics]], table:alias=[household_demographics])
-                HiveProject(ib_income_band_sk=[$0], ib_lower_bound=[$1], ib_upper_bound=[$2])
+                HiveProject(ib_income_band_sk=[$0])
                   HiveFilter(condition=[AND(>=($1, 32287), <=($2, 82287), IS NOT NULL($0))])
                     HiveTableScan(table=[[default, income_band]], table:alias=[income_band])
 


[32/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/mapjoin47.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/mapjoin47.q.out b/ql/src/test/results/clientpositive/mapjoin47.q.out
index d3e61f8..dadac0d 100644
--- a/ql/src/test/results/clientpositive/mapjoin47.q.out
+++ b/ql/src/test/results/clientpositive/mapjoin47.q.out
@@ -385,8 +385,8 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(value) BETWEEN 100.0D AND 102.0D (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -400,8 +400,8 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(value) BETWEEN 100.0D AND 102.0D (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -409,19 +409,23 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
-                residual filter predicates: {((_col0 = _col2) or UDFToDouble(_col1) BETWEEN 100.0D AND 102.0D or UDFToDouble(_col3) BETWEEN 100.0D AND 102.0D)}
-                Statistics: Num rows: 9026 Data size: 173876 Basic stats: COMPLETE Column stats: NONE
-                Limit
-                  Number of rows: 10
-                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                residual filter predicates: {((_col0 = _col3) or _col2 or _col5)}
+                Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 12500 Data size: 240800 Basic stats: COMPLETE Column stats: NONE
+                  Limit
+                    Number of rows: 10
                     Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -501,8 +505,8 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -516,8 +520,8 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -525,19 +529,23 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
-                residual filter predicates: {((UDFToDouble(_col0) + UDFToDouble(_col2)) >= 100.0D)} {((UDFToDouble(_col0) + UDFToDouble(_col2)) <= 102.0D)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                residual filter predicates: {((_col2 + _col5) >= 100.0D)} {((_col2 + _col5) <= 102.0D)}
                 Statistics: Num rows: 1388 Data size: 26738 Basic stats: COMPLETE Column stats: NONE
-                Limit
-                  Number of rows: 10
-                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 1388 Data size: 26738 Basic stats: COMPLETE Column stats: NONE
+                  Limit
+                    Number of rows: 10
                     Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -611,8 +619,8 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -626,8 +634,8 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -635,19 +643,23 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
-                residual filter predicates: {(((UDFToDouble(_col0) + UDFToDouble(_col2)) >= 100.0D) or ((UDFToDouble(_col0) + UDFToDouble(_col2)) <= 102.0D))}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                residual filter predicates: {(((_col2 + _col5) >= 100.0D) or ((_col2 + _col5) <= 102.0D))}
                 Statistics: Num rows: 8332 Data size: 160507 Basic stats: COMPLETE Column stats: NONE
-                Limit
-                  Number of rows: 10
-                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 8332 Data size: 160507 Basic stats: COMPLETE Column stats: NONE
+                  Limit
+                    Number of rows: 10
                     Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -723,8 +735,8 @@ STAGE PLANS:
             alias: src1
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -738,8 +750,8 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -747,19 +759,23 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
-                residual filter predicates: {(struct(UDFToDouble(_col0),UDFToDouble(_col2))) IN (const struct(100.0D,100.0D), const struct(101.0D,101.0D), const struct(102.0D,102.0D))}
-                Statistics: Num rows: 6250 Data size: 120400 Basic stats: COMPLETE Column stats: NONE
-                Limit
-                  Number of rows: 10
-                  Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                  File Output Operator
-                    compressed: false
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                residual filter predicates: {(struct(_col2,_col5)) IN (const struct(100.0D,100.0D), const struct(101.0D,101.0D), const struct(102.0D,102.0D))}
+                Statistics: Num rows: 9375 Data size: 180600 Basic stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 9375 Data size: 180600 Basic stats: COMPLETE Column stats: NONE
+                  Limit
+                    Number of rows: 10
                     Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                    table:
-                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                    File Output Operator
+                      compressed: false
+                      Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                      table:
+                          input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                          output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -840,8 +856,8 @@ STAGE PLANS:
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -855,8 +871,8 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -864,7 +880,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -872,11 +888,11 @@ STAGE PLANS:
                   keys:
                     0 
                     1 
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                  residual filter predicates: {((UDFToDouble(_col4) + UDFToDouble(_col0)) >= 100.0D)}
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  residual filter predicates: {((_col7 + _col2) >= 100.0D)}
                   Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col0 (type: string), _col1 (type: string), _col4 (type: string), _col5 (type: string), _col2 (type: string), _col3 (type: string)
+                    expressions: _col0 (type: string), _col1 (type: string), _col5 (type: string), _col6 (type: string), _col3 (type: string), _col4 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                     Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
                     Limit
@@ -981,8 +997,8 @@ STAGE PLANS:
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -996,8 +1012,8 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -1005,7 +1021,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -1013,19 +1029,23 @@ STAGE PLANS:
                   keys:
                     0 
                     1 
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                  residual filter predicates: {((UDFToDouble(_col4) + UDFToDouble(_col0)) <= 102.0D)}
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  residual filter predicates: {((_col7 + _col2) <= 102.0D)}
                   Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
-                  Limit
-                    Number of rows: 10
-                    Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                    File Output Operator
-                      compressed: false
+                  Select Operator
+                    expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                    Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
+                    Limit
+                      Number of rows: 10
                       Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                      table:
-                          input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                          output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                      File Output Operator
+                        compressed: false
+                        Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                        table:
+                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -1064,7 +1084,7 @@ POSTHOOK: Input: default@src1
 4	val_4	NULL	NULL	66	val_66
 35	val_35	NULL	NULL	66	val_66
 12	val_12	NULL	NULL	66	val_66
-Warning: Map Join MAPJOIN[26][bigTable=?] in task 'Stage-7:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[27][bigTable=?] in task 'Stage-7:MAPRED' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM src
@@ -1098,17 +1118,17 @@ STAGE PLANS:
   Stage: Stage-9
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        $hdt$_1:a 
+        $hdt$_0:$hdt$_1:a 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        $hdt$_1:a 
+        $hdt$_0:$hdt$_1:a 
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -1122,8 +1142,8 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -1131,15 +1151,19 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
-                residual filter predicates: {((UDFToDouble(_col2) + UDFToDouble(_col0)) >= 100.0D)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                residual filter predicates: {((_col5 + _col2) >= 100.0D)}
                 Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
       Local Work:
         Map Reduce Local Work
 
@@ -1241,7 +1265,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Map Join MAPJOIN[26][bigTable=?] in task 'Stage-7:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[27][bigTable=?] in task 'Stage-7:MAPRED' is a cross product
 PREHOOK: query: SELECT *
 FROM src
 JOIN src1 a ON (a.key+src.key >= 100)
@@ -1312,8 +1336,8 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -1324,8 +1348,8 @@ STAGE PLANS:
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -1348,7 +1372,7 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -1356,19 +1380,23 @@ STAGE PLANS:
                   keys:
                     0 
                     1 
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                  residual filter predicates: {((UDFToDouble(_col4) + UDFToDouble(_col0)) <= 102.0D)}
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  residual filter predicates: {((_col7 + _col2) <= 102.0D)}
                   Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
-                  Limit
-                    Number of rows: 10
-                    Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                    File Output Operator
-                      compressed: false
+                  Select Operator
+                    expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                    Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
+                    Limit
+                      Number of rows: 10
                       Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                      table:
-                          input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                          output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                      File Output Operator
+                        compressed: false
+                        Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                        table:
+                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -1397,7 +1425,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Input: default@src1
 #### A masked pattern was here ####
-Warning: Map Join MAPJOIN[17][bigTable=?] in task 'Stage-2:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[18][bigTable=?] in task 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM src
@@ -1427,17 +1455,17 @@ STAGE PLANS:
   Stage: Stage-6
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        $hdt$_1:a 
+        $hdt$_0:$hdt$_1:a 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        $hdt$_1:a 
+        $hdt$_0:$hdt$_1:a 
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -1464,8 +1492,8 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Map Join Operator
                 condition map:
@@ -1473,15 +1501,19 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
-                residual filter predicates: {((UDFToDouble(_col2) + UDFToDouble(_col0)) >= 100.0D)}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                residual filter predicates: {((_col5 + _col2) >= 100.0D)}
                 Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string)
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 4166 Data size: 80253 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string)
       Local Work:
         Map Reduce Local Work
       Reduce Operator Tree:
@@ -1510,7 +1542,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Map Join MAPJOIN[17][bigTable=?] in task 'Stage-2:MAPRED' is a cross product
+Warning: Map Join MAPJOIN[18][bigTable=?] in task 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: SELECT *
 FROM src
 JOIN src1 a ON (a.key+src.key >= 100)
@@ -1574,15 +1606,15 @@ STAGE PLANS:
             alias: src
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: string)
                 sort order: +
                 Map-reduce partition columns: _col0 (type: string)
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: string)
+                value expressions: _col1 (type: string), _col2 (type: double)
           TableScan
             alias: a
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -1603,7 +1635,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -1624,8 +1656,8 @@ STAGE PLANS:
             alias: b
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -1642,19 +1674,23 @@ STAGE PLANS:
               keys:
                 0 
                 1 
-              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-              residual filter predicates: {((UDFToDouble(_col4) + UDFToDouble(_col0)) <= 102.0D)}
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+              residual filter predicates: {((_col7 + _col2) <= 102.0D)}
               Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
-              Limit
-                Number of rows: 10
-                Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+              Select Operator
+                expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                Statistics: Num rows: 4583 Data size: 88285 Basic stats: COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 10
                   Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 190 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Local Work:
         Map Reduce Local Work
 
@@ -1727,10 +1763,10 @@ STAGE PLANS:
   Stage: Stage-8
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        $hdt$_0:t3 
+        $hdt$_0:t5 
           Fetch Operator
             limit: -1
-        $hdt$_1:t5 
+        $hdt$_1:t3 
           Fetch Operator
             limit: -1
         $hdt$_2:t4 
@@ -1740,13 +1776,13 @@ STAGE PLANS:
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        $hdt$_0:t3 
+        $hdt$_0:t5 
           TableScan
-            alias: t3
+            alias: t5
             Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
-              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+              expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string), (c_int = 42) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
               Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
               HashTable Sink Operator
                 keys:
@@ -1754,9 +1790,9 @@ STAGE PLANS:
                   1 
                   2 
                   3 
-        $hdt$_1:t5 
+        $hdt$_1:t3 
           TableScan
-            alias: t5
+            alias: t3
             Statistics: Num rows: 20 Data size: 262 Basic stats: COMPLETE Column stats: NONE
             Select Operator
               expressions: key (type: string), value (type: string), c_int (type: int), c_float (type: float), c_boolean (type: boolean), dt (type: string)
@@ -1823,11 +1859,11 @@ STAGE PLANS:
                     1 
                     2 
                     3 
-                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29
-                  residual filter predicates: {((_col6 = _col24) or ((_col28 = _col16) and (_col8 = 42)))} {((_col12 = _col24) or ((_col27 = _col15) and (_col13 = _col25)))} {((_col0 = _col24) or ((_col1 = _col25) and (_col26 = _col20)))}
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29, _col30
+                  residual filter predicates: {((_col0 = _col25) or ((_col29 = _col17) and _col6))} {((_col13 = _col25) or ((_col28 = _col16) and (_col14 = _col26)))} {((_col7 = _col25) or ((_col8 = _col26) and (_col27 = _col21)))}
                   Statistics: Num rows: 74250 Data size: 3964275 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col18 (type: string), _col19 (type: string), _col20 (type: int), _col21 (type: float), _col22 (type: boolean), _col23 (type: string), _col24 (type: string), _col25 (type: string), _col26 (type: int), _col27 (type: float), _col28 (type: boolean), _col29 (type: string), _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: float), _col16 (type: boolean), _col17 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: int), _col9 (type: float), _col10 (type: boolean), _col11 (type: string)
+                    expressions: _col19 (type: string), _col20 (type: string), _col21 (type: int), _col22 (type: float), _col23 (type: boolean), _col24 (type: string), _col25 (type: string), _col26 (type: string), _col27 (type: int), _col28 (type: float), _col29 (type: boolean), _col30 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: int), _col10 (type: float), _col11 (type: boolean), _col12 (type: string), _col13 (type: string), _col14 (type: string), _col15 (type: int), _col16 (type: float), _col17 (type: boolean), _col18 (type: string), _col0 (type: string), _col1 (type: string), _col2 (type: int), _col3 (type: float), _col4 (type: boolean), _col5 (type: string)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26, _col27, _col28, _col29
                     Statistics: Num rows: 74250 Data size: 3964275 Basic stats: COMPLETE Column stats: NONE
                     Limit

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/masking_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/masking_1.q.out b/ql/src/test/results/clientpositive/masking_1.q.out
index 95ed32a..ec83e0c 100644
--- a/ql/src/test/results/clientpositive/masking_1.q.out
+++ b/ql/src/test/results/clientpositive/masking_1.q.out
@@ -259,13 +259,13 @@ STAGE PLANS:
               predicate: (((key % 2) = 0) and (key < 10)) (type: boolean)
               Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: int), reverse(value) (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: int), reverse(value) (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col2 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col2 (type: double)
                   Statistics: Num rows: 83 Data size: 881 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: int), _col1 (type: string)
           TableScan
@@ -276,13 +276,13 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string), ds (type: string), hr (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                expressions: key (type: string), value (type: string), ds (type: string), hr (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col4 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col4 (type: double)
                   Statistics: Num rows: 2000 Data size: 21248 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
       Reduce Operator Tree:
@@ -290,17 +290,21 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+            0 _col2 (type: double)
+            1 _col4 (type: double)
+          outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6
           Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 2200 Data size: 23372 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/masking_12.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/masking_12.q.out b/ql/src/test/results/clientpositive/masking_12.q.out
index 21bfd07..9ecd981 100644
--- a/ql/src/test/results/clientpositive/masking_12.q.out
+++ b/ql/src/test/results/clientpositive/masking_12.q.out
@@ -162,12 +162,16 @@ STAGE PLANS:
           mode: mergepartial
           outputColumnNames: _col0
           Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -180,20 +184,20 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col1 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col1 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string)
           TableScan
             Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
+              key expressions: _col1 (type: double)
               sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Map-reduce partition columns: _col1 (type: double)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: int)
       Reduce Operator Tree:
@@ -201,21 +205,25 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1
+            0 _col1 (type: double)
+            1 _col1 (type: double)
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Group By Operator
-            keys: _col0 (type: string), _col1 (type: int)
-            mode: hash
+          Select Operator
+            expressions: _col0 (type: string), _col2 (type: int)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            Group By Operator
+              keys: _col0 (type: string), _col1 (type: int)
+              mode: hash
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-1
     Map Reduce


[07/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query75.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query75.q.out b/ql/src/test/results/clientpositive/perf/tez/query75.q.out
index 9968ade..f4bd046 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query75.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query75.q.out
@@ -244,7 +244,7 @@ Stage-0
                                           Select Operator [SEL_539] (rows=170474971 width=131)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                             Merge Join Operator [MERGEJOIN_538] (rows=170474971 width=234)
-                                              Conds:RS_103._col1, _col2=RS_625._col0, _col1(Left Outer),Output:["_col3","_col4","_col8","_col9","_col10","_col12","_col15","_col16"]
+                                              Conds:RS_103._col1, _col2=RS_625._col0, _col1(Left Outer),Output:["_col3","_col4","_col7","_col8","_col9","_col10","_col13","_col14"]
                                             <-Map 44 [SIMPLE_EDGE] vectorized
                                               SHUFFLE [RS_625]
                                                 PartitionCols:_col0, _col1
@@ -258,12 +258,12 @@ Stage-0
                                               SHUFFLE [RS_103]
                                                 PartitionCols:_col1, _col2
                                                 Merge Join Operator [MERGEJOIN_510] (rows=96821196 width=138)
-                                                  Conds:RS_100._col1=RS_599._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col8","_col9","_col10","_col12"]
+                                                  Conds:RS_100._col1=RS_599._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col7","_col8","_col9","_col10"]
                                                 <-Map 37 [SIMPLE_EDGE] vectorized
                                                   PARTITION_ONLY_SHUFFLE [RS_599]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_592] (rows=45745 width=109)
-                                                      Output:["_col0","_col1","_col2","_col3","_col5"]
+                                                    Select Operator [SEL_592] (rows=45745 width=19)
+                                                      Output:["_col0","_col1","_col2","_col3","_col4"]
                                                       Filter Operator [FIL_591] (rows=45745 width=109)
                                                         predicate:((i_category = 'Sports') and i_brand_id is not null and i_category_id is not null and i_class_id is not null and i_item_sk is not null and i_manufact_id is not null)
                                                         TableScan [TS_6] (rows=462000 width=109)
@@ -276,7 +276,7 @@ Stage-0
                                                     <-Map 11 [SIMPLE_EDGE] vectorized
                                                       PARTITION_ONLY_SHUFFLE [RS_571]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_562] (rows=652 width=8)
+                                                        Select Operator [SEL_562] (rows=652 width=4)
                                                           Output:["_col0"]
                                                           Filter Operator [FIL_558] (rows=652 width=8)
                                                             predicate:((d_year = 2002) and d_date_sk is not null)
@@ -321,7 +321,7 @@ Stage-0
                                           Select Operator [SEL_548] (rows=450703984 width=131)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                             Merge Join Operator [MERGEJOIN_547] (rows=450703984 width=204)
-                                              Conds:RS_125._col1, _col2=RS_649._col0, _col1(Left Outer),Output:["_col3","_col4","_col8","_col9","_col10","_col12","_col15","_col16"]
+                                              Conds:RS_125._col1, _col2=RS_649._col0, _col1(Left Outer),Output:["_col3","_col4","_col7","_col8","_col9","_col10","_col13","_col14"]
                                             <-Map 46 [SIMPLE_EDGE] vectorized
                                               SHUFFLE [RS_649]
                                                 PartitionCols:_col0, _col1
@@ -335,7 +335,7 @@ Stage-0
                                               SHUFFLE [RS_125]
                                                 PartitionCols:_col1, _col2
                                                 Merge Join Operator [MERGEJOIN_513] (rows=187186493 width=124)
-                                                  Conds:RS_122._col1=RS_601._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col8","_col9","_col10","_col12"]
+                                                  Conds:RS_122._col1=RS_601._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col7","_col8","_col9","_col10"]
                                                 <-Map 37 [SIMPLE_EDGE] vectorized
                                                   PARTITION_ONLY_SHUFFLE [RS_601]
                                                     PartitionCols:_col0
@@ -348,7 +348,7 @@ Stage-0
                                                     <-Map 11 [SIMPLE_EDGE] vectorized
                                                       PARTITION_ONLY_SHUFFLE [RS_573]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_563] (rows=652 width=8)
+                                                        Select Operator [SEL_563] (rows=652 width=4)
                                                           Output:["_col0"]
                                                           Filter Operator [FIL_559] (rows=652 width=8)
                                                             predicate:((d_year = 2002) and d_date_sk is not null)
@@ -392,7 +392,7 @@ Stage-0
                                   Select Operator [SEL_553] (rows=115177968 width=131)
                                     Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                     Merge Join Operator [MERGEJOIN_552] (rows=115177968 width=220)
-                                      Conds:RS_154._col1, _col2=RS_660._col0, _col1(Left Outer),Output:["_col3","_col4","_col8","_col9","_col10","_col12","_col15","_col16"]
+                                      Conds:RS_154._col1, _col2=RS_660._col0, _col1(Left Outer),Output:["_col3","_col4","_col7","_col8","_col9","_col10","_col13","_col14"]
                                     <-Map 48 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_660]
                                         PartitionCols:_col0, _col1
@@ -406,7 +406,7 @@ Stage-0
                                       SHUFFLE [RS_154]
                                         PartitionCols:_col1, _col2
                                         Merge Join Operator [MERGEJOIN_516] (rows=48990732 width=139)
-                                          Conds:RS_151._col1=RS_603._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col8","_col9","_col10","_col12"]
+                                          Conds:RS_151._col1=RS_603._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col7","_col8","_col9","_col10"]
                                         <-Map 37 [SIMPLE_EDGE] vectorized
                                           PARTITION_ONLY_SHUFFLE [RS_603]
                                             PartitionCols:_col0
@@ -419,7 +419,7 @@ Stage-0
                                             <-Map 11 [SIMPLE_EDGE] vectorized
                                               PARTITION_ONLY_SHUFFLE [RS_575]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_564] (rows=652 width=8)
+                                                Select Operator [SEL_564] (rows=652 width=4)
                                                   Output:["_col0"]
                                                   Filter Operator [FIL_560] (rows=652 width=8)
                                                     predicate:((d_year = 2002) and d_date_sk is not null)
@@ -471,7 +471,7 @@ Stage-0
                                   Select Operator [SEL_534] (rows=115177968 width=131)
                                     Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                     Merge Join Operator [MERGEJOIN_533] (rows=115177968 width=220)
-                                      Conds:RS_69._col1, _col2=RS_659._col0, _col1(Left Outer),Output:["_col3","_col4","_col8","_col9","_col10","_col12","_col15","_col16"]
+                                      Conds:RS_69._col1, _col2=RS_659._col0, _col1(Left Outer),Output:["_col3","_col4","_col7","_col8","_col9","_col10","_col13","_col14"]
                                     <-Map 48 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_659]
                                         PartitionCols:_col0, _col1
@@ -480,7 +480,7 @@ Stage-0
                                       SHUFFLE [RS_69]
                                         PartitionCols:_col1, _col2
                                         Merge Join Operator [MERGEJOIN_507] (rows=48990732 width=139)
-                                          Conds:RS_66._col1=RS_597._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col8","_col9","_col10","_col12"]
+                                          Conds:RS_66._col1=RS_597._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col7","_col8","_col9","_col10"]
                                         <-Map 37 [SIMPLE_EDGE] vectorized
                                           PARTITION_ONLY_SHUFFLE [RS_597]
                                             PartitionCols:_col0
@@ -493,7 +493,7 @@ Stage-0
                                             <-Map 11 [SIMPLE_EDGE] vectorized
                                               PARTITION_ONLY_SHUFFLE [RS_569]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_561] (rows=652 width=8)
+                                                Select Operator [SEL_561] (rows=652 width=4)
                                                   Output:["_col0"]
                                                   Filter Operator [FIL_557] (rows=652 width=8)
                                                     predicate:((d_year = 2001) and d_date_sk is not null)
@@ -545,7 +545,7 @@ Stage-0
                                           Select Operator [SEL_529] (rows=450703984 width=131)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                             Merge Join Operator [MERGEJOIN_528] (rows=450703984 width=204)
-                                              Conds:RS_40._col1, _col2=RS_648._col0, _col1(Left Outer),Output:["_col3","_col4","_col8","_col9","_col10","_col12","_col15","_col16"]
+                                              Conds:RS_40._col1, _col2=RS_648._col0, _col1(Left Outer),Output:["_col3","_col4","_col7","_col8","_col9","_col10","_col13","_col14"]
                                             <-Map 46 [SIMPLE_EDGE] vectorized
                                               SHUFFLE [RS_648]
                                                 PartitionCols:_col0, _col1
@@ -554,7 +554,7 @@ Stage-0
                                               SHUFFLE [RS_40]
                                                 PartitionCols:_col1, _col2
                                                 Merge Join Operator [MERGEJOIN_504] (rows=187186493 width=124)
-                                                  Conds:RS_37._col1=RS_595._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col8","_col9","_col10","_col12"]
+                                                  Conds:RS_37._col1=RS_595._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col7","_col8","_col9","_col10"]
                                                 <-Map 37 [SIMPLE_EDGE] vectorized
                                                   PARTITION_ONLY_SHUFFLE [RS_595]
                                                     PartitionCols:_col0
@@ -607,7 +607,7 @@ Stage-0
                                           Select Operator [SEL_520] (rows=170474971 width=131)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                             Merge Join Operator [MERGEJOIN_519] (rows=170474971 width=234)
-                                              Conds:RS_18._col1, _col2=RS_624._col0, _col1(Left Outer),Output:["_col3","_col4","_col8","_col9","_col10","_col12","_col15","_col16"]
+                                              Conds:RS_18._col1, _col2=RS_624._col0, _col1(Left Outer),Output:["_col3","_col4","_col7","_col8","_col9","_col10","_col13","_col14"]
                                             <-Map 44 [SIMPLE_EDGE] vectorized
                                               SHUFFLE [RS_624]
                                                 PartitionCols:_col0, _col1
@@ -616,7 +616,7 @@ Stage-0
                                               SHUFFLE [RS_18]
                                                 PartitionCols:_col1, _col2
                                                 Merge Join Operator [MERGEJOIN_501] (rows=96821196 width=138)
-                                                  Conds:RS_15._col1=RS_593._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col8","_col9","_col10","_col12"]
+                                                  Conds:RS_15._col1=RS_593._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col7","_col8","_col9","_col10"]
                                                 <-Map 37 [SIMPLE_EDGE] vectorized
                                                   PARTITION_ONLY_SHUFFLE [RS_593]
                                                     PartitionCols:_col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query76.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query76.q.out b/ql/src/test/results/clientpositive/perf/tez/query76.q.out
index add0141..2e426a2 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query76.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query76.q.out
@@ -93,7 +93,7 @@ Stage-0
                         Select Operator [SEL_163] (rows=1433911 width=399)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                           Merge Join Operator [MERGEJOIN_162] (rows=1433911 width=209)
-                            Conds:RS_45._col0=RS_195._col0(Inner),Output:["_col3","_col5","_col7","_col8"]
+                            Conds:RS_45._col0=RS_195._col0(Inner),Output:["_col2","_col4","_col6","_col7"]
                           <-Map 16 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_195]
                               PartitionCols:_col0
@@ -107,7 +107,7 @@ Stage-0
                             SHUFFLE [RS_45]
                               PartitionCols:_col0
                               Merge Join Operator [MERGEJOIN_148] (rows=1433911 width=205)
-                                Conds:RS_192._col2=RS_172._col0(Inner),Output:["_col0","_col3","_col5"]
+                                Conds:RS_192._col1=RS_172._col0(Inner),Output:["_col0","_col2","_col4"]
                               <-Map 1 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_172]
                                   PartitionCols:_col0
@@ -119,9 +119,9 @@ Stage-0
                                         default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_category"]
                               <-Map 15 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_192]
-                                  PartitionCols:_col2
+                                  PartitionCols:_col1
                                   Select Operator [SEL_191] (rows=1433911 width=119)
-                                    Output:["_col0","_col2","_col3"]
+                                    Output:["_col0","_col1","_col2"]
                                     Filter Operator [FIL_190] (rows=1433911 width=123)
                                       predicate:(cs_item_sk is not null and cs_sold_date_sk is not null and cs_warehouse_sk is null)
                                       TableScan [TS_33] (rows=287989836 width=123)
@@ -136,7 +136,7 @@ Stage-0
                         Select Operator [SEL_151] (rows=24749363 width=387)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                           Merge Join Operator [MERGEJOIN_150] (rows=24749363 width=204)
-                            Conds:RS_12._col2=RS_178._col0(Inner),Output:["_col1","_col5","_col7","_col8"]
+                            Conds:RS_12._col2=RS_178._col0(Inner),Output:["_col1","_col4","_col6","_col7"]
                           <-Map 12 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_178]
                               PartitionCols:_col0
@@ -150,7 +150,7 @@ Stage-0
                             SHUFFLE [RS_12]
                               PartitionCols:_col2
                               Merge Join Operator [MERGEJOIN_144] (rows=24749363 width=200)
-                                Conds:RS_170._col0=RS_175._col1(Inner),Output:["_col1","_col2","_col5"]
+                                Conds:RS_170._col0=RS_175._col1(Inner),Output:["_col1","_col2","_col4"]
                               <-Map 1 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_170]
                                   PartitionCols:_col0
@@ -159,7 +159,7 @@ Stage-0
                                 SHUFFLE [RS_175]
                                   PartitionCols:_col1
                                   Select Operator [SEL_174] (rows=24749363 width=114)
-                                    Output:["_col0","_col1","_col3"]
+                                    Output:["_col0","_col1","_col2"]
                                     Filter Operator [FIL_173] (rows=24749363 width=118)
                                       predicate:(ss_addr_sk is null and ss_item_sk is not null and ss_sold_date_sk is not null)
                                       TableScan [TS_3] (rows=575995635 width=118)
@@ -174,7 +174,7 @@ Stage-0
                         Select Operator [SEL_157] (rows=35728 width=394)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                           Merge Join Operator [MERGEJOIN_156] (rows=35728 width=209)
-                            Conds:RS_28._col0=RS_189._col0(Inner),Output:["_col3","_col5","_col7","_col8"]
+                            Conds:RS_28._col0=RS_189._col0(Inner),Output:["_col2","_col4","_col6","_col7"]
                           <-Map 14 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_189]
                               PartitionCols:_col0
@@ -188,7 +188,7 @@ Stage-0
                             SHUFFLE [RS_28]
                               PartitionCols:_col0
                               Merge Join Operator [MERGEJOIN_146] (rows=35728 width=205)
-                                Conds:RS_186._col1=RS_171._col0(Inner),Output:["_col0","_col3","_col5"]
+                                Conds:RS_186._col1=RS_171._col0(Inner),Output:["_col0","_col2","_col4"]
                               <-Map 1 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_171]
                                   PartitionCols:_col0
@@ -197,7 +197,7 @@ Stage-0
                                 SHUFFLE [RS_186]
                                   PartitionCols:_col1
                                   Select Operator [SEL_185] (rows=35728 width=119)
-                                    Output:["_col0","_col1","_col3"]
+                                    Output:["_col0","_col1","_col2"]
                                     Filter Operator [FIL_184] (rows=35728 width=123)
                                       predicate:(ws_item_sk is not null and ws_sold_date_sk is not null and ws_web_page_sk is null)
                                       TableScan [TS_16] (rows=144002668 width=123)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query77.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query77.q.out b/ql/src/test/results/clientpositive/perf/tez/query77.q.out
index ac1b0e4..528c19c 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query77.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query77.q.out
@@ -304,7 +304,7 @@ Stage-0
                                       <-Map 9 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_334]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_330] (rows=8116 width=98)
+                                          Select Operator [SEL_330] (rows=8116 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_329] (rows=8116 width=98)
                                               predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-09-03 00:00:00' and d_date_sk is not null)
@@ -373,9 +373,9 @@ Stage-0
                                   SHUFFLE [RS_94]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_93] (rows=345 width=228)
-                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col6
+                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col5
                                       Merge Join Operator [MERGEJOIN_305] (rows=15991254 width=227)
-                                        Conds:RS_89._col1=RS_387._col0(Inner),Output:["_col2","_col3","_col6"]
+                                        Conds:RS_89._col1=RS_387._col0(Inner),Output:["_col2","_col3","_col5"]
                                       <-Map 33 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_387]
                                           PartitionCols:_col0
@@ -423,9 +423,9 @@ Stage-0
                                   SHUFFLE [RS_114]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_113] (rows=23 width=228)
-                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col6
+                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col5
                                       Merge Join Operator [MERGEJOIN_307] (rows=1458758 width=137)
-                                        Conds:RS_109._col1=RS_388._col0(Inner),Output:["_col2","_col3","_col6"]
+                                        Conds:RS_109._col1=RS_388._col0(Inner),Output:["_col2","_col3","_col5"]
                                       <-Map 33 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_388]
                                           PartitionCols:_col0
@@ -468,9 +468,9 @@ Stage-0
                                   SHUFFLE [RS_37]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_36] (rows=40 width=228)
-                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col6
+                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col5
                                       Merge Join Operator [MERGEJOIN_301] (rows=5959021 width=157)
-                                        Conds:RS_32._col1=RS_354._col0(Inner),Output:["_col2","_col3","_col6"]
+                                        Conds:RS_32._col1=RS_354._col0(Inner),Output:["_col2","_col3","_col5"]
                                       <-Map 28 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_354]
                                           PartitionCols:_col0
@@ -507,9 +507,9 @@ Stage-0
                                   SHUFFLE [RS_17]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_16] (rows=320 width=228)
-                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col6
+                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col5
                                       Merge Join Operator [MERGEJOIN_299] (rows=58365993 width=137)
-                                        Conds:RS_12._col1=RS_353._col0(Inner),Output:["_col2","_col3","_col6"]
+                                        Conds:RS_12._col1=RS_353._col0(Inner),Output:["_col2","_col3","_col5"]
                                       <-Map 28 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_353]
                                           PartitionCols:_col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query78.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query78.q.out b/ql/src/test/results/clientpositive/perf/tez/query78.q.out
index 853759f..3d938e1 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query78.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query78.q.out
@@ -179,13 +179,13 @@ Stage-0
                           SHUFFLE [RS_65]
                             PartitionCols:_col0, _col1
                             Group By Operator [GBY_64] (rows=50796051 width=239)
-                              Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col3, _col4
+                              Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col4)","sum(_col5)","sum(_col6)"],keys:_col2, _col3
                               Merge Join Operator [MERGEJOIN_189] (rows=50796051 width=233)
-                                Conds:RS_198._col0=RS_61._col0(Inner),Output:["_col3","_col4","_col6","_col7","_col8"]
+                                Conds:RS_198._col0=RS_61._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col6"]
                               <-Map 1 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_198]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_193] (rows=652 width=8)
+                                  Select Operator [SEL_193] (rows=652 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_192] (rows=652 width=8)
                                       predicate:((d_year = 2000) and d_date_sk is not null)
@@ -194,8 +194,8 @@ Stage-0
                               <-Reducer 21 [SIMPLE_EDGE]
                                 SHUFFLE [RS_61]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_59] (rows=143274863 width=240)
-                                    Output:["_col0","_col1","_col2","_col4","_col5","_col6"]
+                                  Select Operator [SEL_59] (rows=143274863 width=239)
+                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                     Filter Operator [FIL_58] (rows=143274863 width=240)
                                       predicate:_col8 is null
                                       Merge Join Operator [MERGEJOIN_188] (rows=234359952 width=240)
@@ -245,9 +245,9 @@ Stage-0
                                 SHUFFLE [RS_18]
                                   PartitionCols:_col0, _col1
                                   Group By Operator [GBY_17] (rows=114214965 width=239)
-                                    Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col4, _col3
+                                    Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col4)","sum(_col5)","sum(_col6)"],keys:_col3, _col2
                                     Merge Join Operator [MERGEJOIN_185] (rows=114214965 width=217)
-                                      Conds:RS_194._col0=RS_14._col0(Inner),Output:["_col3","_col4","_col6","_col7","_col8"]
+                                      Conds:RS_194._col0=RS_14._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col6"]
                                     <-Map 1 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_194]
                                         PartitionCols:_col0
@@ -255,8 +255,8 @@ Stage-0
                                     <-Reducer 15 [SIMPLE_EDGE]
                                       SHUFFLE [RS_14]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_12] (rows=319876350 width=235)
-                                          Output:["_col0","_col1","_col2","_col4","_col5","_col6"]
+                                        Select Operator [SEL_12] (rows=319876350 width=233)
+                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                           Filter Operator [FIL_11] (rows=319876350 width=235)
                                             predicate:_col8 is null
                                             Merge Join Operator [MERGEJOIN_184] (rows=883006376 width=235)
@@ -299,9 +299,9 @@ Stage-0
                                 SHUFFLE [RS_39]
                                   PartitionCols:_col0, _col1
                                   Group By Operator [GBY_38] (rows=40539971 width=239)
-                                    Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col4, _col3
+                                    Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col4)","sum(_col5)","sum(_col6)"],keys:_col3, _col2
                                     Merge Join Operator [MERGEJOIN_187] (rows=40539971 width=235)
-                                      Conds:RS_196._col0=RS_35._col0(Inner),Output:["_col3","_col4","_col6","_col7","_col8"]
+                                      Conds:RS_196._col0=RS_35._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col6"]
                                     <-Map 1 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_196]
                                         PartitionCols:_col0
@@ -309,8 +309,8 @@ Stage-0
                                     <-Reducer 18 [SIMPLE_EDGE]
                                       SHUFFLE [RS_35]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_33] (rows=113538342 width=242)
-                                          Output:["_col0","_col1","_col2","_col4","_col5","_col6"]
+                                        Select Operator [SEL_33] (rows=113538342 width=239)
+                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                           Filter Operator [FIL_32] (rows=113538342 width=242)
                                             predicate:_col8 is null
                                             Merge Join Operator [MERGEJOIN_186] (rows=254679677 width=242)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query79.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query79.q.out b/ql/src/test/results/clientpositive/perf/tez/query79.q.out
index f1538371..877ff7b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query79.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query79.q.out
@@ -80,9 +80,9 @@ Stage-0
           <-Reducer 2 [SIMPLE_EDGE]
             SHUFFLE [RS_33]
               Select Operator [SEL_32] (rows=43530621 width=776)
-                Output:["_col0","_col1","_col3","_col4","_col5","_col6"]
-                Merge Join Operator [MERGEJOIN_100] (rows=43530621 width=501)
-                  Conds:RS_103._col0=RS_128._col1(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col7"]
+                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                Merge Join Operator [MERGEJOIN_100] (rows=43530621 width=685)
+                  Conds:RS_103._col0=RS_128._col1(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col7","_col8"]
                 <-Map 1 [SIMPLE_EDGE] vectorized
                   SHUFFLE [RS_103]
                     PartitionCols:_col0
@@ -95,21 +95,21 @@ Stage-0
                 <-Reducer 8 [SIMPLE_EDGE] vectorized
                   SHUFFLE [RS_128]
                     PartitionCols:_col1
-                    Select Operator [SEL_127] (rows=43530621 width=323)
-                      Output:["_col0","_col1","_col2","_col3","_col4"]
+                    Select Operator [SEL_127] (rows=43530621 width=507)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                       Group By Operator [GBY_126] (rows=43530621 width=325)
                         Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3
                       <-Reducer 7 [SIMPLE_EDGE]
                         SHUFFLE [RS_26]
                           PartitionCols:_col0, _col1, _col2, _col3
                           Group By Operator [GBY_25] (rows=43530621 width=325)
-                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col6)","sum(_col7)"],keys:_col1, _col3, _col5, _col13
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col6)","sum(_col7)"],keys:_col1, _col3, _col5, _col10
                             Merge Join Operator [MERGEJOIN_99] (rows=43530621 width=214)
-                              Conds:RS_21._col2=RS_114._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col13"]
+                              Conds:RS_21._col2=RS_114._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col10"]
                             <-Map 12 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_114]
                                 PartitionCols:_col0
-                                Select Operator [SEL_113] (rows=3055 width=12)
+                                Select Operator [SEL_113] (rows=3055 width=4)
                                   Output:["_col0"]
                                   Filter Operator [FIL_112] (rows=3055 width=12)
                                     predicate:(((hd_dep_count = 8) or (hd_vehicle_count > 0)) and hd_demo_sk is not null)
@@ -119,12 +119,12 @@ Stage-0
                               SHUFFLE [RS_21]
                                 PartitionCols:_col2
                                 Merge Join Operator [MERGEJOIN_98] (rows=102592623 width=283)
-                                  Conds:RS_18._col4=RS_125._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col7","_col13"]
+                                  Conds:RS_18._col4=RS_125._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col7","_col10"]
                                 <-Map 11 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_125]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_124] (rows=1704 width=100)
-                                      Output:["_col0","_col2"]
+                                    Select Operator [SEL_124] (rows=1704 width=97)
+                                      Output:["_col0","_col1"]
                                       Filter Operator [FIL_123] (rows=1704 width=100)
                                         predicate:(s_number_employees BETWEEN 200 AND 295 and s_store_sk is not null)
                                         TableScan [TS_9] (rows=1704 width=100)
@@ -137,7 +137,7 @@ Stage-0
                                     <-Map 9 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_106]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_105] (rows=391 width=12)
+                                        Select Operator [SEL_105] (rows=391 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_104] (rows=391 width=12)
                                             predicate:((d_dow = 1) and (d_year) IN (1998, 1999, 2000) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query8.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query8.q.out b/ql/src/test/results/clientpositive/perf/tez/query8.q.out
index 8c24550..5d6fad2 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query8.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query8.q.out
@@ -259,20 +259,20 @@ Stage-0
                 SHUFFLE [RS_57]
                   PartitionCols:_col0
                   Group By Operator [GBY_56] (rows=1 width=200)
-                    Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col8
+                    Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col6
                     Top N Key Operator [TNK_84] (rows=1 width=200)
-                      keys:_col8,sort order:+,top n:100
+                      keys:_col6,sort order:+,top n:100
                       Merge Join Operator [MERGEJOIN_118] (rows=1 width=200)
-                        Conds:RS_52._col1=RS_53._col1(Inner),Output:["_col2","_col8"]
+                        Conds:RS_52._col1=RS_53._col1(Inner),Output:["_col2","_col6"]
                       <-Reducer 12 [SIMPLE_EDGE]
                         SHUFFLE [RS_53]
                           PartitionCols:_col1
                           Merge Join Operator [MERGEJOIN_117] (rows=1 width=92)
-                            Conds:RS_138.substr(_col0, 1, 2)=RS_141.substr(_col2, 1, 2)(Inner),Output:["_col1","_col2"]
+                            Conds:RS_138._col0=RS_141._col2(Inner),Output:["_col1","_col2"]
                           <-Map 19 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_141]
-                              PartitionCols:substr(_col2, 1, 2)
-                              Select Operator [SEL_140] (rows=1704 width=181)
+                              PartitionCols:_col2
+                              Select Operator [SEL_140] (rows=1704 width=276)
                                 Output:["_col0","_col1","_col2"]
                                 Filter Operator [FIL_139] (rows=1704 width=181)
                                   predicate:(s_store_sk is not null and substr(s_zip, 1, 2) is not null)
@@ -280,7 +280,7 @@ Stage-0
                                     default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_name","s_zip"]
                           <-Reducer 11 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_138]
-                              PartitionCols:substr(_col0, 1, 2)
+                              PartitionCols:_col0
                               Select Operator [SEL_137] (rows=1 width=184)
                                 Output:["_col0"]
                                 Filter Operator [FIL_136] (rows=1 width=192)
@@ -325,7 +325,7 @@ Stage-0
                                                           <-Map 18 [SIMPLE_EDGE] vectorized
                                                             SHUFFLE [RS_164]
                                                               PartitionCols:_col0
-                                                              Select Operator [SEL_163] (rows=26666667 width=89)
+                                                              Select Operator [SEL_163] (rows=26666667 width=4)
                                                                 Output:["_col0"]
                                                                 Filter Operator [FIL_162] (rows=26666667 width=89)
                                                                   predicate:((c_preferred_cust_flag = 'Y') and c_current_addr_sk is not null)
@@ -357,7 +357,7 @@ Stage-0
                           <-Map 6 [SIMPLE_EDGE] vectorized
                             PARTITION_ONLY_SHUFFLE [RS_129]
                               PartitionCols:_col0
-                              Select Operator [SEL_128] (rows=130 width=12)
+                              Select Operator [SEL_128] (rows=130 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_127] (rows=130 width=12)
                                   predicate:((d_qoy = 1) and (d_year = 2002) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query80.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query80.q.out b/ql/src/test/results/clientpositive/perf/tez/query80.q.out
index ff26bef..223e61a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query80.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query80.q.out
@@ -286,7 +286,7 @@ Stage-0
                                   Select Operator [SEL_72] (rows=8592843 width=305)
                                     Output:["_col0","_col1","_col2","_col3"]
                                     Merge Join Operator [MERGEJOIN_369] (rows=8592843 width=305)
-                                      Conds:RS_69._col1=RS_475._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col18"]
+                                      Conds:RS_69._col1=RS_475._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
                                     <-Map 38 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_475]
                                         PartitionCols:_col0
@@ -304,7 +304,7 @@ Stage-0
                                         <-Map 30 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_429]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_426] (rows=1150 width=89)
+                                            Select Operator [SEL_426] (rows=1150 width=4)
                                               Output:["_col0"]
                                               Filter Operator [FIL_425] (rows=1150 width=89)
                                                 predicate:((p_channel_tv = 'N') and p_promo_sk is not null)
@@ -318,7 +318,7 @@ Stage-0
                                             <-Map 26 [SIMPLE_EDGE] vectorized
                                               SHUFFLE [RS_413]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_410] (rows=154000 width=115)
+                                                Select Operator [SEL_410] (rows=154000 width=4)
                                                   Output:["_col0"]
                                                   Filter Operator [FIL_409] (rows=154000 width=115)
                                                     predicate:((i_current_price > 50) and i_item_sk is not null)
@@ -332,7 +332,7 @@ Stage-0
                                                 <-Map 12 [SIMPLE_EDGE] vectorized
                                                   SHUFFLE [RS_397]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_394] (rows=8116 width=98)
+                                                    Select Operator [SEL_394] (rows=8116 width=4)
                                                       Output:["_col0"]
                                                       Filter Operator [FIL_393] (rows=8116 width=98)
                                                         predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-09-03 00:00:00' and d_date_sk is not null)
@@ -413,7 +413,7 @@ Stage-0
                                   Select Operator [SEL_112] (rows=4714659 width=323)
                                     Output:["_col0","_col1","_col2","_col3"]
                                     Merge Join Operator [MERGEJOIN_374] (rows=4714659 width=323)
-                                      Conds:RS_109._col2=RS_495._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col18"]
+                                      Conds:RS_109._col2=RS_495._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
                                     <-Map 42 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_495]
                                         PartitionCols:_col0
@@ -525,7 +525,7 @@ Stage-0
                                   Select Operator [SEL_33] (rows=15038783 width=100)
                                     Output:["_col0","_col1","_col2","_col3"]
                                     Merge Join Operator [MERGEJOIN_364] (rows=15038783 width=100)
-                                      Conds:RS_30._col2=RS_449._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col18"]
+                                      Conds:RS_30._col2=RS_449._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
                                     <-Map 34 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_449]
                                         PartitionCols:_col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query81.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query81.q.out b/ql/src/test/results/clientpositive/perf/tez/query81.q.out
index b08ed9e..94398cf 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query81.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query81.q.out
@@ -99,7 +99,7 @@ Stage-0
                 Select Operator [SEL_62] (rows=1577696 width=1418)
                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14"]
                   Merge Join Operator [MERGEJOIN_178] (rows=1577696 width=1418)
-                    Conds:RS_59._col0=RS_60._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col7","_col8","_col9","_col10","_col11","_col12","_col14","_col15","_col16","_col17","_col20"]
+                    Conds:RS_59._col0=RS_60._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col19"]
                   <-Reducer 10 [SIMPLE_EDGE]
                     SHUFFLE [RS_60]
                       PartitionCols:_col0
@@ -124,9 +124,9 @@ Stage-0
                                       SHUFFLE [RS_43]
                                         PartitionCols:_col0
                                         Group By Operator [GBY_42] (rows=8749496 width=201)
-                                          Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col7, _col1
+                                          Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col6, _col1
                                           Merge Join Operator [MERGEJOIN_176] (rows=8749496 width=194)
-                                            Conds:RS_38._col2=RS_198._col0(Inner),Output:["_col1","_col3","_col7"]
+                                            Conds:RS_38._col2=RS_198._col0(Inner),Output:["_col1","_col3","_col6"]
                                           <-Map 15 [SIMPLE_EDGE] vectorized
                                             SHUFFLE [RS_198]
                                               PartitionCols:_col0
@@ -144,7 +144,7 @@ Stage-0
                                               <-Map 14 [SIMPLE_EDGE] vectorized
                                                 SHUFFLE [RS_194]
                                                   PartitionCols:_col0
-                                                  Select Operator [SEL_192] (rows=652 width=8)
+                                                  Select Operator [SEL_192] (rows=652 width=4)
                                                     Output:["_col0"]
                                                     Filter Operator [FIL_191] (rows=652 width=8)
                                                       predicate:((d_year = 1998) and d_date_sk is not null)
@@ -170,9 +170,9 @@ Stage-0
                                   SHUFFLE [RS_23]
                                     PartitionCols:_col0, _col1
                                     Group By Operator [GBY_22] (rows=8574602 width=201)
-                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col7, _col1
+                                      Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col6, _col1
                                       Merge Join Operator [MERGEJOIN_174] (rows=8574602 width=194)
-                                        Conds:RS_18._col2=RS_197._col0(Inner),Output:["_col1","_col3","_col7"]
+                                        Conds:RS_18._col2=RS_197._col0(Inner),Output:["_col1","_col3","_col6"]
                                       <-Map 15 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_197]
                                           PartitionCols:_col0
@@ -198,7 +198,7 @@ Stage-0
                     SHUFFLE [RS_59]
                       PartitionCols:_col0
                       Merge Join Operator [MERGEJOIN_172] (rows=1568628 width=1310)
-                        Conds:RS_181._col2=RS_184._col0(Inner),Output:["_col0","_col1","_col3","_col4","_col5","_col7","_col8","_col9","_col10","_col11","_col12","_col14","_col15","_col16","_col17"]
+                        Conds:RS_181._col2=RS_184._col0(Inner),Output:["_col0","_col1","_col3","_col4","_col5","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16"]
                       <-Map 1 [SIMPLE_EDGE] vectorized
                         SHUFFLE [RS_181]
                           PartitionCols:_col2
@@ -211,8 +211,8 @@ Stage-0
                       <-Map 5 [SIMPLE_EDGE] vectorized
                         SHUFFLE [RS_184]
                           PartitionCols:_col0
-                          Select Operator [SEL_183] (rows=784314 width=1027)
-                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col8","_col9","_col10","_col11"]
+                          Select Operator [SEL_183] (rows=784314 width=941)
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"]
                             Filter Operator [FIL_182] (rows=784314 width=1027)
                               predicate:((ca_state = 'IL') and ca_address_sk is not null)
                               TableScan [TS_3] (rows=40000000 width=1027)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query82.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query82.q.out b/ql/src/test/results/clientpositive/perf/tez/query82.q.out
index 6bc9666..2cad363 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query82.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query82.q.out
@@ -83,7 +83,7 @@ Stage-0
                           <-Map 11 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_93]
                               PartitionCols:_col0
-                              Select Operator [SEL_92] (rows=8116 width=98)
+                              Select Operator [SEL_92] (rows=8116 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_91] (rows=8116 width=98)
                                   predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'2002-05-30 00:00:00' AND TIMESTAMP'2002-07-29 00:00:00' and d_date_sk is not null)
@@ -92,7 +92,7 @@ Stage-0
                           <-Map 8 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_90]
                               PartitionCols:_col0
-                              Select Operator [SEL_89] (rows=4176000 width=11)
+                              Select Operator [SEL_89] (rows=4176000 width=8)
                                 Output:["_col0","_col1"]
                                 Filter Operator [FIL_88] (rows=4176000 width=11)
                                   predicate:(inv_date_sk is not null and inv_item_sk is not null and inv_quantity_on_hand BETWEEN 100 AND 500)
@@ -106,7 +106,7 @@ Stage-0
                           <-Map 6 [SIMPLE_EDGE] vectorized
                             PARTITION_ONLY_SHUFFLE [RS_82]
                               PartitionCols:_col0
-                              Select Operator [SEL_81] (rows=297 width=404)
+                              Select Operator [SEL_81] (rows=297 width=400)
                                 Output:["_col0","_col1","_col2","_col3"]
                                 Filter Operator [FIL_80] (rows=297 width=404)
                                   predicate:((i_manufact_id) IN (437, 129, 727, 663) and i_current_price BETWEEN 30 AND 60 and i_item_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query83.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query83.q.out b/ql/src/test/results/clientpositive/perf/tez/query83.q.out
index 63f459c..cb9810b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query83.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query83.q.out
@@ -166,169 +166,175 @@ Stage-0
     limit:100
     Stage-1
       Reducer 7 vectorized
-      File Output Operator [FS_398]
-        Limit [LIM_397] (rows=57 width=260)
+      File Output Operator [FS_401]
+        Limit [LIM_400] (rows=57 width=260)
           Number of rows:100
-          Select Operator [SEL_396] (rows=57 width=260)
+          Select Operator [SEL_399] (rows=57 width=260)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
           <-Reducer 6 [SIMPLE_EDGE]
             SHUFFLE [RS_127]
               Select Operator [SEL_126] (rows=57 width=260)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                Merge Join Operator [MERGEJOIN_363] (rows=57 width=124)
-                  Conds:RS_123._col0=RS_395._col0(Inner),Output:["_col0","_col1","_col3","_col5"]
+                Merge Join Operator [MERGEJOIN_363] (rows=57 width=148)
+                  Conds:RS_123._col0=RS_398._col0(Inner),Output:["_col0","_col1","_col2","_col4","_col5","_col7","_col8"]
                 <-Reducer 14 [ONE_TO_ONE_EDGE] vectorized
-                  FORWARD [RS_395]
+                  FORWARD [RS_398]
                     PartitionCols:_col0
-                    Group By Operator [GBY_394] (rows=57 width=108)
-                      Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                    <-Reducer 13 [SIMPLE_EDGE]
-                      SHUFFLE [RS_117]
-                        PartitionCols:_col0
-                        Group By Operator [GBY_116] (rows=57 width=108)
-                          Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
-                          Merge Join Operator [MERGEJOIN_361] (rows=2521 width=100)
-                            Conds:RS_112._col0=RS_113._col0(Inner),Output:["_col2","_col4"]
-                          <-Reducer 16 [SIMPLE_EDGE]
-                            SHUFFLE [RS_113]
-                              PartitionCols:_col0
-                              Merge Join Operator [MERGEJOIN_352] (rows=2 width=4)
-                                Conds:RS_374._col1=RS_383._col0(Inner),Output:["_col0"]
-                              <-Map 15 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_374]
-                                  PartitionCols:_col1
-                                  Select Operator [SEL_373] (rows=73049 width=98)
-                                    Output:["_col0","_col1"]
-                                    Filter Operator [FIL_372] (rows=73049 width=98)
-                                      predicate:(d_date is not null and d_date_sk is not null)
-                                      TableScan [TS_6] (rows=73049 width=98)
-                                        default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
-                              <-Reducer 19 [ONE_TO_ONE_EDGE] vectorized
-                                FORWARD [RS_383]
-                                  PartitionCols:_col0
-                                  Group By Operator [GBY_382] (rows=2 width=94)
-                                    Output:["_col0"],keys:KEY._col0
-                                  <-Reducer 18 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_22]
-                                      PartitionCols:_col0
-                                      Group By Operator [GBY_21] (rows=2 width=94)
-                                        Output:["_col0"],keys:_col0
-                                        Merge Join Operator [MERGEJOIN_351] (rows=5 width=94)
-                                          Conds:RS_377._col1=RS_381._col0(Left Semi),Output:["_col0"]
-                                        <-Map 17 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_377]
-                                            PartitionCols:_col1
-                                            Select Operator [SEL_376] (rows=73049 width=98)
-                                              Output:["_col0","_col1"]
-                                              Filter Operator [FIL_375] (rows=73049 width=98)
-                                                predicate:(d_date is not null and d_week_seq is not null)
-                                                TableScan [TS_9] (rows=73049 width=98)
-                                                  default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date","d_week_seq"]
-                                        <-Map 20 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_381]
-                                            PartitionCols:_col0
-                                            Group By Operator [GBY_380] (rows=1 width=4)
-                                              Output:["_col0"],keys:_col0
-                                              Select Operator [SEL_379] (rows=2 width=4)
-                                                Output:["_col0"]
-                                                Filter Operator [FIL_378] (rows=2 width=98)
-                                                  predicate:((d_date) IN ('1998-01-02', '1998-10-15', '1998-11-10') and d_week_seq is not null)
-                                                  TableScan [TS_12] (rows=73049 width=98)
+                    Select Operator [SEL_397] (rows=57 width=116)
+                      Output:["_col0","_col1","_col2"]
+                      Group By Operator [GBY_396] (rows=57 width=108)
+                        Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                      <-Reducer 13 [SIMPLE_EDGE]
+                        SHUFFLE [RS_117]
+                          PartitionCols:_col0
+                          Group By Operator [GBY_116] (rows=57 width=108)
+                            Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                            Merge Join Operator [MERGEJOIN_361] (rows=2521 width=100)
+                              Conds:RS_112._col0=RS_113._col0(Inner),Output:["_col2","_col4"]
+                            <-Reducer 16 [SIMPLE_EDGE]
+                              SHUFFLE [RS_113]
+                                PartitionCols:_col0
+                                Merge Join Operator [MERGEJOIN_352] (rows=2 width=4)
+                                  Conds:RS_374._col1=RS_383._col0(Inner),Output:["_col0"]
+                                <-Map 15 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_374]
+                                    PartitionCols:_col1
+                                    Select Operator [SEL_373] (rows=73049 width=98)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_372] (rows=73049 width=98)
+                                        predicate:(d_date is not null and d_date_sk is not null)
+                                        TableScan [TS_6] (rows=73049 width=98)
+                                          default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
+                                <-Reducer 19 [ONE_TO_ONE_EDGE] vectorized
+                                  FORWARD [RS_383]
+                                    PartitionCols:_col0
+                                    Group By Operator [GBY_382] (rows=2 width=94)
+                                      Output:["_col0"],keys:KEY._col0
+                                    <-Reducer 18 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_22]
+                                        PartitionCols:_col0
+                                        Group By Operator [GBY_21] (rows=2 width=94)
+                                          Output:["_col0"],keys:_col0
+                                          Merge Join Operator [MERGEJOIN_351] (rows=5 width=94)
+                                            Conds:RS_377._col1=RS_381._col0(Left Semi),Output:["_col0"]
+                                          <-Map 17 [SIMPLE_EDGE] vectorized
+                                            SHUFFLE [RS_377]
+                                              PartitionCols:_col1
+                                              Select Operator [SEL_376] (rows=73049 width=98)
+                                                Output:["_col0","_col1"]
+                                                Filter Operator [FIL_375] (rows=73049 width=98)
+                                                  predicate:(d_date is not null and d_week_seq is not null)
+                                                  TableScan [TS_9] (rows=73049 width=98)
                                                     default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date","d_week_seq"]
-                          <-Reducer 12 [SIMPLE_EDGE]
-                            SHUFFLE [RS_112]
-                              PartitionCols:_col0
-                              Merge Join Operator [MERGEJOIN_356] (rows=13749816 width=107)
-                                Conds:RS_393._col1=RS_371._col0(Inner),Output:["_col0","_col2","_col4"]
-                              <-Map 8 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_371]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_368] (rows=462000 width=104)
-                                    Output:["_col0","_col1"]
-                                    Filter Operator [FIL_367] (rows=462000 width=104)
-                                      predicate:(i_item_id is not null and i_item_sk is not null)
-                                      TableScan [TS_3] (rows=462000 width=104)
-                                        default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
-                              <-Map 22 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_393]
-                                  PartitionCols:_col1
-                                  Select Operator [SEL_392] (rows=13749816 width=11)
-                                    Output:["_col0","_col1","_col2"]
-                                    Filter Operator [FIL_391] (rows=13749816 width=11)
-                                      predicate:(wr_item_sk is not null and wr_returned_date_sk is not null)
-                                      TableScan [TS_80] (rows=14398467 width=11)
-                                        default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_returned_date_sk","wr_item_sk","wr_return_quantity"]
+                                          <-Map 20 [SIMPLE_EDGE] vectorized
+                                            SHUFFLE [RS_381]
+                                              PartitionCols:_col0
+                                              Group By Operator [GBY_380] (rows=1 width=4)
+                                                Output:["_col0"],keys:_col0
+                                                Select Operator [SEL_379] (rows=2 width=4)
+                                                  Output:["_col0"]
+                                                  Filter Operator [FIL_378] (rows=2 width=98)
+                                                    predicate:((d_date) IN ('1998-01-02', '1998-10-15', '1998-11-10') and d_week_seq is not null)
+                                                    TableScan [TS_12] (rows=73049 width=98)
+                                                      default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date","d_week_seq"]
+                            <-Reducer 12 [SIMPLE_EDGE]
+                              SHUFFLE [RS_112]
+                                PartitionCols:_col0
+                                Merge Join Operator [MERGEJOIN_356] (rows=13749816 width=107)
+                                  Conds:RS_395._col1=RS_371._col0(Inner),Output:["_col0","_col2","_col4"]
+                                <-Map 8 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_371]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_368] (rows=462000 width=104)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_367] (rows=462000 width=104)
+                                        predicate:(i_item_id is not null and i_item_sk is not null)
+                                        TableScan [TS_3] (rows=462000 width=104)
+                                          default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
+                                <-Map 22 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_395]
+                                    PartitionCols:_col1
+                                    Select Operator [SEL_394] (rows=13749816 width=11)
+                                      Output:["_col0","_col1","_col2"]
+                                      Filter Operator [FIL_393] (rows=13749816 width=11)
+                                        predicate:(wr_item_sk is not null and wr_returned_date_sk is not null)
+                                        TableScan [TS_80] (rows=14398467 width=11)
+                                          default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_returned_date_sk","wr_item_sk","wr_return_quantity"]
                 <-Reducer 5 [ONE_TO_ONE_EDGE]
                   FORWARD [RS_123]
                     PartitionCols:_col0
-                    Merge Join Operator [MERGEJOIN_362] (rows=60 width=116)
-                      Conds:RS_385._col0=RS_390._col0(Inner),Output:["_col0","_col1","_col3"]
+                    Merge Join Operator [MERGEJOIN_362] (rows=60 width=132)
+                      Conds:RS_386._col0=RS_392._col0(Inner),Output:["_col0","_col1","_col2","_col4","_col5"]
                     <-Reducer 11 [ONE_TO_ONE_EDGE] vectorized
-                      FORWARD [RS_390]
+                      FORWARD [RS_392]
                         PartitionCols:_col0
-                        Group By Operator [GBY_389] (rows=63 width=108)
-                          Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                        <-Reducer 10 [SIMPLE_EDGE]
-                          SHUFFLE [RS_77]
-                            PartitionCols:_col0
-                            Group By Operator [GBY_76] (rows=63 width=108)
-                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
-                              Merge Join Operator [MERGEJOIN_360] (rows=11105 width=100)
-                                Conds:RS_72._col0=RS_73._col0(Inner),Output:["_col2","_col4"]
-                              <-Reducer 16 [SIMPLE_EDGE]
-                                SHUFFLE [RS_73]
-                                  PartitionCols:_col0
-                                   Please refer to the previous Merge Join Operator [MERGEJOIN_352]
-                              <-Reducer 9 [SIMPLE_EDGE]
-                                SHUFFLE [RS_72]
-                                  PartitionCols:_col0
-                                  Merge Join Operator [MERGEJOIN_353] (rows=55578005 width=107)
-                                    Conds:RS_388._col1=RS_370._col0(Inner),Output:["_col0","_col2","_col4"]
-                                  <-Map 8 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_370]
-                                      PartitionCols:_col0
-                                       Please refer to the previous Select Operator [SEL_368]
-                                  <-Map 21 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_388]
-                                      PartitionCols:_col1
-                                      Select Operator [SEL_387] (rows=55578005 width=11)
-                                        Output:["_col0","_col1","_col2"]
-                                        Filter Operator [FIL_386] (rows=55578005 width=11)
-                                          predicate:(sr_item_sk is not null and sr_returned_date_sk is not null)
-                                          TableScan [TS_40] (rows=57591150 width=11)
-                                            default@store_returns,store_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_returned_date_sk","sr_item_sk","sr_return_quantity"]
+                        Select Operator [SEL_391] (rows=63 width=116)
+                          Output:["_col0","_col1","_col2"]
+                          Group By Operator [GBY_390] (rows=63 width=108)
+                            Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                          <-Reducer 10 [SIMPLE_EDGE]
+                            SHUFFLE [RS_77]
+                              PartitionCols:_col0
+                              Group By Operator [GBY_76] (rows=63 width=108)
+                                Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                                Merge Join Operator [MERGEJOIN_360] (rows=11105 width=100)
+                                  Conds:RS_72._col0=RS_73._col0(Inner),Output:["_col2","_col4"]
+                                <-Reducer 16 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_73]
+                                    PartitionCols:_col0
+                                     Please refer to the previous Merge Join Operator [MERGEJOIN_352]
+                                <-Reducer 9 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_72]
+                                    PartitionCols:_col0
+                                    Merge Join Operator [MERGEJOIN_353] (rows=55578005 width=107)
+                                      Conds:RS_389._col1=RS_370._col0(Inner),Output:["_col0","_col2","_col4"]
+                                    <-Map 8 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_370]
+                                        PartitionCols:_col0
+                                         Please refer to the previous Select Operator [SEL_368]
+                                    <-Map 21 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_389]
+                                        PartitionCols:_col1
+                                        Select Operator [SEL_388] (rows=55578005 width=11)
+                                          Output:["_col0","_col1","_col2"]
+                                          Filter Operator [FIL_387] (rows=55578005 width=11)
+                                            predicate:(sr_item_sk is not null and sr_returned_date_sk is not null)
+                                            TableScan [TS_40] (rows=57591150 width=11)
+                                              default@store_returns,store_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_returned_date_sk","sr_item_sk","sr_return_quantity"]
                     <-Reducer 4 [ONE_TO_ONE_EDGE] vectorized
-                      FORWARD [RS_385]
+                      FORWARD [RS_386]
                         PartitionCols:_col0
-                        Group By Operator [GBY_384] (rows=60 width=108)
-                          Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                        <-Reducer 3 [SIMPLE_EDGE]
-                          SHUFFLE [RS_37]
-                            PartitionCols:_col0
-                            Group By Operator [GBY_36] (rows=60 width=108)
-                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
-                              Merge Join Operator [MERGEJOIN_359] (rows=5478 width=100)
-                                Conds:RS_32._col0=RS_33._col0(Inner),Output:["_col2","_col4"]
-                              <-Reducer 16 [SIMPLE_EDGE]
-                                SHUFFLE [RS_33]
-                                  PartitionCols:_col0
-                                   Please refer to the previous Merge Join Operator [MERGEJOIN_352]
-                              <-Reducer 2 [SIMPLE_EDGE]
-                                SHUFFLE [RS_32]
-                                  PartitionCols:_col0
-                                  Merge Join Operator [MERGEJOIN_350] (rows=28798881 width=107)
-                                    Conds:RS_366._col1=RS_369._col0(Inner),Output:["_col0","_col2","_col4"]
-                                  <-Map 8 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_369]
-                                      PartitionCols:_col0
-                                       Please refer to the previous Select Operator [SEL_368]
-                                  <-Map 1 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_366]
-                                      PartitionCols:_col1
-                                      Select Operator [SEL_365] (rows=28798881 width=11)
-                                        Output:["_col0","_col1","_col2"]
-                                        Filter Operator [FIL_364] (rows=28798881 width=11)
-                                          predicate:(cr_item_sk is not null and cr_returned_date_sk is not null)
-                                          TableScan [TS_0] (rows=28798881 width=11)
-                                            default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_returned_date_sk","cr_item_sk","cr_return_quantity"]
+                        Select Operator [SEL_385] (rows=60 width=116)
+                          Output:["_col0","_col1","_col2"]
+                          Group By Operator [GBY_384] (rows=60 width=108)
+                            Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                          <-Reducer 3 [SIMPLE_EDGE]
+                            SHUFFLE [RS_37]
+                              PartitionCols:_col0
+                              Group By Operator [GBY_36] (rows=60 width=108)
+                                Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                                Merge Join Operator [MERGEJOIN_359] (rows=5478 width=100)
+                                  Conds:RS_32._col0=RS_33._col0(Inner),Output:["_col2","_col4"]
+                                <-Reducer 16 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_33]
+                                    PartitionCols:_col0
+                                     Please refer to the previous Merge Join Operator [MERGEJOIN_352]
+                                <-Reducer 2 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_32]
+                                    PartitionCols:_col0
+                                    Merge Join Operator [MERGEJOIN_350] (rows=28798881 width=107)
+                                      Conds:RS_366._col1=RS_369._col0(Inner),Output:["_col0","_col2","_col4"]
+                                    <-Map 8 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_369]
+                                        PartitionCols:_col0
+                                         Please refer to the previous Select Operator [SEL_368]
+                                    <-Map 1 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_366]
+                                        PartitionCols:_col1
+                                        Select Operator [SEL_365] (rows=28798881 width=11)
+                                          Output:["_col0","_col1","_col2"]
+                                          Filter Operator [FIL_364] (rows=28798881 width=11)
+                                            predicate:(cr_item_sk is not null and cr_returned_date_sk is not null)
+                                            TableScan [TS_0] (rows=28798881 width=11)
+                                              default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_returned_date_sk","cr_item_sk","cr_return_quantity"]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query84.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query84.q.out b/ql/src/test/results/clientpositive/perf/tez/query84.q.out
index d4c0125..9adcf86 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query84.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query84.q.out
@@ -76,8 +76,8 @@ Stage-0
             SHUFFLE [RS_36]
               Select Operator [SEL_35] (rows=255285 width=384)
                 Output:["_col1","_col2"]
-                Merge Join Operator [MERGEJOIN_120] (rows=255285 width=280)
-                  Conds:RS_32._col1=RS_33._col1(Inner),Output:["_col2","_col6","_col7"]
+                Merge Join Operator [MERGEJOIN_120] (rows=255285 width=284)
+                  Conds:RS_32._col1=RS_33._col1(Inner),Output:["_col2","_col6"]
                 <-Reducer 2 [ONE_TO_ONE_EDGE]
                   FORWARD [RS_32]
                     PartitionCols:_col1
@@ -104,8 +104,8 @@ Stage-0
                 <-Reducer 8 [SIMPLE_EDGE]
                   SHUFFLE [RS_33]
                     PartitionCols:_col1
-                    Merge Join Operator [MERGEJOIN_119] (rows=8315 width=280)
-                      Conds:RS_25._col2=RS_26._col0(Inner),Output:["_col0","_col1","_col4","_col5"]
+                    Merge Join Operator [MERGEJOIN_119] (rows=8315 width=284)
+                      Conds:RS_25._col2=RS_26._col0(Inner),Output:["_col0","_col1","_col4"]
                     <-Reducer 11 [SIMPLE_EDGE]
                       SHUFFLE [RS_26]
                         PartitionCols:_col0
@@ -123,7 +123,7 @@ Stage-0
                         <-Map 12 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_138]
                             PartitionCols:_col0
-                            Select Operator [SEL_137] (rows=2 width=12)
+                            Select Operator [SEL_137] (rows=2 width=4)
                               Output:["_col0"]
                               Filter Operator [FIL_136] (rows=2 width=12)
                                 predicate:((ib_lower_bound >= 32287) and (ib_upper_bound <= 82287) and ib_income_band_sk is not null)
@@ -132,13 +132,13 @@ Stage-0
                     <-Reducer 7 [SIMPLE_EDGE]
                       SHUFFLE [RS_25]
                         PartitionCols:_col2
-                        Merge Join Operator [MERGEJOIN_117] (rows=83148 width=280)
-                          Conds:RS_129._col3=RS_132._col0(Inner),Output:["_col0","_col1","_col2","_col4","_col5"]
+                        Merge Join Operator [MERGEJOIN_117] (rows=83148 width=284)
+                          Conds:RS_129._col3=RS_132._col0(Inner),Output:["_col0","_col1","_col2","_col4"]
                         <-Map 6 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_129]
                             PartitionCols:_col3
-                            Select Operator [SEL_128] (rows=74500295 width=291)
-                              Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                            Select Operator [SEL_128] (rows=74500295 width=295)
+                              Output:["_col0","_col1","_col2","_col3","_col4"]
                               Filter Operator [FIL_127] (rows=74500295 width=291)
                                 predicate:(c_current_addr_sk is not null and c_current_cdemo_sk is not null and c_current_hdemo_sk is not null)
                                 TableScan [TS_6] (rows=80000000 width=291)
@@ -146,7 +146,7 @@ Stage-0
                         <-Map 9 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_132]
                             PartitionCols:_col0
-                            Select Operator [SEL_131] (rows=44643 width=96)
+                            Select Operator [SEL_131] (rows=44643 width=4)
                               Output:["_col0"]
                               Filter Operator [FIL_130] (rows=44643 width=97)
                                 predicate:((ca_city = 'Hopewell') and ca_address_sk is not null)


[14/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query23.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query23.q.out b/ql/src/test/results/clientpositive/perf/tez/query23.q.out
index 7784792..059195a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query23.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query23.q.out
@@ -1,7 +1,7 @@
-Warning: Shuffle Join MERGEJOIN[593][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 29' is a cross product
-Warning: Shuffle Join MERGEJOIN[594][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 30' is a cross product
-Warning: Shuffle Join MERGEJOIN[596][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 33' is a cross product
-Warning: Shuffle Join MERGEJOIN[597][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 34' is a cross product
+Warning: Shuffle Join MERGEJOIN[583][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 29' is a cross product
+Warning: Shuffle Join MERGEJOIN[584][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 30' is a cross product
+Warning: Shuffle Join MERGEJOIN[586][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 33' is a cross product
+Warning: Shuffle Join MERGEJOIN[587][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 34' is a cross product
 PREHOOK: query: explain
 with frequent_ss_items as 
  (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt
@@ -166,399 +166,391 @@ Stage-0
     limit:100
     Stage-1
       Reducer 6 vectorized
-      File Output Operator [FS_699]
-        Limit [LIM_698] (rows=1 width=112)
+      File Output Operator [FS_689]
+        Limit [LIM_688] (rows=1 width=112)
           Number of rows:100
-          Group By Operator [GBY_697] (rows=1 width=112)
+          Group By Operator [GBY_687] (rows=1 width=112)
             Output:["_col0"],aggregations:["sum(VALUE._col0)"]
           <-Union 5 [CUSTOM_SIMPLE_EDGE]
             <-Reducer 12 [CONTAINS]
-              Reduce Output Operator [RS_608]
-                Group By Operator [GBY_607] (rows=1 width=112)
+              Reduce Output Operator [RS_598]
+                Group By Operator [GBY_597] (rows=1 width=112)
                   Output:["_col0"],aggregations:["sum(_col0)"]
-                  Select Operator [SEL_605] (rows=1 width=112)
+                  Select Operator [SEL_595] (rows=1 width=112)
                     Output:["_col0"]
-                    Merge Join Operator [MERGEJOIN_604] (rows=1 width=116)
-                      Conds:RS_248._col2=RS_249._col0(Inner),Output:["_col3","_col4"]
+                    Merge Join Operator [MERGEJOIN_594] (rows=1 width=116)
+                      Conds:RS_240._col2=RS_241._col0(Inner),Output:["_col3","_col4"]
                     <-Reducer 11 [SIMPLE_EDGE]
-                      PARTITION_ONLY_SHUFFLE [RS_248]
+                      PARTITION_ONLY_SHUFFLE [RS_240]
                         PartitionCols:_col2
-                        Merge Join Operator [MERGEJOIN_592] (rows=155 width=0)
-                          Conds:RS_245._col1=RS_642._col0(Inner),Output:["_col2","_col3","_col4"]
+                        Merge Join Operator [MERGEJOIN_582] (rows=155 width=0)
+                          Conds:RS_237._col1=RS_632._col0(Inner),Output:["_col2","_col3","_col4"]
                         <-Reducer 18 [SIMPLE_EDGE] vectorized
-                          SHUFFLE [RS_642]
+                          SHUFFLE [RS_632]
                             PartitionCols:_col0
-                            Group By Operator [GBY_639] (rows=2235 width=4)
+                            Group By Operator [GBY_629] (rows=2235 width=4)
                               Output:["_col0"],keys:_col1
-                              Select Operator [SEL_638] (rows=6548799 width=12)
+                              Select Operator [SEL_628] (rows=6548799 width=290)
                                 Output:["_col1"]
-                                Filter Operator [FIL_637] (rows=6548799 width=12)
+                                Filter Operator [FIL_627] (rows=6548799 width=290)
                                   predicate:(_col3 > 4L)
-                                  Select Operator [SEL_636] (rows=19646398 width=12)
-                                    Output:["_col0","_col3"]
-                                    Group By Operator [GBY_635] (rows=19646398 width=290)
+                                  Select Operator [SEL_626] (rows=19646398 width=290)
+                                    Output:["_col1","_col3"]
+                                    Group By Operator [GBY_625] (rows=19646398 width=290)
                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                     <-Reducer 17 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_24]
+                                      SHUFFLE [RS_23]
                                         PartitionCols:_col0
-                                        Group By Operator [GBY_23] (rows=19646398 width=290)
-                                          Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col1, _col0, _col2
-                                          Select Operator [SEL_21] (rows=19646398 width=282)
-                                            Output:["_col0","_col1","_col2"]
-                                            Merge Join Operator [MERGEJOIN_577] (rows=19646398 width=282)
-                                              Conds:RS_18._col1=RS_634._col0(Inner),Output:["_col3","_col5","_col6"]
-                                            <-Map 23 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_634]
-                                                PartitionCols:_col0
-                                                Select Operator [SEL_633] (rows=462000 width=188)
-                                                  Output:["_col0","_col1"]
-                                                  Filter Operator [FIL_632] (rows=462000 width=188)
-                                                    predicate:i_item_sk is not null
-                                                    TableScan [TS_12] (rows=462000 width=188)
-                                                      default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_desc"]
-                                            <-Reducer 16 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_18]
-                                                PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_576] (rows=19646398 width=98)
-                                                  Conds:RS_631._col0=RS_623._col0(Inner),Output:["_col1","_col3"]
-                                                <-Map 21 [SIMPLE_EDGE] vectorized
-                                                  PARTITION_ONLY_SHUFFLE [RS_623]
-                                                    PartitionCols:_col0
-                                                    Select Operator [SEL_622] (rows=2609 width=102)
-                                                      Output:["_col0","_col1"]
-                                                      Filter Operator [FIL_621] (rows=2609 width=102)
-                                                        predicate:((d_year) IN (1999, 2000, 2001, 2002) and d_date_sk is not null)
-                                                        TableScan [TS_9] (rows=73049 width=102)
-                                                          default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date","d_year"]
-                                                <-Map 15 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_631]
-                                                    PartitionCols:_col0
-                                                    Select Operator [SEL_630] (rows=550076554 width=7)
-                                                      Output:["_col0","_col1"]
-                                                      Filter Operator [FIL_629] (rows=550076554 width=7)
-                                                        predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_16_date_dim_d_date_sk_min) AND DynamicValue(RS_16_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_16_date_dim_d_date_sk_bloom_filter))) and ss_item_sk is not null and ss_sold_date_sk is not null)
-                                                        TableScan [TS_6] (rows=575995635 width=7)
-                                                          default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk"]
-                                                        <-Reducer 22 [BROADCAST_EDGE] vectorized
-                                                          BROADCAST [RS_628]
-                                                            Group By Operator [GBY_627] (rows=1 width=12)
-                                                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                            <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                              PARTITION_ONLY_SHUFFLE [RS_626]
-                                                                Group By Operator [GBY_625] (rows=1 width=12)
-                                                                  Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                  Select Operator [SEL_624] (rows=2609 width=4)
-                                                                    Output:["_col0"]
-                                                                     Please refer to the previous Select Operator [SEL_622]
+                                        Group By Operator [GBY_22] (rows=19646398 width=290)
+                                          Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col3, _col5
+                                          Merge Join Operator [MERGEJOIN_567] (rows=19646398 width=282)
+                                            Conds:RS_18._col1=RS_624._col0(Inner),Output:["_col3","_col4","_col5"]
+                                          <-Map 23 [SIMPLE_EDGE] vectorized
+                                            SHUFFLE [RS_624]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_623] (rows=462000 width=188)
+                                                Output:["_col0","_col1"]
+                                                Filter Operator [FIL_622] (rows=462000 width=188)
+                                                  predicate:i_item_sk is not null
+                                                  TableScan [TS_12] (rows=462000 width=188)
+                                                    default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_desc"]
+                                          <-Reducer 16 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_18]
+                                              PartitionCols:_col1
+                                              Merge Join Operator [MERGEJOIN_566] (rows=19646398 width=98)
+                                                Conds:RS_621._col0=RS_613._col0(Inner),Output:["_col1","_col3"]
+                                              <-Map 21 [SIMPLE_EDGE] vectorized
+                                                PARTITION_ONLY_SHUFFLE [RS_613]
+                                                  PartitionCols:_col0
+                                                  Select Operator [SEL_612] (rows=2609 width=98)
+                                                    Output:["_col0","_col1"]
+                                                    Filter Operator [FIL_611] (rows=2609 width=102)
+                                                      predicate:((d_year) IN (1999, 2000, 2001, 2002) and d_date_sk is not null)
+                                                      TableScan [TS_9] (rows=73049 width=102)
+                                                        default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date","d_year"]
+                                              <-Map 15 [SIMPLE_EDGE] vectorized
+                                                SHUFFLE [RS_621]
+                                                  PartitionCols:_col0
+                                                  Select Operator [SEL_620] (rows=550076554 width=7)
+                                                    Output:["_col0","_col1"]
+                                                    Filter Operator [FIL_619] (rows=550076554 width=7)
+                                                      predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_16_date_dim_d_date_sk_min) AND DynamicValue(RS_16_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_16_date_dim_d_date_sk_bloom_filter))) and ss_item_sk is not null and ss_sold_date_sk is not null)
+                                                      TableScan [TS_6] (rows=575995635 width=7)
+                                                        default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk"]
+                                                      <-Reducer 22 [BROADCAST_EDGE] vectorized
+                                                        BROADCAST [RS_618]
+                                                          Group By Operator [GBY_617] (rows=1 width=12)
+                                                            Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                          <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                            PARTITION_ONLY_SHUFFLE [RS_616]
+                                                              Group By Operator [GBY_615] (rows=1 width=12)
+                                                                Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                Select Operator [SEL_614] (rows=2609 width=4)
+                                                                  Output:["_col0"]
+                                                                   Please refer to the previous Select Operator [SEL_612]
                         <-Reducer 10 [SIMPLE_EDGE]
-                          SHUFFLE [RS_245]
+                          SHUFFLE [RS_237]
                             PartitionCols:_col1
-                            Merge Join Operator [MERGEJOIN_583] (rows=3941102 width=122)
-                              Conds:RS_706._col0=RS_613._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
+                            Merge Join Operator [MERGEJOIN_573] (rows=3941102 width=122)
+                              Conds:RS_696._col0=RS_603._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
                             <-Map 8 [SIMPLE_EDGE] vectorized
-                              PARTITION_ONLY_SHUFFLE [RS_613]
+                              PARTITION_ONLY_SHUFFLE [RS_603]
                                 PartitionCols:_col0
-                                Select Operator [SEL_610] (rows=50 width=12)
+                                Select Operator [SEL_600] (rows=50 width=4)
                                   Output:["_col0"]
-                                  Filter Operator [FIL_609] (rows=50 width=12)
+                                  Filter Operator [FIL_599] (rows=50 width=12)
                                     predicate:((d_moy = 1) and (d_year = 1999) and d_date_sk is not null)
                                     TableScan [TS_3] (rows=73049 width=12)
                                       default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year","d_moy"]
                             <-Map 44 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_706]
+                              SHUFFLE [RS_696]
                                 PartitionCols:_col0
-                                Select Operator [SEL_705] (rows=143930993 width=127)
+                                Select Operator [SEL_695] (rows=143930993 width=127)
                                   Output:["_col0","_col1","_col2","_col3","_col4"]
-                                  Filter Operator [FIL_704] (rows=143930993 width=127)
-                                    predicate:((ws_item_sk BETWEEN DynamicValue(RS_246_item_i_item_sk_min) AND DynamicValue(RS_246_item_i_item_sk_max) and in_bloom_filter(ws_item_sk, DynamicValue(RS_246_item_i_item_sk_bloom_filter))) and (ws_sold_date_sk BETWEEN DynamicValue(RS_243_date_dim_d_date_sk_min) AND DynamicValue(RS_243_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_243_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_item_sk is not null and ws_sold_date_sk is not null)
-                                    TableScan [TS_126] (rows=144002668 width=127)
+                                  Filter Operator [FIL_694] (rows=143930993 width=127)
+                                    predicate:((ws_item_sk BETWEEN DynamicValue(RS_238_item_i_item_sk_min) AND DynamicValue(RS_238_item_i_item_sk_max) and in_bloom_filter(ws_item_sk, DynamicValue(RS_238_item_i_item_sk_bloom_filter))) and (ws_sold_date_sk BETWEEN DynamicValue(RS_235_date_dim_d_date_sk_min) AND DynamicValue(RS_235_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_235_date_dim_d_date_sk_bloom_filter))) and ws_bill_customer_sk is not null and ws_item_sk is not null and ws_sold_date_sk is not null)
+                                    TableScan [TS_122] (rows=144002668 width=127)
                                       default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_bill_customer_sk","ws_quantity","ws_list_price"]
                                     <-Reducer 14 [BROADCAST_EDGE] vectorized
-                                      BROADCAST [RS_701]
-                                        Group By Operator [GBY_700] (rows=1 width=12)
+                                      BROADCAST [RS_691]
+                                        Group By Operator [GBY_690] (rows=1 width=12)
                                           Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                         <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                          PARTITION_ONLY_SHUFFLE [RS_618]
-                                            Group By Operator [GBY_616] (rows=1 width=12)
+                                          PARTITION_ONLY_SHUFFLE [RS_608]
+                                            Group By Operator [GBY_606] (rows=1 width=12)
                                               Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                              Select Operator [SEL_614] (rows=50 width=4)
+                                              Select Operator [SEL_604] (rows=50 width=4)
                                                 Output:["_col0"]
-                                                 Please refer to the previous Select Operator [SEL_610]
+                                                 Please refer to the previous Select Operator [SEL_600]
                                     <-Reducer 20 [BROADCAST_EDGE] vectorized
-                                      BROADCAST [RS_703]
-                                        Group By Operator [GBY_702] (rows=1 width=12)
+                                      BROADCAST [RS_693]
+                                        Group By Operator [GBY_692] (rows=1 width=12)
                                           Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                         <-Reducer 18 [CUSTOM_SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_647]
-                                            Group By Operator [GBY_645] (rows=1 width=12)
+                                          SHUFFLE [RS_637]
+                                            Group By Operator [GBY_635] (rows=1 width=12)
                                               Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                              Select Operator [SEL_643] (rows=2235 width=4)
+                                              Select Operator [SEL_633] (rows=2235 width=4)
                                                 Output:["_col0"]
-                                                 Please refer to the previous Group By Operator [GBY_639]
+                                                 Please refer to the previous Group By Operator [GBY_629]
                     <-Reducer 34 [SIMPLE_EDGE]
-                      SHUFFLE [RS_249]
+                      SHUFFLE [RS_241]
                         PartitionCols:_col0
-                        Select Operator [SEL_241] (rows=471875 width=4)
+                        Select Operator [SEL_233] (rows=471875 width=4)
                           Output:["_col0"]
-                          Filter Operator [FIL_240] (rows=471875 width=228)
+                          Filter Operator [FIL_232] (rows=471875 width=228)
                             predicate:(_col3 > (0.95 * _col1))
-                            Merge Join Operator [MERGEJOIN_597] (rows=1415625 width=228)
+                            Merge Join Operator [MERGEJOIN_587] (rows=1415625 width=228)
                               Conds:(Inner),Output:["_col1","_col2","_col3"]
                             <-Reducer 33 [CUSTOM_SIMPLE_EDGE]
-                              PARTITION_ONLY_SHUFFLE [RS_237]
-                                Merge Join Operator [MERGEJOIN_596] (rows=1 width=112)
+                              PARTITION_ONLY_SHUFFLE [RS_229]
+                                Merge Join Operator [MERGEJOIN_586] (rows=1 width=112)
                                   Conds:(Inner),Output:["_col1"]
                                 <-Reducer 32 [CUSTOM_SIMPLE_EDGE] vectorized
-                                  PARTITION_ONLY_SHUFFLE [RS_712]
-                                    Select Operator [SEL_711] (rows=1 width=8)
-                                      Filter Operator [FIL_710] (rows=1 width=8)
+                                  PARTITION_ONLY_SHUFFLE [RS_702]
+                                    Select Operator [SEL_701] (rows=1 width=8)
+                                      Filter Operator [FIL_700] (rows=1 width=8)
                                         predicate:(sq_count_check(_col0) <= 1)
-                                        Group By Operator [GBY_709] (rows=1 width=8)
+                                        Group By Operator [GBY_699] (rows=1 width=8)
                                           Output:["_col0"],aggregations:["count()"]
-                                          Select Operator [SEL_708] (rows=1 width=8)
-                                            Group By Operator [GBY_707] (rows=1 width=8)
+                                          Select Operator [SEL_698] (rows=1 width=8)
+                                            Group By Operator [GBY_697] (rows=1 width=8)
                                               Output:["_col0"],aggregations:["count(VALUE._col0)"]
                                             <-Reducer 27 [CUSTOM_SIMPLE_EDGE] vectorized
-                                              PARTITION_ONLY_SHUFFLE [RS_680]
-                                                Group By Operator [GBY_676] (rows=1 width=8)
+                                              PARTITION_ONLY_SHUFFLE [RS_670]
+                                                Group By Operator [GBY_666] (rows=1 width=8)
                                                   Output:["_col0"],aggregations:["count(_col0)"]
-                                                  Select Operator [SEL_672] (rows=11859 width=116)
+                                                  Select Operator [SEL_662] (rows=11859 width=116)
                                                     Output:["_col0"]
-                                                    Group By Operator [GBY_669] (rows=11859 width=116)
+                                                    Group By Operator [GBY_659] (rows=11859 width=116)
                                                       Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
                                                     <-Reducer 26 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_51]
+                                                      SHUFFLE [RS_49]
                                                         PartitionCols:_col0
-                                                        Group By Operator [GBY_50] (rows=11859 width=116)
-                                                          Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                                                          Select Operator [SEL_48] (rows=18762463 width=4)
-                                                            Output:["_col0","_col1"]
-                                                            Merge Join Operator [MERGEJOIN_579] (rows=18762463 width=4)
-                                                              Conds:RS_45._col1=RS_667._col0(Inner),Output:["_col2","_col3","_col6"]
-                                                            <-Map 41 [SIMPLE_EDGE] vectorized
-                                                              SHUFFLE [RS_667]
-                                                                PartitionCols:_col0
-                                                                Select Operator [SEL_665] (rows=80000000 width=4)
-                                                                  Output:["_col0"]
-                                                                  Filter Operator [FIL_664] (rows=80000000 width=4)
-                                                                    predicate:c_customer_sk is not null
-                                                                    TableScan [TS_96] (rows=80000000 width=4)
-                                                                      default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk"]
-                                                            <-Reducer 25 [SIMPLE_EDGE]
-                                                              SHUFFLE [RS_45]
-                                                                PartitionCols:_col1
-                                                                Merge Join Operator [MERGEJOIN_578] (rows=18762463 width=0)
-                                                                  Conds:RS_663._col0=RS_655._col0(Inner),Output:["_col1","_col2","_col3"]
-                                                                <-Map 36 [SIMPLE_EDGE] vectorized
-                                                                  PARTITION_ONLY_SHUFFLE [RS_655]
-                                                                    PartitionCols:_col0
-                                                                    Select Operator [SEL_654] (rows=2609 width=8)
-                                                                      Output:["_col0"]
-                                                                      Filter Operator [FIL_653] (rows=2609 width=8)
-                                                                        predicate:((d_year) IN (1999, 2000, 2001, 2002) and d_date_sk is not null)
-                                                                        TableScan [TS_36] (rows=73049 width=8)
-                                                                          default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                                                                <-Map 24 [SIMPLE_EDGE] vectorized
-                                                                  SHUFFLE [RS_663]
-                                                                    PartitionCols:_col0
-                                                                    Select Operator [SEL_662] (rows=525327388 width=118)
-                                                                      Output:["_col0","_col1","_col2","_col3"]
-                                                                      Filter Operator [FIL_661] (rows=525327388 width=118)
-                                                                        predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_43_date_dim_d_date_sk_min) AND DynamicValue(RS_43_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_43_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
-                                                                        TableScan [TS_33] (rows=575995635 width=118)
-                                                                          default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_quantity","ss_sales_price"]
-                                                                        <-Reducer 37 [BROADCAST_EDGE] vectorized
-                                                                          BROADCAST [RS_660]
-                                                                            Group By Operator [GBY_659] (rows=1 width=12)
-                                                                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                                            <-Map 36 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                              PARTITION_ONLY_SHUFFLE [RS_658]
-                                                                                Group By Operator [GBY_657] (rows=1 width=12)
-                                                                                  Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                  Select Operator [SEL_656] (rows=2609 width=4)
-                                                                                    Output:["_col0"]
-                                                                                     Please refer to the previous Select Operator [SEL_654]
+                                                        Group By Operator [GBY_48] (rows=106731 width=116)
+                                                          Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                                                          Merge Join Operator [MERGEJOIN_569] (rows=18762463 width=116)
+                                                            Conds:RS_44._col1=RS_657._col0(Inner),Output:["_col2","_col4"]
+                                                          <-Map 41 [SIMPLE_EDGE] vectorized
+                                                            SHUFFLE [RS_657]
+                                                              PartitionCols:_col0
+                                                              Select Operator [SEL_655] (rows=80000000 width=4)
+                                                                Output:["_col0"]
+                                                                Filter Operator [FIL_654] (rows=80000000 width=4)
+                                                                  predicate:c_customer_sk is not null
+                                                                  TableScan [TS_93] (rows=80000000 width=4)
+                                                                    default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk"]
+                                                          <-Reducer 25 [SIMPLE_EDGE]
+                                                            SHUFFLE [RS_44]
+                                                              PartitionCols:_col1
+                                                              Merge Join Operator [MERGEJOIN_568] (rows=18762463 width=112)
+                                                                Conds:RS_653._col0=RS_645._col0(Inner),Output:["_col1","_col2"]
+                                                              <-Map 36 [SIMPLE_EDGE] vectorized
+                                                                PARTITION_ONLY_SHUFFLE [RS_645]
+                                                                  PartitionCols:_col0
+                                                                  Select Operator [SEL_644] (rows=2609 width=4)
+                                                                    Output:["_col0"]
+                                                                    Filter Operator [FIL_643] (rows=2609 width=8)
+                                                                      predicate:((d_year) IN (1999, 2000, 2001, 2002) and d_date_sk is not null)
+                                                                      TableScan [TS_35] (rows=73049 width=8)
+                                                                        default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                                              <-Map 24 [SIMPLE_EDGE] vectorized
+                                                                SHUFFLE [RS_653]
+                                                                  PartitionCols:_col0
+                                                                  Select Operator [SEL_652] (rows=525327388 width=119)
+                                                                    Output:["_col0","_col1","_col2"]
+                                                                    Filter Operator [FIL_651] (rows=525327388 width=118)
+                                                                      predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_42_date_dim_d_date_sk_min) AND DynamicValue(RS_42_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_42_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
+                                                                      TableScan [TS_32] (rows=575995635 width=118)
+                                                                        default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_quantity","ss_sales_price"]
+                                                                      <-Reducer 37 [BROADCAST_EDGE] vectorized
+                                                                        BROADCAST [RS_650]
+                                                                          Group By Operator [GBY_649] (rows=1 width=12)
+                                                                            Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                                          <-Map 36 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                                            PARTITION_ONLY_SHUFFLE [RS_648]
+                                                                              Group By Operator [GBY_647] (rows=1 width=12)
+                                                                                Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                                                Select Operator [SEL_646] (rows=2609 width=4)
+                                                                                  Output:["_col0"]
+                                                                                   Please refer to the previous Select Operator [SEL_644]
                                 <-Reducer 35 [CUSTOM_SIMPLE_EDGE] vectorized
-                                  PARTITION_ONLY_SHUFFLE [RS_714]
-                                    Group By Operator [GBY_713] (rows=1 width=112)
+                                  PARTITION_ONLY_SHUFFLE [RS_704]
+                                    Group By Operator [GBY_703] (rows=1 width=112)
                                       Output:["_col0"],aggregations:["max(VALUE._col0)"]
                                     <-Reducer 27 [CUSTOM_SIMPLE_EDGE] vectorized
-                                      PARTITION_ONLY_SHUFFLE [RS_681]
-                                        Group By Operator [GBY_677] (rows=1 width=112)
+                                      PARTITION_ONLY_SHUFFLE [RS_671]
+                                        Group By Operator [GBY_667] (rows=1 width=112)
                                           Output:["_col0"],aggregations:["max(_col1)"]
-                                          Select Operator [SEL_673] (rows=11859 width=116)
+                                          Select Operator [SEL_663] (rows=11859 width=116)
                                             Output:["_col1"]
-                                             Please refer to the previous Group By Operator [GBY_669]
+                                             Please refer to the previous Group By Operator [GBY_659]
                             <-Reducer 43 [CUSTOM_SIMPLE_EDGE] vectorized
-                              PARTITION_ONLY_SHUFFLE [RS_721]
-                                Group By Operator [GBY_720] (rows=1415625 width=116)
+                              PARTITION_ONLY_SHUFFLE [RS_711]
+                                Group By Operator [GBY_710] (rows=1415625 width=116)
                                   Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
                                 <-Reducer 42 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_231]
+                                  SHUFFLE [RS_223]
                                     PartitionCols:_col0
-                                    Group By Operator [GBY_230] (rows=550080312 width=116)
-                                      Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                                      Select Operator [SEL_228] (rows=550080312 width=114)
-                                        Output:["_col0","_col1"]
-                                        Merge Join Operator [MERGEJOIN_590] (rows=550080312 width=114)
-                                          Conds:RS_719._col0=RS_668._col0(Inner),Output:["_col1","_col2","_col3"]
-                                        <-Map 41 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_668]
-                                            PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_665]
-                                        <-Map 45 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_719]
-                                            PartitionCols:_col0
-                                            Select Operator [SEL_718] (rows=550080312 width=114)
-                                              Output:["_col0","_col1","_col2"]
-                                              Filter Operator [FIL_717] (rows=550080312 width=114)
-                                                predicate:((ss_customer_sk BETWEEN DynamicValue(RS_248_web_sales_ws_bill_customer_sk_min) AND DynamicValue(RS_248_web_sales_ws_bill_customer_sk_max) and in_bloom_filter(ss_customer_sk, DynamicValue(RS_248_web_sales_ws_bill_customer_sk_bloom_filter))) and ss_customer_sk is not null)
-                                                TableScan [TS_219] (rows=575995635 width=114)
-                                                  default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_customer_sk","ss_quantity","ss_sales_price"]
-                                                <-Reducer 13 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_716]
-                                                    Group By Operator [GBY_715] (rows=1 width=12)
-                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                    <-Reducer 11 [CUSTOM_SIMPLE_EDGE]
-                                                      PARTITION_ONLY_SHUFFLE [RS_570]
-                                                        Group By Operator [GBY_569] (rows=1 width=12)
-                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_568] (rows=155 width=0)
-                                                            Output:["_col0"]
-                                                             Please refer to the previous Merge Join Operator [MERGEJOIN_592]
+                                    Group By Operator [GBY_222] (rows=80000000 width=116)
+                                      Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col2
+                                      Merge Join Operator [MERGEJOIN_580] (rows=550080312 width=116)
+                                        Conds:RS_709._col0=RS_658._col0(Inner),Output:["_col1","_col2"]
+                                      <-Map 41 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_658]
+                                          PartitionCols:_col0
+                                           Please refer to the previous Select Operator [SEL_655]
+                                      <-Map 45 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_709]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_708] (rows=550080312 width=115)
+                                            Output:["_col0","_col1"]
+                                            Filter Operator [FIL_707] (rows=550080312 width=114)
+                                              predicate:((ss_customer_sk BETWEEN DynamicValue(RS_240_web_sales_ws_bill_customer_sk_min) AND DynamicValue(RS_240_web_sales_ws_bill_customer_sk_max) and in_bloom_filter(ss_customer_sk, DynamicValue(RS_240_web_sales_ws_bill_customer_sk_bloom_filter))) and ss_customer_sk is not null)
+                                              TableScan [TS_212] (rows=575995635 width=114)
+                                                default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_customer_sk","ss_quantity","ss_sales_price"]
+                                              <-Reducer 13 [BROADCAST_EDGE] vectorized
+                                                BROADCAST [RS_706]
+                                                  Group By Operator [GBY_705] (rows=1 width=12)
+                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                  <-Reducer 11 [CUSTOM_SIMPLE_EDGE]
+                                                    PARTITION_ONLY_SHUFFLE [RS_560]
+                                                      Group By Operator [GBY_559] (rows=1 width=12)
+                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                        Select Operator [SEL_558] (rows=155 width=0)
+                                                          Output:["_col0"]
+                                                           Please refer to the previous Merge Join Operator [MERGEJOIN_582]
             <-Reducer 4 [CONTAINS]
-              Reduce Output Operator [RS_603]
-                Group By Operator [GBY_602] (rows=1 width=112)
+              Reduce Output Operator [RS_593]
+                Group By Operator [GBY_592] (rows=1 width=112)
                   Output:["_col0"],aggregations:["sum(_col0)"]
-                  Select Operator [SEL_600] (rows=1 width=112)
+                  Select Operator [SEL_590] (rows=1 width=112)
                     Output:["_col0"]
-                    Merge Join Operator [MERGEJOIN_599] (rows=1 width=116)
-                      Conds:RS_122._col1=RS_123._col0(Inner),Output:["_col3","_col4"]
+                    Merge Join Operator [MERGEJOIN_589] (rows=1 width=116)
+                      Conds:RS_118._col1=RS_119._col0(Inner),Output:["_col3","_col4"]
                     <-Reducer 3 [SIMPLE_EDGE]
-                      PARTITION_ONLY_SHUFFLE [RS_122]
+                      PARTITION_ONLY_SHUFFLE [RS_118]
                         PartitionCols:_col1
-                        Merge Join Operator [MERGEJOIN_591] (rows=304 width=0)
-                          Conds:RS_119._col2=RS_640._col0(Inner),Output:["_col1","_col3","_col4"]
+                        Merge Join Operator [MERGEJOIN_581] (rows=304 width=0)
+                          Conds:RS_115._col2=RS_630._col0(Inner),Output:["_col1","_col3","_col4"]
                         <-Reducer 18 [SIMPLE_EDGE] vectorized
-                          SHUFFLE [RS_640]
+                          SHUFFLE [RS_630]
                             PartitionCols:_col0
-                             Please refer to the previous Group By Operator [GBY_639]
+                             Please refer to the previous Group By Operator [GBY_629]
                         <-Reducer 2 [SIMPLE_EDGE]
-                          SHUFFLE [RS_119]
+                          SHUFFLE [RS_115]
                             PartitionCols:_col2
-                            Merge Join Operator [MERGEJOIN_575] (rows=7751875 width=101)
-                              Conds:RS_652._col0=RS_611._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
+                            Merge Join Operator [MERGEJOIN_565] (rows=7751875 width=101)
+                              Conds:RS_642._col0=RS_601._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
                             <-Map 8 [SIMPLE_EDGE] vectorized
-                              PARTITION_ONLY_SHUFFLE [RS_611]
+                              PARTITION_ONLY_SHUFFLE [RS_601]
                                 PartitionCols:_col0
-                                 Please refer to the previous Select Operator [SEL_610]
+                                 Please refer to the previous Select Operator [SEL_600]
                             <-Map 1 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_652]
+                              SHUFFLE [RS_642]
                                 PartitionCols:_col0
-                                Select Operator [SEL_651] (rows=285117831 width=127)
+                                Select Operator [SEL_641] (rows=285117831 width=127)
                                   Output:["_col0","_col1","_col2","_col3","_col4"]
-                                  Filter Operator [FIL_650] (rows=285117831 width=127)
-                                    predicate:((cs_item_sk BETWEEN DynamicValue(RS_120_item_i_item_sk_min) AND DynamicValue(RS_120_item_i_item_sk_max) and in_bloom_filter(cs_item_sk, DynamicValue(RS_120_item_i_item_sk_bloom_filter))) and (cs_sold_date_sk BETWEEN DynamicValue(RS_117_date_dim_d_date_sk_min) AND DynamicValue(RS_117_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_117_date_dim_d_date_sk_bloom_filter))) and cs_bill_customer_sk is not null and cs_item_sk is not null and cs_sold_date_sk is not null)
+                                  Filter Operator [FIL_640] (rows=285117831 width=127)
+                                    predicate:((cs_item_sk BETWEEN DynamicValue(RS_116_item_i_item_sk_min) AND DynamicValue(RS_116_item_i_item_sk_max) and in_bloom_filter(cs_item_sk, DynamicValue(RS_116_item_i_item_sk_bloom_filter))) and (cs_sold_date_sk BETWEEN DynamicValue(RS_113_date_dim_d_date_sk_min) AND DynamicValue(RS_113_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_113_date_dim_d_date_sk_bloom_filter))) and cs_bill_customer_sk is not null and cs_item_sk is not null and cs_sold_date_sk is not null)
                                     TableScan [TS_0] (rows=287989836 width=127)
                                       default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_bill_customer_sk","cs_item_sk","cs_quantity","cs_list_price"]
                                     <-Reducer 19 [BROADCAST_EDGE] vectorized
-                                      BROADCAST [RS_649]
-                                        Group By Operator [GBY_648] (rows=1 width=12)
+                                      BROADCAST [RS_639]
+                                        Group By Operator [GBY_638] (rows=1 width=12)
                                           Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                         <-Reducer 18 [CUSTOM_SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_646]
-                                            Group By Operator [GBY_644] (rows=1 width=12)
+                                          SHUFFLE [RS_636]
+                                            Group By Operator [GBY_634] (rows=1 width=12)
                                               Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                              Select Operator [SEL_641] (rows=2235 width=4)
+                                              Select Operator [SEL_631] (rows=2235 width=4)
                                                 Output:["_col0"]
-                                                 Please refer to the previous Group By Operator [GBY_639]
+                                                 Please refer to the previous Group By Operator [GBY_629]
                                     <-Reducer 9 [BROADCAST_EDGE] vectorized
-                                      BROADCAST [RS_620]
-                                        Group By Operator [GBY_619] (rows=1 width=12)
+                                      BROADCAST [RS_610]
+                                        Group By Operator [GBY_609] (rows=1 width=12)
                                           Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                         <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                          PARTITION_ONLY_SHUFFLE [RS_617]
-                                            Group By Operator [GBY_615] (rows=1 width=12)
+                                          PARTITION_ONLY_SHUFFLE [RS_607]
+                                            Group By Operator [GBY_605] (rows=1 width=12)
                                               Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                              Select Operator [SEL_612] (rows=50 width=4)
+                                              Select Operator [SEL_602] (rows=50 width=4)
                                                 Output:["_col0"]
-                                                 Please refer to the previous Select Operator [SEL_610]
+                                                 Please refer to the previous Select Operator [SEL_600]
                     <-Reducer 30 [SIMPLE_EDGE]
-                      SHUFFLE [RS_123]
+                      SHUFFLE [RS_119]
                         PartitionCols:_col0
-                        Select Operator [SEL_115] (rows=471875 width=4)
+                        Select Operator [SEL_111] (rows=471875 width=4)
                           Output:["_col0"]
-                          Filter Operator [FIL_114] (rows=471875 width=228)
+                          Filter Operator [FIL_110] (rows=471875 width=228)
                             predicate:(_col3 > (0.95 * _col1))
-                            Merge Join Operator [MERGEJOIN_594] (rows=1415625 width=228)
+                            Merge Join Operator [MERGEJOIN_584] (rows=1415625 width=228)
                               Conds:(Inner),Output:["_col1","_col2","_col3"]
                             <-Reducer 29 [CUSTOM_SIMPLE_EDGE]
-                              PARTITION_ONLY_SHUFFLE [RS_111]
-                                Merge Join Operator [MERGEJOIN_593] (rows=1 width=112)
+                              PARTITION_ONLY_SHUFFLE [RS_107]
+                                Merge Join Operator [MERGEJOIN_583] (rows=1 width=112)
                                   Conds:(Inner),Output:["_col1"]
                                 <-Reducer 28 [CUSTOM_SIMPLE_EDGE] vectorized
-                                  PARTITION_ONLY_SHUFFLE [RS_687]
-                                    Select Operator [SEL_686] (rows=1 width=8)
-                                      Filter Operator [FIL_685] (rows=1 width=8)
+                                  PARTITION_ONLY_SHUFFLE [RS_677]
+                                    Select Operator [SEL_676] (rows=1 width=8)
+                                      Filter Operator [FIL_675] (rows=1 width=8)
                                         predicate:(sq_count_check(_col0) <= 1)
-                                        Group By Operator [GBY_684] (rows=1 width=8)
+                                        Group By Operator [GBY_674] (rows=1 width=8)
                                           Output:["_col0"],aggregations:["count()"]
-                                          Select Operator [SEL_683] (rows=1 width=8)
-                                            Group By Operator [GBY_682] (rows=1 width=8)
+                                          Select Operator [SEL_673] (rows=1 width=8)
+                                            Group By Operator [GBY_672] (rows=1 width=8)
                                               Output:["_col0"],aggregations:["count(VALUE._col0)"]
                                             <-Reducer 27 [CUSTOM_SIMPLE_EDGE] vectorized
-                                              PARTITION_ONLY_SHUFFLE [RS_678]
-                                                Group By Operator [GBY_674] (rows=1 width=8)
+                                              PARTITION_ONLY_SHUFFLE [RS_668]
+                                                Group By Operator [GBY_664] (rows=1 width=8)
                                                   Output:["_col0"],aggregations:["count(_col0)"]
-                                                  Select Operator [SEL_670] (rows=11859 width=116)
+                                                  Select Operator [SEL_660] (rows=11859 width=116)
                                                     Output:["_col0"]
-                                                     Please refer to the previous Group By Operator [GBY_669]
+                                                     Please refer to the previous Group By Operator [GBY_659]
                                 <-Reducer 31 [CUSTOM_SIMPLE_EDGE] vectorized
-                                  PARTITION_ONLY_SHUFFLE [RS_689]
-                                    Group By Operator [GBY_688] (rows=1 width=112)
+                                  PARTITION_ONLY_SHUFFLE [RS_679]
+                                    Group By Operator [GBY_678] (rows=1 width=112)
                                       Output:["_col0"],aggregations:["max(VALUE._col0)"]
                                     <-Reducer 27 [CUSTOM_SIMPLE_EDGE] vectorized
-                                      PARTITION_ONLY_SHUFFLE [RS_679]
-                                        Group By Operator [GBY_675] (rows=1 width=112)
+                                      PARTITION_ONLY_SHUFFLE [RS_669]
+                                        Group By Operator [GBY_665] (rows=1 width=112)
                                           Output:["_col0"],aggregations:["max(_col1)"]
-                                          Select Operator [SEL_671] (rows=11859 width=116)
+                                          Select Operator [SEL_661] (rows=11859 width=116)
                                             Output:["_col1"]
-                                             Please refer to the previous Group By Operator [GBY_669]
+                                             Please refer to the previous Group By Operator [GBY_659]
                             <-Reducer 40 [CUSTOM_SIMPLE_EDGE] vectorized
-                              PARTITION_ONLY_SHUFFLE [RS_696]
-                                Group By Operator [GBY_695] (rows=1415625 width=116)
+                              PARTITION_ONLY_SHUFFLE [RS_686]
+                                Group By Operator [GBY_685] (rows=1415625 width=116)
                                   Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
                                 <-Reducer 39 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_105]
+                                  SHUFFLE [RS_101]
                                     PartitionCols:_col0
-                                    Group By Operator [GBY_104] (rows=550080312 width=116)
-                                      Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                                      Select Operator [SEL_102] (rows=550080312 width=114)
-                                        Output:["_col0","_col1"]
-                                        Merge Join Operator [MERGEJOIN_582] (rows=550080312 width=114)
-                                          Conds:RS_694._col0=RS_666._col0(Inner),Output:["_col1","_col2","_col3"]
-                                        <-Map 41 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_666]
-                                            PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_665]
-                                        <-Map 38 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_694]
-                                            PartitionCols:_col0
-                                            Select Operator [SEL_693] (rows=550080312 width=114)
-                                              Output:["_col0","_col1","_col2"]
-                                              Filter Operator [FIL_692] (rows=550080312 width=114)
-                                                predicate:((ss_customer_sk BETWEEN DynamicValue(RS_122_catalog_sales_cs_bill_customer_sk_min) AND DynamicValue(RS_122_catalog_sales_cs_bill_customer_sk_max) and in_bloom_filter(ss_customer_sk, DynamicValue(RS_122_catalog_sales_cs_bill_customer_sk_bloom_filter))) and ss_customer_sk is not null)
-                                                TableScan [TS_93] (rows=575995635 width=114)
-                                                  default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_customer_sk","ss_quantity","ss_sales_price"]
-                                                <-Reducer 7 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_691]
-                                                    Group By Operator [GBY_690] (rows=1 width=12)
-                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                    <-Reducer 3 [CUSTOM_SIMPLE_EDGE]
-                                                      PARTITION_ONLY_SHUFFLE [RS_464]
-                                                        Group By Operator [GBY_463] (rows=1 width=12)
-                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_462] (rows=304 width=0)
-                                                            Output:["_col0"]
-                                                             Please refer to the previous Merge Join Operator [MERGEJOIN_591]
+                                    Group By Operator [GBY_100] (rows=80000000 width=116)
+                                      Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col2
+                                      Merge Join Operator [MERGEJOIN_572] (rows=550080312 width=116)
+                                        Conds:RS_684._col0=RS_656._col0(Inner),Output:["_col1","_col2"]
+                                      <-Map 41 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_656]
+                                          PartitionCols:_col0
+                                           Please refer to the previous Select Operator [SEL_655]
+                                      <-Map 38 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_684]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_683] (rows=550080312 width=115)
+                                            Output:["_col0","_col1"]
+                                            Filter Operator [FIL_682] (rows=550080312 width=114)
+                                              predicate:((ss_customer_sk BETWEEN DynamicValue(RS_118_catalog_sales_cs_bill_customer_sk_min) AND DynamicValue(RS_118_catalog_sales_cs_bill_customer_sk_max) and in_bloom_filter(ss_customer_sk, DynamicValue(RS_118_catalog_sales_cs_bill_customer_sk_bloom_filter))) and ss_customer_sk is not null)
+                                              TableScan [TS_90] (rows=575995635 width=114)
+                                                default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_customer_sk","ss_quantity","ss_sales_price"]
+                                              <-Reducer 7 [BROADCAST_EDGE] vectorized
+                                                BROADCAST [RS_681]
+                                                  Group By Operator [GBY_680] (rows=1 width=12)
+                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                  <-Reducer 3 [CUSTOM_SIMPLE_EDGE]
+                                                    PARTITION_ONLY_SHUFFLE [RS_454]
+                                                      Group By Operator [GBY_453] (rows=1 width=12)
+                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                        Select Operator [SEL_452] (rows=304 width=0)
+                                                          Output:["_col0"]
+                                                           Please refer to the previous Merge Join Operator [MERGEJOIN_581]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query24.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query24.q.out b/ql/src/test/results/clientpositive/perf/tez/query24.q.out
index 43ece85..bd065ae 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query24.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query24.q.out
@@ -166,9 +166,9 @@ Stage-0
                             SHUFFLE [RS_81]
                               PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
                               Group By Operator [GBY_80] (rows=576061174 width=932)
-                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(_col18)"],keys:_col11, _col12, _col1, _col5, _col7, _col20, _col21, _col22, _col23, _col24
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(_col17)"],keys:_col10, _col11, _col1, _col5, _col6, _col19, _col20, _col21, _col22, _col23
                                 Merge Join Operator [MERGEJOIN_300] (rows=589731269 width=928)
-                                  Conds:RS_76._col14, _col17=RS_332._col0, _col1(Inner),Output:["_col1","_col5","_col7","_col11","_col12","_col18","_col20","_col21","_col22","_col23","_col24"]
+                                  Conds:RS_76._col13, _col16=RS_332._col0, _col1(Inner),Output:["_col1","_col5","_col6","_col10","_col11","_col17","_col19","_col20","_col21","_col22","_col23"]
                                 <-Map 23 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_332]
                                     PartitionCols:_col0, _col1
@@ -180,9 +180,9 @@ Stage-0
                                           default@store_returns,store_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_item_sk","sr_ticket_number"]
                                 <-Reducer 9 [SIMPLE_EDGE]
                                   SHUFFLE [RS_76]
-                                    PartitionCols:_col14, _col17
+                                    PartitionCols:_col13, _col16
                                     Merge Join Operator [MERGEJOIN_299] (rows=576061174 width=936)
-                                      Conds:RS_73._col14=RS_308._col0(Inner),Output:["_col1","_col5","_col7","_col11","_col12","_col14","_col17","_col18","_col20","_col21","_col22","_col23","_col24"]
+                                      Conds:RS_73._col13=RS_308._col0(Inner),Output:["_col1","_col5","_col6","_col10","_col11","_col13","_col16","_col17","_col19","_col20","_col21","_col22","_col23"]
                                     <-Map 7 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_308]
                                         PartitionCols:_col0
@@ -194,16 +194,16 @@ Stage-0
                                               default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_current_price","i_size","i_color","i_units","i_manager_id"]
                                     <-Reducer 18 [SIMPLE_EDGE]
                                       SHUFFLE [RS_73]
-                                        PartitionCols:_col14
+                                        PartitionCols:_col13
                                         Merge Join Operator [MERGEJOIN_298] (rows=576061174 width=555)
-                                          Conds:RS_70._col9, _col4=RS_344._col1, _col2(Inner),Output:["_col1","_col5","_col7","_col11","_col12","_col14","_col17","_col18"]
+                                          Conds:RS_70._col8, _col4=RS_344._col1, _col2(Inner),Output:["_col1","_col5","_col6","_col10","_col11","_col13","_col16","_col17"]
                                         <-Reducer 15 [SIMPLE_EDGE]
                                           SHUFFLE [RS_70]
-                                            PartitionCols:_col9, _col4
-                                            Filter Operator [FIL_21] (rows=7276996 width=637)
-                                              predicate:(_col13 <> upper(_col3))
-                                              Merge Join Operator [MERGEJOIN_293] (rows=7276996 width=637)
-                                                Conds:RS_18._col0=RS_321._col1(Inner),Output:["_col1","_col3","_col4","_col5","_col7","_col9","_col11","_col12","_col13"]
+                                            PartitionCols:_col8, _col4
+                                            Filter Operator [FIL_21] (rows=7276996 width=724)
+                                              predicate:(_col12 <> _col3)
+                                              Merge Join Operator [MERGEJOIN_293] (rows=7276996 width=724)
+                                                Conds:RS_18._col0=RS_321._col1(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col8","_col10","_col11","_col12"]
                                               <-Map 22 [SIMPLE_EDGE] vectorized
                                                 SHUFFLE [RS_321]
                                                   PartitionCols:_col1
@@ -216,12 +216,12 @@ Stage-0
                                               <-Reducer 14 [SIMPLE_EDGE]
                                                 SHUFFLE [RS_18]
                                                   PartitionCols:_col0
-                                                  Merge Join Operator [MERGEJOIN_292] (rows=611379 width=365)
-                                                    Conds:RS_315._col2=RS_318._col4(Inner),Output:["_col0","_col1","_col3","_col4","_col5","_col7"]
+                                                  Merge Join Operator [MERGEJOIN_292] (rows=611379 width=452)
+                                                    Conds:RS_315._col2=RS_318._col3(Inner),Output:["_col0","_col1","_col3","_col4","_col5","_col6"]
                                                   <-Map 13 [SIMPLE_EDGE] vectorized
                                                     SHUFFLE [RS_315]
                                                       PartitionCols:_col2
-                                                      Select Operator [SEL_314] (rows=40000000 width=276)
+                                                      Select Operator [SEL_314] (rows=40000000 width=363)
                                                         Output:["_col0","_col1","_col2","_col3"]
                                                         Filter Operator [FIL_313] (rows=40000000 width=276)
                                                           predicate:(ca_address_sk is not null and ca_zip is not null)
@@ -229,9 +229,9 @@ Stage-0
                                                             default@customer_address,customer_address,Tbl:COMPLETE,Col:COMPLETE,Output:["ca_address_sk","ca_state","ca_zip","ca_country"]
                                                   <-Map 21 [SIMPLE_EDGE] vectorized
                                                     SHUFFLE [RS_318]
-                                                      PartitionCols:_col4
-                                                      Select Operator [SEL_317] (rows=155 width=271)
-                                                        Output:["_col0","_col1","_col3","_col4"]
+                                                      PartitionCols:_col3
+                                                      Select Operator [SEL_317] (rows=155 width=267)
+                                                        Output:["_col0","_col1","_col2","_col3"]
                                                         Filter Operator [FIL_316] (rows=155 width=271)
                                                           predicate:((s_market_id = 7) and s_store_sk is not null and s_zip is not null)
                                                           TableScan [TS_9] (rows=1704 width=270)
@@ -281,9 +281,9 @@ Stage-0
                         SHUFFLE [RS_37]
                           PartitionCols:_col0, _col1, _col2
                           Group By Operator [GBY_36] (rows=84010488 width=843)
-                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"],aggregations:["sum(_col4)"],keys:_col13, _col14, _col21, _col6, _col7, _col9, _col10, _col17, _col23
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"],aggregations:["sum(_col4)"],keys:_col12, _col13, _col20, _col6, _col7, _col8, _col9, _col16, _col21
                             Merge Join Operator [MERGEJOIN_295] (rows=138508741 width=824)
-                              Conds:RS_32._col0, _col3=RS_331._col0, _col1(Inner),Output:["_col4","_col6","_col7","_col9","_col10","_col13","_col14","_col17","_col21","_col23"]
+                              Conds:RS_32._col0, _col3=RS_331._col0, _col1(Inner),Output:["_col4","_col6","_col7","_col8","_col9","_col12","_col13","_col16","_col20","_col21"]
                             <-Map 23 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_331]
                                 PartitionCols:_col0, _col1
@@ -292,23 +292,23 @@ Stage-0
                               SHUFFLE [RS_32]
                                 PartitionCols:_col0, _col3
                                 Merge Join Operator [MERGEJOIN_294] (rows=84010488 width=820)
-                                  Conds:RS_29._col1, _col2=RS_30._col0, _col9(Inner),Output:["_col0","_col3","_col4","_col6","_col7","_col9","_col10","_col13","_col14","_col17","_col21","_col23"]
+                                  Conds:RS_29._col1, _col2=RS_30._col0, _col9(Inner),Output:["_col0","_col3","_col4","_col6","_col7","_col8","_col9","_col12","_col13","_col16","_col20","_col21"]
                                 <-Reducer 15 [SIMPLE_EDGE]
                                   SHUFFLE [RS_30]
                                     PartitionCols:_col0, _col9
-                                    Select Operator [SEL_22] (rows=7276996 width=637)
-                                      Output:["_col0","_col2","_col3","_col6","_col9","_col10","_col12"]
+                                    Select Operator [SEL_22] (rows=7276996 width=724)
+                                      Output:["_col0","_col2","_col3","_col6","_col9","_col10","_col11"]
                                        Please refer to the previous Filter Operator [FIL_21]
                                 <-Reducer 2 [SIMPLE_EDGE]
                                   SHUFFLE [RS_29]
                                     PartitionCols:_col1, _col2
                                     Merge Join Operator [MERGEJOIN_291] (rows=76612563 width=382)
-                                      Conds:RS_328._col0=RS_306._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col6","_col7","_col9","_col10"]
+                                      Conds:RS_328._col0=RS_306._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col6","_col7","_col8","_col9"]
                                     <-Map 7 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_306]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_304] (rows=7000 width=385)
-                                          Output:["_col0","_col1","_col2","_col4","_col5"]
+                                        Select Operator [SEL_304] (rows=7000 width=295)
+                                          Output:["_col0","_col1","_col2","_col3","_col4"]
                                           Filter Operator [FIL_302] (rows=7000 width=384)
                                             predicate:((i_color = 'orchid') and i_item_sk is not null)
                                              Please refer to the previous TableScan [TS_3]

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query25.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query25.q.out b/ql/src/test/results/clientpositive/perf/tez/query25.q.out
index 5d1c9fc..0a0cfcc 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query25.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query25.q.out
@@ -145,11 +145,11 @@ Stage-0
                 SHUFFLE [RS_49]
                   PartitionCols:_col0, _col1, _col2, _col3
                   Group By Operator [GBY_48] (rows=4248052806 width=808)
-                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col5)","sum(_col20)","sum(_col12)"],keys:_col25, _col26, _col28, _col29
+                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col5)","sum(_col16)","sum(_col10)"],keys:_col19, _col20, _col22, _col23
                     Top N Key Operator [TNK_95] (rows=4248052806 width=807)
-                      keys:_col25, _col26, _col28, _col29,sort order:++++,top n:100
+                      keys:_col19, _col20, _col22, _col23,sort order:++++,top n:100
                       Merge Join Operator [MERGEJOIN_214] (rows=4248052806 width=807)
-                        Conds:RS_44._col3=RS_258._col0(Inner),Output:["_col5","_col12","_col20","_col25","_col26","_col28","_col29"]
+                        Conds:RS_44._col3=RS_258._col0(Inner),Output:["_col5","_col10","_col16","_col19","_col20","_col22","_col23"]
                       <-Map 21 [SIMPLE_EDGE] vectorized
                         SHUFFLE [RS_258]
                           PartitionCols:_col0
@@ -163,7 +163,7 @@ Stage-0
                         SHUFFLE [RS_44]
                           PartitionCols:_col3
                           Merge Join Operator [MERGEJOIN_213] (rows=4248052806 width=623)
-                            Conds:RS_41._col1=RS_255._col0(Inner),Output:["_col3","_col5","_col12","_col20","_col25","_col26"]
+                            Conds:RS_41._col1=RS_255._col0(Inner),Output:["_col3","_col5","_col10","_col16","_col19","_col20"]
                           <-Map 20 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_255]
                               PartitionCols:_col0
@@ -177,12 +177,12 @@ Stage-0
                             SHUFFLE [RS_41]
                               PartitionCols:_col1
                               Merge Join Operator [MERGEJOIN_212] (rows=4248052806 width=343)
-                                Conds:RS_38._col1, _col2, _col4=RS_39._col8, _col9, _col10(Inner),Output:["_col1","_col3","_col5","_col12","_col20"]
+                                Conds:RS_38._col1, _col2, _col4=RS_39._col6, _col7, _col8(Inner),Output:["_col1","_col3","_col5","_col10","_col16"]
                               <-Reducer 11 [SIMPLE_EDGE]
                                 SHUFFLE [RS_39]
-                                  PartitionCols:_col8, _col9, _col10
+                                  PartitionCols:_col6, _col7, _col8
                                   Merge Join Operator [MERGEJOIN_211] (rows=1893811716 width=235)
-                                    Conds:RS_25._col2, _col1=RS_26._col1, _col2(Inner),Output:["_col3","_col8","_col9","_col10","_col11"]
+                                    Conds:RS_25._col2, _col1=RS_26._col1, _col2(Inner),Output:["_col3","_col6","_col7","_col8","_col9"]
                                   <-Reducer 10 [SIMPLE_EDGE]
                                     PARTITION_ONLY_SHUFFLE [RS_25]
                                       PartitionCols:_col2, _col1
@@ -191,7 +191,7 @@ Stage-0
                                       <-Map 8 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_223]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_219] (rows=351 width=12)
+                                          Select Operator [SEL_219] (rows=351 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_216] (rows=351 width=12)
                                               predicate:((d_year = 2000) and d_date_sk is not null and d_moy BETWEEN 4 AND 10)
@@ -221,7 +221,7 @@ Stage-0
                                                           <-Map 8 [SIMPLE_EDGE] vectorized
                                                             PARTITION_ONLY_SHUFFLE [RS_225]
                                                               PartitionCols:_col0
-                                                              Select Operator [SEL_220] (rows=351 width=12)
+                                                              Select Operator [SEL_220] (rows=351 width=4)
                                                                 Output:["_col0"]
                                                                 Filter Operator [FIL_217] (rows=351 width=12)
                                                                   predicate:((d_year = 2000) and d_date_sk is not null and d_moy BETWEEN 4 AND 10)
@@ -269,7 +269,7 @@ Stage-0
                                   <-Map 8 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_221]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_218] (rows=50 width=12)
+                                      Select Operator [SEL_218] (rows=50 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_215] (rows=50 width=12)
                                           predicate:((d_moy = 4) and (d_year = 2000) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query26.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query26.q.out b/ql/src/test/results/clientpositive/perf/tez/query26.q.out
index 7c42069..62bcbe8 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query26.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query26.q.out
@@ -83,11 +83,11 @@ Stage-0
                   SHUFFLE [RS_29]
                     PartitionCols:_col0
                     Group By Operator [GBY_28] (rows=462000 width=476)
-                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"],aggregations:["sum(_col4)","count(_col4)","sum(_col5)","count(_col5)","sum(_col7)","count(_col7)","sum(_col6)","count(_col6)"],keys:_col18
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"],aggregations:["sum(_col4)","count(_col4)","sum(_col5)","count(_col5)","sum(_col7)","count(_col7)","sum(_col6)","count(_col6)"],keys:_col12
                       Top N Key Operator [TNK_55] (rows=809521 width=100)
-                        keys:_col18,sort order:+,top n:100
+                        keys:_col12,sort order:+,top n:100
                         Merge Join Operator [MERGEJOIN_99] (rows=809521 width=100)
-                          Conds:RS_24._col2=RS_124._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col18"]
+                          Conds:RS_24._col2=RS_124._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col12"]
                         <-Map 13 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_124]
                             PartitionCols:_col0
@@ -105,7 +105,7 @@ Stage-0
                             <-Map 12 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_121]
                                 PartitionCols:_col0
-                                Select Operator [SEL_120] (rows=2300 width=174)
+                                Select Operator [SEL_120] (rows=2300 width=4)
                                   Output:["_col0"]
                                   Filter Operator [FIL_119] (rows=2300 width=174)
                                     predicate:(((p_channel_email = 'N') or (p_channel_event = 'N')) and p_promo_sk is not null)
@@ -119,7 +119,7 @@ Stage-0
                                 <-Map 10 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_110]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_109] (rows=652 width=8)
+                                    Select Operator [SEL_109] (rows=652 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_108] (rows=652 width=8)
                                         predicate:((d_year = 1998) and d_date_sk is not null)
@@ -133,7 +133,7 @@ Stage-0
                                     <-Map 8 [SIMPLE_EDGE] vectorized
                                       PARTITION_ONLY_SHUFFLE [RS_102]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_101] (rows=14776 width=265)
+                                        Select Operator [SEL_101] (rows=14776 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_100] (rows=14776 width=268)
                                             predicate:((cd_education_status = 'Primary') and (cd_gender = 'F') and (cd_marital_status = 'W') and cd_demo_sk is not null)


[34/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_join_filters.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_join_filters.q.out b/ql/src/test/results/clientpositive/llap/vector_join_filters.q.out
index a8f06eb..def06a5 100644
--- a/ql/src/test/results/clientpositive/llap/vector_join_filters.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_join_filters.q.out
@@ -122,18 +122,19 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), ((key > 40) and (value > 50) and (key = value)) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
+                        selectExpressions: VectorUDFAdaptor(((key > 40) and (value > 50) and (key = value)))(children: LongColGreaterLongScalar(col 0:int, val 40) -> 3:boolean, LongColGreaterLongScalar(col 1:int, val 50) -> 4:boolean, LongColEqualLongColumn(col 0:int, col 1:int) -> 5:boolean) -> 6:boolean
                     Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: NONE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       filter predicates:
                         0 
-                        1 {(_col0 > 40)} {(_col1 > 50)} {(_col0 = _col1)}
+                        1 {_col2}
                       keys:
                         0 
                         1 
@@ -368,18 +369,19 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
+                        selectExpressions: LongColGreaterLongScalar(col 0:int, val 40) -> 3:boolean, LongColGreaterLongScalar(col 1:int, val 50) -> 4:boolean, LongColEqualLongColumn(col 0:int, col 1:int) -> 5:boolean
                     Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: NONE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       filter predicates:
                         0 
-                        1 {(_col0 > 40)} {(_col1 > 50)} {(_col0 = _col1)}
+                        1 {_col2} {_col3} {_col4}
                       keys:
                         0 _col0 (type: int)
                         1 _col1 (type: int)
@@ -397,7 +399,7 @@ STAGE PLANS:
                         Select Vectorization:
                             className: VectorSelectOperator
                             native: true
-                            selectExpressions: VectorUDFAdaptor(hash(_col0,_col1,_col2,_col3)) -> 5:int
+                            selectExpressions: VectorUDFAdaptor(hash(_col0,_col1,_col2,_col3)) -> 8:int
                         Statistics: Num rows: 4 Data size: 35 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
                           aggregations: sum(_col0)
@@ -541,18 +543,19 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
+                        selectExpressions: LongColGreaterLongScalar(col 0:int, val 40) -> 3:boolean, LongColGreaterLongScalar(col 1:int, val 50) -> 4:boolean, LongColEqualLongColumn(col 0:int, col 1:int) -> 5:boolean
                     Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: NONE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       filter predicates:
                         0 
-                        1 {(_col0 > 40)} {(_col1 > 50)} {(_col0 = _col1)}
+                        1 {_col2} {_col3} {_col4}
                       keys:
                         0 _col0 (type: int)
                         1 _col0 (type: int)
@@ -570,7 +573,7 @@ STAGE PLANS:
                         Select Vectorization:
                             className: VectorSelectOperator
                             native: true
-                            selectExpressions: VectorUDFAdaptor(hash(_col0,_col1,_col2,_col3)) -> 5:int
+                            selectExpressions: VectorUDFAdaptor(hash(_col0,_col1,_col2,_col3)) -> 8:int
                         Statistics: Num rows: 4 Data size: 35 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
                           aggregations: sum(_col0)
@@ -714,18 +717,19 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
+                        selectExpressions: LongColGreaterLongScalar(col 0:int, val 40) -> 3:boolean, LongColGreaterLongScalar(col 1:int, val 50) -> 4:boolean, LongColEqualLongColumn(col 0:int, col 1:int) -> 5:boolean
                     Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: NONE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       filter predicates:
                         0 
-                        1 {(_col0 > 40)} {(_col1 > 50)} {(_col0 = _col1)}
+                        1 {_col2} {_col3} {_col4}
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
@@ -743,7 +747,7 @@ STAGE PLANS:
                         Select Vectorization:
                             className: VectorSelectOperator
                             native: true
-                            selectExpressions: VectorUDFAdaptor(hash(_col0,_col1,_col2,_col3)) -> 5:int
+                            selectExpressions: VectorUDFAdaptor(hash(_col0,_col1,_col2,_col3)) -> 8:int
                         Statistics: Num rows: 4 Data size: 35 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
                           aggregations: sum(_col0)
@@ -886,18 +890,19 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
+                        selectExpressions: LongColGreaterLongScalar(col 0:int, val 40) -> 3:boolean, LongColGreaterLongScalar(col 1:int, val 50) -> 4:boolean, LongColEqualLongColumn(col 0:int, col 1:int) -> 5:boolean
                     Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: NONE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       filter predicates:
                         0 
-                        1 {(_col0 > 40)} {(_col1 > 50)} {(_col0 = _col1)}
+                        1 {_col2} {_col3} {_col4}
                       keys:
                         0 _col0 (type: int), _col1 (type: int)
                         1 _col0 (type: int), _col1 (type: int)
@@ -915,7 +920,7 @@ STAGE PLANS:
                         Select Vectorization:
                             className: VectorSelectOperator
                             native: true
-                            selectExpressions: VectorUDFAdaptor(hash(_col0,_col1,_col2,_col3)) -> 5:int
+                            selectExpressions: VectorUDFAdaptor(hash(_col0,_col1,_col2,_col3)) -> 8:int
                         Statistics: Num rows: 4 Data size: 35 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
                           aggregations: sum(_col0)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_left_outer_join2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_left_outer_join2.q.out b/ql/src/test/results/clientpositive/llap/vector_left_outer_join2.q.out
index 5ac15ef..261b470 100644
--- a/ql/src/test/results/clientpositive/llap/vector_left_outer_join2.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_left_outer_join2.q.out
@@ -113,24 +113,24 @@ STAGE PLANS:
                   alias: tjoin1
                   Statistics: Num rows: 3 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: rnum (type: int), c1 (type: int), c2 (type: int)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 3 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: rnum (type: int), c1 (type: int), c2 (type: int), (c2 > 15) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {(_col2 > 15)}
+                        0 {_col3}
                         1 
                       keys:
                         0 _col1 (type: int)
                         1 _col0 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col4
+                      outputColumnNames: _col0, _col1, _col2, _col5
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                       Select Operator
-                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col4 (type: char(2))
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col5 (type: char(2))
                         outputColumnNames: _col0, _col1, _col2, _col3
                         Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                         File Output Operator
@@ -215,24 +215,24 @@ STAGE PLANS:
                   alias: tjoin1
                   Statistics: Num rows: 3 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: rnum (type: int), c1 (type: int), c2 (type: int)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 3 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: rnum (type: int), c1 (type: int), c2 (type: int), (c2 > 15) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {(_col2 > 15)}
+                        0 {_col3}
                         1 
                       keys:
                         0 _col1 (type: int)
                         1 _col0 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col4
+                      outputColumnNames: _col0, _col1, _col2, _col5
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                       Select Operator
-                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col4 (type: char(2))
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col5 (type: char(2))
                         outputColumnNames: _col0, _col1, _col2, _col3
                         Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                         File Output Operator
@@ -320,18 +320,19 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:rnum:int, 1:c1:int, 2:c2:int, 3:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: rnum (type: int), c1 (type: int), c2 (type: int)
-                    outputColumnNames: _col0, _col1, _col2
+                    expressions: rnum (type: int), c1 (type: int), c2 (type: int), (c2 > 15) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1, 2]
-                    Statistics: Num rows: 3 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
+                        projectedOutputColumnNums: [0, 1, 2, 4]
+                        selectExpressions: LongColGreaterLongScalar(col 2:int, val 15) -> 4:boolean
+                    Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {(_col2 > 15)}
+                        0 {_col3}
                         1 
                       keys:
                         0 _col1 (type: int)
@@ -343,12 +344,12 @@ STAGE PLANS:
                           native: false
                           nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Outer Join has keys IS true, Optimized Table and Supports Key Types IS true
                           nativeConditionsNotMet: hive.vectorized.execution.mapjoin.native.enabled IS false
-                      outputColumnNames: _col0, _col1, _col2, _col4
+                      outputColumnNames: _col0, _col1, _col2, _col5
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                       Select Operator
-                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col4 (type: char(2))
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col5 (type: char(2))
                         outputColumnNames: _col0, _col1, _col2, _col3
                         Select Vectorization:
                             className: VectorSelectOperator
@@ -381,7 +382,7 @@ STAGE PLANS:
                     includeColumns: [0, 1, 2]
                     dataColumns: rnum:int, c1:int, c2:int
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [string]
+                    scratchColumnTypeNames: [bigint, string]
         Map 2 
             Map Operator Tree:
                 TableScan
@@ -486,18 +487,19 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:rnum:int, 1:c1:int, 2:c2:int, 3:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: rnum (type: int), c1 (type: int), c2 (type: int)
-                    outputColumnNames: _col0, _col1, _col2
+                    expressions: rnum (type: int), c1 (type: int), c2 (type: int), (c2 > 15) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1, 2]
-                    Statistics: Num rows: 3 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
+                        projectedOutputColumnNums: [0, 1, 2, 4]
+                        selectExpressions: LongColGreaterLongScalar(col 2:int, val 15) -> 4:boolean
+                    Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {(_col2 > 15)}
+                        0 {_col3}
                         1 
                       keys:
                         0 _col1 (type: int)
@@ -509,12 +511,12 @@ STAGE PLANS:
                           native: false
                           nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Outer Join has keys IS true, Optimized Table and Supports Key Types IS true
                           nativeConditionsNotMet: hive.vectorized.execution.mapjoin.native.enabled IS false
-                      outputColumnNames: _col0, _col1, _col2, _col4
+                      outputColumnNames: _col0, _col1, _col2, _col5
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                       Select Operator
-                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col4 (type: char(2))
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col5 (type: char(2))
                         outputColumnNames: _col0, _col1, _col2, _col3
                         Select Vectorization:
                             className: VectorSelectOperator
@@ -547,7 +549,7 @@ STAGE PLANS:
                     includeColumns: [0, 1, 2]
                     dataColumns: rnum:int, c1:int, c2:int
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [string]
+                    scratchColumnTypeNames: [bigint, string]
         Map 2 
             Map Operator Tree:
                 TableScan
@@ -652,44 +654,45 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:rnum:int, 1:c1:int, 2:c2:int, 3:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: rnum (type: int), c1 (type: int), c2 (type: int)
-                    outputColumnNames: _col0, _col1, _col2
+                    expressions: rnum (type: int), c1 (type: int), c2 (type: int), (c2 > 15) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1, 2]
-                    Statistics: Num rows: 3 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
+                        projectedOutputColumnNums: [0, 1, 2, 4]
+                        selectExpressions: LongColGreaterLongScalar(col 2:int, val 15) -> 4:boolean
+                    Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {(_col2 > 15)}
+                        0 {_col3}
                         1 
                       keys:
                         0 _col1 (type: int)
                         1 _col0 (type: int)
                       Map Join Vectorization:
-                          bigTableFilterExpressions: FilterLongColGreaterLongScalar(col 2:int, val 15)
+                          bigTableFilterExpressions: SelectColumnIsTrue(col 4:boolean)
                           bigTableKeyColumns: 1:int
                           bigTableRetainColumnNums: [0, 1, 2]
                           bigTableValueColumns: 0:int, 1:int, 2:int
                           className: VectorMapJoinOuterLongOperator
                           native: true
                           nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Outer Join has keys IS true, Optimized Table and Supports Key Types IS true
-                          projectedOutput: 0:int, 1:int, 2:int, 4:char(2)
-                          smallTableValueMapping: 4:char(2)
+                          projectedOutput: 0:int, 1:int, 2:int, 5:char(2)
+                          smallTableValueMapping: 5:char(2)
                           hashTableImplementationType: OPTIMIZED
-                      outputColumnNames: _col0, _col1, _col2, _col4
+                      outputColumnNames: _col0, _col1, _col2, _col5
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                       Select Operator
-                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col4 (type: char(2))
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col5 (type: char(2))
                         outputColumnNames: _col0, _col1, _col2, _col3
                         Select Vectorization:
                             className: VectorSelectOperator
                             native: true
-                            projectedOutputColumnNums: [0, 1, 2, 4]
+                            projectedOutputColumnNums: [0, 1, 2, 5]
                         Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                         File Output Operator
                           compressed: false
@@ -717,7 +720,7 @@ STAGE PLANS:
                     includeColumns: [0, 1, 2]
                     dataColumns: rnum:int, c1:int, c2:int
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [string]
+                    scratchColumnTypeNames: [bigint, string]
         Map 2 
             Map Operator Tree:
                 TableScan
@@ -822,44 +825,45 @@ STAGE PLANS:
                       native: true
                       vectorizationSchemaColumns: [0:rnum:int, 1:c1:int, 2:c2:int, 3:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
                   Select Operator
-                    expressions: rnum (type: int), c1 (type: int), c2 (type: int)
-                    outputColumnNames: _col0, _col1, _col2
+                    expressions: rnum (type: int), c1 (type: int), c2 (type: int), (c2 > 15) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumnNums: [0, 1, 2]
-                    Statistics: Num rows: 3 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
+                        projectedOutputColumnNums: [0, 1, 2, 4]
+                        selectExpressions: LongColGreaterLongScalar(col 2:int, val 15) -> 4:boolean
+                    Statistics: Num rows: 3 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {(_col2 > 15)}
+                        0 {_col3}
                         1 
                       keys:
                         0 _col1 (type: int)
                         1 _col0 (type: int)
                       Map Join Vectorization:
-                          bigTableFilterExpressions: FilterLongColGreaterLongScalar(col 2:int, val 15)
+                          bigTableFilterExpressions: SelectColumnIsTrue(col 4:boolean)
                           bigTableKeyColumns: 1:int
                           bigTableRetainColumnNums: [0, 1, 2]
                           bigTableValueColumns: 0:int, 1:int, 2:int
                           className: VectorMapJoinOuterLongOperator
                           native: true
                           nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Outer Join has keys IS true, Optimized Table and Supports Key Types IS true
-                          projectedOutput: 0:int, 1:int, 2:int, 4:char(2)
-                          smallTableValueMapping: 4:char(2)
+                          projectedOutput: 0:int, 1:int, 2:int, 5:char(2)
+                          smallTableValueMapping: 5:char(2)
                           hashTableImplementationType: OPTIMIZED
-                      outputColumnNames: _col0, _col1, _col2, _col4
+                      outputColumnNames: _col0, _col1, _col2, _col5
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                       Select Operator
-                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col4 (type: char(2))
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col5 (type: char(2))
                         outputColumnNames: _col0, _col1, _col2, _col3
                         Select Vectorization:
                             className: VectorSelectOperator
                             native: true
-                            projectedOutputColumnNums: [0, 1, 2, 4]
+                            projectedOutputColumnNums: [0, 1, 2, 5]
                         Statistics: Num rows: 6 Data size: 588 Basic stats: COMPLETE Column stats: COMPLETE
                         File Output Operator
                           compressed: false
@@ -887,7 +891,7 @@ STAGE PLANS:
                     includeColumns: [0, 1, 2]
                     dataColumns: rnum:int, c1:int, c2:int
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [string]
+                    scratchColumnTypeNames: [bigint, string]
         Map 2 
             Map Operator Tree:
                 TableScan

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out b/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out
index aaf14ee..30b86bb 100644
--- a/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out
@@ -52,7 +52,7 @@ STAGE PLANS:
                           className: VectorSelectOperator
                           native: true
                           projectedOutputColumnNums: [0, 1, 2]
-                      Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 14 Data size: 168 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: int)
                         sort order: +
@@ -61,7 +61,7 @@ STAGE PLANS:
                             className: VectorReduceSinkLongOperator
                             native: true
                             nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                        Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 14 Data size: 168 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col2 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_varchar_mapjoin1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_varchar_mapjoin1.q.out b/ql/src/test/results/clientpositive/llap/vector_varchar_mapjoin1.q.out
index 895b90e..0cfd81c 100644
--- a/ql/src/test/results/clientpositive/llap/vector_varchar_mapjoin1.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_varchar_mapjoin1.q.out
@@ -429,13 +429,13 @@ STAGE PLANS:
                     predicate: c2 is not null (type: boolean)
                     Statistics: Num rows: 3 Data size: 294 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: c1 (type: int), c2 (type: varchar(10))
-                      outputColumnNames: _col0, _col1
+                      expressions: c1 (type: int), c2 (type: varchar(10)), CAST( c2 AS STRING) (type: string)
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 3 Data size: 294 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: CAST( _col1 AS STRING) (type: string)
+                        key expressions: _col2 (type: string)
                         sort order: +
-                        Map-reduce partition columns: CAST( _col1 AS STRING) (type: string)
+                        Map-reduce partition columns: _col2 (type: string)
                         Statistics: Num rows: 3 Data size: 294 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int), _col1 (type: varchar(10))
             Execution mode: vectorized, llap
@@ -466,17 +466,21 @@ STAGE PLANS:
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 CAST( _col1 AS STRING) (type: string)
+                          0 _col2 (type: string)
                           1 _col1 (type: string)
-                        outputColumnNames: _col0, _col1, _col2, _col3
+                        outputColumnNames: _col0, _col1, _col3, _col4
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 3 Data size: 323 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col0 (type: int)
-                          sort order: +
+                        Select Operator
+                          expressions: _col0 (type: int), _col1 (type: varchar(10)), _col3 (type: int), _col4 (type: string)
+                          outputColumnNames: _col0, _col1, _col2, _col3
                           Statistics: Num rows: 3 Data size: 323 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col1 (type: varchar(10)), _col2 (type: int), _col3 (type: string)
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int)
+                            sort order: +
+                            Statistics: Num rows: 3 Data size: 323 Basic stats: COMPLETE Column stats: NONE
+                            value expressions: _col1 (type: varchar(10)), _col2 (type: int), _col3 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vector_windowing_rank.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_windowing_rank.q.out b/ql/src/test/results/clientpositive/llap/vector_windowing_rank.q.out
index be943d5..9331132 100644
--- a/ql/src/test/results/clientpositive/llap/vector_windowing_rank.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_windowing_rank.q.out
@@ -1704,16 +1704,16 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 164 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: b (type: bigint), ts (type: timestamp), dec (type: decimal(4,2))
-                      outputColumnNames: _col1, _col2, _col3
+                      outputColumnNames: _col0, _col1, _col2
                       Select Vectorization:
                           className: VectorSelectOperator
                           native: true
                           projectedOutputColumnNums: [3, 8, 9]
                       Statistics: Num rows: 1 Data size: 164 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: bigint)
+                        key expressions: _col0 (type: bigint)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: bigint)
+                        Map-reduce partition columns: _col0 (type: bigint)
                         Reduce Sink Vectorization:
                             className: VectorReduceSinkLongOperator
                             keyColumns: 3:bigint
@@ -1721,7 +1721,7 @@ STAGE PLANS:
                             nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
                             valueColumns: 8:timestamp, 9:decimal(4,2)
                         Statistics: Num rows: 1 Data size: 164 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: timestamp), _col3 (type: decimal(4,2))
+                        value expressions: _col1 (type: timestamp), _col2 (type: decimal(4,2))
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -1797,14 +1797,14 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: bigint)
+                  0 _col0 (type: bigint)
                   1 _col0 (type: bigint)
-                outputColumnNames: _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 1 Data size: 180 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: timestamp), _col3 (type: decimal(4,2))
+                  key expressions: _col1 (type: timestamp), _col2 (type: decimal(4,2))
                   sort order: ++
-                  Map-reduce partition columns: _col2 (type: timestamp)
+                  Map-reduce partition columns: _col1 (type: timestamp)
                   Statistics: Num rows: 1 Data size: 180 Basic stats: COMPLETE Column stats: NONE
             MergeJoin Vectorization:
                 enabled: false
@@ -1827,7 +1827,7 @@ STAGE PLANS:
             Reduce Operator Tree:
               Select Operator
                 expressions: KEY.reducesinkkey0 (type: timestamp), KEY.reducesinkkey1 (type: decimal(4,2))
-                outputColumnNames: _col2, _col3
+                outputColumnNames: _col1, _col2
                 Select Vectorization:
                     className: VectorSelectOperator
                     native: true
@@ -1837,18 +1837,18 @@ STAGE PLANS:
                   Function definitions:
                       Input definition
                         input alias: ptf_0
-                        output shape: _col2: timestamp, _col3: decimal(4,2)
+                        output shape: _col1: timestamp, _col2: decimal(4,2)
                         type: WINDOWING
                       Windowing table definition
                         input alias: ptf_1
                         name: windowingtablefunction
-                        order by: _col3 ASC NULLS LAST
-                        partition by: _col2
+                        order by: _col2 ASC NULLS LAST
+                        partition by: _col1
                         raw input shape:
                         window functions:
                             window function definition
                               alias: rank_window_0
-                              arguments: _col3
+                              arguments: _col2
                               name: rank
                               window function: GenericUDAFRankEvaluator
                               window frame: ROWS PRECEDING(MAX)~FOLLOWING(MAX)
@@ -1875,7 +1875,7 @@ STAGE PLANS:
                     predicate: (rank_window_0 = 1) (type: boolean)
                     Statistics: Num rows: 1 Data size: 180 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col2 (type: timestamp), _col3 (type: decimal(4,2)), 1 (type: int)
+                      expressions: _col1 (type: timestamp), _col2 (type: decimal(4,2)), 1 (type: int)
                       outputColumnNames: _col0, _col1, _col2
                       Select Vectorization:
                           className: VectorSelectOperator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out b/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
index feecc27..43ccbe9 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
@@ -1123,12 +1123,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col2 (type: string)
+                        key expressions: _col0 (type: string), _col1 (type: string)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), _col2 (type: string)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
                         expressions: _col0 (type: string)
@@ -1146,7 +1146,7 @@ STAGE PLANS:
                             Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                             Target Vertex: Map 1
                       Select Operator
-                        expressions: _col2 (type: string)
+                        expressions: _col1 (type: string)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -1179,7 +1179,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: string), _col1 (type: string)
-                  1 _col0 (type: string), _col2 (type: string)
+                  1 _col0 (type: string), _col1 (type: string)
                 Statistics: Num rows: 2200 Data size: 809600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
@@ -1312,12 +1312,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col2 (type: string)
+                        key expressions: _col0 (type: string), _col1 (type: string)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), _col2 (type: string)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -1338,7 +1338,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: string), _col1 (type: string)
-                  1 _col0 (type: string), _col2 (type: string)
+                  1 _col0 (type: string), _col1 (type: string)
                 Statistics: Num rows: 2200 Data size: 809600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
@@ -1794,14 +1794,14 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: UDFToDouble(hr) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: UDFToDouble(_col0) (type: double)
+                      key expressions: _col0 (type: double)
                       sort order: +
-                      Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: double)
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -1823,16 +1823,16 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: double)
+                      expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
-                        expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        expressions: _col0 (type: double)
                         outputColumnNames: _col0
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -1864,9 +1864,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: double)
+                  1 _col0 (type: double)
+                Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -1968,14 +1968,14 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: (UDFToDouble(_col0) * 2.0D) (type: double)
+                      key expressions: _col0 (type: double)
                       sort order: +
-                      Map-reduce partition columns: (UDFToDouble(_col0) * 2.0D) (type: double)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: double)
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -2038,9 +2038,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 (UDFToDouble(_col0) * 2.0D) (type: double)
+                  0 _col0 (type: double)
                   1 _col0 (type: double)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -2142,14 +2142,14 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: UDFToDouble(hr) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: UDFToDouble(_col0) (type: double)
+                      key expressions: _col0 (type: double)
                       sort order: +
-                      Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: double)
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -2171,13 +2171,13 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: double)
+                      expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized, llap
             LLAP IO: all inputs
@@ -2197,9 +2197,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                  0 _col0 (type: double)
+                  1 _col0 (type: double)
+                Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -2301,14 +2301,14 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: (UDFToDouble(_col0) * 2.0D) (type: double)
+                      key expressions: _col0 (type: double)
                       sort order: +
-                      Map-reduce partition columns: (UDFToDouble(_col0) * 2.0D) (type: double)
-                      Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map-reduce partition columns: _col0 (type: double)
+                      Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
             Map Vectorization:
@@ -2356,9 +2356,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 (UDFToDouble(_col0) * 2.0D) (type: double)
+                  0 _col0 (type: double)
                   1 _col0 (type: double)
-                Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -2473,13 +2473,13 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: CAST( (UDFToDouble(hr) * 2.0D) AS STRING) (type: string)
                     outputColumnNames: _col0
                     Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
-                      key expressions: CAST( (UDFToDouble(_col0) * 2.0D) AS STRING) (type: string)
+                      key expressions: _col0 (type: string)
                       sort order: +
-                      Map-reduce partition columns: CAST( (UDFToDouble(_col0) * 2.0D) AS STRING) (type: string)
+                      Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -2502,16 +2502,16 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: double)
+                      expressions: CAST( hr AS STRING) (type: string)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: CAST( _col0 AS STRING) (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: CAST( _col0 AS STRING) (type: string)
+                        Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
-                        expressions: CAST( _col0 AS STRING) (type: string)
+                        expressions: _col0 (type: string)
                         outputColumnNames: _col0
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -2543,8 +2543,8 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 CAST( (UDFToDouble(_col0) * 2.0D) AS STRING) (type: string)
-                  1 CAST( _col0 AS STRING) (type: string)
+                  0 _col0 (type: string)
+                  1 _col0 (type: string)
                 Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
@@ -2848,12 +2848,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         sort order: 
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col2 (type: string)
+                        value expressions: _col0 (type: string), _col1 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -2874,8 +2874,8 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col4
-                residual filter predicates: {((_col0 = _col2) or (_col1 = _col4))}
+                outputColumnNames: _col0, _col1, _col2, _col3
+                residual filter predicates: {((_col0 = _col2) or (_col1 = _col3))}
                 Statistics: Num rows: 4000 Data size: 4420000 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   Statistics: Num rows: 4000 Data size: 4420000 Basic stats: COMPLETE Column stats: NONE
@@ -3010,12 +3010,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col2 (type: string)
+                        key expressions: _col0 (type: string), _col1 (type: string)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), _col2 (type: string)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
                         expressions: _col0 (type: string)
@@ -3033,7 +3033,7 @@ STAGE PLANS:
                             Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                             Target Vertex: Map 1
                       Select Operator
-                        expressions: _col2 (type: string)
+                        expressions: _col1 (type: string)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -3066,7 +3066,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: string), _col1 (type: string)
-                  1 _col0 (type: string), _col2 (type: string)
+                  1 _col0 (type: string), _col1 (type: string)
                 Statistics: Num rows: 2200 Data size: 809600 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
@@ -3863,21 +3863,21 @@ STAGE PLANS:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: srcpart_hour_n2
-                  filterExpr: (UDFToDouble(hr) = 13.0D) (type: boolean)
-                  Statistics: Num rows: 2 Data size: 368 Basic stats: COMPLETE Column stats: NONE
+                  alias: srcpart_date_n8
+                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (UDFToDouble(hr) = 13.0D) (type: boolean)
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                    Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: string)
+                      expressions: ds (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -3903,11 +3903,11 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col1 (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: string)
+                        Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: string)
+                        value expressions: _col1 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: unknown
             Map Vectorization:
@@ -3920,21 +3920,21 @@ STAGE PLANS:
         Map 6 
             Map Operator Tree:
                 TableScan
-                  alias: srcpart_date_n8
-                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
-                  Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                  alias: srcpart_hour_n2
+                  filterExpr: (UDFToDouble(hr) = 13.0D) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 368 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
-                    Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (UDFToDouble(hr) = 13.0D) (type: boolean)
+                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ds (type: string)
+                      expressions: hr (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -3954,14 +3954,14 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: string)
-                  1 _col1 (type: string)
-                outputColumnNames: _col1
-                Statistics: Num rows: 1 Data size: 202 Basic stats: COMPLETE Column stats: NONE
+                  1 _col0 (type: string)
+                outputColumnNames: _col2
+                Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: string)
+                  key expressions: _col2 (type: string)
                   sort order: +
-                  Map-reduce partition columns: _col1 (type: string)
-                  Statistics: Num rows: 1 Data size: 202 Basic stats: COMPLETE Column stats: NONE
+                  Map-reduce partition columns: _col2 (type: string)
+                  Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
             MergeJoin Vectorization:
                 enabled: false
                 enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
@@ -3972,9 +3972,9 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: string)
+                  0 _col2 (type: string)
                   1 _col0 (type: string)
-                Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 2 Data size: 889 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   mode: hash
@@ -5393,7 +5393,7 @@ STAGE PLANS:
                            Inner Join 0 to 1
                       keys:
                         0 _col0 (type: string), _col1 (type: string)
-                        1 _col0 (type: string), _col2 (type: string)
+                        1 _col0 (type: string), _col1 (type: string)
                       input vertices:
                         1 Map 3
                       Statistics: Num rows: 2200 Data size: 809600 Basic stats: COMPLETE Column stats: NONE
@@ -5428,12 +5428,12 @@ STAGE PLANS:
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), _col2 (type: string)
+                        key expressions: _col0 (type: string), _col1 (type: string)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), _col2 (type: string)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
                         expressions: _col0 (type: string)
@@ -5451,7 +5451,7 @@ STAGE PLANS:
                             Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                             Target Vertex: Map 1
                       Select Operator
-                        expressions: _col2 (type: string)
+                        expressions: _col1 (type: string)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -5741,18 +5741,18 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: UDFToDouble(hr) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
                       keys:
-                        0 UDFToDouble(_col0) (type: double)
-                        1 UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        0 _col0 (type: double)
+                        1 _col0 (type: double)
                       input vertices:
                         1 Map 3
-                      Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         aggregations: count()
                         mode: hash
@@ -5783,16 +5783,16 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and hr is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: double)
+                      expressions: UDFToDouble(UDFToInteger((hr / 2.0D))) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
-                        expressions: UDFToDouble(UDFToInteger((_col0 / 2.0D))) (type: double)
+                        expressions: _col0 (type: double)
                         outputColumnNames: _col0
                         Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator
@@ -5906,18 +5906,18 @@ STAGE PLANS:
                   filterExpr: hr is not null (type: boolean)
                   Statistics: Num rows: 2000 Data size: 389248 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: hr (type: string)
+                    expressions: (UDFToDouble(hr) * 2.0D) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 2000 Data size: 368000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 16000 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
                       keys:
-                        0 (UDFToDouble(_col0) * 2.0D) (type: double)
+                        0 _col0 (type: double)
                         1 _col0 (type: double)
                       input vertices:
                         1 Map 3
-                      Statistics: Num rows: 2200 Data size: 404800 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2200 Data size: 17600 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         aggregations: count()
                         mode: hash
@@ -6852,39 +6852,51 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Map 1 <- Map 2 (BROADCAST_EDGE)
-        Map 3 <- Map 1 (BROADCAST_EDGE)
-        Reducer 4 <- Map 3 (CUSTOM_SIMPLE_EDGE)
+        Map 1 <- Map 3 (BROADCAST_EDGE), Map 4 (BROADCAST_EDGE)
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: srcpart_hour_n2
-                  filterExpr: (UDFToDouble(hr) = 13.0D) (type: boolean)
-                  Statistics: Num rows: 2 Data size: 368 Basic stats: COMPLETE Column stats: NONE
+                  alias: srcpart_date_n8
+                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (UDFToDouble(hr) = 13.0D) (type: boolean)
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
+                    Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hr (type: string)
+                      expressions: ds (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: string)
-                          1 _col1 (type: string)
-                        outputColumnNames: _col1
+                          1 _col0 (type: string)
+                        outputColumnNames: _col2
                         input vertices:
-                          1 Map 2
-                        Statistics: Num rows: 1 Data size: 202 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col1 (type: string)
-                          sort order: +
-                          Map-reduce partition columns: _col1 (type: string)
-                          Statistics: Num rows: 1 Data size: 202 Basic stats: COMPLETE Column stats: NONE
+                          1 Map 3
+                        Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
+                        Map Join Operator
+                          condition map:
+                               Inner Join 0 to 1
+                          keys:
+                            0 _col2 (type: string)
+                            1 _col0 (type: string)
+                          input vertices:
+                            1 Map 4
+                          Statistics: Num rows: 2 Data size: 889 Basic stats: COMPLETE Column stats: NONE
+                          Group By Operator
+                            aggregations: count()
+                            mode: hash
+                            outputColumnNames: _col0
+                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                            Reduce Output Operator
+                              sort order: 
+                              Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                              value expressions: _col0 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -6893,10 +6905,10 @@ STAGE PLANS:
                 inputFormatFeatureSupport: [DECIMAL_64]
                 featureSupportInUse: [DECIMAL_64]
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
-                allNative: true
+                allNative: false
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 2 
+        Map 3 
             Map Operator Tree:
                 TableScan
                   alias: srcpart
@@ -6910,11 +6922,11 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col1 (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: string)
+                        Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: string)
+                        value expressions: _col1 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: unknown
             Map Vectorization:
@@ -6924,37 +6936,24 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 3 
+        Map 4 
             Map Operator Tree:
                 TableScan
-                  alias: srcpart_date_n8
-                  filterExpr: ((date = '2008-04-08') and ds is not null) (type: boolean)
-                  Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                  alias: srcpart_hour_n2
+                  filterExpr: (UDFToDouble(hr) = 13.0D) (type: boolean)
+                  Statistics: Num rows: 2 Data size: 368 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((date = '2008-04-08') and ds is not null) (type: boolean)
-                    Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (UDFToDouble(hr) = 13.0D) (type: boolean)
+                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ds (type: string)
+                      expressions: hr (type: string)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 2 Data size: 736 Basic stats: COMPLETE Column stats: NONE
-                      Map Join Operator
-                        condition map:
-                             Inner Join 0 to 1
-                        keys:
-                          0 _col1 (type: string)
-                          1 _col0 (type: string)
-                        input vertices:
-                          0 Map 1
-                        Statistics: Num rows: 2 Data size: 809 Basic stats: COMPLETE Column stats: NONE
-                        Group By Operator
-                          aggregations: count()
-                          mode: hash
-                          outputColumnNames: _col0
-                          Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                          Reduce Output Operator
-                            sort order: 
-                            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                            value expressions: _col0 (type: bigint)
+                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -6963,10 +6962,10 @@ STAGE PLANS:
                 inputFormatFeatureSupport: [DECIMAL_64]
                 featureSupportInUse: [DECIMAL_64]
                 inputFileFormats: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
-                allNative: false
+                allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Reducer 4 
+        Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true
@@ -7351,18 +7350,18 @@ STAGE PLANS:
                   alias: srcpart_orc_n0
                   Statistics: Num rows: 2000 Data size: 564000 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: ds (type: string), hr (type: int)
+                    expressions: ds (type: string), UDFToDouble(hr) (type: double)
                     outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 2000 Data size: 376000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 2000 Data size: 384000 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
                       keys:
-                        0 _col0 (type: string), UDFToDouble(_col1) (type: double)
-                        1 _col0 (type: string), UDFToDouble(_col2) (type: double)
+                        0 _col0 (type: string), _col1 (type: double)
+                        1 _col0 (type: string), _col1 (type: double)
                       input vertices:
                         1 Map 3
-                      Statistics: Num rows: 2200 Data size: 413600 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 2200 Data size: 422400 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         aggregations: count()
                         mode: hash
@@ -7384,13 +7383,13 @@ STAGE PLANS:
                     predicate: ((UDFToDouble(hour) = 11.0D) and (date) IN ('2008-04-08', '2008-04-09') and ds is not null and hr is not null) (type: boolean)
                     Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ds (type: string), hr (type: string)
-                      outputColumnNames: _col0, _col2
+                      expressions: ds (type: string), UDFToDouble(hr) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col0 (type: string), UDFToDouble(_col2) (type: double)
+                        key expressions: _col0 (type: string), _col1 (type: double)
                         sort order: ++
-                        Map-reduce partition columns: _col0 (type: string), UDFToDouble(_col2) (type: double)
+                        Map-reduce partition columns: _col0 (type: string), _col1 (type: double)
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
                         expressions: _col0 (type: string)
@@ -7408,7 +7407,7 @@ STAGE PLANS:
                             Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                             Target Vertex: Map 1
                       Select Operator
-                        expressions: UDFToDouble(_col2) (type: double)
+                        expressions: _col1 (type: double)
                         outputColumnNames: _col0
                         Statistics: Num rows: 2 Data size: 1472 Basic stats: COMPLETE Column stats: NONE
                         Group By Operator


[50/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/auto_join_stats.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join_stats.q.out b/ql/src/test/results/clientpositive/auto_join_stats.q.out
index 43a248b..42e165d 100644
--- a/ql/src/test/results/clientpositive/auto_join_stats.q.out
+++ b/ql/src/test/results/clientpositive/auto_join_stats.q.out
@@ -63,8 +63,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
@@ -82,8 +82,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -91,7 +91,7 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col1
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
@@ -119,13 +119,13 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
-                    0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
+                    0 (_col1 + _col3) (type: double)
+                    1 _col1 (type: double)
 
   Stage: Stage-5
     Map Reduce
@@ -135,17 +135,21 @@ STAGE PLANS:
               condition map:
                    Inner Join 0 to 1
               keys:
-                0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                1 UDFToDouble(_col0) (type: double)
-              outputColumnNames: _col0, _col1, _col2
+                0 (_col1 + _col3) (type: double)
+                1 _col1 (type: double)
+              outputColumnNames: _col0, _col2, _col4
               Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
-              File Output Operator
-                compressed: false
+              Select Operator
+                expressions: _col0 (type: string), _col2 (type: string), _col4 (type: string)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
-                table:
-                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
       Execution mode: vectorized
       Local Work:
         Map Reduce Local Work
@@ -166,8 +170,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
@@ -185,8 +189,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -194,7 +198,7 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col1
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
@@ -217,14 +221,15 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: double)
           TableScan
             alias: src2
             filterExpr: key is not null (type: boolean)
@@ -233,14 +238,15 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -248,7 +254,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
@@ -342,8 +348,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
@@ -361,8 +367,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -370,7 +376,7 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col1
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
@@ -401,14 +407,14 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
-                    0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
-                    2 UDFToDouble(_col0) (type: double)
+                    0 (_col1 + _col3) (type: double)
+                    1 _col0 (type: double)
+                    2 _col1 (type: double)
         $hdt$_3:smalltable2_n0 
           TableScan
             alias: smalltable2_n0
@@ -418,14 +424,14 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
+                expressions: UDFToDouble(key) (type: double)
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
-                    0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
-                    2 UDFToDouble(_col0) (type: double)
+                    0 (_col1 + _col3) (type: double)
+                    1 _col0 (type: double)
+                    2 _col1 (type: double)
 
   Stage: Stage-6
     Map Reduce
@@ -436,13 +442,13 @@ STAGE PLANS:
                    Inner Join 0 to 1
                    Inner Join 0 to 2
               keys:
-                0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                1 UDFToDouble(_col0) (type: double)
-                2 UDFToDouble(_col0) (type: double)
-              outputColumnNames: _col0, _col1, _col3
+                0 (_col1 + _col3) (type: double)
+                1 _col0 (type: double)
+                2 _col1 (type: double)
+              outputColumnNames: _col0, _col2, _col5
               Statistics: Num rows: 1210 Data size: 12854 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string)
+                expressions: _col0 (type: string), _col2 (type: string), _col5 (type: string)
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1210 Data size: 12854 Basic stats: COMPLETE Column stats: NONE
                 File Output Operator
@@ -472,8 +478,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
@@ -491,8 +497,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -500,7 +506,7 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col1
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
@@ -523,14 +529,15 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: double)
           TableScan
             alias: src2
             filterExpr: key is not null (type: boolean)
@@ -539,14 +546,15 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: double)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -554,7 +562,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/auto_join_stats2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/auto_join_stats2.q.out b/ql/src/test/results/clientpositive/auto_join_stats2.q.out
index 94b9df9..339a612 100644
--- a/ql/src/test/results/clientpositive/auto_join_stats2.q.out
+++ b/ql/src/test/results/clientpositive/auto_join_stats2.q.out
@@ -34,45 +34,45 @@ STAGE PLANS:
   Stage: Stage-7
     Map Reduce Local Work
       Alias -> Map Local Tables:
-        $hdt$_0:src1 
+        $hdt$_1:smalltable 
           Fetch Operator
             limit: -1
-        $hdt$_2:smalltable 
+        $hdt$_2:src1 
           Fetch Operator
             limit: -1
       Alias -> Map Local Operator Tree:
-        $hdt$_0:src1 
+        $hdt$_1:smalltable 
           TableScan
-            alias: src1
+            alias: smalltable
             filterExpr: key is not null (type: boolean)
-            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
-              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
-                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
-                    0 _col0 (type: string)
-                    1 _col0 (type: string)
-        $hdt$_2:smalltable 
+                    0 
+                    1 
+        $hdt$_2:src1 
           TableScan
-            alias: smalltable
+            alias: src1
             filterExpr: key is not null (type: boolean)
-            Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
-              Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
-                    0 
-                    1 
+                    0 _col0 (type: string)
+                    1 _col0 (type: string)
 
   Stage: Stage-5
     Map Reduce
@@ -85,8 +85,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -94,7 +94,7 @@ STAGE PLANS:
                   keys:
                     0 
                     1 
-                  outputColumnNames: _col0, _col1
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 500 Data size: 155812 Basic stats: COMPLETE Column stats: NONE
                   Map Join Operator
                     condition map:
@@ -102,13 +102,13 @@ STAGE PLANS:
                     keys:
                       0 _col0 (type: string)
                       1 _col0 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                     Statistics: Num rows: 550 Data size: 171393 Basic stats: COMPLETE Column stats: NONE
                     Filter Operator
-                      predicate: ((UDFToDouble(_col2) + UDFToDouble(_col0)) = UDFToDouble(_col1)) (type: boolean)
+                      predicate: ((_col5 + _col1) = _col3) (type: boolean)
                       Statistics: Num rows: 275 Data size: 85696 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
-                        expressions: _col2 (type: string), _col0 (type: string), _col1 (type: string)
+                        expressions: _col4 (type: string), _col0 (type: string), _col2 (type: string)
                         outputColumnNames: _col0, _col1, _col2
                         Statistics: Num rows: 275 Data size: 85696 Basic stats: COMPLETE Column stats: NONE
                         File Output Operator
@@ -205,14 +205,14 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
-                    0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
-                    2 UDFToDouble(_col0) (type: double)
+                    0 (_col1 + _col3) (type: double)
+                    1 _col0 (type: double)
+                    2 _col1 (type: double)
         $hdt$_1:src1 
           TableScan
             alias: src1
@@ -222,8 +222,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
@@ -238,14 +238,14 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
+                expressions: UDFToDouble(key) (type: double)
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                 HashTable Sink Operator
                   keys:
-                    0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
-                    2 UDFToDouble(_col0) (type: double)
+                    0 (_col1 + _col3) (type: double)
+                    1 _col0 (type: double)
+                    2 _col1 (type: double)
 
   Stage: Stage-6
     Map Reduce
@@ -258,8 +258,8 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -267,20 +267,20 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: string)
                     1 _col0 (type: string)
-                  outputColumnNames: _col0, _col1
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                   Map Join Operator
                     condition map:
                          Inner Join 0 to 1
                          Inner Join 0 to 2
                     keys:
-                      0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                      1 UDFToDouble(_col0) (type: double)
-                      2 UDFToDouble(_col0) (type: double)
-                    outputColumnNames: _col0, _col1, _col3
+                      0 (_col1 + _col3) (type: double)
+                      1 _col0 (type: double)
+                      2 _col1 (type: double)
+                    outputColumnNames: _col0, _col2, _col5
                     Statistics: Num rows: 1210 Data size: 12854 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string)
+                      expressions: _col0 (type: string), _col2 (type: string), _col5 (type: string)
                       outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 1210 Data size: 12854 Basic stats: COMPLETE Column stats: NONE
                       File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/beeline/materialized_view_create_rewrite.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/beeline/materialized_view_create_rewrite.q.out b/ql/src/test/results/clientpositive/beeline/materialized_view_create_rewrite.q.out
index 45b6d5a..1976545 100644
--- a/ql/src/test/results/clientpositive/beeline/materialized_view_create_rewrite.q.out
+++ b/ql/src/test/results/clientpositive/beeline/materialized_view_create_rewrite.q.out
@@ -324,12 +324,12 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 1948 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: c (type: decimal(10,2))
-                outputColumnNames: _col1
+                outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 1948 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 1948 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: decimal(10,2))
+                  value expressions: _col0 (type: decimal(10,2))
           TableScan
             alias: default.cmv_mat_view2_n4
             Statistics: Num rows: 2 Data size: 232 Basic stats: COMPLETE Column stats: NONE
@@ -344,10 +344,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col6
+          outputColumnNames: _col0, _col1, _col5
           Statistics: Num rows: 2 Data size: 4130 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col1 (type: decimal(10,2)), _col0 (type: int), _col6 (type: decimal(10,2))
+            expressions: _col0 (type: int), _col1 (type: decimal(10,2)), _col0 (type: int), _col5 (type: decimal(10,2))
             outputColumnNames: _col0, _col1, _col2, _col3
             Statistics: Num rows: 2 Data size: 4130 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/bucket_map_join_spark1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucket_map_join_spark1.q.out b/ql/src/test/results/clientpositive/bucket_map_join_spark1.q.out
index f9007b5..5f6a42b 100644
--- a/ql/src/test/results/clientpositive/bucket_map_join_spark1.q.out
+++ b/ql/src/test/results/clientpositive/bucket_map_join_spark1.q.out
@@ -130,7 +130,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n19`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n16`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -591,7 +591,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n19`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n16`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/bucket_map_join_spark2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucket_map_join_spark2.q.out b/ql/src/test/results/clientpositive/bucket_map_join_spark2.q.out
index d6a75f4..2dc500c 100644
--- a/ql/src/test/results/clientpositive/bucket_map_join_spark2.q.out
+++ b/ql/src/test/results/clientpositive/bucket_map_join_spark2.q.out
@@ -114,7 +114,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n12`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n10`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -575,7 +575,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n12`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n10`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/bucket_map_join_spark3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucket_map_join_spark3.q.out b/ql/src/test/results/clientpositive/bucket_map_join_spark3.q.out
index ba153dd..bc607d9 100644
--- a/ql/src/test/results/clientpositive/bucket_map_join_spark3.q.out
+++ b/ql/src/test/results/clientpositive/bucket_map_join_spark3.q.out
@@ -114,7 +114,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n4`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n3`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -575,7 +575,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n4`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n3`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/bucket_map_join_spark4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucket_map_join_spark4.q.out b/ql/src/test/results/clientpositive/bucket_map_join_spark4.q.out
index d923870..d299ae0 100644
--- a/ql/src/test/results/clientpositive/bucket_map_join_spark4.q.out
+++ b/ql/src/test/results/clientpositive/bucket_map_join_spark4.q.out
@@ -74,7 +74,7 @@ POSTHOOK: Input: default@tbl1_n0
 POSTHOOK: Input: default@tbl2_n0
 POSTHOOK: Input: default@tbl3
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value` AS `val1`, `t2`.`value` AS `val2`, `t4`.`value` AS `val3`
+OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value0`, `t4`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`tbl1_n0`
 WHERE `key` IS NOT NULL AND `value` IS NOT NULL) AS `t0`
@@ -457,7 +457,7 @@ POSTHOOK: Input: default@tbl1_n0
 POSTHOOK: Input: default@tbl2_n0
 POSTHOOK: Input: default@tbl3
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value` AS `val1`, `t2`.`value` AS `val2`, `t4`.`value` AS `val3`
+OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value0`, `t4`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`tbl1_n0`
 WHERE `key` IS NOT NULL AND `value` IS NOT NULL) AS `t0`

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/bucketsortoptimize_insert_4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_4.q.out b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_4.q.out
index cdf9030..3889804 100644
--- a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_4.q.out
+++ b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_4.q.out
@@ -101,9 +101,9 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col1, _col4
+                  outputColumnNames: _col0, _col1, _col3
                   Select Operator
-                    expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                    expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                     outputColumnNames: _col1, _col2
                     Reduce Output Operator
                       key expressions: _col1 (type: int)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/bucketsortoptimize_insert_5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_5.q.out b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_5.q.out
index 7fbd930..6baa706 100644
--- a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_5.q.out
+++ b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_5.q.out
@@ -101,9 +101,9 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col1, _col4
+                  outputColumnNames: _col0, _col1, _col3
                   Select Operator
-                    expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                    expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                     outputColumnNames: _col0, _col1
                     Reduce Output Operator
                       key expressions: _col0 (type: int)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out
index 9fa361c..5cd668f 100644
--- a/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out
+++ b/ql/src/test/results/clientpositive/bucketsortoptimize_insert_8.q.out
@@ -101,9 +101,9 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col1, _col3, _col4
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Select Operator
-                    expressions: _col0 (type: int), _col3 (type: int), concat(_col1, _col4) (type: string)
+                    expressions: _col0 (type: int), _col2 (type: int), concat(_col1, _col3) (type: string)
                     outputColumnNames: _col0, _col1, _col2
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
@@ -295,9 +295,9 @@ STAGE PLANS:
                   keys:
                     0 _col0 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col0, _col1, _col3, _col4
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Select Operator
-                    expressions: _col3 (type: int), _col0 (type: int), concat(_col1, _col4) (type: string)
+                    expressions: _col2 (type: int), _col0 (type: int), concat(_col1, _col3) (type: string)
                     outputColumnNames: _col0, _col1, _col2
                     Reduce Output Operator
                       key expressions: _col0 (type: int)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/cbo_const.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cbo_const.q.out b/ql/src/test/results/clientpositive/cbo_const.q.out
index 080eb55..9c2d3e4 100644
--- a/ql/src/test/results/clientpositive/cbo_const.q.out
+++ b/ql/src/test/results/clientpositive/cbo_const.q.out
@@ -251,23 +251,6 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: y
-            filterExpr: (UDFToDouble(key) = 3.0D) (type: boolean)
-            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-            Filter Operator
-              predicate: (UDFToDouble(key) = 3.0D) (type: boolean)
-              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-              Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
-          TableScan
             alias: x
             filterExpr: ((UDFToDouble(key) = 3.0D) and value is not null) (type: boolean)
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
@@ -279,20 +262,36 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 12 Data size: 91 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
+                  key expressions: _col1 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col1 (type: string)
+                  Statistics: Num rows: 12 Data size: 91 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: string)
+          TableScan
+            alias: z
+            filterExpr: ((ds = '2008-04-08') and (UDFToDouble(hr) = 14.0D) and value is not null) (type: boolean)
+            Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+            Filter Operator
+              predicate: ((UDFToDouble(hr) = 14.0D) and (ds = '2008-04-08') and value is not null) (type: boolean)
+              Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+              Select Operator
+                expressions: value (type: string)
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 12 Data size: 91 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 _col0 (type: string)
+            0 _col1 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col1, _col2, _col3
-          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+          outputColumnNames: _col0, _col2
+          Statistics: Num rows: 13 Data size: 100 Basic stats: PARTIAL Column stats: NONE
           File Output Operator
             compressed: false
             table:
@@ -305,43 +304,44 @@ STAGE PLANS:
       Map Operator Tree:
           TableScan
             Reduce Output Operator
-              key expressions: _col3 (type: string)
+              key expressions: _col0 (type: string)
               sort order: +
-              Map-reduce partition columns: _col3 (type: string)
-              Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-              value expressions: _col1 (type: string), _col2 (type: string)
+              Map-reduce partition columns: _col0 (type: string)
+              Statistics: Num rows: 13 Data size: 100 Basic stats: PARTIAL Column stats: NONE
+              value expressions: _col2 (type: string)
           TableScan
-            alias: z
-            filterExpr: ((ds = '2008-04-08') and (UDFToDouble(hr) = 14.0D) and value is not null) (type: boolean)
-            Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+            alias: y
+            filterExpr: (UDFToDouble(key) = 3.0D) (type: boolean)
+            Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((UDFToDouble(hr) = 14.0D) and (ds = '2008-04-08') and value is not null) (type: boolean)
-              Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+              predicate: (UDFToDouble(key) = 3.0D) (type: boolean)
+              Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: value (type: string)
-                outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                  Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 _col3 (type: string)
+            0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col1, _col2, _col4
-          Statistics: Num rows: 302 Data size: 3213 Basic stats: PARTIAL Column stats: NONE
+          outputColumnNames: _col0, _col2, _col4
+          Statistics: Num rows: 275 Data size: 2921 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: _col2 (type: string), _col4 (type: string), _col1 (type: string)
+            expressions: _col0 (type: string), _col2 (type: string), _col4 (type: string)
             outputColumnNames: _col0, _col1, _col2
-            Statistics: Num rows: 302 Data size: 3213 Basic stats: PARTIAL Column stats: NONE
+            Statistics: Num rows: 275 Data size: 2921 Basic stats: PARTIAL Column stats: NONE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 302 Data size: 3213 Basic stats: PARTIAL Column stats: NONE
+              Statistics: Num rows: 275 Data size: 2921 Basic stats: PARTIAL Column stats: NONE
               table:
                   input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/cbo_rp_join1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cbo_rp_join1.q.out b/ql/src/test/results/clientpositive/cbo_rp_join1.q.out
index f24f0ad..93eacf7 100644
--- a/ql/src/test/results/clientpositive/cbo_rp_join1.q.out
+++ b/ql/src/test/results/clientpositive/cbo_rp_join1.q.out
@@ -36,38 +36,38 @@ STAGE PLANS:
             alias: a
             Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (key = 40) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean)
           TableScan
             alias: b
             Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (key = 40) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Full Outer Join 0 to 1
           filter predicates:
-            0 {(VALUE._col0 = 40)}
-            1 {(VALUE._col0 = 40)}
+            0 {VALUE._col2}
+            1 {VALUE._col2}
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col3, _col4
           Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+            expressions: hash(_col0,_col1,_col3,_col4) (type: int)
             outputColumnNames: _col0
             Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
             Group By Operator
@@ -143,38 +143,38 @@ STAGE PLANS:
             alias: a
             Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (key = 40) (type: boolean), (value = 40) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean)
           TableScan
             alias: b
             Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (key = 40) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Full Outer Join 0 to 1
           filter predicates:
-            0 {(VALUE._col0 = 40)} {(VALUE._col1 = 40)}
-            1 {(VALUE._col0 = 40)}
+            0 {VALUE._col2} {VALUE._col3}
+            1 {VALUE._col2}
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col4, _col5
           Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+            expressions: hash(_col0,_col1,_col4,_col5) (type: int)
             outputColumnNames: _col0
             Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
             Group By Operator
@@ -250,38 +250,38 @@ STAGE PLANS:
             alias: a
             Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (key = 40) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean)
           TableScan
             alias: b
             Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (key = 40) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Full Outer Join 0 to 1
           filter predicates:
-            0 {(VALUE._col0 = 40)}
-            1 {(VALUE._col0 = 40)}
+            0 {VALUE._col2}
+            1 {VALUE._col2}
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col3, _col4
           Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+            expressions: hash(_col0,_col1,_col3,_col4) (type: int)
             outputColumnNames: _col0
             Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
             Group By Operator
@@ -357,38 +357,38 @@ STAGE PLANS:
             alias: a
             Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4
               Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
           TableScan
             alias: b
             Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4
               Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 220 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: int)
+                value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Full Outer Join 0 to 1
           filter predicates:
-            0 {(VALUE._col0 > 40)} {(VALUE._col1 > 50)} {(VALUE._col0 = VALUE._col1)}
-            1 {(VALUE._col0 > 40)} {(VALUE._col1 > 50)} {(VALUE._col0 = VALUE._col1)}
+            0 {VALUE._col2} {VALUE._col3} {VALUE._col4}
+            1 {VALUE._col2} {VALUE._col3} {VALUE._col4}
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col5, _col6
           Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+            expressions: hash(_col0,_col1,_col5,_col6) (type: int)
             outputColumnNames: _col0
             Statistics: Num rows: 1 Data size: 441 Basic stats: COMPLETE Column stats: NONE
             Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/cbo_rp_outer_join_ppr.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cbo_rp_outer_join_ppr.q.out b/ql/src/test/results/clientpositive/cbo_rp_outer_join_ppr.q.out
index 59712b0..8fd669b 100644
--- a/ql/src/test/results/clientpositive/cbo_rp_outer_join_ppr.q.out
+++ b/ql/src/test/results/clientpositive/cbo_rp_outer_join_ppr.q.out
@@ -243,7 +243,7 @@ STAGE PLANS:
           Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: key (type: string), value (type: string), key0 (type: string), value0 (type: string)
-            outputColumnNames: key, value, key1, value1
+            outputColumnNames: key, value, key0, value0
             Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
@@ -256,7 +256,7 @@ STAGE PLANS:
                   input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   properties:
-                    columns key,value,key1,value1
+                    columns key,value,key0,value0
                     columns.types string:string:string:string
                     escape.delim \
                     hive.serialization.extend.additional.nesting.levels true
@@ -557,7 +557,7 @@ STAGE PLANS:
           Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: key (type: string), value (type: string), key0 (type: string), value0 (type: string)
-            outputColumnNames: key, value, key1, value1
+            outputColumnNames: key, value, key0, value0
             Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
@@ -570,7 +570,7 @@ STAGE PLANS:
                   input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   properties:
-                    columns key,value,key1,value1
+                    columns key,value,key0,value0
                     columns.types string:string:string:string
                     escape.delim \
                     hive.serialization.extend.additional.nesting.levels true

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/constantPropagateForSubQuery.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/constantPropagateForSubQuery.q.out b/ql/src/test/results/clientpositive/constantPropagateForSubQuery.q.out
index 9905da0..221837b 100644
--- a/ql/src/test/results/clientpositive/constantPropagateForSubQuery.q.out
+++ b/ql/src/test/results/clientpositive/constantPropagateForSubQuery.q.out
@@ -12,7 +12,7 @@ POSTHOOK: Input: default@src
 POSTHOOK: Input: default@src1
 #### A masked pattern was here ####
 OPTIMIZED SQL: SELECT CAST('429' AS STRING) AS `ak`, `t0`.`value` AS `av`, `t1`.`key` AS `bk`, `t1`.`value` AS `bv`
-FROM (SELECT CAST('429' AS STRING) AS `key`, `value`
+FROM (SELECT `value`
 FROM `default`.`src`
 WHERE `key` = '429') AS `t0`,
 (SELECT `key`, `value`
@@ -36,14 +36,14 @@ STAGE PLANS:
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: value (type: string)
-                outputColumnNames: _col1
+                outputColumnNames: _col0
                 Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   null sort order: 
                   sort order: 
                   Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
-                  value expressions: _col1 (type: string)
+                  value expressions: _col0 (type: string)
                   auto parallelism: false
           TableScan
             alias: b
@@ -170,10 +170,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col2
           Statistics: Num rows: 6250 Data size: 120400 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: '429' (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+            expressions: '429' (type: string), _col0 (type: string), _col1 (type: string), _col2 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3
             Statistics: Num rows: 6250 Data size: 120400 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/constprog2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/constprog2.q.out b/ql/src/test/results/clientpositive/constprog2.q.out
index 6a7e7cc..3bca912 100644
--- a/ql/src/test/results/clientpositive/constprog2.q.out
+++ b/ql/src/test/results/clientpositive/constprog2.q.out
@@ -40,12 +40,12 @@ STAGE PLANS:
               Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: value (type: string)
-                outputColumnNames: _col1
+                outputColumnNames: _col0
                 Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col0 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -53,10 +53,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col2
+          outputColumnNames: _col1
           Statistics: Num rows: 250000 Data size: 5551000 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: 86 (type: int), 87 (type: int), _col2 (type: string)
+            expressions: 86 (type: int), 87 (type: int), _col1 (type: string)
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 250000 Data size: 5551000 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
@@ -115,12 +115,12 @@ STAGE PLANS:
               Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: value (type: string)
-                outputColumnNames: _col1
+                outputColumnNames: _col0
                 Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col0 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -128,10 +128,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col2
+          outputColumnNames: _col1
           Statistics: Num rows: 250000 Data size: 5551000 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: 86 (type: int), 87 (type: int), _col2 (type: string)
+            expressions: 86 (type: int), 87 (type: int), _col1 (type: string)
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 250000 Data size: 5551000 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/constprog_partitioner.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/constprog_partitioner.q.out b/ql/src/test/results/clientpositive/constprog_partitioner.q.out
index 5467d2c..cac2fdc 100644
--- a/ql/src/test/results/clientpositive/constprog_partitioner.q.out
+++ b/ql/src/test/results/clientpositive/constprog_partitioner.q.out
@@ -40,12 +40,12 @@ STAGE PLANS:
               Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: value (type: string)
-                outputColumnNames: _col1
+                outputColumnNames: _col0
                 Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col0 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -53,10 +53,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col2
+          outputColumnNames: _col1
           Statistics: Num rows: 250000 Data size: 5551000 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: 100 (type: int), 101 (type: int), _col2 (type: string)
+            expressions: 100 (type: int), 101 (type: int), _col1 (type: string)
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 250000 Data size: 5551000 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/correlationoptimizer8.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/correlationoptimizer8.q.out b/ql/src/test/results/clientpositive/correlationoptimizer8.q.out
index 36d5777..0e82cc3 100644
--- a/ql/src/test/results/clientpositive/correlationoptimizer8.q.out
+++ b/ql/src/test/results/clientpositive/correlationoptimizer8.q.out
@@ -1107,32 +1107,40 @@ STAGE PLANS:
           TableScan
             Union
               Statistics: Num rows: 166 Data size: 1762 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: UDFToDouble(_col0) (type: double)
-                sort order: +
-                Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Select Operator
+                expressions: _col0 (type: bigint), _col1 (type: bigint), UDFToDouble(_col0) (type: double)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 166 Data size: 1762 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: bigint), _col1 (type: bigint)
+                Reduce Output Operator
+                  key expressions: _col2 (type: double)
+                  sort order: +
+                  Map-reduce partition columns: _col2 (type: double)
+                  Statistics: Num rows: 166 Data size: 1762 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: bigint), _col1 (type: bigint)
           TableScan
             Union
               Statistics: Num rows: 166 Data size: 1762 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: UDFToDouble(_col0) (type: double)
-                sort order: +
-                Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Select Operator
+                expressions: _col0 (type: bigint), _col1 (type: bigint), UDFToDouble(_col0) (type: double)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 166 Data size: 1762 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col0 (type: bigint), _col1 (type: bigint)
+                Reduce Output Operator
+                  key expressions: _col2 (type: double)
+                  sort order: +
+                  Map-reduce partition columns: _col2 (type: double)
+                  Statistics: Num rows: 166 Data size: 1762 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: bigint), _col1 (type: bigint)
           TableScan
             alias: x
             Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
             Select Operator
-              expressions: key (type: string), value (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: string), value (type: string), UDFToDouble(key) (type: double)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
-                key expressions: UDFToDouble(_col0) (type: double)
+                key expressions: _col2 (type: double)
                 sort order: +
-                Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                Map-reduce partition columns: _col2 (type: double)
                 Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE
                 value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
@@ -1140,17 +1148,21 @@ STAGE PLANS:
           condition map:
                Full Outer Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1, _col2, _col3
+            0 _col2 (type: double)
+            1 _col2 (type: double)
+          outputColumnNames: _col0, _col1, _col3, _col4
           Statistics: Num rows: 182 Data size: 1938 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: bigint), _col1 (type: bigint), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
             Statistics: Num rows: 182 Data size: 1938 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 182 Data size: 1938 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-3
     Map Reduce

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/cte_mat_5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/cte_mat_5.q.out b/ql/src/test/results/clientpositive/cte_mat_5.q.out
index 4f8e12f..be52727 100644
--- a/ql/src/test/results/clientpositive/cte_mat_5.q.out
+++ b/ql/src/test/results/clientpositive/cte_mat_5.q.out
@@ -121,13 +121,13 @@ STAGE PLANS:
               predicate: colnum is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: colnum (type: int)
-                outputColumnNames: _col0
+                expressions: colnum (type: int), UDFToDouble(colnum) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col1 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col1 (type: double)
                   Statistics: Num rows: 1 Data size: 3 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: int)
           TableScan
@@ -138,21 +138,21 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: key (type: string)
+                expressions: UDFToDouble(key) (type: double)
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col0 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col0 (type: double)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
+            0 _col1 (type: double)
+            1 _col0 (type: double)
           outputColumnNames: _col0
           Statistics: Num rows: 1 Data size: 3 Basic stats: PARTIAL Column stats: NONE
           File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/deleteAnalyze.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/deleteAnalyze.q.out b/ql/src/test/results/clientpositive/deleteAnalyze.q.out
index e542704..a26c04f 100644
--- a/ql/src/test/results/clientpositive/deleteAnalyze.q.out
+++ b/ql/src/test/results/clientpositive/deleteAnalyze.q.out
@@ -195,26 +195,26 @@ STAGE PLANS:
               predicate: ((id = 2) and item is not null) (type: boolean)
               Statistics: Num rows: 1 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
               Select Operator
-                expressions: amount (type: decimal(10,3)), sales_tax (type: decimal(10,3)), item (type: string)
-                outputColumnNames: _col1, _col2, _col3
-                Statistics: Num rows: 1 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
+                expressions: item (type: string), CASE WHEN (amount is not null) THEN (amount) ELSE (0) END (type: decimal(13,3)), CASE WHEN (sales_tax is not null) THEN (sales_tax) ELSE (0) END (type: decimal(13,3))
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 1 Data size: 308 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
-                  key expressions: _col3 (type: string)
+                  key expressions: _col0 (type: string)
                   sort order: +
-                  Map-reduce partition columns: _col3 (type: string)
-                  Statistics: Num rows: 1 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col1 (type: decimal(10,3)), _col2 (type: decimal(10,3))
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 1 Data size: 308 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col1 (type: decimal(13,3)), _col2 (type: decimal(13,3))
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
             0 _col1 (type: string)
-            1 _col3 (type: string)
+            1 _col0 (type: string)
           outputColumnNames: _col0, _col3, _col4
           Statistics: Num rows: 1 Data size: 228 Basic stats: COMPLETE Column stats: COMPLETE
           Select Operator
-            expressions: _col0 (type: int), CASE WHEN (_col3 is not null) THEN (_col3) ELSE (0) END (type: decimal(13,3)), CASE WHEN (_col4 is not null) THEN (_col4) ELSE (0) END (type: decimal(13,3))
+            expressions: _col0 (type: int), _col3 (type: decimal(13,3)), _col4 (type: decimal(13,3))
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 1 Data size: 228 Basic stats: COMPLETE Column stats: COMPLETE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/druid/druidmini_mv.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/druid/druidmini_mv.q.out b/ql/src/test/results/clientpositive/druid/druidmini_mv.q.out
index 8f9c4c0..5aef596 100644
--- a/ql/src/test/results/clientpositive/druid/druidmini_mv.q.out
+++ b/ql/src/test/results/clientpositive/druid/druidmini_mv.q.out
@@ -240,12 +240,12 @@ STAGE PLANS:
                     Statistics: Num rows: 6 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: c (type: double)
-                      outputColumnNames: _col1
+                      outputColumnNames: _col0
                       Statistics: Num rows: 6 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         sort order: 
                         Statistics: Num rows: 6 Data size: 96 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: double)
+                        value expressions: _col0 (type: double)
             Execution mode: vectorized, llap
             LLAP IO: may be used (ACID table)
         Map 3 
@@ -273,10 +273,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col3
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 18 Data size: 522 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), _col1 (type: double), _col0 (type: int), _col3 (type: double)
+                  expressions: _col0 (type: int), _col1 (type: double), _col0 (type: int), _col2 (type: double)
                   outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 18 Data size: 522 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
@@ -603,12 +603,12 @@ STAGE PLANS:
                     Statistics: Num rows: 7 Data size: 112 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: c (type: double)
-                      outputColumnNames: _col1
+                      outputColumnNames: _col0
                       Statistics: Num rows: 7 Data size: 112 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         sort order: 
                         Statistics: Num rows: 7 Data size: 112 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: double)
+                        value expressions: _col0 (type: double)
             Execution mode: vectorized, llap
             LLAP IO: may be used (ACID table)
         Map 3 
@@ -636,10 +636,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col3
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 21 Data size: 609 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), _col1 (type: double), _col0 (type: int), _col3 (type: double)
+                  expressions: _col0 (type: int), _col1 (type: double), _col0 (type: int), _col2 (type: double)
                   outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 21 Data size: 609 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator


[40/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/mapjoin46.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/mapjoin46.q.out b/ql/src/test/results/clientpositive/llap/mapjoin46.q.out
index a1fe936..d9d2396 100644
--- a/ql/src/test/results/clientpositive/llap/mapjoin46.q.out
+++ b/ql/src/test/results/clientpositive/llap/mapjoin46.q.out
@@ -180,29 +180,33 @@ STAGE PLANS:
                   alias: test1_n4
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {_col0 BETWEEN 100 AND 102}
+                        0 {_col3}
                         1 
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 8 Data size: 1049 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 8 Data size: 1049 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 8 Data size: 1049 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
         Map 2 
@@ -294,29 +298,33 @@ STAGE PLANS:
                   alias: test1_n4
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {_col0 BETWEEN 100 AND 102}
+                        0 {_col3}
                         1 
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 6 Data size: 1142 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 6 Data size: 1142 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 6 Data size: 1142 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
         Map 2 
@@ -503,29 +511,33 @@ STAGE PLANS:
                   alias: test1_n4
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {_col0 BETWEEN 100 AND 102}
+                        0 {_col3}
                         1 
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
         Map 2 
@@ -616,27 +628,31 @@ STAGE PLANS:
                   alias: test1_n4
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
-                      residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {((_col1 = _col5) or _col3 or _col4 BETWEEN 100 AND 102)}
+                      Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
         Map 2 
@@ -730,27 +746,31 @@ STAGE PLANS:
                   alias: test1_n4
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
-                      residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {((_col1 = _col5) or _col3)}
+                      Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
         Map 2 
@@ -950,27 +970,31 @@ STAGE PLANS:
                   alias: test1_n4
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
-                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
+                      Statistics: Num rows: 11 Data size: 1947 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
         Map 2 
@@ -1076,27 +1100,31 @@ STAGE PLANS:
                   alias: test2_n2
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         0 Map 1
-                      residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {((_col1 = _col4) or _col0 BETWEEN 100 AND 102 or _col6)}
+                      Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
 
@@ -1299,27 +1327,31 @@ STAGE PLANS:
                   alias: test2_n2
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         0 Map 1
-                      residual filter predicates: {((_col1 = _col4) or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {((_col1 = _col4) or _col6)}
+                      Statistics: Num rows: 24 Data size: 4676 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
 
@@ -1411,27 +1443,31 @@ STAGE PLANS:
                   alias: test2_n2
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         0 Map 1
-                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
+                      Statistics: Num rows: 10 Data size: 1850 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: llap
             LLAP IO: no inputs
 
@@ -2406,7 +2442,7 @@ POSTHOOK: Input: default@test2_n2
 NULL	NULL	NULL	104	3	Fli
 NULL	NULL	NULL	105	NULL	None
 NULL	NULL	None	NULL	NULL	NULL
-Warning: Shuffle Join MERGEJOIN[36][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[37][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM (
@@ -2483,24 +2519,28 @@ STAGE PLANS:
                       Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col0 (type: int), _col2 (type: string)
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         1 Map 4
-                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        sort order: 
+                      residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
+                      Statistics: Num rows: 11 Data size: 1947 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        Reduce Output Operator
+                          sort order: 
+                          Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
+                          value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
             Execution mode: llap
             LLAP IO: no inputs
         Map 3 
@@ -2509,24 +2549,28 @@ STAGE PLANS:
                   alias: test2_n2
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         0 Map 1
-                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        sort order: 
+                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
+                      Statistics: Num rows: 10 Data size: 1850 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        Reduce Output Operator
+                          sort order: 
+                          Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
+                          value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -2572,7 +2616,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join MERGEJOIN[36][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[37][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
 PREHOOK: query: SELECT *
 FROM (
   SELECT test1_n4.key AS key1, test1_n4.value AS value1, test1_n4.col_1 AS col_1,
@@ -2637,7 +2681,7 @@ NULL	NULL	NULL	105	NULL	None	98	NULL	None	NULL	NULL	NULL
 NULL	NULL	NULL	105	NULL	None	99	0	Alice	NULL	NULL	NULL
 NULL	NULL	NULL	105	NULL	None	99	2	Mat	102	2	Del
 NULL	NULL	NULL	105	NULL	None	NULL	NULL	None	NULL	NULL	NULL
-Warning: Shuffle Join MERGEJOIN[36][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[37][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
 PREHOOK: query: EXPLAIN
 SELECT *
 FROM (
@@ -2714,24 +2758,28 @@ STAGE PLANS:
                       Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col0 (type: int), _col2 (type: string)
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         1 Map 4
-                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        sort order: 
+                      residual filter predicates: {(_col3 or _col4 BETWEEN 100 AND 102)}
+                      Statistics: Num rows: 11 Data size: 1947 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        Reduce Output Operator
+                          sort order: 
+                          Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
+                          value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
             Execution mode: llap
             LLAP IO: no inputs
         Map 3 
@@ -2740,24 +2788,28 @@ STAGE PLANS:
                   alias: test2_n2
                   Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_2 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 4 Data size: 380 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_2 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 4 Data size: 396 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Right Outer Join 0 to 1
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       input vertices:
                         0 Map 1
-                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col3 BETWEEN 100 AND 102)}
-                      Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        sort order: 
+                      residual filter predicates: {(_col0 BETWEEN 100 AND 102 or _col6)}
+                      Statistics: Num rows: 10 Data size: 1850 Basic stats: COMPLETE Column stats: COMPLETE
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
+                        Reduce Output Operator
+                          sort order: 
+                          Statistics: Num rows: 10 Data size: 1810 Basic stats: COMPLETE Column stats: COMPLETE
+                          value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col3 (type: int), _col4 (type: int), _col5 (type: string)
             Execution mode: llap
             LLAP IO: no inputs
         Map 4 
@@ -2803,7 +2855,7 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Shuffle Join MERGEJOIN[36][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[37][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
 PREHOOK: query: SELECT *
 FROM (
   SELECT test1_n4.key AS key1, test1_n4.value AS value1, test1_n4.col_1 AS col_1,

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/mapjoin_emit_interval.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/mapjoin_emit_interval.q.out b/ql/src/test/results/clientpositive/llap/mapjoin_emit_interval.q.out
index 706d27c..8c9008a 100644
--- a/ql/src/test/results/clientpositive/llap/mapjoin_emit_interval.q.out
+++ b/ql/src/test/results/clientpositive/llap/mapjoin_emit_interval.q.out
@@ -74,29 +74,33 @@ STAGE PLANS:
                   alias: test1_n0
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {_col0 BETWEEN 100 AND 102}
+                        0 {_col3}
                         1 
                       keys:
                         0 _col1 (type: int)
                         1 _col1 (type: int)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 11 Data size: 1903 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 2 
@@ -179,29 +183,33 @@ STAGE PLANS:
                   alias: test1_n0
                   Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: int), value (type: int), col_1 (type: string)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 6 Data size: 572 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: int), value (type: int), col_1 (type: string), key BETWEEN 100 AND 102 (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
+                    Statistics: Num rows: 6 Data size: 596 Basic stats: COMPLETE Column stats: COMPLETE
                     Map Join Operator
                       condition map:
                            Left Outer Join 0 to 1
                       filter predicates:
-                        0 {_col0 BETWEEN 100 AND 102}
+                        0 {_col3}
                         1 
                       keys:
                         0 
                         1 
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                      outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
                       input vertices:
                         1 Map 2
                       Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                      File Output Operator
-                        compressed: false
+                      Select Operator
+                        expressions: _col0 (type: int), _col1 (type: int), _col2 (type: string), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                        outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                         Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
-                        table:
-                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                        File Output Operator
+                          compressed: false
+                          Statistics: Num rows: 24 Data size: 4580 Basic stats: COMPLETE Column stats: COMPLETE
+                          table:
+                              input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                              output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 2 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/mapjoin_hint.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/mapjoin_hint.q.out b/ql/src/test/results/clientpositive/llap/mapjoin_hint.q.out
index e62eb0e..46e211d 100644
--- a/ql/src/test/results/clientpositive/llap/mapjoin_hint.q.out
+++ b/ql/src/test/results/clientpositive/llap/mapjoin_hint.q.out
@@ -506,12 +506,12 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: p_partkey (type: int), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 1 Data size: 582 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                      Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 582 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                        Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -541,15 +541,15 @@ STAGE PLANS:
                   0 
                   1 
                   2 
-                outputColumnNames: _col2, _col4, _col5, _col6, _col7, _col8, _col9, _col10
-                Statistics: Num rows: 1 Data size: 959 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                Statistics: Num rows: 1 Data size: 875 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col2 (type: int), null (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: int), _col8 (type: string), _col9 (type: double), _col10 (type: string)
+                  expressions: _col2 (type: int), null (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: int), _col7 (type: string), _col8 (type: double), _col9 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                  Statistics: Num rows: 1 Data size: 959 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 875 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 1 Data size: 959 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 1 Data size: 875 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -621,8 +621,8 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 619 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: p_partkey (type: int), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 1 Data size: 582 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                      Statistics: Num rows: 1 Data size: 498 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
@@ -631,18 +631,18 @@ STAGE PLANS:
                           0 
                           1 
                           2 
-                        outputColumnNames: _col2, _col4, _col5, _col6, _col7, _col8, _col9, _col10
+                        outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
                         input vertices:
                           0 Reducer 2
                           1 Map 1
-                        Statistics: Num rows: 1 Data size: 959 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 1 Data size: 875 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col2 (type: int), null (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: int), _col8 (type: string), _col9 (type: double), _col10 (type: string)
+                          expressions: _col2 (type: int), null (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: int), _col7 (type: string), _col8 (type: double), _col9 (type: string)
                           outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                          Statistics: Num rows: 1 Data size: 959 Basic stats: COMPLETE Column stats: NONE
+                          Statistics: Num rows: 1 Data size: 875 Basic stats: COMPLETE Column stats: NONE
                           File Output Operator
                             compressed: false
-                            Statistics: Num rows: 1 Data size: 959 Basic stats: COMPLETE Column stats: NONE
+                            Statistics: Num rows: 1 Data size: 875 Basic stats: COMPLETE Column stats: NONE
                             table:
                                 input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                                 output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite.q.out
index 62d0687..69bdbea 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite.q.out
@@ -342,12 +342,12 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: c (type: decimal(10,2))
-                      outputColumnNames: _col1
-                      Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col1 (type: decimal(10,2))
+                        Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: decimal(10,2))
             Execution mode: llap
             LLAP IO: may be used (ACID table)
         Map 3 
@@ -370,15 +370,15 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col6
-                Statistics: Num rows: 2 Data size: 474 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1, _col5
+                Statistics: Num rows: 2 Data size: 458 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), _col1 (type: decimal(10,2)), _col0 (type: int), _col6 (type: decimal(10,2))
+                  expressions: _col0 (type: int), _col1 (type: decimal(10,2)), _col0 (type: int), _col5 (type: decimal(10,2))
                   outputColumnNames: _col0, _col1, _col2, _col3
-                  Statistics: Num rows: 2 Data size: 474 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 2 Data size: 458 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 2 Data size: 474 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 2 Data size: 458 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out
index 85de436..8fcab1f 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_3.q.out
@@ -526,12 +526,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col1 (type: decimal(10,2))
             Execution mode: llap
             LLAP IO: may be used (ACID table)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out
index 356f5e2..8fe194e 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_4.q.out
@@ -774,12 +774,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2)), d (type: int)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 1 Data size: 196 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 196 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col1 (type: decimal(10,2)), _col2 (type: int)
             Execution mode: llap
             LLAP IO: may be used (ACID table)
@@ -1645,12 +1645,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2)), d (type: int)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 1 Data size: 196 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 196 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col1 (type: decimal(10,2)), _col2 (type: int)
             Execution mode: llap
             LLAP IO: may be used (ACID table)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out
index 9822780..117593e 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_5.q.out
@@ -186,12 +186,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: a (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: llap
             LLAP IO: may be used (ACID table)
         Reducer 2 
@@ -298,12 +298,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col1 (type: decimal(10,2))
             Execution mode: llap
             LLAP IO: may be used (ACID table)
@@ -1021,12 +1021,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col1 (type: decimal(10,2))
             Execution mode: llap
             LLAP IO: may be used (ACID table)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_dummy.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_dummy.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_dummy.q.out
index a637b2c..485a32e 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_dummy.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_dummy.q.out
@@ -342,12 +342,12 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: c (type: decimal(10,2))
-                      outputColumnNames: _col1
-                      Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 1 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col1 (type: decimal(10,2))
+                        Statistics: Num rows: 1 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: decimal(10,2))
             Execution mode: llap
             LLAP IO: may be used (ACID table)
         Map 3 
@@ -370,15 +370,15 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col6
-                Statistics: Num rows: 2 Data size: 474 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0, _col1, _col5
+                Statistics: Num rows: 2 Data size: 458 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), _col1 (type: decimal(10,2)), _col0 (type: int), _col6 (type: decimal(10,2))
+                  expressions: _col0 (type: int), _col1 (type: decimal(10,2)), _col0 (type: int), _col5 (type: decimal(10,2))
                   outputColumnNames: _col0, _col1, _col2, _col3
-                  Statistics: Num rows: 2 Data size: 474 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 2 Data size: 458 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 2 Data size: 474 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 2 Data size: 458 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out
index 21bfa8d..32befa5 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_rebuild_dummy.q.out
@@ -526,12 +526,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col1 (type: decimal(10,2))
             Execution mode: vectorized, llap
             LLAP IO: may be used (ACID table)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out
index 21e3b78..06835a1 100644
--- a/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out
+++ b/ql/src/test/results/clientpositive/llap/materialized_view_create_rewrite_time_window.q.out
@@ -646,12 +646,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: a (type: int), c (type: decimal(10,2))
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col1 (type: decimal(10,2))
             Execution mode: vectorized, llap
             LLAP IO: may be used (ACID table)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/mergejoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/mergejoin.q.out b/ql/src/test/results/clientpositive/llap/mergejoin.q.out
index ea94b3b..7c1bc56 100644
--- a/ql/src/test/results/clientpositive/llap/mergejoin.q.out
+++ b/ql/src/test/results/clientpositive/llap/mergejoin.q.out
@@ -4078,8 +4078,8 @@ NULL	NULL	NULL	98	val_98	2008-04-08	98	val_98	2008-04-08
 NULL	NULL	NULL	98	val_98	2008-04-08	98	val_98	2008-04-08
 NULL	NULL	NULL	98	val_98	2008-04-08	98	val_98	2008-04-08
 NULL	NULL	NULL	98	val_98	2008-04-08	98	val_98	2008-04-08
-Warning: Shuffle Join MERGEJOIN[18][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
-Warning: Shuffle Join MERGEJOIN[19][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
+Warning: Shuffle Join MERGEJOIN[19][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[20][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 3' is a cross product
 PREHOOK: query: select * from
 (select * from tab_n9 where tab_n9.key = 0)a
 join
@@ -4606,8 +4606,8 @@ NULL	NULL	NULL	NULL	NULL	NULL	97	val_97	2008-04-08
 NULL	NULL	NULL	NULL	NULL	NULL	97	val_97	2008-04-08
 NULL	NULL	NULL	NULL	NULL	NULL	98	val_98	2008-04-08
 NULL	NULL	NULL	NULL	NULL	NULL	98	val_98	2008-04-08
-Warning: Shuffle Join MERGEJOIN[18][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
-Warning: Shuffle Join MERGEJOIN[19][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Reducer 3' is a cross product
+Warning: Shuffle Join MERGEJOIN[19][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 4' is a cross product
+Warning: Shuffle Join MERGEJOIN[20][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
 PREHOOK: query: select * from
 (select * from tab_n9 where tab_n9.key = 0)a
 join

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/multiMapJoin1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/multiMapJoin1.q.out b/ql/src/test/results/clientpositive/llap/multiMapJoin1.q.out
index 540ff08..e121bd7 100644
--- a/ql/src/test/results/clientpositive/llap/multiMapJoin1.q.out
+++ b/ql/src/test/results/clientpositive/llap/multiMapJoin1.q.out
@@ -903,12 +903,12 @@ STAGE PLANS:
                               keys:
                                 0 _col3 (type: string)
                                 1 _col0 (type: string)
-                              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col7
+                              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col8
                               input vertices:
                                 1 Map 6
                               Statistics: Num rows: 6221 Data size: 3263724 Basic stats: COMPLETE Column stats: NONE
                               Select Operator
-                                expressions: hash(_col0) (type: int), hash(_col1) (type: int), hash(_col3) (type: int), hash(_col5) (type: int), hash(_col4) (type: int), hash(_col7) (type: int), hash(_col2) (type: int), hash(_col2) (type: int)
+                                expressions: hash(_col0) (type: int), hash(_col1) (type: int), hash(_col3) (type: int), hash(_col5) (type: int), hash(_col4) (type: int), _col8 (type: int), hash(_col2) (type: int), hash(_col2) (type: int)
                                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                                 Statistics: Num rows: 6221 Data size: 3263724 Basic stats: COMPLETE Column stats: NONE
                                 Group By Operator
@@ -993,14 +993,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), hash(key) (type: int)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1243,12 +1244,12 @@ STAGE PLANS:
                               keys:
                                 0 _col3 (type: string)
                                 1 _col0 (type: string)
-                              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col7
+                              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col8
                               input vertices:
                                 1 Map 6
                               Statistics: Num rows: 6221 Data size: 3263724 Basic stats: COMPLETE Column stats: NONE
                               Select Operator
-                                expressions: hash(_col0) (type: int), hash(_col1) (type: int), hash(_col3) (type: int), hash(_col5) (type: int), hash(_col4) (type: int), hash(_col7) (type: int), hash(_col2) (type: int), hash(_col2) (type: int)
+                                expressions: hash(_col0) (type: int), hash(_col1) (type: int), hash(_col3) (type: int), hash(_col5) (type: int), hash(_col4) (type: int), _col8 (type: int), hash(_col2) (type: int), hash(_col2) (type: int)
                                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                                 Statistics: Num rows: 6221 Data size: 3263724 Basic stats: COMPLETE Column stats: NONE
                                 Group By Operator
@@ -1333,14 +1334,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), hash(key) (type: int)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1568,14 +1570,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), hash(key) (type: int)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 7 
@@ -1699,10 +1702,10 @@ STAGE PLANS:
                 keys:
                   0 _col3 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col7
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col8
                 Statistics: Num rows: 6221 Data size: 3263724 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: hash(_col0) (type: int), hash(_col1) (type: int), hash(_col3) (type: int), hash(_col5) (type: int), hash(_col4) (type: int), hash(_col7) (type: int), hash(_col2) (type: int), hash(_col2) (type: int)
+                  expressions: hash(_col0) (type: int), hash(_col1) (type: int), hash(_col3) (type: int), hash(_col5) (type: int), hash(_col4) (type: int), _col8 (type: int), hash(_col2) (type: int), hash(_col2) (type: int)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 6221 Data size: 3263724 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -1939,14 +1942,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), hash(key) (type: int)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 10 Data size: 1840 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 7 
@@ -2070,10 +2074,10 @@ STAGE PLANS:
                 keys:
                   0 _col3 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col7
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col8
                 Statistics: Num rows: 6221 Data size: 3263724 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: hash(_col0) (type: int), hash(_col1) (type: int), hash(_col3) (type: int), hash(_col5) (type: int), hash(_col4) (type: int), hash(_col7) (type: int), hash(_col2) (type: int), hash(_col2) (type: int)
+                  expressions: hash(_col0) (type: int), hash(_col1) (type: int), hash(_col3) (type: int), hash(_col5) (type: int), hash(_col4) (type: int), _col8 (type: int), hash(_col2) (type: int), hash(_col2) (type: int)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 6221 Data size: 3263724 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/orc_llap.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/orc_llap.q.out b/ql/src/test/results/clientpositive/llap/orc_llap.q.out
index 7452a93..23ea496 100644
--- a/ql/src/test/results/clientpositive/llap/orc_llap.q.out
+++ b/ql/src/test/results/clientpositive/llap/orc_llap.q.out
@@ -602,14 +602,14 @@ STAGE PLANS:
                     Statistics: Num rows: 68484 Data size: 5419732 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: csmallint (type: smallint), cstring1 (type: string)
-                      outputColumnNames: _col0, _col2
-                      Statistics: Num rows: 68484 Data size: 5419732 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 68484 Data size: 5010740 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: smallint)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: smallint)
-                        Statistics: Num rows: 68484 Data size: 5419732 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col2 (type: string)
+                        Statistics: Num rows: 68484 Data size: 5010740 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col1 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
         Map 2 
@@ -623,20 +623,20 @@ STAGE PLANS:
                     Statistics: Num rows: 68484 Data size: 5521416 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: csmallint (type: smallint), cstring2 (type: string)
-                      outputColumnNames: _col0, _col2
-                      Statistics: Num rows: 68484 Data size: 5521416 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 68484 Data size: 5112424 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: smallint)
                           1 _col0 (type: smallint)
-                        outputColumnNames: _col2, _col5
+                        outputColumnNames: _col1, _col3
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 159130 Data size: 26936864 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: hash(_col2,_col5) (type: int)
+                          expressions: hash(_col1,_col3) (type: int)
                           outputColumnNames: _col0
                           Statistics: Num rows: 159130 Data size: 26936864 Basic stats: COMPLETE Column stats: COMPLETE
                           Group By Operator
@@ -1080,14 +1080,14 @@ STAGE PLANS:
                     Statistics: Num rows: 136968 Data size: 10839366 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: csmallint (type: smallint), cstring1 (type: string)
-                      outputColumnNames: _col0, _col2
-                      Statistics: Num rows: 136968 Data size: 10839366 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 136968 Data size: 10021382 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: smallint)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: smallint)
-                        Statistics: Num rows: 136968 Data size: 10839366 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col2 (type: string)
+                        Statistics: Num rows: 136968 Data size: 10021382 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col1 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
         Map 2 
@@ -1101,20 +1101,20 @@ STAGE PLANS:
                     Statistics: Num rows: 136968 Data size: 11042828 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: csmallint (type: smallint), cstring2 (type: string)
-                      outputColumnNames: _col0, _col2
-                      Statistics: Num rows: 136968 Data size: 11042828 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 136968 Data size: 10224844 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: smallint)
                           1 _col0 (type: smallint)
-                        outputColumnNames: _col2, _col5
+                        outputColumnNames: _col1, _col3
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 636522 Data size: 114343414 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: hash(_col2,_col5) (type: int)
+                          expressions: hash(_col1,_col3) (type: int)
                           outputColumnNames: _col0
                           Statistics: Num rows: 636522 Data size: 114343414 Basic stats: COMPLETE Column stats: COMPLETE
                           Group By Operator


[05/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query91.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query91.q.out b/ql/src/test/results/clientpositive/perf/tez/query91.q.out
index 5b4952d..98e8adf 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query91.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query91.q.out
@@ -104,13 +104,13 @@ Stage-0
                 SHUFFLE [RS_42]
                   PartitionCols:_col0, _col1, _col2, _col3, _col4
                   Group By Operator [GBY_41] (rows=1 width=585)
-                    Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col12)"],keys:_col5, _col6, _col17, _col18, _col19
+                    Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col11)"],keys:_col5, _col6, _col14, _col15, _col16
                     Merge Join Operator [MERGEJOIN_144] (rows=10438 width=473)
-                      Conds:RS_37._col2=RS_165._col0(Inner),Output:["_col5","_col6","_col12","_col17","_col18","_col19"]
+                      Conds:RS_37._col2=RS_165._col0(Inner),Output:["_col5","_col6","_col11","_col14","_col15","_col16"]
                     <-Map 15 [SIMPLE_EDGE] vectorized
                       SHUFFLE [RS_165]
                         PartitionCols:_col0
-                        Select Operator [SEL_164] (rows=3600 width=96)
+                        Select Operator [SEL_164] (rows=3600 width=4)
                           Output:["_col0"]
                           Filter Operator [FIL_163] (rows=3600 width=96)
                             predicate:((hd_buy_potential like '0-500%') and hd_demo_sk is not null)
@@ -120,12 +120,12 @@ Stage-0
                       SHUFFLE [RS_37]
                         PartitionCols:_col2
                         Merge Join Operator [MERGEJOIN_143] (rows=20876 width=473)
-                          Conds:RS_34._col0=RS_35._col1(Inner),Output:["_col2","_col5","_col6","_col12","_col17","_col18","_col19"]
+                          Conds:RS_34._col0=RS_35._col1(Inner),Output:["_col2","_col5","_col6","_col11","_col14","_col15","_col16"]
                         <-Reducer 12 [SIMPLE_EDGE]
                           SHUFFLE [RS_35]
                             PartitionCols:_col1
                             Merge Join Operator [MERGEJOIN_142] (rows=657590 width=312)
-                              Conds:RS_21._col2=RS_162._col0(Inner),Output:["_col1","_col3","_col8","_col9","_col10"]
+                              Conds:RS_21._col2=RS_162._col0(Inner),Output:["_col1","_col3","_col6","_col7","_col8"]
                             <-Map 14 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_162]
                                 PartitionCols:_col0
@@ -152,7 +152,7 @@ Stage-0
                                 <-Map 13 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_159]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_158] (rows=50 width=12)
+                                    Select Operator [SEL_158] (rows=50 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_157] (rows=50 width=12)
                                         predicate:((d_moy = 11) and (d_year = 1999) and d_date_sk is not null)
@@ -166,7 +166,7 @@ Stage-0
                             <-Map 9 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_153]
                                 PartitionCols:_col0
-                                Select Operator [SEL_152] (rows=8000000 width=116)
+                                Select Operator [SEL_152] (rows=8000000 width=4)
                                   Output:["_col0"]
                                   Filter Operator [FIL_151] (rows=8000000 width=112)
                                     predicate:((ca_gmt_offset = -7) and ca_address_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query92.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query92.q.out b/ql/src/test/results/clientpositive/perf/tez/query92.q.out
index 50918f0..1f837dd 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query92.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query92.q.out
@@ -104,9 +104,9 @@ Stage-0
                       Select Operator [SEL_34] (rows=2478 width=112)
                         Output:["_col2"]
                         Filter Operator [FIL_33] (rows=2478 width=112)
-                          predicate:(_col2 > CAST( (1.3 * _col6) AS decimal(14,7)))
+                          predicate:(_col2 > _col5)
                           Merge Join Operator [MERGEJOIN_107] (rows=7434 width=112)
-                            Conds:RS_30._col1=RS_31._col2(Inner),Output:["_col2","_col6"]
+                            Conds:RS_30._col1=RS_31._col2(Inner),Output:["_col2","_col5"]
                           <-Reducer 2 [SIMPLE_EDGE]
                             PARTITION_ONLY_SHUFFLE [RS_30]
                               PartitionCols:_col1
@@ -115,7 +115,7 @@ Stage-0
                               <-Map 7 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_110]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_109] (rows=8116 width=98)
+                                  Select Operator [SEL_109] (rows=8116 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_108] (rows=8116 width=98)
                                       predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-03-18 00:00:00' AND TIMESTAMP'1998-06-16 00:00:00' and d_date_sk is not null)
@@ -140,7 +140,7 @@ Stage-0
                                                 Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
                                                 Select Operator [SEL_123] (rows=669 width=4)
                                                   Output:["_col0"]
-                                                  Select Operator [SEL_121] (rows=669 width=8)
+                                                  Select Operator [SEL_121] (rows=669 width=4)
                                                     Output:["_col0"]
                                                     Filter Operator [FIL_120] (rows=669 width=7)
                                                       predicate:((i_manufact_id = 269) and i_item_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query93.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query93.q.out b/ql/src/test/results/clientpositive/perf/tez/query93.q.out
index 2891fcc..45e6e9f 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query93.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query93.q.out
@@ -68,22 +68,22 @@ Stage-0
               <-Reducer 3 [SIMPLE_EDGE]
                 SHUFFLE [RS_18]
                   PartitionCols:_col0
-                  Group By Operator [GBY_17] (rows=38308 width=112)
+                  Group By Operator [GBY_17] (rows=306464 width=112)
                     Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                    Select Operator [SEL_15] (rows=15586502 width=3)
+                    Select Operator [SEL_15] (rows=15586502 width=119)
                       Output:["_col0","_col1"]
-                      Merge Join Operator [MERGEJOIN_64] (rows=15586502 width=3)
-                        Conds:RS_12._col0, _col2=RS_77._col0, _col2(Inner),Output:["_col3","_col7","_col9","_col10"]
+                      Merge Join Operator [MERGEJOIN_64] (rows=15586502 width=119)
+                        Conds:RS_12._col0, _col2=RS_77._col0, _col2(Inner),Output:["_col3","_col4","_col7","_col9","_col10","_col11"]
                       <-Reducer 2 [SIMPLE_EDGE]
                         PARTITION_ONLY_SHUFFLE [RS_12]
                           PartitionCols:_col0, _col2
-                          Merge Join Operator [MERGEJOIN_63] (rows=1522298 width=8)
-                            Conds:RS_67._col1=RS_70._col0(Inner),Output:["_col0","_col2","_col3"]
+                          Merge Join Operator [MERGEJOIN_63] (rows=1522298 width=12)
+                            Conds:RS_67._col1=RS_70._col0(Inner),Output:["_col0","_col2","_col3","_col4"]
                           <-Map 1 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_67]
                               PartitionCols:_col1
-                              Select Operator [SEL_66] (rows=55574563 width=15)
-                                Output:["_col0","_col1","_col2","_col3"]
+                              Select Operator [SEL_66] (rows=55574563 width=19)
+                                Output:["_col0","_col1","_col2","_col3","_col4"]
                                 Filter Operator [FIL_65] (rows=55574563 width=15)
                                   predicate:(sr_item_sk is not null and sr_reason_sk is not null and sr_ticket_number is not null)
                                   TableScan [TS_0] (rows=57591150 width=15)
@@ -91,7 +91,7 @@ Stage-0
                           <-Map 8 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_70]
                               PartitionCols:_col0
-                              Select Operator [SEL_69] (rows=1 width=113)
+                              Select Operator [SEL_69] (rows=1 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_68] (rows=1 width=101)
                                   predicate:((r_reason_desc = 'Did not like the warranty') and r_reason_sk is not null)
@@ -100,8 +100,8 @@ Stage-0
                       <-Map 9 [SIMPLE_EDGE] vectorized
                         SHUFFLE [RS_77]
                           PartitionCols:_col0, _col2
-                          Select Operator [SEL_76] (rows=575995635 width=122)
-                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                          Select Operator [SEL_76] (rows=575995635 width=234)
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                             Filter Operator [FIL_75] (rows=575995635 width=122)
                               predicate:((ss_item_sk BETWEEN DynamicValue(RS_12_store_returns_sr_item_sk_min) AND DynamicValue(RS_12_store_returns_sr_item_sk_max) and in_bloom_filter(ss_item_sk, DynamicValue(RS_12_store_returns_sr_item_sk_bloom_filter))) and (ss_ticket_number BETWEEN DynamicValue(RS_12_store_returns_sr_ticket_number_min) AND DynamicValue(RS_12_store_returns_sr_ticket_number_max) and in_bloom_filter(ss_ticket_number, DynamicValue(RS_12_store_returns_sr_ticket_number_bloom_filter))) and ss_item_sk is not null and ss_ticket_number is not null)
                               TableScan [TS_6] (rows=575995635 width=122)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query95.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query95.q.out b/ql/src/test/results/clientpositive/perf/tez/query95.q.out
index 49e8e86..885e670 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query95.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query95.q.out
@@ -141,7 +141,7 @@ Stage-0
                                     <-Map 16 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_260]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_259] (rows=12 width=91)
+                                        Select Operator [SEL_259] (rows=12 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_258] (rows=12 width=92)
                                             predicate:((web_company_name = 'pri') and web_site_sk is not null)
@@ -155,7 +155,7 @@ Stage-0
                                         <-Map 14 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_252]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_251] (rows=784314 width=90)
+                                            Select Operator [SEL_251] (rows=784314 width=4)
                                               Output:["_col0"]
                                               Filter Operator [FIL_250] (rows=784314 width=90)
                                                 predicate:((ca_state = 'TX') and ca_address_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query96.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query96.q.out b/ql/src/test/results/clientpositive/perf/tez/query96.q.out
index d06ad6a..0c80233 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query96.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query96.q.out
@@ -76,7 +76,7 @@ Stage-0
                       <-Map 11 [SIMPLE_EDGE] vectorized
                         SHUFFLE [RS_95]
                           PartitionCols:_col0
-                          Select Operator [SEL_94] (rows=155 width=91)
+                          Select Operator [SEL_94] (rows=155 width=4)
                             Output:["_col0"]
                             Filter Operator [FIL_93] (rows=155 width=92)
                               predicate:((s_store_name = 'ese') and s_store_sk is not null)
@@ -90,7 +90,7 @@ Stage-0
                           <-Map 9 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_87]
                               PartitionCols:_col0
-                              Select Operator [SEL_86] (rows=655 width=8)
+                              Select Operator [SEL_86] (rows=655 width=4)
                                 Output:["_col0"]
                                 Filter Operator [FIL_85] (rows=655 width=8)
                                   predicate:((hd_dep_count = 5) and hd_demo_sk is not null)
@@ -104,7 +104,7 @@ Stage-0
                               <-Map 7 [SIMPLE_EDGE] vectorized
                                 PARTITION_ONLY_SHUFFLE [RS_79]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_78] (rows=1515 width=12)
+                                  Select Operator [SEL_78] (rows=1515 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_77] (rows=1515 width=12)
                                       predicate:((t_hour = 8) and (t_minute >= 30) and t_time_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query97.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query97.q.out b/ql/src/test/results/clientpositive/perf/tez/query97.q.out
index 21daca3..8cd15fb 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query97.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query97.q.out
@@ -101,7 +101,7 @@ Stage-0
                             <-Map 6 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_72]
                                 PartitionCols:_col0
-                                Select Operator [SEL_71] (rows=317 width=8)
+                                Select Operator [SEL_71] (rows=317 width=4)
                                   Output:["_col0"]
                                   Filter Operator [FIL_70] (rows=317 width=8)
                                     predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query98.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query98.q.out b/ql/src/test/results/clientpositive/perf/tez/query98.q.out
index 8403d20..5be1e37 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query98.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query98.q.out
@@ -105,9 +105,9 @@ Stage-0
                       SHUFFLE [RS_17]
                         PartitionCols:_col0, _col1, _col2, _col3, _col4
                         Group By Operator [GBY_16] (rows=138600 width=689)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)"],keys:_col10, _col9, _col6, _col7, _col8
+                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)"],keys:_col9, _col8, _col5, _col6, _col7
                           Merge Join Operator [MERGEJOIN_57] (rows=18334631 width=577)
-                            Conds:RS_12._col1=RS_68._col0(Inner),Output:["_col2","_col6","_col7","_col8","_col9","_col10"]
+                            Conds:RS_12._col1=RS_68._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9"]
                           <-Map 9 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_68]
                               PartitionCols:_col0
@@ -125,7 +125,7 @@ Stage-0
                               <-Map 7 [SIMPLE_EDGE] vectorized
                                 PARTITION_ONLY_SHUFFLE [RS_60]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_59] (rows=8116 width=98)
+                                  Select Operator [SEL_59] (rows=8116 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_58] (rows=8116 width=98)
                                       predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'2001-01-12 00:00:00' AND TIMESTAMP'2001-02-11 00:00:00' and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query99.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query99.q.out b/ql/src/test/results/clientpositive/perf/tez/query99.q.out
index 745c5a9..0d9d1f8 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query99.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query99.q.out
@@ -96,108 +96,106 @@ Stage-0
     limit:-1
     Stage-1
       Reducer 7 vectorized
-      File Output Operator [FS_132]
-        Limit [LIM_131] (rows=100 width=590)
+      File Output Operator [FS_131]
+        Limit [LIM_130] (rows=100 width=590)
           Number of rows:100
-          Select Operator [SEL_130] (rows=3869553 width=590)
+          Select Operator [SEL_129] (rows=3869553 width=590)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
           <-Reducer 6 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_129]
-              Select Operator [SEL_128] (rows=3869553 width=590)
+            SHUFFLE [RS_128]
+              Select Operator [SEL_127] (rows=3869553 width=590)
                 Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
-                Group By Operator [GBY_127] (rows=3869553 width=406)
+                Group By Operator [GBY_126] (rows=3869553 width=406)
                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)","sum(VALUE._col4)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Reducer 5 [SIMPLE_EDGE]
-                  SHUFFLE [RS_30]
+                  SHUFFLE [RS_29]
                     PartitionCols:_col0, _col1, _col2
-                    Group By Operator [GBY_29] (rows=7739106 width=406)
-                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col3)","sum(_col4)","sum(_col5)","sum(_col6)","sum(_col7)"],keys:_col0, _col1, _col2
-                      Top N Key Operator [TNK_57] (rows=15478212 width=289)
-                        keys:_col0, _col1, _col2,sort order:+++,top n:100
-                        Select Operator [SEL_27] (rows=15478212 width=289)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                          Merge Join Operator [MERGEJOIN_101] (rows=15478212 width=289)
-                            Conds:RS_24._col3=RS_112._col0(Inner),Output:["_col0","_col1","_col8","_col10","_col12"]
-                          <-Map 12 [SIMPLE_EDGE] vectorized
-                            SHUFFLE [RS_112]
-                              PartitionCols:_col0
-                              Select Operator [SEL_111] (rows=1 width=88)
-                                Output:["_col0","_col1"]
-                                Filter Operator [FIL_110] (rows=1 width=88)
-                                  predicate:sm_ship_mode_sk is not null
-                                  TableScan [TS_12] (rows=1 width=88)
-                                    default@ship_mode,ship_mode,Tbl:COMPLETE,Col:COMPLETE,Output:["sm_ship_mode_sk","sm_type"]
-                          <-Reducer 4 [SIMPLE_EDGE]
-                            SHUFFLE [RS_24]
-                              PartitionCols:_col3
-                              Merge Join Operator [MERGEJOIN_100] (rows=46434637 width=209)
-                                Conds:RS_21._col4=RS_126._col0(Inner),Output:["_col0","_col1","_col3","_col8","_col10"]
-                              <-Map 11 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_126]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_125] (rows=27 width=104)
-                                    Output:["_col0","_col1"]
-                                    Filter Operator [FIL_124] (rows=27 width=104)
-                                      predicate:w_warehouse_sk is not null
-                                      TableScan [TS_9] (rows=27 width=104)
-                                        default@warehouse,warehouse,Tbl:COMPLETE,Col:COMPLETE,Output:["w_warehouse_sk","w_warehouse_name"]
-                              <-Reducer 3 [SIMPLE_EDGE]
-                                SHUFFLE [RS_21]
-                                  PartitionCols:_col4
-                                  Merge Join Operator [MERGEJOIN_99] (rows=46434637 width=113)
-                                    Conds:RS_18._col2=RS_123._col0(Inner),Output:["_col0","_col1","_col3","_col4","_col8"]
-                                  <-Map 10 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_123]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_122] (rows=60 width=102)
-                                        Output:["_col0","_col1"]
-                                        Filter Operator [FIL_121] (rows=60 width=102)
-                                          predicate:cc_call_center_sk is not null
-                                          TableScan [TS_6] (rows=60 width=102)
-                                            default@call_center,call_center,Tbl:COMPLETE,Col:COMPLETE,Output:["cc_call_center_sk","cc_name"]
-                                  <-Reducer 2 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_18]
-                                      PartitionCols:_col2
-                                      Merge Join Operator [MERGEJOIN_98] (rows=46434637 width=19)
-                                        Conds:RS_120._col1=RS_104._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4"]
-                                      <-Map 8 [SIMPLE_EDGE] vectorized
-                                        PARTITION_ONLY_SHUFFLE [RS_104]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_103] (rows=317 width=8)
-                                            Output:["_col0"]
-                                            Filter Operator [FIL_102] (rows=317 width=8)
-                                              predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)
-                                              TableScan [TS_3] (rows=73049 width=8)
-                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_month_seq"]
-                                      <-Map 1 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_120]
-                                          PartitionCols:_col1
-                                          Select Operator [SEL_119] (rows=282273729 width=19)
-                                            Output:["_col0","_col1","_col2","_col3","_col4"]
-                                            Filter Operator [FIL_118] (rows=282273729 width=19)
-                                              predicate:((cs_ship_date_sk BETWEEN DynamicValue(RS_16_date_dim_d_date_sk_min) AND DynamicValue(RS_16_date_dim_d_date_sk_max) and in_bloom_filter(cs_ship_date_sk, DynamicValue(RS_16_date_dim_d_date_sk_bloom_filter))) and (cs_ship_mode_sk BETWEEN DynamicValue(RS_25_ship_mode_sm_ship_mode_sk_min) AND DynamicValue(RS_25_ship_mode_sm_ship_mode_sk_max) and in_bloom_filter(cs_ship_mode_sk, DynamicValue(RS_25_ship_mode_sm_ship_mode_sk_bloom_filter))) and cs_call_center_sk is not null and cs_ship_date_sk is not null and cs_ship_mode_sk is not null and cs_warehouse_sk is not null)
-                                              TableScan [TS_0] (rows=287989836 width=19)
-                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_ship_date_sk","cs_call_center_sk","cs_ship_mode_sk","cs_warehouse_sk"]
-                                              <-Reducer 13 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_117]
-                                                  Group By Operator [GBY_116] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                  <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_115]
-                                                      Group By Operator [GBY_114] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_113] (rows=1 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_111]
-                                              <-Reducer 9 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_109]
-                                                  Group By Operator [GBY_108] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                  <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_107]
-                                                      Group By Operator [GBY_106] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_105] (rows=317 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_103]
+                    Group By Operator [GBY_28] (rows=7739106 width=406)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col4)","sum(_col5)","sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col13, _col15, _col11
+                      Top N Key Operator [TNK_56] (rows=15478212 width=386)
+                        keys:_col13, _col15, _col11,sort order:+++,top n:100
+                        Merge Join Operator [MERGEJOIN_100] (rows=15478212 width=386)
+                          Conds:RS_24._col2=RS_111._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col8","_col11","_col13","_col15"]
+                        <-Map 12 [SIMPLE_EDGE] vectorized
+                          SHUFFLE [RS_111]
+                            PartitionCols:_col0
+                            Select Operator [SEL_110] (rows=1 width=88)
+                              Output:["_col0","_col1"]
+                              Filter Operator [FIL_109] (rows=1 width=88)
+                                predicate:sm_ship_mode_sk is not null
+                                TableScan [TS_12] (rows=1 width=88)
+                                  default@ship_mode,ship_mode,Tbl:COMPLETE,Col:COMPLETE,Output:["sm_ship_mode_sk","sm_type"]
+                        <-Reducer 4 [SIMPLE_EDGE]
+                          SHUFFLE [RS_24]
+                            PartitionCols:_col2
+                            Merge Join Operator [MERGEJOIN_99] (rows=46434637 width=305)
+                              Conds:RS_21._col3=RS_125._col0(Inner),Output:["_col2","_col4","_col5","_col6","_col7","_col8","_col11","_col13"]
+                            <-Map 11 [SIMPLE_EDGE] vectorized
+                              SHUFFLE [RS_125]
+                                PartitionCols:_col0
+                                Select Operator [SEL_124] (rows=27 width=188)
+                                  Output:["_col0","_col1"]
+                                  Filter Operator [FIL_123] (rows=27 width=104)
+                                    predicate:w_warehouse_sk is not null
+                                    TableScan [TS_9] (rows=27 width=104)
+                                      default@warehouse,warehouse,Tbl:COMPLETE,Col:COMPLETE,Output:["w_warehouse_sk","w_warehouse_name"]
+                            <-Reducer 3 [SIMPLE_EDGE]
+                              SHUFFLE [RS_21]
+                                PartitionCols:_col3
+                                Merge Join Operator [MERGEJOIN_98] (rows=46434637 width=125)
+                                  Conds:RS_18._col1=RS_122._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col11"]
+                                <-Map 10 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_122]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_121] (rows=60 width=102)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_120] (rows=60 width=102)
+                                        predicate:cc_call_center_sk is not null
+                                        TableScan [TS_6] (rows=60 width=102)
+                                          default@call_center,call_center,Tbl:COMPLETE,Col:COMPLETE,Output:["cc_call_center_sk","cc_name"]
+                                <-Reducer 2 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_18]
+                                    PartitionCols:_col1
+                                    Merge Join Operator [MERGEJOIN_97] (rows=46434637 width=31)
+                                      Conds:RS_119._col0=RS_103._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                                    <-Map 8 [SIMPLE_EDGE] vectorized
+                                      PARTITION_ONLY_SHUFFLE [RS_103]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_102] (rows=317 width=4)
+                                          Output:["_col0"]
+                                          Filter Operator [FIL_101] (rows=317 width=8)
+                                            predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)
+                                            TableScan [TS_3] (rows=73049 width=8)
+                                              default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_month_seq"]
+                                    <-Map 1 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_119]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_118] (rows=282273729 width=35)
+                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                                          Filter Operator [FIL_117] (rows=282273729 width=19)
+                                            predicate:((cs_ship_date_sk BETWEEN DynamicValue(RS_16_date_dim_d_date_sk_min) AND DynamicValue(RS_16_date_dim_d_date_sk_max) and in_bloom_filter(cs_ship_date_sk, DynamicValue(RS_16_date_dim_d_date_sk_bloom_filter))) and (cs_ship_mode_sk BETWEEN DynamicValue(RS_25_ship_mode_sm_ship_mode_sk_min) AND DynamicValue(RS_25_ship_mode_sm_ship_mode_sk_max) and in_bloom_filter(cs_ship_mode_sk, DynamicValue(RS_25_ship_mode_sm_ship_mode_sk_bloom_filter))) and cs_call_center_sk is not null and cs_ship_date_sk is not null and cs_ship_mode_sk is not null and cs_warehouse_sk is not null)
+                                            TableScan [TS_0] (rows=287989836 width=19)
+                                              default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_ship_date_sk","cs_call_center_sk","cs_ship_mode_sk","cs_warehouse_sk"]
+                                            <-Reducer 13 [BROADCAST_EDGE] vectorized
+                                              BROADCAST [RS_116]
+                                                Group By Operator [GBY_115] (rows=1 width=12)
+                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                  SHUFFLE [RS_114]
+                                                    Group By Operator [GBY_113] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                      Select Operator [SEL_112] (rows=1 width=4)
+                                                        Output:["_col0"]
+                                                         Please refer to the previous Select Operator [SEL_110]
+                                            <-Reducer 9 [BROADCAST_EDGE] vectorized
+                                              BROADCAST [RS_108]
+                                                Group By Operator [GBY_107] (rows=1 width=12)
+                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                  PARTITION_ONLY_SHUFFLE [RS_106]
+                                                    Group By Operator [GBY_105] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                      Select Operator [SEL_104] (rows=317 width=4)
+                                                        Output:["_col0"]
+                                                         Please refer to the previous Select Operator [SEL_102]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/pointlookup2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/pointlookup2.q.out b/ql/src/test/results/clientpositive/pointlookup2.q.out
index 8d906be..42d2c78 100644
--- a/ql/src/test/results/clientpositive/pointlookup2.q.out
+++ b/ql/src/test/results/clientpositive/pointlookup2.q.out
@@ -294,15 +294,15 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@pcr_t1_n2
 POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-08
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t4`.`key1`, `t4`.`value1`, CAST('2000-04-08' AS STRING) AS `ds1`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, CAST('2000-04-08' AS STRING) AS `ds1`
+FROM (SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`pcr_t1_n2`
 WHERE `ds` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`pcr_t1_n2`
 WHERE `ds` = '2000-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t0`.`key`) AS `t4`
+ORDER BY `t0`.`key`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -417,30 +417,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: int), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3
-                    columns.types int,string,int,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3
+                  columns.types int,string,int,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -538,15 +534,15 @@ POSTHOOK: Input: default@pcr_t1_n2
 POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-08
 POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-09
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t4`.`key1`, `t4`.`value1`, CAST('2000-04-09' AS STRING) AS `ds1`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, CAST('2000-04-09' AS STRING) AS `ds1`
+FROM (SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`pcr_t1_n2`
 WHERE `ds` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2000-04-09' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`pcr_t1_n2`
 WHERE `ds` = '2000-04-09' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t0`.`key`) AS `t4`
+ORDER BY `t0`.`key`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -710,30 +706,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: int), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3
-                    columns.types int,string,int,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3
+                  columns.types int,string,int,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -834,14 +826,6 @@ POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-08
 POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-09
 POSTHOOK: Input: default@pcr_t2_n0
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT *
-FROM (SELECT `key`, `value`, `ds`
-FROM `default`.`pcr_t1_n2`
-WHERE `ds` = '2000-04-08' OR `ds` = '2000-04-09') AS `t0`
-INNER JOIN (SELECT `ds`, `key`, `value`
-FROM `default`.`pcr_t2_n0`
-WHERE `key` = 1 OR `key` = 2) AS `t2` ON `t0`.`ds` = '2000-04-08' AND `t2`.`key` = 1 OR `t0`.`ds` = '2000-04-09' AND `t2`.`key` = 2
-ORDER BY `t2`.`key`, `t2`.`value`, `t0`.`ds`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -857,15 +841,15 @@ STAGE PLANS:
             Statistics: Num rows: 40 Data size: 320 Basic stats: COMPLETE Column stats: NONE
             GatherStats: false
             Select Operator
-              expressions: key (type: int), value (type: string), ds (type: string)
-              outputColumnNames: _col0, _col1, _col2
+              expressions: key (type: int), value (type: string), ds (type: string), (ds = '2000-04-08') (type: boolean), (ds = '2000-04-09') (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4
               Statistics: Num rows: 40 Data size: 320 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 null sort order: 
                 sort order: 
                 Statistics: Num rows: 40 Data size: 320 Basic stats: COMPLETE Column stats: NONE
                 tag: 0
-                value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: boolean), _col4 (type: boolean)
                 auto parallelism: false
           TableScan
             alias: t2
@@ -877,15 +861,15 @@ STAGE PLANS:
               predicate: ((key = 1) or (key = 2)) (type: boolean)
               Statistics: Num rows: 1 Data size: 18 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: ds (type: string), key (type: int), value (type: string)
-                outputColumnNames: _col0, _col1, _col2
+                expressions: ds (type: string), key (type: int), value (type: string), (key = 1) (type: boolean), (key = 2) (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 1 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   null sort order: 
                   sort order: 
                   Statistics: Num rows: 1 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                   tag: 1
-                  value expressions: _col0 (type: string), _col1 (type: int), _col2 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: int), _col2 (type: string), _col3 (type: boolean), _col4 (type: boolean)
                   auto parallelism: false
       Path -> Alias:
 #### A masked pattern was here ####
@@ -1046,30 +1030,34 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
           Statistics: Num rows: 40 Data size: 1080 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
             isSamplingPred: false
-            predicate: (((_col2 = '2000-04-08') and (_col4 = 1)) or ((_col2 = '2000-04-09') and (_col4 = 2))) (type: boolean)
+            predicate: ((_col3 and _col8) or (_col4 and _col9)) (type: boolean)
             Statistics: Num rows: 20 Data size: 540 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
-#### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3,_col4,_col5
-                    columns.types int,string,string,string,int,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            Select Operator
+              expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col5 (type: string), _col6 (type: int), _col7 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+              Statistics: Num rows: 20 Data size: 540 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                GlobalTableId: 0
+#### A masked pattern was here ####
+                NumFilesPerFileSink: 1
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    properties:
+                      column.name.delimiter ,
+                      columns _col0,_col1,_col2,_col3,_col4,_col5
+                      columns.types int,string,string,string,int,string
+                      escape.delim \
+                      serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                TotalFiles: 1
+                GatherStats: false
+                MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -1172,14 +1160,6 @@ POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-09
 POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-10
 POSTHOOK: Input: default@pcr_t2_n0
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT *
-FROM (SELECT `key`, `value`, `ds`
-FROM `default`.`pcr_t1_n2`
-WHERE `key` = 1 OR `key` = 2) AS `t0`
-INNER JOIN (SELECT `ds`, `key`, `value`
-FROM `default`.`pcr_t2_n0`
-WHERE `ds` = '2000-04-08' OR `ds` = '2000-04-09') AS `t2` ON `t2`.`ds` = '2000-04-08' AND `t0`.`key` = 1 OR `t2`.`ds` = '2000-04-09' AND `t0`.`key` = 2
-ORDER BY `t0`.`key`, `t0`.`value`, `t2`.`ds`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -1199,15 +1179,15 @@ STAGE PLANS:
               predicate: ((key = 1) or (key = 2)) (type: boolean)
               Statistics: Num rows: 60 Data size: 480 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: int), value (type: string), ds (type: string)
-                outputColumnNames: _col0, _col1, _col2
+                expressions: key (type: int), value (type: string), ds (type: string), (key = 1) (type: boolean), (key = 2) (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 60 Data size: 480 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   null sort order: 
                   sort order: 
                   Statistics: Num rows: 60 Data size: 480 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
-                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string)
+                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: boolean), _col4 (type: boolean)
                   auto parallelism: false
           TableScan
             alias: t2
@@ -1219,15 +1199,15 @@ STAGE PLANS:
               predicate: ((ds = '2000-04-08') or (ds = '2000-04-09')) (type: boolean)
               Statistics: Num rows: 1 Data size: 18 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: ds (type: string), key (type: int), value (type: string)
-                outputColumnNames: _col0, _col1, _col2
+                expressions: ds (type: string), key (type: int), value (type: string), (ds = '2000-04-08') (type: boolean), (ds = '2000-04-09') (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
                 Statistics: Num rows: 1 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   null sort order: 
                   sort order: 
                   Statistics: Num rows: 1 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                   tag: 1
-                  value expressions: _col0 (type: string), _col1 (type: int), _col2 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: int), _col2 (type: string), _col3 (type: boolean), _col4 (type: boolean)
                   auto parallelism: false
       Path -> Alias:
 #### A masked pattern was here ####
@@ -1437,30 +1417,34 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
           Statistics: Num rows: 60 Data size: 1620 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
             isSamplingPred: false
-            predicate: (((_col3 = '2000-04-08') and (_col0 = 1)) or ((_col3 = '2000-04-09') and (_col0 = 2))) (type: boolean)
+            predicate: ((_col8 and _col3) or (_col9 and _col4)) (type: boolean)
             Statistics: Num rows: 30 Data size: 810 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
-#### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3,_col4,_col5
-                    columns.types int,string,string,string,int,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            Select Operator
+              expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col5 (type: string), _col6 (type: int), _col7 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+              Statistics: Num rows: 30 Data size: 810 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                GlobalTableId: 0
+#### A masked pattern was here ####
+                NumFilesPerFileSink: 1
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    properties:
+                      column.name.delimiter ,
+                      columns _col0,_col1,_col2,_col3,_col4,_col5
+                      columns.types int,string,string,string,int,string
+                      escape.delim \
+                      serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                TotalFiles: 1
+                GatherStats: false
+                MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -1920,15 +1904,15 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@pcr_t1_n2
 POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-08
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t4`.`key1`, `t4`.`value1`, CAST('2000-04-08' AS STRING) AS `ds1`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, CAST('2000-04-08' AS STRING) AS `ds1`
+FROM (SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`pcr_t1_n2`
 WHERE `ds` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`pcr_t1_n2`
 WHERE `ds` = '2000-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t0`.`key`) AS `t4`
+ORDER BY `t0`.`key`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -2043,30 +2027,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: int), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3
-                    columns.types int,string,int,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3
+                  columns.types int,string,int,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -2164,15 +2144,15 @@ POSTHOOK: Input: default@pcr_t1_n2
 POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-08
 POSTHOOK: Input: default@pcr_t1_n2@ds=2000-04-09
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t4`.`key1`, `t4`.`value1`, CAST('2000-04-09' AS STRING) AS `ds1`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, CAST('2000-04-09' AS STRING) AS `ds1`
+FROM (SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`pcr_t1_n2`
 WHERE `ds` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2000-04-09' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`pcr_t1_n2`
 WHERE `ds` = '2000-04-09' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t0`.`key`) AS `t4`
+ORDER BY `t0`.`key`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -2336,30 +2316,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: int), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3
-                    columns.types int,string,int,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3
+                  columns.types int,string,int,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce


[30/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/masking_4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/masking_4.q.out b/ql/src/test/results/clientpositive/masking_4.q.out
index 60cbd0f..54861b0 100644
--- a/ql/src/test/results/clientpositive/masking_4.q.out
+++ b/ql/src/test/results/clientpositive/masking_4.q.out
@@ -210,12 +210,16 @@ STAGE PLANS:
           mode: mergepartial
           outputColumnNames: _col0
           Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          Select Operator
+            expressions: _col0 (type: int), UDFToDouble(_col0) (type: double)
+            outputColumnNames: _col0, _col1
+            Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -228,20 +232,20 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string)
-                outputColumnNames: _col0
+                expressions: key (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col1 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col1 (type: double)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string)
           TableScan
             Reduce Output Operator
-              key expressions: UDFToDouble(_col0) (type: double)
+              key expressions: _col1 (type: double)
               sort order: +
-              Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+              Map-reduce partition columns: _col1 (type: double)
               Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: int)
       Reduce Operator Tree:
@@ -249,21 +253,25 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1
+            0 _col1 (type: double)
+            1 _col1 (type: double)
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-          Group By Operator
-            keys: _col0 (type: string), _col1 (type: int)
-            mode: hash
+          Select Operator
+            expressions: _col0 (type: string), _col2 (type: int)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            Group By Operator
+              keys: _col0 (type: string), _col1 (type: int)
+              mode: hash
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-1
     Map Reduce

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/mergejoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/mergejoin.q.out b/ql/src/test/results/clientpositive/mergejoin.q.out
index b20ea45..2108434 100644
--- a/ql/src/test/results/clientpositive/mergejoin.q.out
+++ b/ql/src/test/results/clientpositive/mergejoin.q.out
@@ -3399,8 +3399,8 @@ NULL	NULL	NULL	98	val_98	2008-04-08	98	val_98	2008-04-08
 NULL	NULL	NULL	98	val_98	2008-04-08	98	val_98	2008-04-08
 NULL	NULL	NULL	98	val_98	2008-04-08	98	val_98	2008-04-08
 NULL	NULL	NULL	98	val_98	2008-04-08	98	val_98	2008-04-08
-Warning: Shuffle Join JOIN[13][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
-Warning: Shuffle Join JOIN[10][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[14][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-2:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[8][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
 PREHOOK: query: select * from
 (select * from tab_n9 where tab_n9.key = 0)a
 join
@@ -3927,8 +3927,8 @@ NULL	NULL	NULL	NULL	NULL	NULL	97	val_97	2008-04-08
 NULL	NULL	NULL	NULL	NULL	NULL	97	val_97	2008-04-08
 NULL	NULL	NULL	NULL	NULL	NULL	98	val_98	2008-04-08
 NULL	NULL	NULL	NULL	NULL	NULL	98	val_98	2008-04-08
-Warning: Shuffle Join JOIN[13][tables = [$hdt$_0, $hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
-Warning: Shuffle Join JOIN[10][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[14][tables = [$hdt$_0, $hdt$_1]] in Stage 'Stage-1:MAPRED' is a cross product
+Warning: Shuffle Join JOIN[10][tables = [$hdt$_1, $hdt$_2]] in Stage 'Stage-2:MAPRED' is a cross product
 PREHOOK: query: select * from
 (select * from tab_n9 where tab_n9.key = 0)a
 join

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/mergejoins.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/mergejoins.q.out b/ql/src/test/results/clientpositive/mergejoins.q.out
index dcae432..1841e63 100644
--- a/ql/src/test/results/clientpositive/mergejoins.q.out
+++ b/ql/src/test/results/clientpositive/mergejoins.q.out
@@ -218,24 +218,24 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: a_n0
+            alias: b_n0
             filterExpr: key is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), value (type: string), (UDFToDouble(key) < 10.0D) (type: boolean)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: boolean)
           TableScan
-            alias: b_n0
+            alias: a_n0
             filterExpr: key is not null (type: boolean)
             Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
@@ -272,24 +272,28 @@ STAGE PLANS:
         Join Operator
           condition map:
                Inner Join 0 to 1
-               Left Outer Join 1 to 2
+               Left Outer Join 0 to 2
           filter predicates:
-            0 
-            1 {(UDFToDouble(KEY.reducesinkkey0) < 10.0D)}
+            0 {VALUE._col1}
+            1 
             2 
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
             2 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6
           Statistics: Num rows: 1100 Data size: 11686 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col3 (type: string), _col4 (type: string), _col0 (type: string), _col1 (type: string), _col5 (type: string), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 1100 Data size: 11686 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 1100 Data size: 11686 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/multi_insert_with_join2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/multi_insert_with_join2.q.out b/ql/src/test/results/clientpositive/multi_insert_with_join2.q.out
index 50d407f..761e7c0 100644
--- a/ql/src/test/results/clientpositive/multi_insert_with_join2.q.out
+++ b/ql/src/test/results/clientpositive/multi_insert_with_join2.q.out
@@ -92,12 +92,12 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: val (type: string)
-                outputColumnNames: _col1
+                outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col0 (type: string)
           TableScan
             alias: b
             filterExpr: ((id = 'Id_1') and (val = 'val_103')) (type: boolean)
@@ -117,10 +117,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col1
+          outputColumnNames: _col0
           Statistics: Num rows: 1 Data size: 25 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: 'Id_1' (type: string), _col1 (type: string), 'Id_1' (type: string), 'val_103' (type: string)
+            expressions: 'Id_1' (type: string), _col0 (type: string), 'Id_1' (type: string), 'val_103' (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3
             Statistics: Num rows: 1 Data size: 25 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
@@ -226,12 +226,12 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: val (type: string)
-                outputColumnNames: _col1
+                outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string)
+                  value expressions: _col0 (type: string)
           TableScan
             alias: b
             filterExpr: ((val = 'val_104') and (id = 'Id_2')) (type: boolean)
@@ -251,10 +251,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col1
+          outputColumnNames: _col0
           Statistics: Num rows: 1 Data size: 25 Basic stats: COMPLETE Column stats: NONE
           Select Operator
-            expressions: 'Id_2' (type: string), _col1 (type: string), 'Id_2' (type: string), 'val_104' (type: string)
+            expressions: 'Id_2' (type: string), _col0 (type: string), 'Id_2' (type: string), 'val_104' (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3
             Statistics: Num rows: 1 Data size: 25 Basic stats: COMPLETE Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/outer_join_ppr.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/outer_join_ppr.q.out b/ql/src/test/results/clientpositive/outer_join_ppr.q.out
index ea85034..fc0ea34 100644
--- a/ql/src/test/results/clientpositive/outer_join_ppr.q.out
+++ b/ql/src/test/results/clientpositive/outer_join_ppr.q.out
@@ -26,11 +26,11 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
+OPTIMIZED SQL: SELECT *
 FROM (SELECT `key`, `value`
 FROM `default`.`src`
 WHERE `key` < 20 AND `key` > 15) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `key` > 15 AND `ds` = '2008-04-08' AND `key` < 20) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -343,11 +343,11 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
+OPTIMIZED SQL: SELECT *
 FROM (SELECT `key`, `value`
 FROM `default`.`src`
 WHERE `key` < 20 AND `key` > 15) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `key` > 15 AND `ds` = '2008-04-08' AND `key` < 20) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/pcr.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/pcr.q.out b/ql/src/test/results/clientpositive/pcr.q.out
index 95f560f..d71ef67 100644
--- a/ql/src/test/results/clientpositive/pcr.q.out
+++ b/ql/src/test/results/clientpositive/pcr.q.out
@@ -2430,15 +2430,15 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@pcr_t1
 POSTHOOK: Input: default@pcr_t1@ds=2000-04-08
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t4`.`key1`, `t4`.`value1`, CAST('2000-04-08' AS STRING) AS `ds1`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, CAST('2000-04-08' AS STRING) AS `ds1`
+FROM (SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`pcr_t1`
 WHERE `ds` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`pcr_t1`
 WHERE `ds` = '2000-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t0`.`key`) AS `t4`
+ORDER BY `t0`.`key`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -2553,30 +2553,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: int), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3
-                    columns.types int,string,int,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3
+                  columns.types int,string,int,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -2714,15 +2710,15 @@ POSTHOOK: Input: default@pcr_t1
 POSTHOOK: Input: default@pcr_t1@ds=2000-04-08
 POSTHOOK: Input: default@pcr_t1@ds=2000-04-09
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t4`.`key1`, `t4`.`value1`, CAST('2000-04-09' AS STRING) AS `ds1`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, CAST('2000-04-09' AS STRING) AS `ds1`
+FROM (SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`pcr_t1`
 WHERE `ds` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2000-04-09' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`pcr_t1`
 WHERE `ds` = '2000-04-09' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t0`.`key`) AS `t4`
+ORDER BY `t0`.`key`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -2886,30 +2882,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: int), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3
-                    columns.types int,string,int,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3
+                  columns.types int,string,int,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query1.q.out b/ql/src/test/results/clientpositive/perf/spark/query1.q.out
index e0fd19e..75da726 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query1.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query1.q.out
@@ -309,14 +309,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col6
+                outputColumnNames: _col1, _col2, _col5
                 Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(17,2)), _col6 (type: string)
+                  value expressions: _col2 (type: decimal(17,2)), _col5 (type: string)
         Reducer 5 
             Reduce Operator Tree:
               Join Operator
@@ -325,13 +325,13 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col2, _col6, _col7
+                outputColumnNames: _col2, _col5, _col6
                 Statistics: Num rows: 96800003 Data size: 83249958789 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (_col2 > _col7) (type: boolean)
+                  predicate: (_col2 > _col6) (type: boolean)
                   Statistics: Num rows: 32266667 Data size: 27749985689 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col6 (type: string)
+                    expressions: _col5 (type: string)
                     outputColumnNames: _col0
                     Statistics: Num rows: 32266667 Data size: 27749985689 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query11.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query11.q.out b/ql/src/test/results/clientpositive/perf/spark/query11.q.out
index 823ad71..28ce6d0 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query11.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query11.q.out
@@ -190,15 +190,15 @@ STAGE PLANS:
                     predicate: (ws_bill_customer_sk is not null and ws_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_bill_customer_sk (type: int), ws_ext_discount_amt (type: decimal(7,2)), ws_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3
+                      expressions: ws_sold_date_sk (type: int), ws_bill_customer_sk (type: int), (ws_ext_list_price - ws_ext_discount_amt) (type: decimal(8,2))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: decimal(8,2))
             Execution mode: vectorized
         Map 13 
             Map Operator Tree:
@@ -249,15 +249,15 @@ STAGE PLANS:
                     predicate: (ws_bill_customer_sk is not null and ws_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_bill_customer_sk (type: int), ws_ext_discount_amt (type: decimal(7,2)), ws_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3
+                      expressions: ws_sold_date_sk (type: int), ws_bill_customer_sk (type: int), (ws_ext_list_price - ws_ext_discount_amt) (type: decimal(8,2))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: decimal(8,2))
             Execution mode: vectorized
         Map 19 
             Map Operator Tree:
@@ -308,15 +308,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ss_ext_discount_amt (type: decimal(7,2)), ss_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), (ss_ext_list_price - ss_ext_discount_amt) (type: decimal(8,2))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: decimal(8,2))
             Execution mode: vectorized
         Map 25 
             Map Operator Tree:
@@ -406,15 +406,15 @@ STAGE PLANS:
                     predicate: (ss_customer_sk is not null and ss_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), ss_ext_discount_amt (type: decimal(7,2)), ss_ext_list_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3
+                      expressions: ss_sold_date_sk (type: int), ss_customer_sk (type: int), (ss_ext_list_price - ss_ext_discount_amt) (type: decimal(8,2))
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: decimal(8,2))
             Execution mode: vectorized
         Reducer 10 
             Reduce Operator Tree:
@@ -424,14 +424,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(8,2))
         Reducer 11 
             Reduce Operator Tree:
               Join Operator
@@ -440,24 +440,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col7, _col8, _col9, _col10, _col11, _col12, _col13
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), (_col3 - _col2) (type: decimal(8,2))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(18,2))
+                    value expressions: _col7 (type: decimal(18,2))
         Reducer 12 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -492,14 +488,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(8,2))
         Reducer 17 
             Reduce Operator Tree:
               Join Operator
@@ -508,24 +504,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col7, _col8, _col9, _col10, _col11, _col12, _col13
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), (_col3 - _col2) (type: decimal(8,2))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(18,2))
+                    value expressions: _col7 (type: decimal(18,2))
         Reducer 18 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -543,15 +535,15 @@ STAGE PLANS:
                     predicate: (_col7 > 0) (type: boolean)
                     Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: _col0 (type: string), _col7 (type: decimal(18,2))
-                      outputColumnNames: _col0, _col1
+                      expressions: _col0 (type: string), _col7 (type: decimal(18,2)), _col7 is not null (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 29040539 Data size: 3948673454 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: decimal(18,2))
+                        value expressions: _col1 (type: decimal(18,2)), _col2 (type: boolean)
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -560,14 +552,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(8,2))
         Reducer 22 
             Reduce Operator Tree:
               Join Operator
@@ -576,14 +568,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(8,2))
         Reducer 23 
             Reduce Operator Tree:
               Join Operator
@@ -592,24 +584,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col7, _col8, _col9, _col10, _col11, _col12, _col13
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), (_col3 - _col2) (type: decimal(8,2))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(18,2))
+                    value expressions: _col7 (type: decimal(18,2))
         Reducer 24 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -637,24 +625,20 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col7, _col8, _col9, _col10, _col11, _col12, _col13
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), (_col3 - _col2) (type: decimal(8,2))
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col5 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col7)
-                    keys: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
+                    sort order: +++++++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
                     Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      sort order: +++++++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string)
-                      Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col7 (type: decimal(18,2))
+                    value expressions: _col7 (type: decimal(18,2))
         Reducer 4 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -686,13 +670,13 @@ STAGE PLANS:
                   1 _col0 (type: string)
                   2 _col0 (type: string)
                   3 _col0 (type: string)
-                outputColumnNames: _col1, _col3, _col5, _col7, _col8
+                outputColumnNames: _col1, _col3, _col5, _col6, _col8, _col9
                 Statistics: Num rows: 1149975359 Data size: 101451160012 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col5 is not null) THEN (((_col1 / _col5) > (_col8 / _col3))) ELSE ((null > (_col8 / _col3))) END) ELSE (CASE WHEN (_col5 is not null) THEN (((_col1 / _col5) > null)) ELSE (null) END) END (type: boolean)
+                  predicate: CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col6) THEN (((_col1 / _col5) > (_col9 / _col3))) ELSE ((null > (_col9 / _col3))) END) ELSE (CASE WHEN (_col6) THEN (((_col1 / _col5) > null)) ELSE (null) END) END (type: boolean)
                   Statistics: Num rows: 574987679 Data size: 50725579961 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col7 (type: string)
+                    expressions: _col8 (type: string)
                     outputColumnNames: _col0
                     Statistics: Num rows: 574987679 Data size: 50725579961 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query12.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query12.q.out b/ql/src/test/results/clientpositive/perf/spark/query12.q.out
index 903fcee..6ec6b73 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query12.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query12.q.out
@@ -170,11 +170,11 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col6, _col7, _col8, _col9, _col10
+                outputColumnNames: _col2, _col5, _col6, _col7, _col8, _col9
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col10 (type: string), _col9 (type: string), _col6 (type: string), _col7 (type: string), _col8 (type: decimal(7,2))
+                  keys: _col9 (type: string), _col8 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: decimal(7,2))
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query13.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query13.q.out b/ql/src/test/results/clientpositive/perf/spark/query13.q.out
index 4d530fc..2b6c19d 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query13.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query13.q.out
@@ -114,8 +114,7 @@ POSTHOOK: Input: default@store_sales
 #### A masked pattern was here ####
 STAGE DEPENDENCIES:
   Stage-2 is a root stage
-  Stage-3 depends on stages: Stage-2
-  Stage-1 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
@@ -123,6 +122,26 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
+        Map 7 
+            Map Operator Tree:
+                TableScan
+                  alias: store
+                  filterExpr: s_store_sk is not null (type: boolean)
+                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: s_store_sk is not null (type: boolean)
+                    Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: s_store_sk (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
+                      Spark HashTable Sink Operator
+                        keys:
+                          0 _col5 (type: int)
+                          1 _col0 (type: int)
+            Execution mode: vectorized
+            Local Work:
+              Map Reduce Local Work
         Map 8 
             Map Operator Tree:
                 TableScan
@@ -133,8 +152,8 @@ STAGE PLANS:
                     predicate: ((hd_dep_count) IN (3, 1) and hd_demo_sk is not null) (type: boolean)
                     Statistics: Num rows: 7200 Data size: 770400 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: hd_demo_sk (type: int), hd_dep_count (type: int)
-                      outputColumnNames: _col0, _col1
+                      expressions: hd_demo_sk (type: int), (hd_dep_count = 3) (type: boolean), (hd_dep_count = 1) (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 7200 Data size: 770400 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -144,40 +163,34 @@ STAGE PLANS:
             Local Work:
               Map Reduce Local Work
 
-  Stage: Stage-3
+  Stage: Stage-1
     Spark
+      Edges:
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 45), Map 6 (PARTITION-LEVEL SORT, 45)
+        Reducer 3 <- Map 9 (PARTITION-LEVEL SORT, 218), Reducer 2 (PARTITION-LEVEL SORT, 218)
+        Reducer 4 <- Map 10 (PARTITION-LEVEL SORT, 55), Reducer 3 (PARTITION-LEVEL SORT, 55)
+        Reducer 5 <- Reducer 4 (GROUP, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: store
-                  filterExpr: s_store_sk is not null (type: boolean)
-                  Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
+                  alias: date_dim
+                  filterExpr: ((d_year = 2001) and d_date_sk is not null) (type: boolean)
+                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: s_store_sk is not null (type: boolean)
-                    Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
+                    predicate: ((d_year = 2001) and d_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: s_store_sk (type: int)
+                      expressions: d_date_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 1704 Data size: 3256276 Basic stats: COMPLETE Column stats: NONE
-                      Spark HashTable Sink Operator
-                        keys:
-                          0 _col0 (type: int)
-                          1 _col4 (type: int)
+                      Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-            Local Work:
-              Map Reduce Local Work
-
-  Stage: Stage-1
-    Spark
-      Edges:
-        Reducer 3 <- Map 2 (PARTITION-LEVEL SORT, 49), Map 7 (PARTITION-LEVEL SORT, 49)
-        Reducer 4 <- Map 9 (PARTITION-LEVEL SORT, 218), Reducer 3 (PARTITION-LEVEL SORT, 218)
-        Reducer 5 <- Map 10 (PARTITION-LEVEL SORT, 28), Reducer 4 (PARTITION-LEVEL SORT, 28)
-        Reducer 6 <- Reducer 5 (GROUP, 1)
-#### A masked pattern was here ####
-      Vertices:
         Map 10 
             Map Operator Tree:
                 TableScan
@@ -188,17 +201,17 @@ STAGE PLANS:
                     predicate: ((cd_education_status) IN ('4 yr Degree', 'Primary', 'Advanced Degree') and (cd_marital_status) IN ('M', 'D', 'U') and cd_demo_sk is not null) (type: boolean)
                     Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cd_demo_sk (type: int), cd_marital_status (type: string), cd_education_status (type: string)
-                      outputColumnNames: _col0, _col1, _col2
+                      expressions: cd_demo_sk (type: int), (cd_marital_status = 'M') (type: boolean), (cd_education_status = '4 yr Degree') (type: boolean), (cd_marital_status = 'D') (type: boolean), (cd_education_status = 'Primary') (type: boolean), (cd_marital_status = 'U') (type: boolean), (cd_education_status = 'Advanced Degree') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                       Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 1861800 Data size: 717186159 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string), _col2 (type: string)
+                        value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean)
             Execution mode: vectorized
-        Map 2 
+        Map 6 
             Map Operator Tree:
                 TableScan
                   alias: store_sales
@@ -208,46 +221,15 @@ STAGE PLANS:
                     predicate: ((ss_net_profit BETWEEN 100 AND 200 or ss_net_profit BETWEEN 150 AND 300 or ss_net_profit BETWEEN 50 AND 250) and (ss_sales_price BETWEEN 100 AND 150 or ss_sales_price BETWEEN 50 AND 100 or ss_sales_price BETWEEN 150 AND 200) and ss_addr_sk is not null and ss_cdemo_sk is not null and ss_hdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null) (type: boolean)
                     Statistics: Num rows: 63999513 Data size: 5646055611 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_cdemo_sk (type: int), ss_hdemo_sk (type: int), ss_addr_sk (type: int), ss_store_sk (type: int), ss_quantity (type: int), ss_sales_price (type: decimal(7,2)), ss_ext_sales_price (type: decimal(7,2)), ss_ext_wholesale_cost (type: decimal(7,2)), ss_net_profit (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                      expressions: ss_sold_date_sk (type: int), ss_cdemo_sk (type: int), ss_hdemo_sk (type: int), ss_addr_sk (type: int), ss_store_sk (type: int), ss_quantity (type: int), ss_ext_sales_price (type: decimal(7,2)), ss_ext_wholesale_cost (type: decimal(7,2)), ss_net_profit BETWEEN 100 AND 200 (type: boolean), ss_net_profit BETWEEN 150 AND 300 (type: boolean), ss_net_profit BETWEEN 50 AND 250 (type: boolean), ss_sales_price BETWEEN 100 AND 150 (type: boolean), ss_sales_price BETWEEN 50 AND 100 (type: boolean), ss_sales_price BETWEEN 150 AND 200 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
                       Statistics: Num rows: 63999513 Data size: 5646055611 Basic stats: COMPLETE Column stats: NONE
-                      Map Join Operator
-                        condition map:
-                             Inner Join 0 to 1
-                        keys:
-                          0 _col0 (type: int)
-                          1 _col4 (type: int)
-                        outputColumnNames: _col1, _col2, _col3, _col4, _col6, _col7, _col8, _col9, _col10
-                        input vertices:
-                          0 Map 1
-                        Statistics: Num rows: 70399465 Data size: 6210661306 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: _col1 (type: int)
-                          sort order: +
-                          Map-reduce partition columns: _col1 (type: int)
-                          Statistics: Num rows: 70399465 Data size: 6210661306 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col2 (type: int), _col3 (type: int), _col4 (type: int), _col6 (type: int), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2)), _col9 (type: decimal(7,2)), _col10 (type: decimal(7,2))
-            Execution mode: vectorized
-            Local Work:
-              Map Reduce Local Work
-        Map 7 
-            Map Operator Tree:
-                TableScan
-                  alias: date_dim
-                  filterExpr: ((d_year = 2001) and d_date_sk is not null) (type: boolean)
-                  Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
-                  Filter Operator
-                    predicate: ((d_year = 2001) and d_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
-                    Select Operator
-                      expressions: d_date_sk (type: int)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 36524 Data size: 40870356 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 63999513 Data size: 5646055611 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col8 (type: boolean), _col9 (type: boolean), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean), _col13 (type: boolean)
             Execution mode: vectorized
         Map 9 
             Map Operator Tree:
@@ -259,17 +241,17 @@ STAGE PLANS:
                     predicate: ((ca_country = 'United States') and (ca_state) IN ('KY', 'GA', 'NM', 'MT', 'OR', 'IN', 'WI', 'MO', 'WV') and ca_address_sk is not null) (type: boolean)
                     Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ca_address_sk (type: int), ca_state (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: ca_address_sk (type: int), (ca_state) IN ('KY', 'GA', 'NM') (type: boolean), (ca_state) IN ('MT', 'OR', 'IN') (type: boolean), (ca_state) IN ('WI', 'MO', 'WV') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 20000000 Data size: 20297597642 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
+                        value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean)
             Execution mode: vectorized
-        Reducer 3 
+        Reducer 2 
             Local Work:
               Map Reduce Local Work
             Reduce Operator Tree:
@@ -277,27 +259,37 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col4, _col6, _col7, _col8, _col9, _col10
-                Statistics: Num rows: 77439413 Data size: 6831727584 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
+                Statistics: Num rows: 70399465 Data size: 6210661306 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
                        Inner Join 0 to 1
                   keys:
-                    0 _col3 (type: int)
+                    0 _col5 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col2, _col4, _col6, _col7, _col8, _col9, _col10, _col14
+                  outputColumnNames: _col2, _col3, _col4, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14
                   input vertices:
-                    1 Map 8
-                  Statistics: Num rows: 85183356 Data size: 7514900505 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col4 (type: int)
-                    sort order: +
-                    Map-reduce partition columns: _col4 (type: int)
+                    1 Map 7
+                  Statistics: Num rows: 77439413 Data size: 6831727584 Basic stats: COMPLETE Column stats: NONE
+                  Map Join Operator
+                    condition map:
+                         Inner Join 0 to 1
+                    keys:
+                      0 _col3 (type: int)
+                      1 _col0 (type: int)
+                    outputColumnNames: _col2, _col4, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col17, _col18
+                    input vertices:
+                      1 Map 8
                     Statistics: Num rows: 85183356 Data size: 7514900505 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col2 (type: int), _col6 (type: int), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2)), _col9 (type: decimal(7,2)), _col10 (type: decimal(7,2)), _col14 (type: int)
-        Reducer 4 
+                    Reduce Output Operator
+                      key expressions: _col4 (type: int)
+                      sort order: +
+                      Map-reduce partition columns: _col4 (type: int)
+                      Statistics: Num rows: 85183356 Data size: 7514900505 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col2 (type: int), _col6 (type: int), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2)), _col9 (type: boolean), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean), _col13 (type: boolean), _col14 (type: boolean), _col17 (type: boolean), _col18 (type: boolean)
+        Reducer 3 
             Reduce Operator Tree:
               Join Operator
                 condition map:
@@ -305,18 +297,18 @@ STAGE PLANS:
                 keys:
                   0 _col4 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col6, _col7, _col8, _col9, _col10, _col14, _col16
+                outputColumnNames: _col2, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col17, _col18, _col20, _col21, _col22
                 Statistics: Num rows: 93701693 Data size: 8266390734 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (((_col16) IN ('KY', 'GA', 'NM') and _col10 BETWEEN 100 AND 200) or ((_col16) IN ('MT', 'OR', 'IN') and _col10 BETWEEN 150 AND 300) or ((_col16) IN ('WI', 'MO', 'WV') and _col10 BETWEEN 50 AND 250)) (type: boolean)
-                  Statistics: Num rows: 31233897 Data size: 2755463519 Basic stats: COMPLETE Column stats: NONE
+                  predicate: ((_col20 and _col9) or (_col21 and _col10) or (_col22 and _col11)) (type: boolean)
+                  Statistics: Num rows: 70276269 Data size: 6199792984 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col2 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col2 (type: int)
-                    Statistics: Num rows: 31233897 Data size: 2755463519 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col6 (type: int), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2)), _col9 (type: decimal(7,2)), _col14 (type: int)
-        Reducer 5 
+                    Statistics: Num rows: 70276269 Data size: 6199792984 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col6 (type: int), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2)), _col12 (type: boolean), _col13 (type: boolean), _col14 (type: boolean), _col17 (type: boolean), _col18 (type: boolean)
+        Reducer 4 
             Reduce Operator Tree:
               Join Operator
                 condition map:
@@ -324,17 +316,17 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col6, _col7, _col8, _col9, _col14, _col19, _col20
-                Statistics: Num rows: 34357287 Data size: 3031009936 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col6, _col7, _col8, _col12, _col13, _col14, _col17, _col18, _col24, _col25, _col26, _col27, _col28, _col29
+                Statistics: Num rows: 77303897 Data size: 6819772430 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (((_col19 = 'D') and (_col20 = 'Primary') and _col7 BETWEEN 50 AND 100 and (_col14 = 1)) or ((_col19 = 'M') and (_col20 = '4 yr Degree') and _col7 BETWEEN 100 AND 150 and (_col14 = 3)) or ((_col19 = 'U') and (_col20 = 'Advanced Degree') and _col7 BETWEEN 150 AND 200 and (_col14 = 1))) (type: boolean)
-                  Statistics: Num rows: 1431552 Data size: 126291937 Basic stats: COMPLETE Column stats: NONE
+                  predicate: ((_col24 and _col25 and _col12 and _col17) or (_col26 and _col27 and _col13 and _col18) or (_col28 and _col29 and _col14 and _col18)) (type: boolean)
+                  Statistics: Num rows: 14494479 Data size: 1278707181 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col6 (type: int), _col8 (type: decimal(7,2)), _col9 (type: decimal(7,2))
-                    outputColumnNames: _col6, _col8, _col9
-                    Statistics: Num rows: 1431552 Data size: 126291937 Basic stats: COMPLETE Column stats: NONE
+                    expressions: _col6 (type: int), _col7 (type: decimal(7,2)), _col8 (type: decimal(7,2))
+                    outputColumnNames: _col6, _col7, _col8
+                    Statistics: Num rows: 14494479 Data size: 1278707181 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
-                      aggregations: sum(_col6), count(_col6), sum(_col8), count(_col8), sum(_col9), count(_col9)
+                      aggregations: sum(_col6), count(_col6), sum(_col7), count(_col7), sum(_col8), count(_col8)
                       mode: hash
                       outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                       Statistics: Num rows: 1 Data size: 256 Basic stats: COMPLETE Column stats: NONE
@@ -342,7 +334,7 @@ STAGE PLANS:
                         sort order: 
                         Statistics: Num rows: 1 Data size: 256 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: bigint), _col1 (type: bigint), _col2 (type: decimal(17,2)), _col3 (type: bigint), _col4 (type: decimal(17,2)), _col5 (type: bigint)
-        Reducer 6 
+        Reducer 5 
             Execution mode: vectorized
             Reduce Operator Tree:
               Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query15.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query15.q.out b/ql/src/test/results/clientpositive/perf/spark/query15.q.out
index d0017e4..8b45053 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query15.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query15.q.out
@@ -91,15 +91,15 @@ STAGE PLANS:
                     predicate: ca_address_sk is not null (type: boolean)
                     Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ca_address_sk (type: int), ca_state (type: string), ca_zip (type: string)
-                      outputColumnNames: _col0, _col1, _col2
+                      expressions: ca_address_sk (type: int), ca_zip (type: string), (substr(ca_zip, 1, 5)) IN ('85669', '86197', '88274', '83405', '86475', '85392', '85460', '80348', '81792') (type: boolean), (ca_state) IN ('CA', 'WA', 'GA') (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 40000000 Data size: 40595195284 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string), _col2 (type: string)
+                        value expressions: _col1 (type: string), _col2 (type: boolean), _col3 (type: boolean)
             Execution mode: vectorized
         Map 7 
             Map Operator Tree:
@@ -111,15 +111,15 @@ STAGE PLANS:
                     predicate: (cs_bill_customer_sk is not null and cs_sold_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: cs_sold_date_sk (type: int), cs_bill_customer_sk (type: int), cs_sales_price (type: decimal(7,2))
-                      outputColumnNames: _col0, _col1, _col2
+                      expressions: cs_sold_date_sk (type: int), cs_bill_customer_sk (type: int), cs_sales_price (type: decimal(7,2)), (cs_sales_price > 500) (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3
                       Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 287989836 Data size: 38999608952 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2))
+                        value expressions: _col1 (type: int), _col2 (type: decimal(7,2)), _col3 (type: boolean)
             Execution mode: vectorized
         Map 9 
             Map Operator Tree:
@@ -148,14 +148,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col3, _col4
+                outputColumnNames: _col0, _col3, _col4, _col5
                 Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 88000001 Data size: 75681779077 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: string), _col4 (type: string)
+                  value expressions: _col3 (type: string), _col4 (type: boolean), _col5 (type: boolean)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -164,18 +164,18 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col3, _col4, _col7
+                outputColumnNames: _col3, _col4, _col5, _col8, _col9
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: ((_col3) IN ('CA', 'WA', 'GA') or (_col7 > 500) or (substr(_col4, 1, 5)) IN ('85669', '86197', '88274', '83405', '86475', '85392', '85460', '80348', '81792')) (type: boolean)
+                  predicate: (_col4 or _col5 or _col9) (type: boolean)
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col4 (type: string), _col7 (type: decimal(7,2))
-                    outputColumnNames: _col4, _col7
+                    expressions: _col3 (type: string), _col8 (type: decimal(7,2))
+                    outputColumnNames: _col3, _col8
                     Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
-                      aggregations: sum(_col7)
-                      keys: _col4 (type: string)
+                      aggregations: sum(_col8)
+                      keys: _col3 (type: string)
                       mode: hash
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
@@ -226,14 +226,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2
+                outputColumnNames: _col1, _col2, _col3
                 Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col2 (type: decimal(7,2))
+                  value expressions: _col2 (type: decimal(7,2)), _col3 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query17.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query17.q.out b/ql/src/test/results/clientpositive/perf/spark/query17.q.out
index ba78752..7505449 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query17.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query17.q.out
@@ -305,14 +305,14 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int), _col1 (type: int)
                   1 _col1 (type: int), _col2 (type: int)
-                outputColumnNames: _col3, _col7, _col8, _col9, _col10
+                outputColumnNames: _col3, _col6, _col7, _col8, _col9
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col7 (type: int), _col8 (type: int), _col9 (type: int)
+                  key expressions: _col6 (type: int), _col7 (type: int), _col8 (type: int)
                   sort order: +++
-                  Map-reduce partition columns: _col7 (type: int), _col8 (type: int), _col9 (type: int)
+                  Map-reduce partition columns: _col6 (type: int), _col7 (type: int), _col8 (type: int)
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col10 (type: int)
+                  value expressions: _col3 (type: int), _col9 (type: int)
         Reducer 14 
             Reduce Operator Tree:
               Join Operator
@@ -353,14 +353,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col9, _col10
+                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col8, _col9
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col2 (type: int), _col4 (type: int)
                   sort order: +++
                   Map-reduce partition columns: _col1 (type: int), _col2 (type: int), _col4 (type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col5 (type: int), _col9 (type: string), _col10 (type: string)
+                  value expressions: _col3 (type: int), _col5 (type: int), _col8 (type: string), _col9 (type: string)
         Reducer 4 
             Local Work:
               Map Reduce Local Work
@@ -370,8 +370,8 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col1 (type: int), _col2 (type: int), _col4 (type: int)
-                  1 _col7 (type: int), _col8 (type: int), _col9 (type: int)
-                outputColumnNames: _col3, _col5, _col9, _col10, _col14, _col21
+                  1 _col6 (type: int), _col7 (type: int), _col8 (type: int)
+                outputColumnNames: _col3, _col5, _col8, _col9, _col13, _col19
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -379,12 +379,12 @@ STAGE PLANS:
                   keys:
                     0 _col3 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col5, _col9, _col10, _col14, _col21, _col25
+                  outputColumnNames: _col5, _col8, _col9, _col13, _col19, _col22
                   input vertices:
                     1 Map 16
                   Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col9 (type: string), _col10 (type: string), _col25 (type: string), _col5 (type: int), _col21 (type: int), _col14 (type: int), UDFToDouble(_col5) (type: double), (UDFToDouble(_col5) * UDFToDouble(_col5)) (type: double), UDFToDouble(_col21) (type: double), (UDFToDouble(_col21) * UDFToDouble(_col21)) (type: double), UDFToDouble(_col14) (type: double), (UDFToDouble(_col14) * UDFToDouble(_col14)) (type: double)
+                    expressions: _col8 (type: string), _col9 (type: string), _col22 (type: string), _col5 (type: int), _col19 (type: int), _col13 (type: int), UDFToDouble(_col5) (type: double), (UDFToDouble(_col5) * UDFToDouble(_col5)) (type: double), UDFToDouble(_col19) (type: double), (UDFToDouble(_col19) * UDFToDouble(_col19)) (type: double), UDFToDouble(_col13) (type: double), (UDFToDouble(_col13) * UDFToDouble(_col13)) (type: double)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
                     Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator


[44/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/correlationoptimizer4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/correlationoptimizer4.q.out b/ql/src/test/results/clientpositive/llap/correlationoptimizer4.q.out
index 87c5f48..4a77044 100644
--- a/ql/src/test/results/clientpositive/llap/correlationoptimizer4.q.out
+++ b/ql/src/test/results/clientpositive/llap/correlationoptimizer4.q.out
@@ -1357,15 +1357,16 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 6 (ONE_TO_ONE_EDGE)
         Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
         Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 6 <- Map 5 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: x
+                  alias: z
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: key (type: int)
@@ -1412,10 +1413,10 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 6 
+        Map 7 
             Map Operator Tree:
                 TableScan
-                  alias: z
+                  alias: x
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: key (type: int)
@@ -1442,25 +1443,23 @@ STAGE PLANS:
             Reduce Operator Tree:
               Merge Join Operator
                 condition map:
-                     Right Outer Join 0 to 1
-                     Right Outer Join 1 to 2
+                     Left Outer Join 0 to 1
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                  2 _col0 (type: int)
-                outputColumnNames: _col2
-                Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
-                  keys: _col2 (type: int)
+                  keys: _col0 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: bigint)
             MergeJoin Vectorization:
                 enabled: false
@@ -1514,6 +1513,25 @@ STAGE PLANS:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                       serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+        Reducer 6 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Left Outer Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+            MergeJoin Vectorization:
+                enabled: false
+                enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
 
   Stage: Stage-0
     Fetch Operator
@@ -1573,15 +1591,16 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 6 (ONE_TO_ONE_EDGE)
         Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
         Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 6 <- Map 5 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: x
+                  alias: z
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: key (type: int)
@@ -1628,10 +1647,10 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 6 
+        Map 7 
             Map Operator Tree:
                 TableScan
-                  alias: z
+                  alias: x
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: key (type: int)
@@ -1658,25 +1677,23 @@ STAGE PLANS:
             Reduce Operator Tree:
               Merge Join Operator
                 condition map:
-                     Right Outer Join 0 to 1
-                     Right Outer Join 1 to 2
+                     Left Outer Join 0 to 1
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                  2 _col0 (type: int)
-                outputColumnNames: _col2
-                Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
-                  keys: _col2 (type: int)
+                  keys: _col0 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: bigint)
             MergeJoin Vectorization:
                 enabled: false
@@ -1730,6 +1747,25 @@ STAGE PLANS:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                       serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+        Reducer 6 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Left Outer Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+            MergeJoin Vectorization:
+                enabled: false
+                enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
 
   Stage: Stage-0
     Fetch Operator
@@ -1789,15 +1825,16 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 6 (ONE_TO_ONE_EDGE)
         Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
         Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 6 <- Map 5 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: x
+                  alias: z
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: key (type: int)
@@ -1844,10 +1881,10 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 6 
+        Map 7 
             Map Operator Tree:
                 TableScan
-                  alias: z
+                  alias: x
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: key (type: int)
@@ -1874,25 +1911,23 @@ STAGE PLANS:
             Reduce Operator Tree:
               Merge Join Operator
                 condition map:
-                     Right Outer Join 0 to 1
-                     Right Outer Join 1 to 2
+                     Left Outer Join 0 to 1
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                  2 _col0 (type: int)
                 outputColumnNames: _col1
-                Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
                   keys: _col1 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: bigint)
             MergeJoin Vectorization:
                 enabled: false
@@ -1946,6 +1981,25 @@ STAGE PLANS:
                       input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                       serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+        Reducer 6 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Left Outer Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: int)
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+            MergeJoin Vectorization:
+                enabled: false
+                enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
 
   Stage: Stage-0
     Fetch Operator
@@ -2005,9 +2059,10 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-        Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
+        Reducer 3 <- Map 7 (SIMPLE_EDGE), Reducer 2 (ONE_TO_ONE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+        Reducer 5 <- Reducer 4 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -2035,7 +2090,7 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 5 
+        Map 6 
             Map Operator Tree:
                 TableScan
                   alias: y
@@ -2060,7 +2115,7 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 6 
+        Map 7 
             Map Operator Tree:
                 TableScan
                   alias: z
@@ -2091,29 +2146,50 @@ STAGE PLANS:
               Merge Join Operator
                 condition map:
                      Full Outer Join 0 to 1
-                     Full Outer Join 1 to 2
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                  2 _col0 (type: int)
                 outputColumnNames: _col1
-                Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col1 (type: int)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+            MergeJoin Vectorization:
+                enabled: false
+                enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Full Outer Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
-                  keys: _col1 (type: int)
+                  keys: _col0 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: bigint)
             MergeJoin Vectorization:
                 enabled: false
                 enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
-        Reducer 3 
+        Reducer 4 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true
@@ -2141,7 +2217,7 @@ STAGE PLANS:
                       sort order: 
                       Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col0 (type: bigint), _col1 (type: bigint)
-        Reducer 4 
+        Reducer 5 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true
@@ -2221,9 +2297,10 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-        Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
+        Reducer 3 <- Map 7 (SIMPLE_EDGE), Reducer 2 (ONE_TO_ONE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+        Reducer 5 <- Reducer 4 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -2251,7 +2328,7 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 5 
+        Map 6 
             Map Operator Tree:
                 TableScan
                   alias: y
@@ -2276,7 +2353,7 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 6 
+        Map 7 
             Map Operator Tree:
                 TableScan
                   alias: z
@@ -2307,29 +2384,50 @@ STAGE PLANS:
               Merge Join Operator
                 condition map:
                      Full Outer Join 0 to 1
-                     Full Outer Join 1 to 2
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                  2 _col0 (type: int)
                 outputColumnNames: _col1
-                Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col1 (type: int)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+            MergeJoin Vectorization:
+                enabled: false
+                enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Full Outer Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
-                  keys: _col1 (type: int)
+                  keys: _col0 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: bigint)
             MergeJoin Vectorization:
                 enabled: false
                 enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
-        Reducer 3 
+        Reducer 4 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true
@@ -2357,7 +2455,7 @@ STAGE PLANS:
                       sort order: 
                       Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col0 (type: bigint), _col1 (type: bigint)
-        Reducer 4 
+        Reducer 5 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true
@@ -2437,9 +2535,10 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-        Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
+        Reducer 3 <- Map 7 (SIMPLE_EDGE), Reducer 2 (ONE_TO_ONE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+        Reducer 5 <- Reducer 4 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -2467,7 +2566,7 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 5 
+        Map 6 
             Map Operator Tree:
                 TableScan
                   alias: y
@@ -2492,7 +2591,7 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 6 
+        Map 7 
             Map Operator Tree:
                 TableScan
                   alias: z
@@ -2523,29 +2622,50 @@ STAGE PLANS:
               Merge Join Operator
                 condition map:
                      Full Outer Join 0 to 1
-                     Full Outer Join 1 to 2
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                  2 _col0 (type: int)
                 outputColumnNames: _col1
-                Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col1 (type: int)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+            MergeJoin Vectorization:
+                enabled: false
+                enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Full Outer Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
-                  keys: _col1 (type: int)
+                  keys: _col0 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: bigint)
             MergeJoin Vectorization:
                 enabled: false
                 enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
-        Reducer 3 
+        Reducer 4 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true
@@ -2573,7 +2693,7 @@ STAGE PLANS:
                       sort order: 
                       Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col0 (type: bigint), _col1 (type: bigint)
-        Reducer 4 
+        Reducer 5 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true
@@ -2653,9 +2773,10 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-        Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
+        Reducer 3 <- Map 7 (SIMPLE_EDGE), Reducer 2 (ONE_TO_ONE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+        Reducer 5 <- Reducer 4 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -2683,7 +2804,7 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 5 
+        Map 6 
             Map Operator Tree:
                 TableScan
                   alias: y
@@ -2708,7 +2829,7 @@ STAGE PLANS:
                 allNative: true
                 usesVectorUDFAdaptor: false
                 vectorized: true
-        Map 6 
+        Map 7 
             Map Operator Tree:
                 TableScan
                   alias: z
@@ -2739,29 +2860,50 @@ STAGE PLANS:
               Merge Join Operator
                 condition map:
                      Full Outer Join 0 to 1
-                     Full Outer Join 1 to 2
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                  2 _col0 (type: int)
                 outputColumnNames: _col1
-                Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col1 (type: int)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
+            MergeJoin Vectorization:
+                enabled: false
+                enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Full Outer Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: count()
-                  keys: _col1 (type: int)
+                  keys: _col0 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: int)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
-                    Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: bigint)
             MergeJoin Vectorization:
                 enabled: false
                 enableConditionsNotMet: Vectorizing MergeJoin Supported IS false
-        Reducer 3 
+        Reducer 4 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true
@@ -2789,7 +2931,7 @@ STAGE PLANS:
                       sort order: 
                       Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col0 (type: bigint), _col1 (type: bigint)
-        Reducer 4 
+        Reducer 5 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/cross_prod_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/cross_prod_1.q.out b/ql/src/test/results/clientpositive/llap/cross_prod_1.q.out
index 1650f7b..ac1f4ea 100644
--- a/ql/src/test/results/clientpositive/llap/cross_prod_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/cross_prod_1.q.out
@@ -1826,13 +1826,13 @@ STAGE PLANS:
                   alias: a
                   Statistics: Num rows: 10 Data size: 3680 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: string), value (type: string)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: string), value (type: string), value BETWEEN 'val_103' AND 'val_105' (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2
                     Statistics: Num rows: 10 Data size: 3680 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       sort order: 
                       Statistics: Num rows: 10 Data size: 3680 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: string), _col1 (type: string)
+                      value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 3 
@@ -1859,16 +1859,20 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
-                residual filter predicates: {((_col0 = _col2) or _col1 BETWEEN 'val_103' AND 'val_105')}
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                residual filter predicates: {((_col0 = _col3) or _col2)}
                 Statistics: Num rows: 100 Data size: 73700 Basic stats: COMPLETE Column stats: NONE
-                File Output Operator
-                  compressed: false
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+                  outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 100 Data size: 73700 Basic stats: COMPLETE Column stats: NONE
-                  table:
-                      input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                      output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 100 Data size: 73700 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/cte_mat_5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/cte_mat_5.q.out b/ql/src/test/results/clientpositive/llap/cte_mat_5.q.out
index b85991d3..7acc8ee 100644
--- a/ql/src/test/results/clientpositive/llap/cte_mat_5.q.out
+++ b/ql/src/test/results/clientpositive/llap/cte_mat_5.q.out
@@ -70,20 +70,20 @@ Stage-3
     Stage-4
       Reducer 3 llap
       File Output Operator [FS_18]
-        Merge Join Operator [MERGEJOIN_33] (rows=1 width=4)
-          Conds:RS_36.UDFToDouble(_col0)=RS_39.UDFToDouble(_col0)(Inner),Output:["_col0"]
+        Merge Join Operator [MERGEJOIN_33] (rows=1 width=13)
+          Conds:RS_36._col1=RS_39._col0(Inner),Output:["_col0"]
         <-Map 2 [SIMPLE_EDGE] vectorized, llap
           SHUFFLE [RS_36]
-            PartitionCols:UDFToDouble(_col0)
-            Select Operator [SEL_35] (rows=1 width=4)
-              Output:["_col0"]
+            PartitionCols:_col1
+            Select Operator [SEL_35] (rows=1 width=12)
+              Output:["_col0","_col1"]
               Filter Operator [FIL_34] (rows=1 width=4)
                 predicate:colnum is not null
                 TableScan [TS_8] (rows=1 width=4)
                   mydb@q1,a,Tbl:COMPLETE,Col:COMPLETE,Output:["colnum"]
         <-Map 4 [SIMPLE_EDGE] vectorized, llap
           SHUFFLE [RS_39]
-            PartitionCols:UDFToDouble(_col0)
+            PartitionCols:_col0
             Select Operator [SEL_38] (rows=1 width=184)
               Output:["_col0"]
               Filter Operator [FIL_37] (rows=1 width=184)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/deleteAnalyze.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/deleteAnalyze.q.out b/ql/src/test/results/clientpositive/llap/deleteAnalyze.q.out
index 7abcaa0..9fef44a 100644
--- a/ql/src/test/results/clientpositive/llap/deleteAnalyze.q.out
+++ b/ql/src/test/results/clientpositive/llap/deleteAnalyze.q.out
@@ -176,7 +176,7 @@ Stage-0
         Select Operator [SEL_9] (rows=1 width=228)
           Output:["_col0","_col1","_col2"]
           Merge Join Operator [MERGEJOIN_25] (rows=1 width=228)
-            Conds:RS_28._col1=RS_31._col3(Inner),Output:["_col0","_col3","_col4"]
+            Conds:RS_28._col1=RS_31._col0(Inner),Output:["_col0","_col3","_col4"]
           <-Map 1 [SIMPLE_EDGE] vectorized, llap
             SHUFFLE [RS_28]
               PartitionCols:_col1
@@ -188,9 +188,9 @@ Stage-0
                     default@testdeci2_n0,s,Tbl:COMPLETE,Col:COMPLETE,Output:["id","item"]
           <-Map 3 [SIMPLE_EDGE] vectorized, llap
             SHUFFLE [RS_31]
-              PartitionCols:_col3
-              Select Operator [SEL_30] (rows=1 width=312)
-                Output:["_col1","_col2","_col3"]
+              PartitionCols:_col0
+              Select Operator [SEL_30] (rows=1 width=308)
+                Output:["_col0","_col1","_col2"]
                 Filter Operator [FIL_29] (rows=1 width=312)
                   predicate:((id = 2) and item is not null)
                   TableScan [TS_3] (rows=1 width=312)


[02/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucket_map_join_tez1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucket_map_join_tez1.q.out b/ql/src/test/results/clientpositive/spark/bucket_map_join_tez1.q.out
index 3165970..2fc9a3d 100644
--- a/ql/src/test/results/clientpositive/spark/bucket_map_join_tez1.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucket_map_join_tez1.q.out
@@ -2662,7 +2662,7 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
+                      expressions: key (type: int), substr(value, 5) (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -2703,22 +2703,18 @@ STAGE PLANS:
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col1 (type: int), substr(_col2, 5) (type: string)
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col1 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: double)
+                    value expressions: _col1 (type: double)
         Reducer 5 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -2827,7 +2823,7 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
+                      expressions: key (type: int), substr(value, 5) (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -2868,22 +2864,18 @@ STAGE PLANS:
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col1 (type: int), substr(_col2, 5) (type: string)
+                Group By Operator
+                  aggregations: sum(_col2)
+                  keys: _col1 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: double)
+                    value expressions: _col1 (type: double)
         Reducer 5 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -2973,7 +2965,7 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
+                      expressions: key (type: int), substr(value, 5) (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -3033,22 +3025,18 @@ STAGE PLANS:
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 266 Data size: 2822 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col0 (type: int), substr(_col1, 5) (type: string)
+                Group By Operator
+                  aggregations: sum(_col1)
+                  keys: _col0 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 266 Data size: 2822 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 266 Data size: 2822 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 266 Data size: 2822 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: double)
+                    value expressions: _col1 (type: double)
         Reducer 5 
             Execution mode: vectorized
             Reduce Operator Tree:
@@ -3138,7 +3126,7 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
+                      expressions: key (type: int), substr(value, 5) (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
@@ -3198,22 +3186,18 @@ STAGE PLANS:
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 266 Data size: 2822 Basic stats: COMPLETE Column stats: NONE
-                Select Operator
-                  expressions: _col0 (type: int), substr(_col1, 5) (type: string)
+                Group By Operator
+                  aggregations: sum(_col1)
+                  keys: _col0 (type: int)
+                  mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 266 Data size: 2822 Basic stats: COMPLETE Column stats: NONE
-                  Group By Operator
-                    aggregations: sum(_col1)
-                    keys: _col0 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 266 Data size: 2822 Basic stats: COMPLETE Column stats: NONE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int)
-                      sort order: +
-                      Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 266 Data size: 2822 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: double)
+                    value expressions: _col1 (type: double)
         Reducer 5 
             Execution mode: vectorized
             Reduce Operator Tree:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucket_map_join_tez2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucket_map_join_tez2.q.out b/ql/src/test/results/clientpositive/spark/bucket_map_join_tez2.q.out
index 2e2e5f8..aecb230 100644
--- a/ql/src/test/results/clientpositive/spark/bucket_map_join_tez2.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucket_map_join_tez2.q.out
@@ -480,13 +480,13 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 UDFToDouble(_col0) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 _col2 (type: double)
+                          1 _col1 (type: double)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -505,15 +505,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 UDFToDouble(_col0) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 _col2 (type: double)
+                          1 _col1 (type: double)
                         outputColumnNames: _col0, _col1, _col3
                         input vertices:
                           0 Map 1
@@ -573,13 +573,13 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
-                          0 UDFToDouble(_col0) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 _col2 (type: double)
+                          1 _col1 (type: double)
             Execution mode: vectorized
             Local Work:
               Map Reduce Local Work
@@ -598,15 +598,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 UDFToDouble(_col0) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 _col2 (type: double)
+                          1 _col1 (type: double)
                         outputColumnNames: _col0, _col1, _col3
                         input vertices:
                           0 Map 1
@@ -1408,10 +1408,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 121 Data size: 1283 Basic stats: COMPLETE Column stats: NONE
-                Spark HashTable Sink Operator
-                  keys:
-                    0 UDFToDouble(_col0) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
+                Select Operator
+                  expressions: _col0 (type: string), UDFToDouble(_col0) (type: double)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 121 Data size: 1283 Basic stats: COMPLETE Column stats: NONE
+                  Spark HashTable Sink Operator
+                    keys:
+                      0 _col1 (type: double)
+                      1 _col1 (type: double)
 
   Stage: Stage-1
     Spark
@@ -1427,15 +1431,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 UDFToDouble(_col0) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 _col1 (type: double)
+                          1 _col1 (type: double)
                         outputColumnNames: _col0, _col2
                         input vertices:
                           0 Reducer 2
@@ -1513,10 +1517,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 121 Data size: 1283 Basic stats: COMPLETE Column stats: NONE
-                Spark HashTable Sink Operator
-                  keys:
-                    0 UDFToDouble(_col0) (type: double)
-                    1 UDFToDouble(_col0) (type: double)
+                Select Operator
+                  expressions: _col0 (type: string), UDFToDouble(_col0) (type: double)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 121 Data size: 1283 Basic stats: COMPLETE Column stats: NONE
+                  Spark HashTable Sink Operator
+                    keys:
+                      0 _col1 (type: double)
+                      1 _col1 (type: double)
 
   Stage: Stage-1
     Spark
@@ -1532,15 +1540,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 242 Data size: 2566 Basic stats: COMPLETE Column stats: NONE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 UDFToDouble(_col0) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 _col1 (type: double)
+                          1 _col1 (type: double)
                         outputColumnNames: _col0, _col2
                         input vertices:
                           0 Reducer 2
@@ -2386,7 +2394,7 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
                       expressions: bucket_col (type: string), join_col (type: string), accounting_period (type: string)
-                      outputColumnNames: _col0, _col1, _col3
+                      outputColumnNames: _col0, _col1, _col2
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
@@ -2422,13 +2430,13 @@ STAGE PLANS:
                         keys:
                           0 _col1 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col3, _col4
+                        outputColumnNames: _col0, _col2, _col3
                         input vertices:
                           0 Map 1
                         Position of Big Table: 1
                         Statistics: Num rows: 4 Data size: 761 Basic stats: PARTIAL Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: string), _col4 (type: string), _col3 (type: string)
+                          expressions: _col0 (type: string), _col3 (type: string), _col2 (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 4 Data size: 761 Basic stats: PARTIAL Column stats: NONE
                           File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucketmapjoin1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucketmapjoin1.q.out b/ql/src/test/results/clientpositive/spark/bucketmapjoin1.q.out
index b1f4d51..e3160d8 100644
--- a/ql/src/test/results/clientpositive/spark/bucketmapjoin1.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucketmapjoin1.q.out
@@ -42,7 +42,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n1`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n1`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -146,7 +146,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n1`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n1`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -344,7 +344,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_n1`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n1`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -722,7 +722,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_n1`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n1`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucketmapjoin2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucketmapjoin2.q.out b/ql/src/test/results/clientpositive/spark/bucketmapjoin2.q.out
index ff292dd..5d154a1 100644
--- a/ql/src/test/results/clientpositive/spark/bucketmapjoin2.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucketmapjoin2.q.out
@@ -114,7 +114,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n6`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n5`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -499,7 +499,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n6`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n5`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucketmapjoin3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucketmapjoin3.q.out b/ql/src/test/results/clientpositive/spark/bucketmapjoin3.q.out
index 899cfef..272c4c1 100644
--- a/ql/src/test/results/clientpositive/spark/bucketmapjoin3.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucketmapjoin3.q.out
@@ -135,10 +135,10 @@ POSTHOOK: Input: default@srcbucket_mapjoin_part_n13
 POSTHOOK: Input: default@srcbucket_mapjoin_part_n13@ds=2008-04-08
 POSTHOOK: Output: default@bucketmapjoin_tmp_result_n6
 OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n11`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n13`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -318,10 +318,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col4
+                outputColumnNames: _col0, _col1, _col3
                 Statistics: Num rows: 163 Data size: 63932 Basic stats: PARTIAL Column stats: NONE
                 Select Operator
-                  expressions: CAST( _col0 AS STRING) (type: string), _col1 (type: string), _col4 (type: string)
+                  expressions: CAST( _col0 AS STRING) (type: string), _col1 (type: string), _col3 (type: string)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 163 Data size: 63932 Basic stats: PARTIAL Column stats: NONE
                   File Output Operator
@@ -520,10 +520,10 @@ POSTHOOK: Input: default@srcbucket_mapjoin_part_n13
 POSTHOOK: Input: default@srcbucket_mapjoin_part_n13@ds=2008-04-08
 POSTHOOK: Output: default@bucketmapjoin_tmp_result_n6
 OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n11`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n13`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -703,10 +703,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col4
+                outputColumnNames: _col0, _col1, _col3
                 Statistics: Num rows: 163 Data size: 63932 Basic stats: PARTIAL Column stats: NONE
                 Select Operator
-                  expressions: CAST( _col0 AS STRING) (type: string), _col1 (type: string), _col4 (type: string)
+                  expressions: CAST( _col0 AS STRING) (type: string), _col1 (type: string), _col3 (type: string)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 163 Data size: 63932 Basic stats: PARTIAL Column stats: NONE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_2.q.out b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_2.q.out
index 59909dd..85983c2 100644
--- a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_2.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_2.q.out
@@ -129,10 +129,10 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col4
+                        outputColumnNames: _col0, _col1, _col3
                         Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -291,10 +291,10 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col4
+                        outputColumnNames: _col0, _col1, _col3
                         Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -477,10 +477,10 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col4
+                        outputColumnNames: _col0, _col1, _col3
                         Statistics: Num rows: 184 Data size: 1619 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 184 Data size: 1619 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_4.q.out b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_4.q.out
index 3258185..dafaa01 100644
--- a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_4.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_4.q.out
@@ -130,12 +130,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col4
+                        outputColumnNames: _col0, _col1, _col3
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col1, _col2
                           Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_6.q.out b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_6.q.out
index 8f6a4cb..137b554 100644
--- a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_6.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_6.q.out
@@ -132,12 +132,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -328,12 +328,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -524,12 +524,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -655,12 +655,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -792,12 +792,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -1006,12 +1006,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -1230,12 +1230,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 92 Data size: 1076 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_7.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_7.q.out b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_7.q.out
index f2f7673..fb4f192 100644
--- a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_7.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_7.q.out
@@ -107,10 +107,10 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col4
+                        outputColumnNames: _col0, _col1, _col3
                         Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_8.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_8.q.out b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_8.q.out
index 5dfb6f6..3e2bee3 100644
--- a/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_8.q.out
+++ b/ql/src/test/results/clientpositive/spark/bucketsortoptimize_insert_8.q.out
@@ -130,12 +130,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col3, _col4
+                        outputColumnNames: _col0, _col1, _col2, _col3
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: int), _col3 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), _col2 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator
@@ -320,12 +320,12 @@ STAGE PLANS:
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col3, _col4
+                        outputColumnNames: _col0, _col1, _col2, _col3
                         input vertices:
                           0 Map 1
                         Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col3 (type: int), _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col2 (type: int), _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 92 Data size: 809 Basic stats: COMPLETE Column stats: NONE
                           Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out b/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out
index 2fa9dff..f0d201c 100644
--- a/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out
+++ b/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out
@@ -48,12 +48,12 @@ STAGE PLANS:
                     Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: value (type: string)
-                      outputColumnNames: _col1
+                      outputColumnNames: _col0
                       Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         sort order: 
                         Statistics: Num rows: 500 Data size: 5301 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
+                        value expressions: _col0 (type: string)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -63,10 +63,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col2
+                outputColumnNames: _col1
                 Statistics: Num rows: 250000 Data size: 5551000 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: 100 (type: int), 101 (type: int), _col2 (type: string)
+                  expressions: 100 (type: int), 101 (type: int), _col1 (type: string)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 250000 Data size: 5551000 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/constprog_semijoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/constprog_semijoin.q.out b/ql/src/test/results/clientpositive/spark/constprog_semijoin.q.out
index 050fae9..6b4fa1e 100644
--- a/ql/src/test/results/clientpositive/spark/constprog_semijoin.q.out
+++ b/ql/src/test/results/clientpositive/spark/constprog_semijoin.q.out
@@ -417,10 +417,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col4
+                outputColumnNames: _col0, _col2
                 Statistics: Num rows: 5 Data size: 121 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), 't1val01' (type: string), _col4 (type: string)
+                  expressions: _col0 (type: int), 't1val01' (type: string), _col2 (type: string)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 5 Data size: 121 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/dynamic_rdd_cache.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/dynamic_rdd_cache.q.out b/ql/src/test/results/clientpositive/spark/dynamic_rdd_cache.q.out
index c515988..2088ccd 100644
--- a/ql/src/test/results/clientpositive/spark/dynamic_rdd_cache.q.out
+++ b/ql/src/test/results/clientpositive/spark/dynamic_rdd_cache.q.out
@@ -763,21 +763,22 @@ STAGE PLANS:
         Map 10 
             Map Operator Tree:
                 TableScan
-                  alias: date_dim
-                  filterExpr: ((d_year = 1999) and (d_moy = 3) and d_date_sk is not null) (type: boolean)
+                  alias: warehouse
+                  filterExpr: w_warehouse_sk is not null (type: boolean)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                   Filter Operator
-                    predicate: ((d_moy = 3) and (d_year = 1999) and d_date_sk is not null) (type: boolean)
+                    predicate: w_warehouse_sk is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int)
-                      outputColumnNames: _col0
+                      expressions: w_warehouse_sk (type: int), w_warehouse_name (type: string)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                        value expressions: _col1 (type: string)
             Execution mode: vectorized
         Map 11 
             Map Operator Tree:
@@ -821,41 +822,41 @@ STAGE PLANS:
         Map 17 
             Map Operator Tree:
                 TableScan
-                  alias: warehouse
-                  filterExpr: w_warehouse_sk is not null (type: boolean)
+                  alias: date_dim
+                  filterExpr: ((d_year = 1999) and (d_moy = 4) and d_date_sk is not null) (type: boolean)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                   Filter Operator
-                    predicate: w_warehouse_sk is not null (type: boolean)
+                    predicate: ((d_moy = 4) and (d_year = 1999) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
-                      expressions: w_warehouse_sk (type: int), w_warehouse_name (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                        value expressions: _col1 (type: string)
             Execution mode: vectorized
         Map 18 
             Map Operator Tree:
                 TableScan
-                  alias: date_dim
-                  filterExpr: ((d_year = 1999) and (d_moy = 4) and d_date_sk is not null) (type: boolean)
+                  alias: warehouse
+                  filterExpr: w_warehouse_sk is not null (type: boolean)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                   Filter Operator
-                    predicate: ((d_moy = 4) and (d_year = 1999) and d_date_sk is not null) (type: boolean)
+                    predicate: w_warehouse_sk is not null (type: boolean)
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
-                      expressions: d_date_sk (type: int)
-                      outputColumnNames: _col0
+                      expressions: w_warehouse_sk (type: int), w_warehouse_name (type: string)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
+                        value expressions: _col1 (type: string)
             Execution mode: vectorized
         Map 8 
             Map Operator Tree:
@@ -879,22 +880,21 @@ STAGE PLANS:
         Map 9 
             Map Operator Tree:
                 TableScan
-                  alias: warehouse
-                  filterExpr: w_warehouse_sk is not null (type: boolean)
+                  alias: date_dim
+                  filterExpr: ((d_year = 1999) and (d_moy = 3) and d_date_sk is not null) (type: boolean)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                   Filter Operator
-                    predicate: w_warehouse_sk is not null (type: boolean)
+                    predicate: ((d_moy = 3) and (d_year = 1999) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                     Select Operator
-                      expressions: w_warehouse_sk (type: int), w_warehouse_name (type: string)
-                      outputColumnNames: _col0, _col1
+                      expressions: d_date_sk (type: int)
+                      outputColumnNames: _col0
                       Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
                         Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                        value expressions: _col1 (type: string)
             Execution mode: vectorized
         Reducer 12 
             Reduce Operator Tree:
@@ -907,39 +907,39 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col2, _col3, _col4
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col3 (type: int)
+                  key expressions: _col0 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col3 (type: int)
+                  Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col0 (type: int), _col2 (type: int), _col4 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: int), _col4 (type: int)
         Reducer 13 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col3 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col2, _col4, _col5, _col6
+                outputColumnNames: _col2, _col3, _col4
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col0 (type: int)
+                  key expressions: _col3 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
+                  Map-reduce partition columns: _col3 (type: int)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col2 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  value expressions: _col2 (type: int), _col4 (type: int)
         Reducer 14 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
+                  0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col4, _col5, _col6
+                outputColumnNames: _col2, _col4, _col6, _col7
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Select Operator
-                  expressions: _col6 (type: string), _col5 (type: int), _col4 (type: int), _col2 (type: int), UDFToDouble(_col2) (type: double), (UDFToDouble(_col2) * UDFToDouble(_col2)) (type: double)
+                  expressions: _col7 (type: string), _col6 (type: int), _col4 (type: int), _col2 (type: int), UDFToDouble(_col2) (type: double), (UDFToDouble(_col2) * UDFToDouble(_col2)) (type: double)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                   Group By Operator
@@ -991,39 +991,39 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col2, _col3, _col4
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col3 (type: int)
+                  key expressions: _col0 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col3 (type: int)
+                  Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col0 (type: int), _col2 (type: int), _col4 (type: int)
+                  value expressions: _col2 (type: int), _col3 (type: int), _col4 (type: int)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col3 (type: int)
+                  0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col2, _col4, _col5, _col6
+                outputColumnNames: _col2, _col3, _col4
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col0 (type: int)
+                  key expressions: _col3 (type: int)
                   sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
+                  Map-reduce partition columns: _col3 (type: int)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col2 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: string)
+                  value expressions: _col2 (type: int), _col4 (type: int)
         Reducer 4 
             Reduce Operator Tree:
               Join Operator
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col0 (type: int)
+                  0 _col3 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col4, _col5, _col6
+                outputColumnNames: _col2, _col4, _col6, _col7
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Select Operator
-                  expressions: _col6 (type: string), _col5 (type: int), _col4 (type: int), _col2 (type: int), UDFToDouble(_col2) (type: double), (UDFToDouble(_col2) * UDFToDouble(_col2)) (type: double)
+                  expressions: _col7 (type: string), _col6 (type: int), _col4 (type: int), _col2 (type: int), UDFToDouble(_col2) (type: double), (UDFToDouble(_col2) * UDFToDouble(_col2)) (type: double)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/filter_join_breaktask.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/filter_join_breaktask.q.out b/ql/src/test/results/clientpositive/spark/filter_join_breaktask.q.out
index d9dde1a..0ce54c5 100644
--- a/ql/src/test/results/clientpositive/spark/filter_join_breaktask.q.out
+++ b/ql/src/test/results/clientpositive/spark/filter_join_breaktask.q.out
@@ -35,13 +35,13 @@ POSTHOOK: Input: default@filter_join_breaktask
 POSTHOOK: Input: default@filter_join_breaktask@ds=2008-04-08
 #### A masked pattern was here ####
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM (SELECT `value`
 FROM `default`.`filter_join_breaktask`
 WHERE `ds` = '2008-04-08' AND `value` <> '') AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`filter_join_breaktask`
 WHERE `ds` = '2008-04-08' AND `value` <> '' AND `key` IS NOT NULL) AS `t2` ON `t0`.`value` = `t2`.`value`
-INNER JOIN (SELECT `key`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`
 FROM `default`.`filter_join_breaktask`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t4` ON `t2`.`key` = `t4`.`key`
 STAGE DEPENDENCIES:
@@ -297,13 +297,13 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col1 (type: string)
-                outputColumnNames: _col0, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 27 Data size: 232 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: int)
+                  key expressions: _col1 (type: int)
                   null sort order: a
                   sort order: +
-                  Map-reduce partition columns: _col2 (type: int)
+                  Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 27 Data size: 232 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
                   value expressions: _col0 (type: string)
@@ -315,12 +315,12 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col2 (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col5
+                outputColumnNames: _col0, _col3
                 Statistics: Num rows: 29 Data size: 255 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col5 (type: int), _col0 (type: string)
+                  expressions: _col3 (type: int), _col0 (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 29 Data size: 255 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/infer_bucket_sort_map_operators.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/infer_bucket_sort_map_operators.q.out b/ql/src/test/results/clientpositive/spark/infer_bucket_sort_map_operators.q.out
index 99847cd..2f230c4 100644
--- a/ql/src/test/results/clientpositive/spark/infer_bucket_sort_map_operators.q.out
+++ b/ql/src/test/results/clientpositive/spark/infer_bucket_sort_map_operators.q.out
@@ -213,12 +213,16 @@ STAGE PLANS:
                       Filter Operator
                         predicate: _col1 is not null (type: boolean)
                         Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-                        Reduce Output Operator
-                          key expressions: UDFToDouble(_col1) (type: double)
-                          sort order: +
-                          Map-reduce partition columns: UDFToDouble(_col1) (type: double)
+                        Select Operator
+                          expressions: _col0 (type: string), _col1 (type: bigint), UDFToDouble(_col1) (type: double)
+                          outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
-                          value expressions: _col0 (type: string), _col1 (type: bigint)
+                          Reduce Output Operator
+                            key expressions: _col2 (type: double)
+                            sort order: +
+                            Map-reduce partition columns: _col2 (type: double)
+                            Statistics: Num rows: 250 Data size: 2656 Basic stats: COMPLETE Column stats: NONE
+                            value expressions: _col0 (type: string), _col1 (type: bigint)
             Execution mode: vectorized
         Map 3 
             Map Operator Tree:
@@ -230,13 +234,13 @@ STAGE PLANS:
                     predicate: value is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: value (type: string)
+                      expressions: UDFToDouble(value) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
         Reducer 2 
@@ -245,8 +249,8 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col1) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
+                  0 _col2 (type: double)
+                  1 _col0 (type: double)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/join13.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join13.q.out b/ql/src/test/results/clientpositive/spark/join13.q.out
index 0fba2f3..965f1bc 100644
--- a/ql/src/test/results/clientpositive/spark/join13.q.out
+++ b/ql/src/test/results/clientpositive/spark/join13.q.out
@@ -85,13 +85,13 @@ STAGE PLANS:
                     predicate: (UDFToDouble(key) < 200.0D) (type: boolean)
                     Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
+                      expressions: UDFToDouble(key) (type: double)
                       outputColumnNames: _col0
                       Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                        Map-reduce partition columns: _col0 (type: double)
                         Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
         Reducer 2 
@@ -117,7 +117,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 (UDFToDouble(_col2) + UDFToDouble(_col0)) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
+                  1 _col0 (type: double)
                 outputColumnNames: _col1, _col2
                 Statistics: Num rows: 200 Data size: 2132 Basic stats: COMPLETE Column stats: NONE
                 Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/join2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join2.q.out b/ql/src/test/results/clientpositive/spark/join2.q.out
index c0d8ea4..3f64bc9 100644
--- a/ql/src/test/results/clientpositive/spark/join2.q.out
+++ b/ql/src/test/results/clientpositive/spark/join2.q.out
@@ -41,14 +41,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: double)
             Execution mode: vectorized
         Map 4 
             Map Operator Tree:
@@ -60,14 +61,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
+                      expressions: key (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: double)
             Execution mode: vectorized
         Map 5 
             Map Operator Tree:
@@ -79,15 +81,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col1 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                        Map-reduce partition columns: _col1 (type: double)
                         Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col1 (type: string)
+                        value expressions: _col0 (type: string)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
@@ -97,12 +99,12 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1
+                outputColumnNames: _col0, _col1, _col3
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
+                  key expressions: (_col1 + _col3) (type: double)
                   sort order: +
-                  Map-reduce partition columns: (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
+                  Map-reduce partition columns: (_col1 + _col3) (type: double)
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string)
         Reducer 3 
@@ -111,12 +113,12 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 (UDFToDouble(_col0) + UDFToDouble(_col1)) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
-                outputColumnNames: _col0, _col3
+                  0 (_col1 + _col3) (type: double)
+                  1 _col1 (type: double)
+                outputColumnNames: _col0, _col4
                 Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: UDFToInteger(_col0) (type: int), _col3 (type: string)
+                  expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/join26.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join26.q.out b/ql/src/test/results/clientpositive/spark/join26.q.out
index 25ed83d..1133cca 100644
--- a/ql/src/test/results/clientpositive/spark/join26.q.out
+++ b/ql/src/test/results/clientpositive/spark/join26.q.out
@@ -29,7 +29,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j1_n10
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `key` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/join32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join32.q.out b/ql/src/test/results/clientpositive/spark/join32.q.out
index 29cb0c9..a3b155e 100644
--- a/ql/src/test/results/clientpositive/spark/join32.q.out
+++ b/ql/src/test/results/clientpositive/spark/join32.q.out
@@ -29,7 +29,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j1_n12
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/join32_lessSize.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join32_lessSize.q.out b/ql/src/test/results/clientpositive/spark/join32_lessSize.q.out
index 58c9a73..7075137 100644
--- a/ql/src/test/results/clientpositive/spark/join32_lessSize.q.out
+++ b/ql/src/test/results/clientpositive/spark/join32_lessSize.q.out
@@ -37,7 +37,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j1_n21
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`
@@ -1104,7 +1104,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j2_n1
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t4`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`
@@ -1598,7 +1598,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j2_n1
 OPTIMIZED SQL: SELECT `t2`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/join33.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join33.q.out b/ql/src/test/results/clientpositive/spark/join33.q.out
index 6471f5b..59c2f3a 100644
--- a/ql/src/test/results/clientpositive/spark/join33.q.out
+++ b/ql/src/test/results/clientpositive/spark/join33.q.out
@@ -29,7 +29,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Output: default@dest_j1_n7
 OPTIMIZED SQL: SELECT `t4`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `value`, CAST('2008-04-08' AS STRING) AS `ds`, `hr`
+FROM (SELECT `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = 11 AND `value` IS NOT NULL) AS `t0`
 INNER JOIN ((SELECT `key`, `value`

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/join9.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join9.q.out b/ql/src/test/results/clientpositive/spark/join9.q.out
index 7df9cb8..9d3e0cb 100644
--- a/ql/src/test/results/clientpositive/spark/join9.q.out
+++ b/ql/src/test/results/clientpositive/spark/join9.q.out
@@ -23,7 +23,7 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 POSTHOOK: Output: default@dest1_n39
 OPTIMIZED SQL: SELECT `t0`.`key`, `t2`.`value`
-FROM (SELECT `key`, CAST('2008-04-08' AS STRING) AS `ds`, CAST('12' AS STRING) AS `hr`
+FROM (SELECT `key`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `hr` = '12' AND `key` IS NOT NULL) AS `t0`
 INNER JOIN (SELECT `key`, `value`
@@ -206,10 +206,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col4
+                outputColumnNames: _col0, _col2
                 Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: UDFToInteger(_col0) (type: int), _col4 (type: string)
+                  expressions: UDFToInteger(_col0) (type: int), _col2 (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/spark/join_cond_pushdown_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join_cond_pushdown_1.q.out b/ql/src/test/results/clientpositive/spark/join_cond_pushdown_1.q.out
index ca02e89..626a415 100644
--- a/ql/src/test/results/clientpositive/spark/join_cond_pushdown_1.q.out
+++ b/ql/src/test/results/clientpositive/spark/join_cond_pushdown_1.q.out
@@ -388,14 +388,14 @@ STAGE PLANS:
                     Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
                       Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        key expressions: _col1 (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: string)
+                        Map-reduce partition columns: _col0 (type: string)
                         Statistics: Num rows: 13 Data size: 1573 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                        value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: double), _col7 (type: string)
             Execution mode: vectorized
         Map 5 
             Map Operator Tree:
@@ -418,13 +418,13 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col1 (type: string)
-                  1 _col1 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17
+                  1 _col0 (type: string)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16
                 Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string)
+                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string)
         Reducer 3 
             Reduce Operator Tree:
               Join Operator
@@ -433,10 +433,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25
                 Statistics: Num rows: 728 Data size: 178830 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col18 (type: int), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: string), _col23 (type: int), _col24 (type: string), _col25 (type: double), _col26 (type: string), 1 (type: int), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col14 (type: int), _col15 (type: string), _col16 (type: double), _col17 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
+                  expressions: _col17 (type: int), _col18 (type: string), _col19 (type: string), _col20 (type: string), _col21 (type: string), _col22 (type: int), _col23 (type: string), _col24 (type: double), _col25 (type: string), 1 (type: int), _col9 (type: string), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: int), _col14 (type: string), _col15 (type: double), _col16 (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24, _col25, _col26
                   Statistics: Num rows: 728 Data size: 178830 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator


[45/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/bucketmapjoin3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/bucketmapjoin3.q.out b/ql/src/test/results/clientpositive/llap/bucketmapjoin3.q.out
index 68fc903..4ed9b60 100644
--- a/ql/src/test/results/clientpositive/llap/bucketmapjoin3.q.out
+++ b/ql/src/test/results/clientpositive/llap/bucketmapjoin3.q.out
@@ -135,10 +135,10 @@ POSTHOOK: Input: default@srcbucket_mapjoin_part_n13
 POSTHOOK: Input: default@srcbucket_mapjoin_part_n13@ds=2008-04-08
 POSTHOOK: Output: default@bucketmapjoin_tmp_result_n6
 OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n11`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n13`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -326,11 +326,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col4
+                outputColumnNames: _col0, _col1, _col3
                 Position of Big Table: 1
                 Statistics: Num rows: 156 Data size: 89111 Basic stats: PARTIAL Column stats: NONE
                 Select Operator
-                  expressions: CAST( _col0 AS STRING) (type: string), _col1 (type: string), _col4 (type: string)
+                  expressions: CAST( _col0 AS STRING) (type: string), _col1 (type: string), _col3 (type: string)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 156 Data size: 89111 Basic stats: PARTIAL Column stats: NONE
                   File Output Operator
@@ -584,10 +584,10 @@ POSTHOOK: Input: default@srcbucket_mapjoin_part_n13
 POSTHOOK: Input: default@srcbucket_mapjoin_part_n13@ds=2008-04-08
 POSTHOOK: Output: default@bucketmapjoin_tmp_result_n6
 OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n11`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n13`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -775,11 +775,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col4
+                outputColumnNames: _col0, _col1, _col3
                 Position of Big Table: 1
                 Statistics: Num rows: 156 Data size: 89111 Basic stats: PARTIAL Column stats: NONE
                 Select Operator
-                  expressions: CAST( _col0 AS STRING) (type: string), _col1 (type: string), _col4 (type: string)
+                  expressions: CAST( _col0 AS STRING) (type: string), _col1 (type: string), _col3 (type: string)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 156 Data size: 89111 Basic stats: PARTIAL Column stats: NONE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_2.q.out b/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_2.q.out
index acb1e87..8039d0f 100644
--- a/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_2.q.out
+++ b/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_2.q.out
@@ -125,7 +125,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 84 Data size: 15036 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 84 Data size: 7896 Basic stats: COMPLETE Column stats: COMPLETE
             Map Operator Tree:
                 TableScan
                   alias: a
@@ -137,17 +137,17 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 10 Data size: 1780 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 930 Basic stats: COMPLETE Column stats: COMPLETE
                       Merge Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col4
+                        outputColumnNames: _col0, _col1, _col3
                         Statistics: Num rows: 14 Data size: 2562 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 14 Data size: 2632 Basic stats: COMPLETE Column stats: COMPLETE
                           Reduce Output Operator
@@ -347,7 +347,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 84 Data size: 15036 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 84 Data size: 7896 Basic stats: COMPLETE Column stats: COMPLETE
             Map Operator Tree:
                 TableScan
                   alias: a
@@ -359,17 +359,17 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 20 Data size: 5540 Basic stats: COMPLETE Column stats: PARTIAL
+                      Statistics: Num rows: 20 Data size: 1860 Basic stats: COMPLETE Column stats: PARTIAL
                       Merge Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col4
+                        outputColumnNames: _col0, _col1, _col3
                         Statistics: Num rows: 29 Data size: 5307 Basic stats: COMPLETE Column stats: PARTIAL
                         Select Operator
-                          expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 29 Data size: 5452 Basic stats: COMPLETE Column stats: PARTIAL
                           Reduce Output Operator
@@ -593,7 +593,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 168 Data size: 46704 Basic stats: COMPLETE Column stats: PARTIAL
+                      Statistics: Num rows: 168 Data size: 15792 Basic stats: COMPLETE Column stats: PARTIAL
             Map Operator Tree:
                 TableScan
                   alias: a
@@ -605,17 +605,17 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 10 Data size: 1780 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 930 Basic stats: COMPLETE Column stats: COMPLETE
                       Merge Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col4
+                        outputColumnNames: _col0, _col1, _col3
                         Statistics: Num rows: 29 Data size: 5307 Basic stats: COMPLETE Column stats: PARTIAL
                         Select Operator
-                          expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 29 Data size: 5452 Basic stats: COMPLETE Column stats: PARTIAL
                           Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_6.q.out b/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_6.q.out
index 28e43cf..ce2ba5f 100644
--- a/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_6.q.out
+++ b/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_6.q.out
@@ -87,45 +87,57 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Map 2 <- Map 1 (CUSTOM_EDGE)
+        Reducer 3 <- Map 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: a
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 84 Data size: 15372 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                        Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col2 (type: string)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Map 2 
             Map Operator Tree:
                 TableScan
-                  alias: a
+                  alias: b
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 10 Data size: 1820 Basic stats: COMPLETE Column stats: COMPLETE
-                      Merge Join Operator
+                      Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
+                        input vertices:
+                          0 Map 1
                         Statistics: Num rows: 14 Data size: 2618 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                           Reduce Output Operator
@@ -135,7 +147,8 @@ STAGE PLANS:
                             Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                             value expressions: _col2 (type: string)
             Execution mode: llap
-        Reducer 2 
+            LLAP IO: no inputs
+        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Select Operator
@@ -166,7 +179,7 @@ STAGE PLANS:
                       Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 1 Data size: 1373 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col2 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col3 (type: struct<columntype:string,maxlength:bigint,sumlength:bigint,count:bigint,countnulls:bigint,bitvector:binary>)
-        Reducer 3 
+        Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
               Group By Operator
@@ -314,45 +327,57 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Map 2 <- Map 1 (CUSTOM_EDGE)
+        Reducer 3 <- Map 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: a
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 84 Data size: 15372 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                        Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col2 (type: string)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Map 2 
             Map Operator Tree:
                 TableScan
-                  alias: a
+                  alias: b
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 10 Data size: 1820 Basic stats: COMPLETE Column stats: COMPLETE
-                      Merge Join Operator
+                      Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
+                        input vertices:
+                          0 Map 1
                         Statistics: Num rows: 14 Data size: 2618 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                           Reduce Output Operator
@@ -362,7 +387,8 @@ STAGE PLANS:
                             Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                             value expressions: _col2 (type: string)
             Execution mode: llap
-        Reducer 2 
+            LLAP IO: no inputs
+        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Select Operator
@@ -393,7 +419,7 @@ STAGE PLANS:
                       Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 1 Data size: 1373 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col2 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col3 (type: struct<columntype:string,maxlength:bigint,sumlength:bigint,count:bigint,countnulls:bigint,bitvector:binary>)
-        Reducer 3 
+        Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
               Group By Operator
@@ -541,45 +567,57 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Map 2 <- Map 1 (CUSTOM_EDGE)
+        Reducer 3 <- Map 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: a
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 84 Data size: 15372 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                        Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col2 (type: string)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Map 2 
             Map Operator Tree:
                 TableScan
-                  alias: a
+                  alias: b
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 10 Data size: 1820 Basic stats: COMPLETE Column stats: COMPLETE
-                      Merge Join Operator
+                      Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
+                        input vertices:
+                          0 Map 1
                         Statistics: Num rows: 14 Data size: 2618 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                           Reduce Output Operator
@@ -589,7 +627,8 @@ STAGE PLANS:
                             Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                             value expressions: _col2 (type: string)
             Execution mode: llap
-        Reducer 2 
+            LLAP IO: no inputs
+        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Select Operator
@@ -620,7 +659,7 @@ STAGE PLANS:
                       Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 1 Data size: 1373 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col2 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col3 (type: struct<columntype:string,maxlength:bigint,sumlength:bigint,count:bigint,countnulls:bigint,bitvector:binary>)
-        Reducer 3 
+        Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
               Group By Operator
@@ -703,45 +742,57 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Map 2 <- Map 1 (CUSTOM_EDGE)
+        Reducer 3 <- Map 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: a
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 84 Data size: 15372 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                        Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col2 (type: string)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Map 2 
             Map Operator Tree:
                 TableScan
-                  alias: a
+                  alias: b
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 10 Data size: 1820 Basic stats: COMPLETE Column stats: COMPLETE
-                      Merge Join Operator
+                      Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
+                        input vertices:
+                          0 Map 1
                         Statistics: Num rows: 14 Data size: 2618 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col1 (type: int), _col0 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                           Reduce Output Operator
@@ -751,7 +802,8 @@ STAGE PLANS:
                             Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                             value expressions: _col2 (type: string)
             Execution mode: llap
-        Reducer 2 
+            LLAP IO: no inputs
+        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Select Operator
@@ -782,7 +834,7 @@ STAGE PLANS:
                       Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 1 Data size: 1373 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col2 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col3 (type: struct<columntype:string,maxlength:bigint,sumlength:bigint,count:bigint,countnulls:bigint,bitvector:binary>)
-        Reducer 3 
+        Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
               Group By Operator
@@ -871,45 +923,57 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Map 2 <- Map 1 (CUSTOM_EDGE)
+        Reducer 3 <- Map 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: a
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 84 Data size: 15372 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                        Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col2 (type: string)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Map 2 
             Map Operator Tree:
                 TableScan
-                  alias: a
+                  alias: b
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 10 Data size: 1820 Basic stats: COMPLETE Column stats: COMPLETE
-                      Merge Join Operator
+                      Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
+                        input vertices:
+                          0 Map 1
                         Statistics: Num rows: 14 Data size: 2618 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                           Reduce Output Operator
@@ -919,7 +983,8 @@ STAGE PLANS:
                             Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                             value expressions: _col2 (type: string)
             Execution mode: llap
-        Reducer 2 
+            LLAP IO: no inputs
+        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Select Operator
@@ -950,7 +1015,7 @@ STAGE PLANS:
                       Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 1 Data size: 1373 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col2 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col3 (type: struct<columntype:string,maxlength:bigint,sumlength:bigint,count:bigint,countnulls:bigint,bitvector:binary>)
-        Reducer 3 
+        Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
               Group By Operator
@@ -1116,45 +1181,57 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Map 2 <- Map 1 (CUSTOM_EDGE)
+        Reducer 3 <- Map 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: a
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 84 Data size: 15372 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                        Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col2 (type: string)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Map 2 
             Map Operator Tree:
                 TableScan
-                  alias: a
+                  alias: b
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 10 Data size: 1820 Basic stats: COMPLETE Column stats: COMPLETE
-                      Merge Join Operator
+                      Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
+                        input vertices:
+                          0 Map 1
                         Statistics: Num rows: 14 Data size: 2618 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                           Reduce Output Operator
@@ -1164,7 +1241,8 @@ STAGE PLANS:
                             Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                             value expressions: _col2 (type: string)
             Execution mode: llap
-        Reducer 2 
+            LLAP IO: no inputs
+        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Select Operator
@@ -1195,7 +1273,7 @@ STAGE PLANS:
                       Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 1 Data size: 1373 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col2 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col3 (type: struct<columntype:string,maxlength:bigint,sumlength:bigint,count:bigint,countnulls:bigint,bitvector:binary>)
-        Reducer 3 
+        Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
               Group By Operator
@@ -1371,45 +1449,57 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE)
-        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Map 2 <- Map 1 (CUSTOM_EDGE)
+        Reducer 3 <- Map 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: a
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 84 Data size: 15372 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                        Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col2 (type: string)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Map 2 
             Map Operator Tree:
                 TableScan
-                  alias: a
+                  alias: b
                   filterExpr: (key is not null and key2 is not null) (type: boolean)
-                  Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: (key is not null and key2 is not null) (type: boolean)
-                    Statistics: Num rows: 10 Data size: 970 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: key (type: int), key2 (type: int), value (type: string)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 10 Data size: 1820 Basic stats: COMPLETE Column stats: COMPLETE
-                      Merge Join Operator
+                      Statistics: Num rows: 84 Data size: 8232 Basic stats: COMPLETE Column stats: COMPLETE
+                      Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int), _col1 (type: int)
                           1 _col0 (type: int), _col1 (type: int)
-                        outputColumnNames: _col0, _col1, _col2, _col6
+                        outputColumnNames: _col0, _col1, _col2, _col5
+                        input vertices:
+                          0 Map 1
                         Statistics: Num rows: 14 Data size: 2618 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col6) (type: string)
+                          expressions: _col0 (type: int), _col1 (type: int), concat(_col2, _col5) (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                           Reduce Output Operator
@@ -1419,7 +1509,8 @@ STAGE PLANS:
                             Statistics: Num rows: 14 Data size: 2688 Basic stats: COMPLETE Column stats: COMPLETE
                             value expressions: _col2 (type: string)
             Execution mode: llap
-        Reducer 2 
+            LLAP IO: no inputs
+        Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
               Select Operator
@@ -1450,7 +1541,7 @@ STAGE PLANS:
                       Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 1 Data size: 1373 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col2 (type: struct<columntype:string,min:bigint,max:bigint,countnulls:bigint,bitvector:binary>), _col3 (type: struct<columntype:string,maxlength:bigint,sumlength:bigint,count:bigint,countnulls:bigint,bitvector:binary>)
-        Reducer 3 
+        Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
               Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_7.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_7.q.out b/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_7.q.out
index afd2975..11de705 100644
--- a/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_7.q.out
+++ b/ql/src/test/results/clientpositive/llap/bucketsortoptimize_insert_7.q.out
@@ -103,7 +103,7 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 3 Data size: 537 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3 Data size: 282 Basic stats: COMPLETE Column stats: COMPLETE
             Map Operator Tree:
                 TableScan
                   alias: a
@@ -115,17 +115,17 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 3 Data size: 534 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 3 Data size: 279 Basic stats: COMPLETE Column stats: COMPLETE
                       Merge Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
                           0 _col0 (type: int)
                           1 _col0 (type: int)
-                        outputColumnNames: _col0, _col1, _col4
+                        outputColumnNames: _col0, _col1, _col3
                         Statistics: Num rows: 3 Data size: 549 Basic stats: COMPLETE Column stats: COMPLETE
                         Select Operator
-                          expressions: _col0 (type: int), concat(_col1, _col4) (type: string)
+                          expressions: _col0 (type: int), concat(_col1, _col3) (type: string)
                           outputColumnNames: _col0, _col1
                           Statistics: Num rows: 3 Data size: 564 Basic stats: COMPLETE Column stats: COMPLETE
                           Reduce Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/check_constraint.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/check_constraint.q.out b/ql/src/test/results/clientpositive/llap/check_constraint.q.out
index 7273680..2b15648 100644
--- a/ql/src/test/results/clientpositive/llap/check_constraint.q.out
+++ b/ql/src/test/results/clientpositive/llap/check_constraint.q.out
@@ -1548,15 +1548,15 @@ STAGE PLANS:
                     predicate: (value > 'val') (type: boolean)
                     Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: key (type: string), value (type: string), UDFToInteger(key) (type: int)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 166 Data size: 30212 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col1 (type: string)
+                        Statistics: Num rows: 166 Data size: 30212 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col1 (type: string), _col2 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -1565,14 +1565,15 @@ STAGE PLANS:
                   alias: s2
                   Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: key (type: string)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: key (type: string), CAST( key AS decimal(5,2)) (type: decimal(5,2))
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 500 Data size: 99500 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: string)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: string)
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 99500 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: decimal(5,2))
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1584,18 +1585,18 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 428 Data size: 99065 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col1, _col2, _col4
+                Statistics: Num rows: 412 Data size: 68596 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: UDFToInteger(_col0) (type: int), CAST( _col2 AS decimal(5,2)) (type: decimal(5,2)), _col1 (type: string)
+                  expressions: _col2 (type: int), _col4 (type: decimal(5,2)), _col1 (type: string)
                   outputColumnNames: _col0, _col1, _col2
-                  Statistics: Num rows: 428 Data size: 88596 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 412 Data size: 68596 Basic stats: COMPLETE Column stats: COMPLETE
                   Limit
                     Number of rows: 10
-                    Statistics: Num rows: 10 Data size: 2070 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 10 Data size: 1734 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 10 Data size: 2070 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 1734 Basic stats: COMPLETE Column stats: COMPLETE
                       TopN Hash Memory Usage: 0.1
                       value expressions: _col0 (type: int), _col1 (type: decimal(5,2)), _col2 (type: string)
         Reducer 3 
@@ -1604,17 +1605,17 @@ STAGE PLANS:
               Select Operator
                 expressions: VALUE._col0 (type: int), VALUE._col1 (type: decimal(5,2)), VALUE._col2 (type: string)
                 outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 10 Data size: 2070 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 10 Data size: 1734 Basic stats: COMPLETE Column stats: COMPLETE
                 Limit
                   Number of rows: 10
-                  Statistics: Num rows: 10 Data size: 2070 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 10 Data size: 1734 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: enforce_constraint((_col1 is not null and (_col1 >= CAST( _col0 AS decimal(5,2))) is not false)) (type: boolean)
-                    Statistics: Num rows: 5 Data size: 1035 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 5 Data size: 923 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
                       Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 5 Data size: 1035 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 5 Data size: 923 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col0 (type: int), _col1 (type: decimal(5,2)), _col2 (type: string)
         Reducer 4 
             Execution mode: vectorized, llap
@@ -1622,10 +1623,10 @@ STAGE PLANS:
               Select Operator
                 expressions: VALUE._col0 (type: int), VALUE._col1 (type: decimal(5,2)), CAST( VALUE._col2 AS varchar(128)) (type: varchar(128))
                 outputColumnNames: _col0, _col1, _col2
-                Statistics: Num rows: 5 Data size: 1640 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 5 Data size: 1528 Basic stats: COMPLETE Column stats: COMPLETE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 5 Data size: 1640 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 5 Data size: 1528 Basic stats: COMPLETE Column stats: COMPLETE
                   table:
                       input format: org.apache.hadoop.hive.ql.io.orc.OrcInputFormat
                       output format: org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/constprog_semijoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/constprog_semijoin.q.out b/ql/src/test/results/clientpositive/llap/constprog_semijoin.q.out
index 54a73cd..ea46b72 100644
--- a/ql/src/test/results/clientpositive/llap/constprog_semijoin.q.out
+++ b/ql/src/test/results/clientpositive/llap/constprog_semijoin.q.out
@@ -205,52 +205,52 @@ POSTHOOK: Input: default@table3_n0
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 4 (SIMPLE_EDGE)
-Reducer 3 <- Map 5 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
+Reducer 4 <- Map 3 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
     limit:-1
     Stage-1
-      Reducer 3 llap
-      File Output Operator [FS_18]
-        Select Operator [SEL_17] (rows=2 width=187)
+      Reducer 2 llap
+      File Output Operator [FS_19]
+        Select Operator [SEL_18] (rows=2 width=187)
           Output:["_col0","_col1","_col2"]
-          Merge Join Operator [MERGEJOIN_48] (rows=2 width=96)
-            Conds:RS_14._col0=RS_58._col0(Inner),Output:["_col0","_col4"]
-          <-Map 5 [SIMPLE_EDGE] vectorized, llap
-            SHUFFLE [RS_58]
+          Merge Join Operator [MERGEJOIN_49] (rows=2 width=96)
+            Conds:RS_52._col0=RS_16._col0(Inner),Output:["_col1","_col2"]
+          <-Map 1 [SIMPLE_EDGE] vectorized, llap
+            SHUFFLE [RS_52]
               PartitionCols:_col0
-              Select Operator [SEL_57] (rows=3 width=96)
+              Select Operator [SEL_51] (rows=3 width=96)
                 Output:["_col0","_col1"]
-                Filter Operator [FIL_56] (rows=3 width=96)
+                Filter Operator [FIL_50] (rows=3 width=96)
                   predicate:id is not null
-                  TableScan [TS_6] (rows=3 width=96)
+                  TableScan [TS_0] (rows=3 width=96)
                     default@table2_n6,table2_n6,Tbl:COMPLETE,Col:COMPLETE,Output:["id","val2"]
-          <-Reducer 2 [SIMPLE_EDGE] llap
-            SHUFFLE [RS_14]
+          <-Reducer 4 [SIMPLE_EDGE] llap
+            SHUFFLE [RS_16]
               PartitionCols:_col0
-              Merge Join Operator [MERGEJOIN_47] (rows=2 width=4)
-                Conds:RS_51._col2=RS_55._col0(Left Semi),Output:["_col0"]
-              <-Map 1 [SIMPLE_EDGE] vectorized, llap
-                SHUFFLE [RS_51]
+              Merge Join Operator [MERGEJOIN_48] (rows=2 width=4)
+                Conds:RS_55._col2=RS_59._col0(Left Semi),Output:["_col0"]
+              <-Map 3 [SIMPLE_EDGE] vectorized, llap
+                SHUFFLE [RS_55]
                   PartitionCols:_col2
-                  Select Operator [SEL_50] (rows=2 width=99)
+                  Select Operator [SEL_54] (rows=2 width=99)
                     Output:["_col0","_col2"]
-                    Filter Operator [FIL_49] (rows=2 width=99)
+                    Filter Operator [FIL_53] (rows=2 width=99)
                       predicate:((val = 't1val01') and dimid is not null and id is not null)
-                      TableScan [TS_0] (rows=10 width=99)
+                      TableScan [TS_3] (rows=10 width=99)
                         default@table1_n10,table1_n10,Tbl:COMPLETE,Col:COMPLETE,Output:["id","val","dimid"]
-              <-Map 4 [SIMPLE_EDGE] vectorized, llap
-                SHUFFLE [RS_55]
+              <-Map 5 [SIMPLE_EDGE] vectorized, llap
+                SHUFFLE [RS_59]
                   PartitionCols:_col0
-                  Group By Operator [GBY_54] (rows=2 width=4)
+                  Group By Operator [GBY_58] (rows=2 width=4)
                     Output:["_col0"],keys:_col0
-                    Select Operator [SEL_53] (rows=5 width=4)
+                    Select Operator [SEL_57] (rows=5 width=4)
                       Output:["_col0"]
-                      Filter Operator [FIL_52] (rows=5 width=4)
+                      Filter Operator [FIL_56] (rows=5 width=4)
                         predicate:id is not null
-                        TableScan [TS_3] (rows=5 width=4)
+                        TableScan [TS_6] (rows=5 width=4)
                           default@table3_n0,table3_n0,Tbl:COMPLETE,Col:COMPLETE,Output:["id"]
 
 PREHOOK: query: select table1_n10.id, table1_n10.val, table2_n6.val2 from table1_n10 left semi join table3_n0 on table1_n10.dimid = table3_n0.id inner join table2_n6 on table1_n10.val = 't1val01' and table1_n10.id = table2_n6.id

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/constraints_optimization.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/constraints_optimization.q.out b/ql/src/test/results/clientpositive/llap/constraints_optimization.q.out
index 23bab34..bf60646 100644
--- a/ql/src/test/results/clientpositive/llap/constraints_optimization.q.out
+++ b/ql/src/test/results/clientpositive/llap/constraints_optimization.q.out
@@ -1103,12 +1103,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: key1 (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1194,12 +1194,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: key1 (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 


[10/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query56.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query56.q.out b/ql/src/test/results/clientpositive/perf/tez/query56.q.out
index 18f64cc..17458f4 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query56.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query56.q.out
@@ -204,9 +204,9 @@ Stage-0
                         SHUFFLE [RS_71]
                           PartitionCols:_col0
                           Group By Operator [GBY_70] (rows=355 width=212)
-                            Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                            Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col1
                             Merge Join Operator [MERGEJOIN_303] (rows=339151 width=100)
-                              Conds:RS_66._col0=RS_67._col4(Inner),Output:["_col1","_col8"]
+                              Conds:RS_66._col0=RS_67._col3(Inner),Output:["_col1","_col7"]
                             <-Reducer 2 [SIMPLE_EDGE]
                               SHUFFLE [RS_66]
                                 PartitionCols:_col0
@@ -239,15 +239,15 @@ Stage-0
                                                 default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_id","i_color"]
                             <-Reducer 23 [SIMPLE_EDGE]
                               SHUFFLE [RS_67]
-                                PartitionCols:_col4
+                                PartitionCols:_col3
                                 Select Operator [SEL_62] (rows=1550375 width=13)
-                                  Output:["_col4","_col5"]
+                                  Output:["_col3","_col4"]
                                   Merge Join Operator [MERGEJOIN_298] (rows=1550375 width=13)
                                     Conds:RS_59._col1=RS_346._col0(Inner),Output:["_col2","_col3"]
                                   <-Map 28 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_346]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_343] (rows=8000000 width=116)
+                                      Select Operator [SEL_343] (rows=8000000 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_342] (rows=8000000 width=112)
                                           predicate:((ca_gmt_offset = -8) and ca_address_sk is not null)
@@ -261,7 +261,7 @@ Stage-0
                                       <-Map 20 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_330]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_327] (rows=50 width=12)
+                                          Select Operator [SEL_327] (rows=50 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_326] (rows=50 width=12)
                                               predicate:((d_moy = 1) and (d_year = 2000) and d_date_sk is not null)
@@ -320,18 +320,18 @@ Stage-0
                         SHUFFLE [RS_109]
                           PartitionCols:_col0
                           Group By Operator [GBY_108] (rows=355 width=212)
-                            Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                            Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col1
                             Merge Join Operator [MERGEJOIN_304] (rows=172427 width=188)
-                              Conds:RS_104._col0=RS_105._col3(Inner),Output:["_col1","_col8"]
+                              Conds:RS_104._col0=RS_105._col2(Inner),Output:["_col1","_col7"]
                             <-Reducer 2 [SIMPLE_EDGE]
                               SHUFFLE [RS_104]
                                 PartitionCols:_col0
                                  Please refer to the previous Merge Join Operator [MERGEJOIN_293]
                             <-Reducer 26 [SIMPLE_EDGE]
                               SHUFFLE [RS_105]
-                                PartitionCols:_col3
+                                PartitionCols:_col2
                                 Select Operator [SEL_100] (rows=788222 width=110)
-                                  Output:["_col3","_col5"]
+                                  Output:["_col2","_col4"]
                                   Merge Join Operator [MERGEJOIN_301] (rows=788222 width=110)
                                     Conds:RS_97._col2=RS_348._col0(Inner),Output:["_col1","_col3"]
                                   <-Map 28 [SIMPLE_EDGE] vectorized
@@ -400,18 +400,18 @@ Stage-0
                         SHUFFLE [RS_34]
                           PartitionCols:_col0
                           Group By Operator [GBY_33] (rows=355 width=212)
-                            Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                            Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col1
                             Merge Join Operator [MERGEJOIN_302] (rows=629332 width=100)
-                              Conds:RS_29._col0=RS_30._col3(Inner),Output:["_col1","_col8"]
+                              Conds:RS_29._col0=RS_30._col2(Inner),Output:["_col1","_col7"]
                             <-Reducer 2 [SIMPLE_EDGE]
                               SHUFFLE [RS_29]
                                 PartitionCols:_col0
                                  Please refer to the previous Merge Join Operator [MERGEJOIN_293]
                             <-Reducer 19 [SIMPLE_EDGE]
                               SHUFFLE [RS_30]
-                                PartitionCols:_col3
+                                PartitionCols:_col2
                                 Select Operator [SEL_25] (rows=2876890 width=4)
-                                  Output:["_col3","_col5"]
+                                  Output:["_col2","_col4"]
                                   Merge Join Operator [MERGEJOIN_295] (rows=2876890 width=4)
                                     Conds:RS_22._col2=RS_344._col0(Inner),Output:["_col1","_col3"]
                                   <-Map 28 [SIMPLE_EDGE] vectorized

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query57.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query57.q.out b/ql/src/test/results/clientpositive/perf/tez/query57.q.out
index 39b9510..4a18880 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query57.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query57.q.out
@@ -133,10 +133,10 @@ Stage-0
               Select Operator [SEL_109] (rows=130121 width=758)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
                 Merge Join Operator [MERGEJOIN_278] (rows=130121 width=646)
-                  Conds:RS_106._col5, _col6, _col7, _col12=RS_306._col0, _col1, _col2, (_col4 - 1)(Inner),Output:["_col3","_col5","_col6","_col8","_col9","_col10","_col11","_col16"]
+                  Conds:RS_106._col5, _col6, _col12, _col7=RS_306._col0, _col1, _col4, _col2(Inner),Output:["_col3","_col5","_col6","_col8","_col9","_col10","_col11","_col16"]
                 <-Reducer 6 [SIMPLE_EDGE] vectorized
                   SHUFFLE [RS_306]
-                    PartitionCols:_col0, _col1, _col2, (_col4 - 1)
+                    PartitionCols:_col0, _col1, _col4, _col2
                     Select Operator [SEL_304] (rows=87441185 width=404)
                       Output:["_col0","_col1","_col2","_col3","_col4"]
                       Filter Operator [FIL_302] (rows=87441185 width=408)
@@ -216,12 +216,12 @@ Stage-0
                                                                  Please refer to the previous Select Operator [SEL_280]
                 <-Reducer 9 [ONE_TO_ONE_EDGE]
                   FORWARD [RS_106]
-                    PartitionCols:_col5, _col6, _col7, _col12
+                    PartitionCols:_col5, _col6, _col12, _col7
                     Merge Join Operator [MERGEJOIN_277] (rows=130121 width=636)
-                      Conds:RS_307._col0, _col1, _col2, (_col4 + 1)=RS_318._col0, _col1, _col2, _col7(Inner),Output:["_col3","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12"]
+                      Conds:RS_307._col0, _col1, _col4, _col2=RS_318._col0, _col1, _col7, _col2(Inner),Output:["_col3","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12"]
                     <-Reducer 6 [SIMPLE_EDGE] vectorized
                       SHUFFLE [RS_307]
-                        PartitionCols:_col0, _col1, _col2, (_col4 + 1)
+                        PartitionCols:_col0, _col1, _col4, _col2
                         Select Operator [SEL_305] (rows=87441185 width=404)
                           Output:["_col0","_col1","_col2","_col3","_col4"]
                           Filter Operator [FIL_303] (rows=87441185 width=408)
@@ -231,7 +231,7 @@ Stage-0
                                Please refer to the previous Select Operator [SEL_299]
                     <-Reducer 11 [SIMPLE_EDGE] vectorized
                       SHUFFLE [RS_318]
-                        PartitionCols:_col0, _col1, _col2, _col7
+                        PartitionCols:_col0, _col1, _col7, _col2
                         Select Operator [SEL_317] (rows=130121 width=524)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
                           Filter Operator [FIL_316] (rows=130121 width=524)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query58.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query58.q.out b/ql/src/test/results/clientpositive/perf/tez/query58.q.out
index 9e71fc0..bff619a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query58.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query58.q.out
@@ -171,223 +171,229 @@ Stage-0
     limit:100
     Stage-1
       Reducer 7 vectorized
-      File Output Operator [FS_467]
-        Limit [LIM_466] (rows=1 width=884)
+      File Output Operator [FS_470]
+        Limit [LIM_469] (rows=1 width=884)
           Number of rows:100
-          Select Operator [SEL_465] (rows=1 width=884)
+          Select Operator [SEL_468] (rows=1 width=884)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
           <-Reducer 6 [SIMPLE_EDGE]
             SHUFFLE [RS_163]
               Select Operator [SEL_162] (rows=1 width=884)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                Filter Operator [FIL_158] (rows=1 width=436)
-                  predicate:(_col1 BETWEEN (0.9 * _col5) AND (1.1 * _col5) and _col3 BETWEEN (0.9 * _col5) AND (1.1 * _col5) and _col5 BETWEEN (0.9 * _col1) AND (1.1 * _col1) and _col5 BETWEEN (0.9 * _col3) AND (1.1 * _col3))
-                  Merge Join Operator [MERGEJOIN_419] (rows=1 width=436)
-                    Conds:RS_155._col0=RS_464._col0(Inner),Output:["_col0","_col1","_col3","_col5"]
+                Filter Operator [FIL_158] (rows=1 width=1108)
+                  predicate:(_col1 BETWEEN _col10 AND _col11 and _col5 BETWEEN _col10 AND _col11 and _col9 BETWEEN _col2 AND _col3 and _col9 BETWEEN _col6 AND _col7)
+                  Merge Join Operator [MERGEJOIN_419] (rows=1 width=1108)
+                    Conds:RS_155._col0=RS_467._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col7","_col9","_col10","_col11"]
                   <-Reducer 14 [ONE_TO_ONE_EDGE] vectorized
-                    FORWARD [RS_464]
+                    FORWARD [RS_467]
                       PartitionCols:_col0
-                      Group By Operator [GBY_463] (rows=69 width=212)
-                        Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                      <-Reducer 13 [SIMPLE_EDGE]
-                        SHUFFLE [RS_147]
-                          PartitionCols:_col0
-                          Group By Operator [GBY_146] (rows=69 width=212)
-                            Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
-                            Merge Join Operator [MERGEJOIN_417] (rows=31537 width=100)
-                              Conds:RS_142._col0=RS_143._col0(Inner),Output:["_col2","_col4"]
-                            <-Reducer 16 [SIMPLE_EDGE]
-                              SHUFFLE [RS_143]
-                                PartitionCols:_col0
-                                Merge Join Operator [MERGEJOIN_406] (rows=2 width=4)
-                                  Conds:RS_422._col1=RS_438._col0(Inner),Output:["_col0"]
-                                <-Map 15 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_422]
-                                    PartitionCols:_col1
-                                    Select Operator [SEL_421] (rows=73049 width=98)
-                                      Output:["_col0","_col1"]
-                                      Filter Operator [FIL_420] (rows=73049 width=98)
-                                        predicate:(d_date is not null and d_date_sk is not null)
-                                        TableScan [TS_6] (rows=73049 width=98)
-                                          default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
-                                <-Reducer 24 [ONE_TO_ONE_EDGE] vectorized
-                                  FORWARD [RS_438]
-                                    PartitionCols:_col0
-                                    Group By Operator [GBY_437] (rows=2 width=94)
-                                      Output:["_col0"],keys:KEY._col0
-                                    <-Reducer 23 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_32]
-                                        PartitionCols:_col0
-                                        Group By Operator [GBY_31] (rows=2 width=94)
-                                          Output:["_col0"],keys:_col2
-                                          Merge Join Operator [MERGEJOIN_405] (rows=5 width=94)
-                                            Conds:RS_27._col1=RS_435._col1(Inner),Output:["_col2"]
-                                          <-Map 25 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_435]
-                                              PartitionCols:_col1
-                                              Select Operator [SEL_433] (rows=73049 width=98)
-                                                Output:["_col0","_col1"]
-                                                Filter Operator [FIL_431] (rows=73049 width=98)
-                                                  predicate:(d_date is not null and d_week_seq is not null)
-                                                  TableScan [TS_21] (rows=73049 width=98)
-                                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date","d_week_seq"]
-                                          <-Reducer 22 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_27]
-                                              PartitionCols:_col1
-                                              Merge Join Operator [MERGEJOIN_404] (rows=1 width=4)
-                                                Conds:(Inner),Output:["_col1"]
-                                              <-Map 25 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_436]
-                                                  Select Operator [SEL_434] (rows=1 width=4)
-                                                    Output:["_col0"]
-                                                    Filter Operator [FIL_432] (rows=1 width=98)
-                                                      predicate:((d_date = '1998-02-19') and d_week_seq is not null)
-                                                       Please refer to the previous TableScan [TS_21]
-                                              <-Reducer 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                PARTITION_ONLY_SHUFFLE [RS_430]
-                                                  Select Operator [SEL_429] (rows=1 width=8)
-                                                    Filter Operator [FIL_428] (rows=1 width=8)
-                                                      predicate:(sq_count_check(_col0) <= 1)
-                                                      Group By Operator [GBY_427] (rows=1 width=8)
-                                                        Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                                                      <-Map 20 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                        PARTITION_ONLY_SHUFFLE [RS_426]
-                                                          Group By Operator [GBY_425] (rows=1 width=8)
-                                                            Output:["_col0"],aggregations:["count()"]
-                                                            Select Operator [SEL_424] (rows=1 width=94)
-                                                              Filter Operator [FIL_423] (rows=1 width=94)
-                                                                predicate:(d_date = '1998-02-19')
-                                                                TableScan [TS_9] (rows=73049 width=94)
-                                                                  default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date"]
-                            <-Reducer 12 [SIMPLE_EDGE]
-                              SHUFFLE [RS_142]
-                                PartitionCols:_col0
-                                Merge Join Operator [MERGEJOIN_411] (rows=143966864 width=215)
-                                  Conds:RS_462._col1=RS_448._col0(Inner),Output:["_col0","_col2","_col4"]
-                                <-Map 8 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_448]
-                                    PartitionCols:_col0
-                                    Select Operator [SEL_445] (rows=462000 width=104)
-                                      Output:["_col0","_col1"]
-                                      Filter Operator [FIL_444] (rows=462000 width=104)
-                                        predicate:(i_item_id is not null and i_item_sk is not null)
-                                        TableScan [TS_3] (rows=462000 width=104)
-                                          default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
-                                <-Map 27 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_462]
-                                    PartitionCols:_col1
-                                    Select Operator [SEL_461] (rows=143966864 width=119)
-                                      Output:["_col0","_col1","_col2"]
-                                      Filter Operator [FIL_460] (rows=143966864 width=119)
-                                        predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_143_date_dim_d_date_sk_min) AND DynamicValue(RS_143_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_143_date_dim_d_date_sk_bloom_filter))) and ws_item_sk is not null and ws_sold_date_sk is not null)
-                                        TableScan [TS_100] (rows=144002668 width=119)
-                                          default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_ext_sales_price"]
-                                        <-Reducer 19 [BROADCAST_EDGE] vectorized
-                                          BROADCAST [RS_459]
-                                            Group By Operator [GBY_458] (rows=1 width=12)
-                                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                            <-Reducer 16 [CUSTOM_SIMPLE_EDGE]
-                                              SHUFFLE [RS_363]
-                                                Group By Operator [GBY_362] (rows=1 width=12)
-                                                  Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                  Select Operator [SEL_361] (rows=2 width=4)
-                                                    Output:["_col0"]
-                                                     Please refer to the previous Merge Join Operator [MERGEJOIN_406]
+                      Select Operator [SEL_466] (rows=69 width=436)
+                        Output:["_col0","_col1","_col2","_col3"]
+                        Group By Operator [GBY_465] (rows=69 width=212)
+                          Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                        <-Reducer 13 [SIMPLE_EDGE]
+                          SHUFFLE [RS_147]
+                            PartitionCols:_col0
+                            Group By Operator [GBY_146] (rows=69 width=212)
+                              Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                              Merge Join Operator [MERGEJOIN_417] (rows=31537 width=100)
+                                Conds:RS_142._col0=RS_143._col0(Inner),Output:["_col2","_col4"]
+                              <-Reducer 16 [SIMPLE_EDGE]
+                                SHUFFLE [RS_143]
+                                  PartitionCols:_col0
+                                  Merge Join Operator [MERGEJOIN_406] (rows=2 width=4)
+                                    Conds:RS_422._col1=RS_438._col0(Inner),Output:["_col0"]
+                                  <-Map 15 [SIMPLE_EDGE] vectorized
+                                    SHUFFLE [RS_422]
+                                      PartitionCols:_col1
+                                      Select Operator [SEL_421] (rows=73049 width=98)
+                                        Output:["_col0","_col1"]
+                                        Filter Operator [FIL_420] (rows=73049 width=98)
+                                          predicate:(d_date is not null and d_date_sk is not null)
+                                          TableScan [TS_6] (rows=73049 width=98)
+                                            default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
+                                  <-Reducer 24 [ONE_TO_ONE_EDGE] vectorized
+                                    FORWARD [RS_438]
+                                      PartitionCols:_col0
+                                      Group By Operator [GBY_437] (rows=2 width=94)
+                                        Output:["_col0"],keys:KEY._col0
+                                      <-Reducer 23 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_32]
+                                          PartitionCols:_col0
+                                          Group By Operator [GBY_31] (rows=2 width=94)
+                                            Output:["_col0"],keys:_col2
+                                            Merge Join Operator [MERGEJOIN_405] (rows=5 width=94)
+                                              Conds:RS_27._col1=RS_435._col1(Inner),Output:["_col2"]
+                                            <-Map 25 [SIMPLE_EDGE] vectorized
+                                              SHUFFLE [RS_435]
+                                                PartitionCols:_col1
+                                                Select Operator [SEL_433] (rows=73049 width=98)
+                                                  Output:["_col0","_col1"]
+                                                  Filter Operator [FIL_431] (rows=73049 width=98)
+                                                    predicate:(d_date is not null and d_week_seq is not null)
+                                                    TableScan [TS_21] (rows=73049 width=98)
+                                                      default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date","d_week_seq"]
+                                            <-Reducer 22 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_27]
+                                                PartitionCols:_col1
+                                                Merge Join Operator [MERGEJOIN_404] (rows=1 width=4)
+                                                  Conds:(Inner),Output:["_col1"]
+                                                <-Map 25 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                  SHUFFLE [RS_436]
+                                                    Select Operator [SEL_434] (rows=1 width=4)
+                                                      Output:["_col0"]
+                                                      Filter Operator [FIL_432] (rows=1 width=98)
+                                                        predicate:((d_date = '1998-02-19') and d_week_seq is not null)
+                                                         Please refer to the previous TableScan [TS_21]
+                                                <-Reducer 21 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                  PARTITION_ONLY_SHUFFLE [RS_430]
+                                                    Select Operator [SEL_429] (rows=1 width=8)
+                                                      Filter Operator [FIL_428] (rows=1 width=8)
+                                                        predicate:(sq_count_check(_col0) <= 1)
+                                                        Group By Operator [GBY_427] (rows=1 width=8)
+                                                          Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                                        <-Map 20 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                          PARTITION_ONLY_SHUFFLE [RS_426]
+                                                            Group By Operator [GBY_425] (rows=1 width=8)
+                                                              Output:["_col0"],aggregations:["count()"]
+                                                              Select Operator [SEL_424] (rows=1 width=94)
+                                                                Filter Operator [FIL_423] (rows=1 width=94)
+                                                                  predicate:(d_date = '1998-02-19')
+                                                                  TableScan [TS_9] (rows=73049 width=94)
+                                                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date"]
+                              <-Reducer 12 [SIMPLE_EDGE]
+                                SHUFFLE [RS_142]
+                                  PartitionCols:_col0
+                                  Merge Join Operator [MERGEJOIN_411] (rows=143966864 width=215)
+                                    Conds:RS_464._col1=RS_448._col0(Inner),Output:["_col0","_col2","_col4"]
+                                  <-Map 8 [SIMPLE_EDGE] vectorized
+                                    SHUFFLE [RS_448]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_445] (rows=462000 width=104)
+                                        Output:["_col0","_col1"]
+                                        Filter Operator [FIL_444] (rows=462000 width=104)
+                                          predicate:(i_item_id is not null and i_item_sk is not null)
+                                          TableScan [TS_3] (rows=462000 width=104)
+                                            default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
+                                  <-Map 27 [SIMPLE_EDGE] vectorized
+                                    SHUFFLE [RS_464]
+                                      PartitionCols:_col1
+                                      Select Operator [SEL_463] (rows=143966864 width=119)
+                                        Output:["_col0","_col1","_col2"]
+                                        Filter Operator [FIL_462] (rows=143966864 width=119)
+                                          predicate:((ws_sold_date_sk BETWEEN DynamicValue(RS_143_date_dim_d_date_sk_min) AND DynamicValue(RS_143_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_143_date_dim_d_date_sk_bloom_filter))) and ws_item_sk is not null and ws_sold_date_sk is not null)
+                                          TableScan [TS_100] (rows=144002668 width=119)
+                                            default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_ext_sales_price"]
+                                          <-Reducer 19 [BROADCAST_EDGE] vectorized
+                                            BROADCAST [RS_461]
+                                              Group By Operator [GBY_460] (rows=1 width=12)
+                                                Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                              <-Reducer 16 [CUSTOM_SIMPLE_EDGE]
+                                                SHUFFLE [RS_363]
+                                                  Group By Operator [GBY_362] (rows=1 width=12)
+                                                    Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                    Select Operator [SEL_361] (rows=2 width=4)
+                                                      Output:["_col0"]
+                                                       Please refer to the previous Merge Join Operator [MERGEJOIN_406]
                   <-Reducer 5 [ONE_TO_ONE_EDGE]
                     FORWARD [RS_155]
                       PartitionCols:_col0
-                      Filter Operator [FIL_153] (rows=1 width=324)
-                        predicate:(_col1 BETWEEN (0.9 * _col3) AND (1.1 * _col3) and _col3 BETWEEN (0.9 * _col1) AND (1.1 * _col1))
-                        Merge Join Operator [MERGEJOIN_418] (rows=68 width=324)
-                          Conds:RS_450._col0=RS_457._col0(Inner),Output:["_col0","_col1","_col3"]
+                      Filter Operator [FIL_153] (rows=1 width=772)
+                        predicate:(_col1 BETWEEN _col6 AND _col7 and _col5 BETWEEN _col2 AND _col3)
+                        Merge Join Operator [MERGEJOIN_418] (rows=68 width=772)
+                          Conds:RS_451._col0=RS_459._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col7"]
                         <-Reducer 11 [ONE_TO_ONE_EDGE] vectorized
-                          FORWARD [RS_457]
+                          FORWARD [RS_459]
                             PartitionCols:_col0
-                            Group By Operator [GBY_456] (rows=69 width=212)
-                              Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                            <-Reducer 10 [SIMPLE_EDGE]
-                              SHUFFLE [RS_97]
-                                PartitionCols:_col0
-                                Group By Operator [GBY_96] (rows=69 width=212)
-                                  Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
-                                  Merge Join Operator [MERGEJOIN_416] (rows=120498 width=100)
-                                    Conds:RS_92._col0=RS_93._col0(Inner),Output:["_col2","_col4"]
-                                  <-Reducer 16 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_93]
-                                      PartitionCols:_col0
-                                       Please refer to the previous Merge Join Operator [MERGEJOIN_406]
-                                  <-Reducer 9 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_92]
-                                      PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_407] (rows=550076554 width=210)
-                                        Conds:RS_455._col1=RS_447._col0(Inner),Output:["_col0","_col2","_col4"]
-                                      <-Map 8 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_447]
-                                          PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_445]
-                                      <-Map 26 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_455]
-                                          PartitionCols:_col1
-                                          Select Operator [SEL_454] (rows=550076554 width=114)
-                                            Output:["_col0","_col1","_col2"]
-                                            Filter Operator [FIL_453] (rows=550076554 width=114)
-                                              predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_93_date_dim_d_date_sk_min) AND DynamicValue(RS_93_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_93_date_dim_d_date_sk_bloom_filter))) and ss_item_sk is not null and ss_sold_date_sk is not null)
-                                              TableScan [TS_50] (rows=575995635 width=114)
-                                                default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_ext_sales_price"]
-                                              <-Reducer 18 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_452]
-                                                  Group By Operator [GBY_451] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                  <-Reducer 16 [CUSTOM_SIMPLE_EDGE]
-                                                    SHUFFLE [RS_317]
-                                                      Group By Operator [GBY_316] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_315] (rows=2 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Merge Join Operator [MERGEJOIN_406]
+                            Select Operator [SEL_458] (rows=69 width=436)
+                              Output:["_col0","_col1","_col2","_col3"]
+                              Group By Operator [GBY_457] (rows=69 width=212)
+                                Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                              <-Reducer 10 [SIMPLE_EDGE]
+                                SHUFFLE [RS_97]
+                                  PartitionCols:_col0
+                                  Group By Operator [GBY_96] (rows=69 width=212)
+                                    Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                                    Merge Join Operator [MERGEJOIN_416] (rows=120498 width=100)
+                                      Conds:RS_92._col0=RS_93._col0(Inner),Output:["_col2","_col4"]
+                                    <-Reducer 16 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_93]
+                                        PartitionCols:_col0
+                                         Please refer to the previous Merge Join Operator [MERGEJOIN_406]
+                                    <-Reducer 9 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_92]
+                                        PartitionCols:_col0
+                                        Merge Join Operator [MERGEJOIN_407] (rows=550076554 width=210)
+                                          Conds:RS_456._col1=RS_447._col0(Inner),Output:["_col0","_col2","_col4"]
+                                        <-Map 8 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_447]
+                                            PartitionCols:_col0
+                                             Please refer to the previous Select Operator [SEL_445]
+                                        <-Map 26 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_456]
+                                            PartitionCols:_col1
+                                            Select Operator [SEL_455] (rows=550076554 width=114)
+                                              Output:["_col0","_col1","_col2"]
+                                              Filter Operator [FIL_454] (rows=550076554 width=114)
+                                                predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_93_date_dim_d_date_sk_min) AND DynamicValue(RS_93_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_93_date_dim_d_date_sk_bloom_filter))) and ss_item_sk is not null and ss_sold_date_sk is not null)
+                                                TableScan [TS_50] (rows=575995635 width=114)
+                                                  default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_ext_sales_price"]
+                                                <-Reducer 18 [BROADCAST_EDGE] vectorized
+                                                  BROADCAST [RS_453]
+                                                    Group By Operator [GBY_452] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                    <-Reducer 16 [CUSTOM_SIMPLE_EDGE]
+                                                      SHUFFLE [RS_317]
+                                                        Group By Operator [GBY_316] (rows=1 width=12)
+                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                          Select Operator [SEL_315] (rows=2 width=4)
+                                                            Output:["_col0"]
+                                                             Please refer to the previous Merge Join Operator [MERGEJOIN_406]
                         <-Reducer 4 [ONE_TO_ONE_EDGE] vectorized
-                          FORWARD [RS_450]
+                          FORWARD [RS_451]
                             PartitionCols:_col0
-                            Group By Operator [GBY_449] (rows=68 width=212)
-                              Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                            <-Reducer 3 [SIMPLE_EDGE]
-                              SHUFFLE [RS_47]
-                                PartitionCols:_col0
-                                Group By Operator [GBY_46] (rows=68 width=212)
-                                  Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
-                                  Merge Join Operator [MERGEJOIN_415] (rows=62327 width=100)
-                                    Conds:RS_42._col0=RS_43._col0(Inner),Output:["_col2","_col4"]
-                                  <-Reducer 16 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_43]
-                                      PartitionCols:_col0
-                                       Please refer to the previous Merge Join Operator [MERGEJOIN_406]
-                                  <-Reducer 2 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_42]
-                                      PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_403] (rows=286549727 width=215)
-                                        Conds:RS_443._col1=RS_446._col0(Inner),Output:["_col0","_col2","_col4"]
-                                      <-Map 8 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_446]
-                                          PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_445]
-                                      <-Map 1 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_443]
-                                          PartitionCols:_col1
-                                          Select Operator [SEL_442] (rows=286549727 width=119)
-                                            Output:["_col0","_col1","_col2"]
-                                            Filter Operator [FIL_441] (rows=286549727 width=119)
-                                              predicate:((cs_sold_date_sk BETWEEN DynamicValue(RS_43_date_dim_d_date_sk_min) AND DynamicValue(RS_43_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_43_date_dim_d_date_sk_bloom_filter))) and cs_item_sk is not null and cs_sold_date_sk is not null)
-                                              TableScan [TS_0] (rows=287989836 width=119)
-                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_item_sk","cs_ext_sales_price"]
-                                              <-Reducer 17 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_440]
-                                                  Group By Operator [GBY_439] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                  <-Reducer 16 [CUSTOM_SIMPLE_EDGE]
-                                                    SHUFFLE [RS_267]
-                                                      Group By Operator [GBY_266] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_265] (rows=2 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Merge Join Operator [MERGEJOIN_406]
+                            Select Operator [SEL_450] (rows=68 width=436)
+                              Output:["_col0","_col1","_col2","_col3"]
+                              Group By Operator [GBY_449] (rows=68 width=212)
+                                Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                              <-Reducer 3 [SIMPLE_EDGE]
+                                SHUFFLE [RS_47]
+                                  PartitionCols:_col0
+                                  Group By Operator [GBY_46] (rows=68 width=212)
+                                    Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                                    Merge Join Operator [MERGEJOIN_415] (rows=62327 width=100)
+                                      Conds:RS_42._col0=RS_43._col0(Inner),Output:["_col2","_col4"]
+                                    <-Reducer 16 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_43]
+                                        PartitionCols:_col0
+                                         Please refer to the previous Merge Join Operator [MERGEJOIN_406]
+                                    <-Reducer 2 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_42]
+                                        PartitionCols:_col0
+                                        Merge Join Operator [MERGEJOIN_403] (rows=286549727 width=215)
+                                          Conds:RS_443._col1=RS_446._col0(Inner),Output:["_col0","_col2","_col4"]
+                                        <-Map 8 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_446]
+                                            PartitionCols:_col0
+                                             Please refer to the previous Select Operator [SEL_445]
+                                        <-Map 1 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_443]
+                                            PartitionCols:_col1
+                                            Select Operator [SEL_442] (rows=286549727 width=119)
+                                              Output:["_col0","_col1","_col2"]
+                                              Filter Operator [FIL_441] (rows=286549727 width=119)
+                                                predicate:((cs_sold_date_sk BETWEEN DynamicValue(RS_43_date_dim_d_date_sk_min) AND DynamicValue(RS_43_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_43_date_dim_d_date_sk_bloom_filter))) and cs_item_sk is not null and cs_sold_date_sk is not null)
+                                                TableScan [TS_0] (rows=287989836 width=119)
+                                                  default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_item_sk","cs_ext_sales_price"]
+                                                <-Reducer 17 [BROADCAST_EDGE] vectorized
+                                                  BROADCAST [RS_440]
+                                                    Group By Operator [GBY_439] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                    <-Reducer 16 [CUSTOM_SIMPLE_EDGE]
+                                                      SHUFFLE [RS_267]
+                                                        Group By Operator [GBY_266] (rows=1 width=12)
+                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                          Select Operator [SEL_265] (rows=2 width=4)
+                                                            Output:["_col0"]
+                                                             Please refer to the previous Merge Join Operator [MERGEJOIN_406]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query59.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query59.q.out b/ql/src/test/results/clientpositive/perf/tez/query59.q.out
index 2ac474a..d325a95 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query59.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query59.q.out
@@ -95,78 +95,79 @@ POSTHOOK: Output: hdfs://### HDFS PATH ###
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 10 <- Map 14 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 11 (SIMPLE_EDGE)
+Reducer 10 <- Map 13 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
+Reducer 11 <- Map 15 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 12 (SIMPLE_EDGE)
 Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Map 12 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
-Reducer 5 <- Map 13 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
-Reducer 6 <- Reducer 10 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
+Reducer 4 <- Map 13 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Map 14 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 11 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
 Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
-Reducer 8 <- Reducer 2 (SIMPLE_EDGE)
-Reducer 9 <- Map 12 (SIMPLE_EDGE), Reducer 8 (SIMPLE_EDGE)
+Reducer 8 <- Map 1 (SIMPLE_EDGE), Map 12 (SIMPLE_EDGE)
+Reducer 9 <- Reducer 8 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
     limit:100
     Stage-1
       Reducer 7 vectorized
-      File Output Operator [FS_208]
-        Limit [LIM_207] (rows=100 width=976)
+      File Output Operator [FS_211]
+        Limit [LIM_210] (rows=100 width=976)
           Number of rows:100
-          Select Operator [SEL_206] (rows=1012347 width=976)
+          Select Operator [SEL_209] (rows=1012347 width=976)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
           <-Reducer 6 [SIMPLE_EDGE]
             SHUFFLE [RS_59]
               Select Operator [SEL_58] (rows=1012347 width=976)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
                 Merge Join Operator [MERGEJOIN_183] (rows=1012347 width=1648)
-                  Conds:RS_55._col12, _col0=RS_56._col1, (_col0 - 52)(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col12","_col13","_col16","_col17","_col18","_col19","_col20","_col21"]
-                <-Reducer 10 [SIMPLE_EDGE]
+                  Conds:RS_55._col11, _col0=RS_56._col1, (_col0 - 52)(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col11","_col12","_col15","_col16","_col17","_col18","_col19","_col20"]
+                <-Reducer 11 [SIMPLE_EDGE]
                   SHUFFLE [RS_56]
                     PartitionCols:_col1, (_col0 - 52)
                     Select Operator [SEL_48] (rows=28847 width=776)
                       Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
                       Merge Join Operator [MERGEJOIN_182] (rows=28847 width=776)
-                        Conds:RS_45._col1=RS_205._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6","_col7","_col11"]
-                      <-Map 14 [SIMPLE_EDGE] vectorized
-                        SHUFFLE [RS_205]
+                        Conds:RS_45._col1=RS_208._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6","_col7","_col10"]
+                      <-Map 15 [SIMPLE_EDGE] vectorized
+                        SHUFFLE [RS_208]
                           PartitionCols:_col0
-                          Select Operator [SEL_204] (rows=1704 width=104)
+                          Select Operator [SEL_207] (rows=1704 width=104)
                             Output:["_col0","_col1"]
-                            Filter Operator [FIL_203] (rows=1704 width=104)
+                            Filter Operator [FIL_206] (rows=1704 width=104)
                               predicate:(s_store_id is not null and s_store_sk is not null)
                               TableScan [TS_39] (rows=1704 width=104)
                                 default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_id"]
-                      <-Reducer 9 [SIMPLE_EDGE]
+                      <-Reducer 10 [SIMPLE_EDGE]
                         SHUFFLE [RS_45]
                           PartitionCols:_col1
                           Merge Join Operator [MERGEJOIN_181] (rows=28847 width=676)
-                            Conds:RS_202._col0=RS_197._col1(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                          <-Map 12 [SIMPLE_EDGE] vectorized
-                            SHUFFLE [RS_197]
-                              PartitionCols:_col1
-                              Select Operator [SEL_195] (rows=317 width=8)
-                                Output:["_col1"]
-                                Filter Operator [FIL_193] (rows=317 width=8)
+                            Conds:RS_205._col0=RS_200._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                          <-Map 13 [SIMPLE_EDGE] vectorized
+                            SHUFFLE [RS_200]
+                              PartitionCols:_col0
+                              Select Operator [SEL_198] (rows=317 width=4)
+                                Output:["_col0"]
+                                Filter Operator [FIL_196] (rows=317 width=8)
                                   predicate:(d_month_seq BETWEEN 1197 AND 1208 and d_week_seq is not null)
                                   TableScan [TS_15] (rows=73049 width=8)
                                     default@date_dim,d,Tbl:COMPLETE,Col:COMPLETE,Output:["d_month_seq","d_week_seq"]
-                          <-Reducer 8 [SIMPLE_EDGE] vectorized
-                            SHUFFLE [RS_202]
+                          <-Reducer 9 [SIMPLE_EDGE] vectorized
+                            SHUFFLE [RS_205]
                               PartitionCols:_col0
-                              Group By Operator [GBY_201] (rows=1196832 width=679)
+                              Group By Operator [GBY_204] (rows=1196832 width=679)
                                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)","sum(VALUE._col4)","sum(VALUE._col5)"],keys:KEY._col0, KEY._col1
-                              <-Reducer 2 [SIMPLE_EDGE]
+                              <-Reducer 8 [SIMPLE_EDGE]
                                 SHUFFLE [RS_33]
                                   PartitionCols:_col0, _col1
                                   Group By Operator [GBY_32] (rows=525329897 width=679)
                                     Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)","sum(_col3)","sum(_col5)","sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col0, _col1
-                                    Select Operator [SEL_30] (rows=525329897 width=205)
+                                    Select Operator [SEL_30] (rows=525329897 width=138)
                                       Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col7","_col8"]
-                                      Merge Join Operator [MERGEJOIN_177] (rows=525329897 width=205)
-                                        Conds:RS_186._col0=RS_189._col0(Inner),Output:["_col1","_col2","_col4","_col5"]
+                                      Merge Join Operator [MERGEJOIN_180] (rows=525329897 width=138)
+                                        Conds:RS_187._col0=RS_192._col0(Inner),Output:["_col1","_col2","_col4","_col5","_col6","_col8","_col9","_col10","_col11"]
                                       <-Map 1 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_186]
+                                        SHUFFLE [RS_187]
                                           PartitionCols:_col0
                                           Select Operator [SEL_185] (rows=525329897 width=114)
                                             Output:["_col0","_col1","_col2"]
@@ -174,26 +175,26 @@ Stage-0
                                               predicate:(ss_sold_date_sk is not null and ss_store_sk is not null)
                                               TableScan [TS_0] (rows=575995635 width=114)
                                                 default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_store_sk","ss_sales_price"]
-                                      <-Map 11 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_189]
+                                      <-Map 12 [SIMPLE_EDGE] vectorized
+                                        SHUFFLE [RS_192]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_188] (rows=73049 width=99)
-                                            Output:["_col0","_col1","_col2"]
-                                            Filter Operator [FIL_187] (rows=73049 width=99)
+                                          Select Operator [SEL_190] (rows=73049 width=36)
+                                            Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col7","_col8"]
+                                            Filter Operator [FIL_188] (rows=73049 width=99)
                                               predicate:(d_date_sk is not null and d_week_seq is not null)
                                               TableScan [TS_3] (rows=73049 width=99)
                                                 default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_week_seq","d_day_name"]
                 <-Reducer 5 [SIMPLE_EDGE]
                   SHUFFLE [RS_55]
-                    PartitionCols:_col12, _col0
+                    PartitionCols:_col11, _col0
                     Merge Join Operator [MERGEJOIN_179] (rows=28847 width=976)
-                      Conds:RS_52._col1=RS_200._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col12","_col13"]
-                    <-Map 13 [SIMPLE_EDGE] vectorized
-                      SHUFFLE [RS_200]
+                      Conds:RS_52._col1=RS_203._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col11","_col12"]
+                    <-Map 14 [SIMPLE_EDGE] vectorized
+                      SHUFFLE [RS_203]
                         PartitionCols:_col0
-                        Select Operator [SEL_199] (rows=1704 width=192)
+                        Select Operator [SEL_202] (rows=1704 width=192)
                           Output:["_col0","_col1","_col2"]
-                          Filter Operator [FIL_198] (rows=1704 width=192)
+                          Filter Operator [FIL_201] (rows=1704 width=192)
                             predicate:(s_store_id is not null and s_store_sk is not null)
                             TableScan [TS_18] (rows=1704 width=192)
                               default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_id","s_store_name"]
@@ -201,26 +202,37 @@ Stage-0
                       SHUFFLE [RS_52]
                         PartitionCols:_col1
                         Merge Join Operator [MERGEJOIN_178] (rows=28847 width=788)
-                          Conds:RS_191._col0=RS_196._col1(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
-                        <-Map 12 [SIMPLE_EDGE] vectorized
-                          SHUFFLE [RS_196]
-                            PartitionCols:_col1
-                            Select Operator [SEL_194] (rows=317 width=8)
-                              Output:["_col1"]
-                              Filter Operator [FIL_192] (rows=317 width=8)
+                          Conds:RS_194._col0=RS_199._col0(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                        <-Map 13 [SIMPLE_EDGE] vectorized
+                          SHUFFLE [RS_199]
+                            PartitionCols:_col0
+                            Select Operator [SEL_197] (rows=317 width=4)
+                              Output:["_col0"]
+                              Filter Operator [FIL_195] (rows=317 width=8)
                                 predicate:(d_month_seq BETWEEN 1185 AND 1196 and d_week_seq is not null)
                                  Please refer to the previous TableScan [TS_15]
                         <-Reducer 3 [SIMPLE_EDGE] vectorized
-                          SHUFFLE [RS_191]
+                          SHUFFLE [RS_194]
                             PartitionCols:_col0
-                            Group By Operator [GBY_190] (rows=1196832 width=791)
+                            Group By Operator [GBY_193] (rows=1196832 width=791)
                               Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)","sum(VALUE._col4)","sum(VALUE._col5)","sum(VALUE._col6)"],keys:KEY._col0, KEY._col1
                             <-Reducer 2 [SIMPLE_EDGE]
                               SHUFFLE [RS_12]
                                 PartitionCols:_col0, _col1
                                 Group By Operator [GBY_11] (rows=525329897 width=791)
                                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)","sum(_col5)","sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col0, _col1
-                                  Select Operator [SEL_9] (rows=525329897 width=205)
+                                  Select Operator [SEL_9] (rows=525329897 width=142)
                                     Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
-                                     Please refer to the previous Merge Join Operator [MERGEJOIN_177]
+                                    Merge Join Operator [MERGEJOIN_177] (rows=525329897 width=142)
+                                      Conds:RS_186._col0=RS_191._col0(Inner),Output:["_col1","_col2","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
+                                    <-Map 1 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_186]
+                                        PartitionCols:_col0
+                                         Please refer to the previous Select Operator [SEL_185]
+                                    <-Map 12 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_191]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_189] (rows=73049 width=36)
+                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                                           Please refer to the previous Filter Operator [FIL_188]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query6.q.out b/ql/src/test/results/clientpositive/perf/tez/query6.q.out
index 7de4229..0ca7039 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query6.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query6.q.out
@@ -107,12 +107,12 @@ Stage-0
                           Select Operator [SEL_212] (rows=154000 width=227)
                             Output:["_col0"]
                             Filter Operator [FIL_211] (rows=154000 width=227)
-                              predicate:(_col4 > (1.2 * CAST( _col0 AS decimal(16,6))))
+                              predicate:(_col4 > _col1)
                               Map Join Operator [MAPJOIN_210] (rows=462000 width=227)
-                                Conds:RS_207._col1=SEL_209._col2(Inner),HybridGraceHashJoin:true,Output:["_col0","_col3","_col4"]
+                                Conds:RS_207._col0=SEL_209._col2(Inner),HybridGraceHashJoin:true,Output:["_col1","_col3","_col4"]
                               <-Reducer 15 [BROADCAST_EDGE] vectorized
                                 BROADCAST [RS_207]
-                                  PartitionCols:_col1
+                                  PartitionCols:_col0
                                   Map Join Operator [MAPJOIN_206] (rows=10 width=202)
                                     Conds:(Inner),Output:["_col0","_col1"]
                                   <-Reducer 5 [BROADCAST_EDGE] vectorized

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query60.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query60.q.out b/ql/src/test/results/clientpositive/perf/tez/query60.q.out
index f94101a..8a499c8 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query60.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query60.q.out
@@ -226,9 +226,9 @@ Stage-0
                           SHUFFLE [RS_71]
                             PartitionCols:_col0
                             Group By Operator [GBY_70] (rows=1717 width=212)
-                              Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                              Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col1
                               Merge Join Operator [MERGEJOIN_304] (rows=746132 width=100)
-                                Conds:RS_66._col0=RS_67._col4(Inner),Output:["_col1","_col8"]
+                                Conds:RS_66._col0=RS_67._col3(Inner),Output:["_col1","_col7"]
                               <-Reducer 2 [SIMPLE_EDGE]
                                 SHUFFLE [RS_66]
                                   PartitionCols:_col0
@@ -261,15 +261,15 @@ Stage-0
                                                   default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_id","i_category"]
                               <-Reducer 23 [SIMPLE_EDGE]
                                 SHUFFLE [RS_67]
-                                  PartitionCols:_col4
+                                  PartitionCols:_col3
                                   Select Operator [SEL_62] (rows=1550375 width=13)
-                                    Output:["_col4","_col5"]
+                                    Output:["_col3","_col4"]
                                     Merge Join Operator [MERGEJOIN_299] (rows=1550375 width=13)
                                       Conds:RS_59._col1=RS_350._col0(Inner),Output:["_col2","_col3"]
                                     <-Map 28 [SIMPLE_EDGE] vectorized
                                       PARTITION_ONLY_SHUFFLE [RS_350]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_347] (rows=8000000 width=116)
+                                        Select Operator [SEL_347] (rows=8000000 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_346] (rows=8000000 width=112)
                                             predicate:((ca_gmt_offset = -6) and ca_address_sk is not null)
@@ -283,7 +283,7 @@ Stage-0
                                         <-Map 20 [SIMPLE_EDGE] vectorized
                                           PARTITION_ONLY_SHUFFLE [RS_334]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_331] (rows=50 width=12)
+                                            Select Operator [SEL_331] (rows=50 width=4)
                                               Output:["_col0"]
                                               Filter Operator [FIL_330] (rows=50 width=12)
                                                 predicate:((d_moy = 9) and (d_year = 1999) and d_date_sk is not null)
@@ -344,18 +344,18 @@ Stage-0
                           SHUFFLE [RS_109]
                             PartitionCols:_col0
                             Group By Operator [GBY_108] (rows=1717 width=212)
-                              Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                              Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col1
                               Merge Join Operator [MERGEJOIN_305] (rows=379339 width=201)
-                                Conds:RS_104._col0=RS_105._col3(Inner),Output:["_col1","_col8"]
+                                Conds:RS_104._col0=RS_105._col2(Inner),Output:["_col1","_col7"]
                               <-Reducer 2 [SIMPLE_EDGE]
                                 SHUFFLE [RS_104]
                                   PartitionCols:_col0
                                    Please refer to the previous Merge Join Operator [MERGEJOIN_294]
                               <-Reducer 26 [SIMPLE_EDGE]
                                 SHUFFLE [RS_105]
-                                  PartitionCols:_col3
+                                  PartitionCols:_col2
                                   Select Operator [SEL_100] (rows=788222 width=110)
-                                    Output:["_col3","_col5"]
+                                    Output:["_col2","_col4"]
                                     Merge Join Operator [MERGEJOIN_302] (rows=788222 width=110)
                                       Conds:RS_97._col2=RS_352._col0(Inner),Output:["_col1","_col3"]
                                     <-Map 28 [SIMPLE_EDGE] vectorized
@@ -426,18 +426,18 @@ Stage-0
                           SHUFFLE [RS_34]
                             PartitionCols:_col0
                             Group By Operator [GBY_33] (rows=1717 width=212)
-                              Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                              Output:["_col0","_col1"],aggregations:["sum(_col7)"],keys:_col1
                               Merge Join Operator [MERGEJOIN_303] (rows=1384530 width=100)
-                                Conds:RS_29._col0=RS_30._col3(Inner),Output:["_col1","_col8"]
+                                Conds:RS_29._col0=RS_30._col2(Inner),Output:["_col1","_col7"]
                               <-Reducer 2 [SIMPLE_EDGE]
                                 SHUFFLE [RS_29]
                                   PartitionCols:_col0
                                    Please refer to the previous Merge Join Operator [MERGEJOIN_294]
                               <-Reducer 19 [SIMPLE_EDGE]
                                 SHUFFLE [RS_30]
-                                  PartitionCols:_col3
+                                  PartitionCols:_col2
                                   Select Operator [SEL_25] (rows=2876890 width=4)
-                                    Output:["_col3","_col5"]
+                                    Output:["_col2","_col4"]
                                     Merge Join Operator [MERGEJOIN_296] (rows=2876890 width=4)
                                       Conds:RS_22._col2=RS_348._col0(Inner),Output:["_col1","_col3"]
                                     <-Map 28 [SIMPLE_EDGE] vectorized

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query61.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query61.q.out b/ql/src/test/results/clientpositive/perf/tez/query61.q.out
index dc18d84..0e3ebf7 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query61.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query61.q.out
@@ -152,9 +152,9 @@ Stage-0
                     <-Reducer 3 [CUSTOM_SIMPLE_EDGE]
                       PARTITION_ONLY_SHUFFLE [RS_42]
                         Group By Operator [GBY_41] (rows=1 width=112)
-                          Output:["_col0"],aggregations:["sum(_col9)"]
+                          Output:["_col0"],aggregations:["sum(_col8)"]
                           Merge Join Operator [MERGEJOIN_264] (rows=505397 width=0)
-                            Conds:RS_37._col0=RS_38._col2(Inner),Output:["_col9"]
+                            Conds:RS_37._col0=RS_38._col2(Inner),Output:["_col8"]
                           <-Reducer 2 [SIMPLE_EDGE]
                             SHUFFLE [RS_37]
                               PartitionCols:_col0
@@ -172,7 +172,7 @@ Stage-0
                               <-Map 11 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_272]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_271] (rows=8000000 width=116)
+                                  Select Operator [SEL_271] (rows=8000000 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_270] (rows=8000000 width=112)
                                       predicate:((ca_gmt_offset = -7) and ca_address_sk is not null)
@@ -186,7 +186,7 @@ Stage-0
                               <-Map 29 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_316]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_315] (rows=2300 width=259)
+                                  Select Operator [SEL_315] (rows=2300 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_314] (rows=2300 width=259)
                                       predicate:(((p_channel_dmail = 'Y') or (p_channel_email = 'Y') or (p_channel_tv = 'Y')) and p_promo_sk is not null)
@@ -200,7 +200,7 @@ Stage-0
                                   <-Map 26 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_299]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_298] (rows=341 width=116)
+                                      Select Operator [SEL_298] (rows=341 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_297] (rows=341 width=115)
                                           predicate:((s_gmt_offset = -7) and s_store_sk is not null)
@@ -214,7 +214,7 @@ Stage-0
                                       <-Map 23 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_287]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_286] (rows=46200 width=99)
+                                          Select Operator [SEL_286] (rows=46200 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_285] (rows=46200 width=94)
                                               predicate:((i_category = 'Electronics') and i_item_sk is not null)
@@ -228,7 +228,7 @@ Stage-0
                                           <-Map 17 [SIMPLE_EDGE] vectorized
                                             PARTITION_ONLY_SHUFFLE [RS_275]
                                               PartitionCols:_col0
-                                              Select Operator [SEL_274] (rows=50 width=12)
+                                              Select Operator [SEL_274] (rows=50 width=4)
                                                 Output:["_col0"]
                                                 Filter Operator [FIL_273] (rows=50 width=12)
                                                   predicate:((d_moy = 11) and (d_year = 1999) and d_date_sk is not null)
@@ -294,9 +294,9 @@ Stage-0
                     <-Reducer 8 [CUSTOM_SIMPLE_EDGE]
                       PARTITION_ONLY_SHUFFLE [RS_81]
                         Group By Operator [GBY_80] (rows=1 width=112)
-                          Output:["_col0"],aggregations:["sum(_col8)"]
+                          Output:["_col0"],aggregations:["sum(_col7)"]
                           Merge Join Operator [MERGEJOIN_265] (rows=529208 width=0)
-                            Conds:RS_76._col0=RS_77._col2(Inner),Output:["_col8"]
+                            Conds:RS_76._col0=RS_77._col2(Inner),Output:["_col7"]
                           <-Reducer 2 [SIMPLE_EDGE]
                             SHUFFLE [RS_76]
                               PartitionCols:_col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query63.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query63.q.out b/ql/src/test/results/clientpositive/perf/tez/query63.q.out
index 2b6b4d2..c01ba03 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query63.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query63.q.out
@@ -104,9 +104,9 @@ Stage-0
                           SHUFFLE [RS_23]
                             PartitionCols:_col0
                             Group By Operator [GBY_22] (rows=130 width=120)
-                              Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col8, _col11
+                              Output:["_col0","_col1","_col2"],aggregations:["sum(_col3)"],keys:_col5, _col7
                               Merge Join Operator [MERGEJOIN_84] (rows=98800 width=8)
-                                Conds:RS_18._col2=RS_106._col0(Inner),Output:["_col3","_col8","_col11"]
+                                Conds:RS_18._col2=RS_106._col0(Inner),Output:["_col3","_col5","_col7"]
                               <-Map 11 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_106]
                                   PartitionCols:_col0
@@ -120,12 +120,12 @@ Stage-0
                                 SHUFFLE [RS_18]
                                   PartitionCols:_col2
                                   Merge Join Operator [MERGEJOIN_83] (rows=98800 width=8)
-                                    Conds:RS_15._col0=RS_95._col0(Inner),Output:["_col2","_col3","_col8","_col11"]
+                                    Conds:RS_15._col0=RS_95._col0(Inner),Output:["_col2","_col3","_col5","_col7"]
                                   <-Map 9 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_95]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_94] (rows=317 width=12)
-                                        Output:["_col0","_col2"]
+                                      Select Operator [SEL_94] (rows=317 width=8)
+                                        Output:["_col0","_col1"]
                                         Filter Operator [FIL_93] (rows=317 width=12)
                                           predicate:((d_month_seq) IN (1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1223) and d_date_sk is not null)
                                           TableScan [TS_6] (rows=73049 width=12)
@@ -134,12 +134,12 @@ Stage-0
                                     SHUFFLE [RS_15]
                                       PartitionCols:_col0
                                       Merge Join Operator [MERGEJOIN_82] (rows=569118 width=4)
-                                        Conds:RS_103._col1=RS_87._col0(Inner),Output:["_col0","_col2","_col3","_col8"]
+                                        Conds:RS_103._col1=RS_87._col0(Inner),Output:["_col0","_col2","_col3","_col5"]
                                       <-Map 7 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_87]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_86] (rows=52 width=290)
-                                            Output:["_col0","_col4"]
+                                          Select Operator [SEL_86] (rows=52 width=8)
+                                            Output:["_col0","_col1"]
                                             Filter Operator [FIL_85] (rows=52 width=290)
                                               predicate:((((i_category) IN ('Books', 'Children', 'Electronics') and (i_class) IN ('personal', 'portable', 'refernece', 'self-help') and (i_brand) IN ('scholaramalgamalg #14', 'scholaramalgamalg #7', 'exportiunivamalg #9', 'scholaramalgamalg #9')) or ((i_category) IN ('Women', 'Music', 'Men') and (i_class) IN ('accessories', 'classical', 'fragrances', 'pants') and (i_brand) IN ('amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'importoamalg #1'))) and (i_brand) IN ('scholaramalgamalg #14', 'scholaramalgamalg #7', 'exportiunivamalg #9', 'scholaramalgamalg #9', 'amalgimporto #1', 'edu packscholar #1', 'exportiimporto #1', 'importoamalg #1') and (i_category) IN ('Books', 'Children', 'Electronics', 'Women', 'Music', 'Men') and (i_class) IN ('personal', 'portable', 'refernece', 'self-help', 'accessories', 'classical', 'fragrances', 'pants') and i_item_sk is not null)
                                               TableScan [TS_3] (rows=462000 width=289)


[28/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query26.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query26.q.out b/ql/src/test/results/clientpositive/perf/spark/query26.q.out
index b6ee41e..48c0e11 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query26.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query26.q.out
@@ -221,11 +221,11 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col4, _col5, _col6, _col7, _col18
+                outputColumnNames: _col4, _col5, _col6, _col7, _col12
                 Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col4), count(_col4), sum(_col5), count(_col5), sum(_col7), count(_col7), sum(_col6), count(_col6)
-                  keys: _col18 (type: string)
+                  keys: _col12 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                   Statistics: Num rows: 421645953 Data size: 57099332415 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query27.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query27.q.out b/ql/src/test/results/clientpositive/perf/spark/query27.q.out
index 4063c4f..6c64664 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query27.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query27.q.out
@@ -207,7 +207,7 @@ STAGE PLANS:
                   keys:
                     0 _col3 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col1, _col4, _col5, _col6, _col7, _col15
+                  outputColumnNames: _col1, _col4, _col5, _col6, _col7, _col11
                   input vertices:
                     1 Map 9
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
@@ -216,7 +216,7 @@ STAGE PLANS:
                     sort order: +
                     Map-reduce partition columns: _col1 (type: int)
                     Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col15 (type: string)
+                    value expressions: _col4 (type: int), _col5 (type: decimal(7,2)), _col6 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col11 (type: string)
         Reducer 4 
             Reduce Operator Tree:
               Join Operator
@@ -225,10 +225,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col4, _col5, _col6, _col7, _col15, _col17
+                outputColumnNames: _col4, _col5, _col6, _col7, _col11, _col13
                 Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col17 (type: string), _col15 (type: string), _col4 (type: int), _col5 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col6 (type: decimal(7,2))
+                  expressions: _col13 (type: string), _col11 (type: string), _col4 (type: int), _col5 (type: decimal(7,2)), _col7 (type: decimal(7,2)), _col6 (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                   Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query29.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query29.q.out b/ql/src/test/results/clientpositive/perf/spark/query29.q.out
index 2e5c0f3..f4a4524 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query29.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query29.q.out
@@ -295,7 +295,7 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col5, _col10, _col11, _col13, _col18, _col19
+                outputColumnNames: _col3, _col5, _col8, _col9, _col11, _col14, _col15
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -303,20 +303,20 @@ STAGE PLANS:
                   keys:
                     0 _col3 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col5, _col10, _col11, _col13, _col18, _col19, _col21, _col22
+                  outputColumnNames: _col5, _col8, _col9, _col11, _col14, _col15, _col17, _col18
                   input vertices:
                     1 Map 16
                   Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col18 (type: string), _col19 (type: string), _col5 (type: int), _col10 (type: int), _col11 (type: int), _col13 (type: int), _col21 (type: string), _col22 (type: string)
-                    outputColumnNames: _col1, _col2, _col8, _col13, _col14, _col16, _col21, _col22
+                    expressions: _col14 (type: string), _col15 (type: string), _col5 (type: int), _col8 (type: int), _col9 (type: int), _col11 (type: int), _col17 (type: string), _col18 (type: string)
+                    outputColumnNames: _col1, _col2, _col8, _col11, _col12, _col14, _col17, _col18
                     Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col14 (type: int), _col13 (type: int)
+                      key expressions: _col11 (type: int), _col12 (type: int)
                       sort order: ++
-                      Map-reduce partition columns: _col14 (type: int), _col13 (type: int)
+                      Map-reduce partition columns: _col11 (type: int), _col12 (type: int)
                       Statistics: Num rows: 843315281 Data size: 74397518956 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: string), _col2 (type: string), _col8 (type: int), _col16 (type: int), _col21 (type: string), _col22 (type: string)
+                      value expressions: _col1 (type: string), _col2 (type: string), _col8 (type: int), _col14 (type: int), _col17 (type: string), _col18 (type: string)
         Reducer 13 
             Reduce Operator Tree:
               Join Operator
@@ -344,9 +344,9 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col2, _col3
                 Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col1 (type: int), _col2 (type: int)
+                  key expressions: _col2 (type: int), _col1 (type: int)
                   sort order: ++
-                  Map-reduce partition columns: _col1 (type: int), _col2 (type: int)
+                  Map-reduce partition columns: _col2 (type: int), _col1 (type: int)
                   Statistics: Num rows: 316788826 Data size: 42899570777 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col3 (type: int)
         Reducer 3 
@@ -355,13 +355,13 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: int), _col2 (type: int)
-                  1 _col14 (type: int), _col13 (type: int)
-                outputColumnNames: _col3, _col7, _col8, _col14, _col22, _col27, _col28
+                  0 _col2 (type: int), _col1 (type: int)
+                  1 _col11 (type: int), _col12 (type: int)
+                outputColumnNames: _col3, _col6, _col7, _col13, _col19, _col22, _col23
                 Statistics: Num rows: 927646829 Data size: 81837272625 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col14), sum(_col22), sum(_col3)
-                  keys: _col7 (type: string), _col8 (type: string), _col27 (type: string), _col28 (type: string)
+                  aggregations: sum(_col13), sum(_col19), sum(_col3)
+                  keys: _col6 (type: string), _col7 (type: string), _col22 (type: string), _col23 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
                   Statistics: Num rows: 927646829 Data size: 81837272625 Basic stats: COMPLETE Column stats: NONE
@@ -428,14 +428,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int), _col2 (type: int), _col4 (type: int)
                   1 _col1 (type: int), _col2 (type: int), _col3 (type: int)
-                outputColumnNames: _col1, _col3, _col5, _col10, _col11, _col13
+                outputColumnNames: _col1, _col3, _col5, _col8, _col9, _col11
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col3 (type: int), _col5 (type: int), _col10 (type: int), _col11 (type: int), _col13 (type: int)
+                  value expressions: _col3 (type: int), _col5 (type: int), _col8 (type: int), _col9 (type: int), _col11 (type: int)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query3.q.out b/ql/src/test/results/clientpositive/perf/spark/query3.q.out
index b2e4b9d..b2ddbf0 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query3.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query3.q.out
@@ -144,11 +144,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col4, _col5, _col8
+                outputColumnNames: _col2, _col4, _col5, _col7
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col8 (type: int), _col4 (type: int), _col5 (type: string)
+                  keys: _col7 (type: int), _col4 (type: int), _col5 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query30.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query30.q.out b/ql/src/test/results/clientpositive/perf/spark/query30.q.out
index 7566e9a..ed8f97b 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query30.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query30.q.out
@@ -292,11 +292,11 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col7
+                outputColumnNames: _col1, _col3, _col6
                 Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col3)
-                  keys: _col7 (type: string), _col1 (type: int)
+                  keys: _col6 (type: string), _col1 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
@@ -359,10 +359,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col18
+                outputColumnNames: _col1, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col17
                 Statistics: Num rows: 96800003 Data size: 83249958789 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col18 (type: decimal(17,2))
+                  expressions: _col1 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: string), _col6 (type: string), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: string), _col11 (type: string), _col12 (type: string), _col13 (type: string), _col17 (type: decimal(17,2))
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
                   Statistics: Num rows: 96800003 Data size: 83249958789 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
@@ -411,11 +411,11 @@ STAGE PLANS:
                 keys:
                   0 _col2 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col7
+                outputColumnNames: _col1, _col3, _col6
                 Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col3)
-                  keys: _col7 (type: string), _col1 (type: int)
+                  keys: _col6 (type: string), _col1 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 44000000 Data size: 44654715780 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query31.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query31.q.out b/ql/src/test/results/clientpositive/perf/spark/query31.q.out
index d14e8c8..27cfadc 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query31.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query31.q.out
@@ -118,56 +118,56 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 10 <- Map 13 (PARTITION-LEVEL SORT, 754), Reducer 9 (PARTITION-LEVEL SORT, 754)
-        Reducer 11 <- Reducer 10 (GROUP, 481)
-        Reducer 15 <- Map 14 (PARTITION-LEVEL SORT, 398), Map 18 (PARTITION-LEVEL SORT, 398)
-        Reducer 16 <- Map 19 (PARTITION-LEVEL SORT, 754), Reducer 15 (PARTITION-LEVEL SORT, 754)
-        Reducer 17 <- Reducer 16 (GROUP, 481)
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 398), Map 6 (PARTITION-LEVEL SORT, 398)
-        Reducer 21 <- Map 20 (PARTITION-LEVEL SORT, 154), Map 25 (PARTITION-LEVEL SORT, 154)
-        Reducer 22 <- Map 26 (PARTITION-LEVEL SORT, 486), Reducer 21 (PARTITION-LEVEL SORT, 486)
-        Reducer 23 <- Reducer 22 (GROUP, 186)
-        Reducer 24 <- Reducer 23 (PARTITION-LEVEL SORT, 278), Reducer 30 (PARTITION-LEVEL SORT, 278), Reducer 36 (PARTITION-LEVEL SORT, 278)
-        Reducer 28 <- Map 27 (PARTITION-LEVEL SORT, 154), Map 31 (PARTITION-LEVEL SORT, 154)
-        Reducer 29 <- Map 32 (PARTITION-LEVEL SORT, 486), Reducer 28 (PARTITION-LEVEL SORT, 486)
-        Reducer 3 <- Map 7 (PARTITION-LEVEL SORT, 754), Reducer 2 (PARTITION-LEVEL SORT, 754)
-        Reducer 30 <- Reducer 29 (GROUP, 186)
-        Reducer 34 <- Map 33 (PARTITION-LEVEL SORT, 154), Map 37 (PARTITION-LEVEL SORT, 154)
-        Reducer 35 <- Map 38 (PARTITION-LEVEL SORT, 486), Reducer 34 (PARTITION-LEVEL SORT, 486)
-        Reducer 36 <- Reducer 35 (GROUP, 186)
-        Reducer 4 <- Reducer 3 (GROUP, 481)
-        Reducer 5 <- Reducer 11 (PARTITION-LEVEL SORT, 925), Reducer 17 (PARTITION-LEVEL SORT, 925), Reducer 24 (PARTITION-LEVEL SORT, 925), Reducer 4 (PARTITION-LEVEL SORT, 925)
-        Reducer 9 <- Map 12 (PARTITION-LEVEL SORT, 398), Map 8 (PARTITION-LEVEL SORT, 398)
+        Reducer 10 <- Map 13 (PARTITION-LEVEL SORT, 486), Reducer 9 (PARTITION-LEVEL SORT, 486)
+        Reducer 11 <- Reducer 10 (GROUP, 186)
+        Reducer 15 <- Map 14 (PARTITION-LEVEL SORT, 154), Map 18 (PARTITION-LEVEL SORT, 154)
+        Reducer 16 <- Map 19 (PARTITION-LEVEL SORT, 486), Reducer 15 (PARTITION-LEVEL SORT, 486)
+        Reducer 17 <- Reducer 16 (GROUP, 186)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 154), Map 6 (PARTITION-LEVEL SORT, 154)
+        Reducer 21 <- Map 20 (PARTITION-LEVEL SORT, 398), Map 25 (PARTITION-LEVEL SORT, 398)
+        Reducer 22 <- Map 26 (PARTITION-LEVEL SORT, 754), Reducer 21 (PARTITION-LEVEL SORT, 754)
+        Reducer 23 <- Reducer 22 (GROUP, 481)
+        Reducer 24 <- Reducer 23 (PARTITION-LEVEL SORT, 721), Reducer 30 (PARTITION-LEVEL SORT, 721), Reducer 36 (PARTITION-LEVEL SORT, 721)
+        Reducer 28 <- Map 27 (PARTITION-LEVEL SORT, 398), Map 31 (PARTITION-LEVEL SORT, 398)
+        Reducer 29 <- Map 32 (PARTITION-LEVEL SORT, 754), Reducer 28 (PARTITION-LEVEL SORT, 754)
+        Reducer 3 <- Map 7 (PARTITION-LEVEL SORT, 486), Reducer 2 (PARTITION-LEVEL SORT, 486)
+        Reducer 30 <- Reducer 29 (GROUP, 481)
+        Reducer 34 <- Map 33 (PARTITION-LEVEL SORT, 398), Map 37 (PARTITION-LEVEL SORT, 398)
+        Reducer 35 <- Map 38 (PARTITION-LEVEL SORT, 754), Reducer 34 (PARTITION-LEVEL SORT, 754)
+        Reducer 36 <- Reducer 35 (GROUP, 481)
+        Reducer 4 <- Reducer 3 (GROUP, 186)
+        Reducer 5 <- Reducer 11 (PARTITION-LEVEL SORT, 807), Reducer 17 (PARTITION-LEVEL SORT, 807), Reducer 24 (PARTITION-LEVEL SORT, 807), Reducer 4 (PARTITION-LEVEL SORT, 807)
+        Reducer 9 <- Map 12 (PARTITION-LEVEL SORT, 154), Map 8 (PARTITION-LEVEL SORT, 154)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: store_sales
-                  filterExpr: (ss_sold_date_sk is not null and ss_addr_sk is not null) (type: boolean)
-                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                  alias: web_sales
+                  filterExpr: (ws_sold_date_sk is not null and ws_bill_addr_sk is not null) (type: boolean)
+                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ss_addr_sk is not null and ss_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (ws_bill_addr_sk is not null and ws_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_addr_sk (type: int), ss_ext_sales_price (type: decimal(7,2))
+                      expressions: ws_sold_date_sk (type: int), ws_bill_addr_sk (type: int), ws_ext_sales_price (type: decimal(7,2))
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: decimal(7,2))
             Execution mode: vectorized
         Map 12 
             Map Operator Tree:
                 TableScan
                   alias: date_dim
-                  filterExpr: ((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                  filterExpr: ((d_qoy = 3) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                   Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                    predicate: ((d_qoy = 3) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_date_sk (type: int)
@@ -202,31 +202,31 @@ STAGE PLANS:
         Map 14 
             Map Operator Tree:
                 TableScan
-                  alias: store_sales
-                  filterExpr: (ss_sold_date_sk is not null and ss_addr_sk is not null) (type: boolean)
-                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                  alias: web_sales
+                  filterExpr: (ws_sold_date_sk is not null and ws_bill_addr_sk is not null) (type: boolean)
+                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ss_addr_sk is not null and ss_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (ws_bill_addr_sk is not null and ws_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_addr_sk (type: int), ss_ext_sales_price (type: decimal(7,2))
+                      expressions: ws_sold_date_sk (type: int), ws_bill_addr_sk (type: int), ws_ext_sales_price (type: decimal(7,2))
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: decimal(7,2))
             Execution mode: vectorized
         Map 18 
             Map Operator Tree:
                 TableScan
                   alias: date_dim
-                  filterExpr: ((d_qoy = 3) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                  filterExpr: ((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                   Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((d_qoy = 3) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                    predicate: ((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_date_sk (type: int)
@@ -261,31 +261,31 @@ STAGE PLANS:
         Map 20 
             Map Operator Tree:
                 TableScan
-                  alias: web_sales
-                  filterExpr: (ws_sold_date_sk is not null and ws_bill_addr_sk is not null) (type: boolean)
-                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                  alias: store_sales
+                  filterExpr: (ss_sold_date_sk is not null and ss_addr_sk is not null) (type: boolean)
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ws_bill_addr_sk is not null and ws_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (ss_addr_sk is not null and ss_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_bill_addr_sk (type: int), ws_ext_sales_price (type: decimal(7,2))
+                      expressions: ss_sold_date_sk (type: int), ss_addr_sk (type: int), ss_ext_sales_price (type: decimal(7,2))
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: decimal(7,2))
             Execution mode: vectorized
         Map 25 
             Map Operator Tree:
                 TableScan
                   alias: date_dim
-                  filterExpr: ((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                  filterExpr: ((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                   Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                    predicate: ((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_date_sk (type: int)
@@ -320,31 +320,31 @@ STAGE PLANS:
         Map 27 
             Map Operator Tree:
                 TableScan
-                  alias: web_sales
-                  filterExpr: (ws_sold_date_sk is not null and ws_bill_addr_sk is not null) (type: boolean)
-                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                  alias: store_sales
+                  filterExpr: (ss_sold_date_sk is not null and ss_addr_sk is not null) (type: boolean)
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ws_bill_addr_sk is not null and ws_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (ss_addr_sk is not null and ss_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_bill_addr_sk (type: int), ws_ext_sales_price (type: decimal(7,2))
+                      expressions: ss_sold_date_sk (type: int), ss_addr_sk (type: int), ss_ext_sales_price (type: decimal(7,2))
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: decimal(7,2))
             Execution mode: vectorized
         Map 31 
             Map Operator Tree:
                 TableScan
                   alias: date_dim
-                  filterExpr: ((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                  filterExpr: ((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                   Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                    predicate: ((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_date_sk (type: int)
@@ -379,21 +379,21 @@ STAGE PLANS:
         Map 33 
             Map Operator Tree:
                 TableScan
-                  alias: web_sales
-                  filterExpr: (ws_sold_date_sk is not null and ws_bill_addr_sk is not null) (type: boolean)
-                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                  alias: store_sales
+                  filterExpr: (ss_sold_date_sk is not null and ss_addr_sk is not null) (type: boolean)
+                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ws_bill_addr_sk is not null and ws_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (ss_addr_sk is not null and ss_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ws_sold_date_sk (type: int), ws_bill_addr_sk (type: int), ws_ext_sales_price (type: decimal(7,2))
+                      expressions: ss_sold_date_sk (type: int), ss_addr_sk (type: int), ss_ext_sales_price (type: decimal(7,2))
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: decimal(7,2))
             Execution mode: vectorized
         Map 37 
@@ -439,10 +439,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: date_dim
-                  filterExpr: ((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                  filterExpr: ((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                   Statistics: Num rows: 73049 Data size: 81741831 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: ((d_qoy = 2) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
+                    predicate: ((d_qoy = 1) and (d_year = 2000) and d_date_sk is not null) (type: boolean)
                     Statistics: Num rows: 18262 Data size: 20435178 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
                       expressions: d_date_sk (type: int)
@@ -477,21 +477,21 @@ STAGE PLANS:
         Map 8 
             Map Operator Tree:
                 TableScan
-                  alias: store_sales
-                  filterExpr: (ss_sold_date_sk is not null and ss_addr_sk is not null) (type: boolean)
-                  Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                  alias: web_sales
+                  filterExpr: (ws_sold_date_sk is not null and ws_bill_addr_sk is not null) (type: boolean)
+                  Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
-                    predicate: (ss_addr_sk is not null and ss_sold_date_sk is not null) (type: boolean)
-                    Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                    predicate: (ws_bill_addr_sk is not null and ws_sold_date_sk is not null) (type: boolean)
+                    Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ss_sold_date_sk (type: int), ss_addr_sk (type: int), ss_ext_sales_price (type: decimal(7,2))
+                      expressions: ws_sold_date_sk (type: int), ws_bill_addr_sk (type: int), ws_ext_sales_price (type: decimal(7,2))
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 575995635 Data size: 50814502088 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 144002668 Data size: 19580198212 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col1 (type: int), _col2 (type: decimal(7,2))
             Execution mode: vectorized
         Reducer 10 
@@ -502,19 +502,19 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7
-                Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col5
+                Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: string)
+                  keys: _col5 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: string)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: decimal(17,2))
         Reducer 11 
             Execution mode: vectorized
@@ -524,12 +524,12 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: decimal(17,2))
         Reducer 15 
             Reduce Operator Tree:
@@ -540,12 +540,12 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2
-                Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
-                  Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col2 (type: decimal(7,2))
         Reducer 16 
             Reduce Operator Tree:
@@ -555,19 +555,19 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7
-                Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col5
+                Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: string)
+                  keys: _col5 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: string)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: decimal(17,2))
         Reducer 17 
             Execution mode: vectorized
@@ -577,13 +577,17 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: decimal(17,2))
+                Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: decimal(17,2)), (_col1 > 0) (type: boolean)
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: decimal(17,2)), _col2 (type: boolean)
         Reducer 2 
             Reduce Operator Tree:
               Join Operator
@@ -593,12 +597,12 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2
-                Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
-                  Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col2 (type: decimal(7,2))
         Reducer 21 
             Reduce Operator Tree:
@@ -609,12 +613,12 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2
-                Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
-                  Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col2 (type: decimal(7,2))
         Reducer 22 
             Reduce Operator Tree:
@@ -624,19 +628,19 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7
-                Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col5
+                Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: string)
+                  keys: _col5 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: string)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: decimal(17,2))
         Reducer 23 
             Execution mode: vectorized
@@ -646,12 +650,12 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: decimal(17,2))
         Reducer 24 
             Reduce Operator Tree:
@@ -664,12 +668,12 @@ STAGE PLANS:
                   1 _col0 (type: string)
                   2 _col0 (type: string)
                 outputColumnNames: _col0, _col1, _col3, _col5
-                Statistics: Num rows: 191667561 Data size: 26061245363 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 766650239 Data size: 67634106674 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 191667561 Data size: 26061245363 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 766650239 Data size: 67634106674 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: decimal(17,2)), _col3 (type: decimal(17,2)), _col5 (type: decimal(17,2))
         Reducer 28 
             Reduce Operator Tree:
@@ -680,12 +684,12 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2
-                Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
-                  Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col2 (type: decimal(7,2))
         Reducer 29 
             Reduce Operator Tree:
@@ -695,19 +699,19 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7
-                Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col5
+                Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: string)
+                  keys: _col5 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: string)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: decimal(17,2))
         Reducer 3 
             Reduce Operator Tree:
@@ -717,19 +721,19 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7
-                Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col5
+                Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: string)
+                  keys: _col5 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: string)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: decimal(17,2))
         Reducer 30 
             Execution mode: vectorized
@@ -739,12 +743,12 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: decimal(17,2))
         Reducer 34 
             Reduce Operator Tree:
@@ -755,12 +759,12 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2
-                Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
-                  Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col2 (type: decimal(7,2))
         Reducer 35 
             Reduce Operator Tree:
@@ -770,19 +774,19 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col7
-                Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col2, _col5
+                Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
                   aggregations: sum(_col2)
-                  keys: _col7 (type: string)
+                  keys: _col5 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
                     key expressions: _col0 (type: string)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col1 (type: decimal(17,2))
         Reducer 36 
             Execution mode: vectorized
@@ -792,12 +796,12 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: decimal(17,2))
         Reducer 4 
             Execution mode: vectorized
@@ -807,13 +811,17 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 348477374 Data size: 30742775095 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: decimal(17,2))
+                Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col0 (type: string), _col1 (type: decimal(17,2)), (_col1 > 0) (type: boolean)
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 87121617 Data size: 11846020363 Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: decimal(17,2)), _col2 (type: boolean)
         Reducer 5 
             Reduce Operator Tree:
               Join Operator
@@ -826,18 +834,18 @@ STAGE PLANS:
                   1 _col0 (type: string)
                   2 _col0 (type: string)
                   3 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col3, _col5, _col7, _col9, _col11
-                Statistics: Num rows: 1149975359 Data size: 101451160012 Basic stats: COMPLETE Column stats: NONE
+                outputColumnNames: _col1, _col2, _col4, _col6, _col7, _col8, _col9, _col11, _col13
+                Statistics: Num rows: 2529945843 Data size: 223192556861 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (CASE WHEN ((_col1 > 0)) THEN (CASE WHEN ((_col9 > 0)) THEN (((_col11 / _col9) > (_col5 / _col1))) ELSE ((null > (_col5 / _col1))) END) ELSE (CASE WHEN ((_col9 > 0)) THEN (((_col11 / _col9) > null)) ELSE (null) END) END and CASE WHEN ((_col3 > 0)) THEN (CASE WHEN ((_col7 > 0)) THEN (((_col9 / _col7) > (_col1 / _col3))) ELSE ((null > (_col1 / _col3))) END) ELSE (CASE WHEN ((_col7 > 0)) THEN (((_col9 / _col7) > null)) ELSE (null) END) END) (type: boolean)
-                  Statistics: Num rows: 287493839 Data size: 25362789936 Basic stats: COMPLETE Column stats: NONE
+                  predicate: (CASE WHEN ((_col11 > 0)) THEN (CASE WHEN (_col2) THEN (((_col6 / _col1) > (_col9 / _col11))) ELSE ((null > (_col9 / _col11))) END) ELSE (CASE WHEN (_col2) THEN (((_col6 / _col1) > null)) ELSE (null) END) END and CASE WHEN ((_col9 > 0)) THEN (CASE WHEN (_col7) THEN (((_col4 / _col6) > (_col13 / _col9))) ELSE ((null > (_col13 / _col9))) END) ELSE (CASE WHEN (_col7) THEN (((_col4 / _col6) > null)) ELSE (null) END) END) (type: boolean)
+                  Statistics: Num rows: 632486460 Data size: 55798139149 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col0 (type: string), 2000 (type: int), (_col9 / _col7) (type: decimal(37,20)), (_col1 / _col3) (type: decimal(37,20)), (_col11 / _col9) (type: decimal(37,20)), (_col5 / _col1) (type: decimal(37,20))
+                    expressions: _col8 (type: string), 2000 (type: int), (_col6 / _col1) (type: decimal(37,20)), (_col9 / _col11) (type: decimal(37,20)), (_col4 / _col6) (type: decimal(37,20)), (_col13 / _col9) (type: decimal(37,20))
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-                    Statistics: Num rows: 287493839 Data size: 25362789936 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 632486460 Data size: 55798139149 Basic stats: COMPLETE Column stats: NONE
                     File Output Operator
                       compressed: false
-                      Statistics: Num rows: 287493839 Data size: 25362789936 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 632486460 Data size: 55798139149 Basic stats: COMPLETE Column stats: NONE
                       table:
                           input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                           output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -851,12 +859,12 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col1, _col2
-                Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col1 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col1 (type: int)
-                  Statistics: Num rows: 633595212 Data size: 55895953508 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 158402938 Data size: 21538218500 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col2 (type: decimal(7,2))
 
   Stage: Stage-0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query32.q.out b/ql/src/test/results/clientpositive/perf/spark/query32.q.out
index e03048f..7b8b362 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query32.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query32.q.out
@@ -223,10 +223,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col2 (type: int)
-                outputColumnNames: _col2, _col6
+                outputColumnNames: _col2, _col5
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Filter Operator
-                  predicate: (_col2 > CAST( (1.3 * _col6) AS decimal(14,7))) (type: boolean)
+                  predicate: (_col2 > _col5) (type: boolean)
                   Statistics: Num rows: 116155905 Data size: 15729842913 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: _col2 (type: decimal(7,2))
@@ -270,7 +270,7 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 158394413 Data size: 21449785388 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col0 (type: int), (_col1 / _col2) (type: decimal(37,22))
+                  expressions: _col0 (type: int), CAST( (1.3 * (_col1 / _col2)) AS decimal(14,7)) (type: decimal(14,7))
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 158394413 Data size: 21449785388 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
@@ -278,7 +278,7 @@ STAGE PLANS:
                     sort order: +
                     Map-reduce partition columns: _col0 (type: int)
                     Statistics: Num rows: 158394413 Data size: 21449785388 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col1 (type: decimal(37,22))
+                    value expressions: _col1 (type: decimal(14,7))
         Reducer 7 
             Reduce Operator Tree:
               Join Operator
@@ -294,7 +294,7 @@ STAGE PLANS:
                   sort order: +
                   Map-reduce partition columns: _col2 (type: int)
                   Statistics: Num rows: 174233858 Data size: 23594764438 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: decimal(37,22))
+                  value expressions: _col1 (type: decimal(14,7))
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query33.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query33.q.out b/ql/src/test/results/clientpositive/perf/spark/query33.q.out
index 15a5301..c98db90 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query33.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query33.q.out
@@ -416,14 +416,14 @@ STAGE PLANS:
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col1 (type: int), _col3 (type: decimal(7,2))
-                  outputColumnNames: _col3, _col5
+                  outputColumnNames: _col2, _col4
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col3 (type: int)
+                    key expressions: _col2 (type: int)
                     sort order: +
-                    Map-reduce partition columns: _col3 (type: int)
+                    Map-reduce partition columns: _col2 (type: int)
                     Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: decimal(7,2))
+                    value expressions: _col4 (type: decimal(7,2))
         Reducer 15 
             Reduce Operator Tree:
               Join Operator
@@ -447,11 +447,11 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col4 (type: int)
-                outputColumnNames: _col1, _col8
+                  1 _col3 (type: int)
+                outputColumnNames: _col1, _col7
                 Statistics: Num rows: 383314495 Data size: 51908482889 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   keys: _col1 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
@@ -524,14 +524,14 @@ STAGE PLANS:
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col2 (type: int), _col3 (type: decimal(7,2))
-                  outputColumnNames: _col4, _col5
+                  outputColumnNames: _col3, _col4
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col4 (type: int)
+                    key expressions: _col3 (type: int)
                     sort order: +
-                    Map-reduce partition columns: _col4 (type: int)
+                    Map-reduce partition columns: _col3 (type: int)
                     Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: decimal(7,2))
+                    value expressions: _col4 (type: decimal(7,2))
         Reducer 26 
             Reduce Operator Tree:
               Join Operator
@@ -555,11 +555,11 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col3 (type: int)
-                outputColumnNames: _col1, _col8
+                  1 _col2 (type: int)
+                outputColumnNames: _col1, _col7
                 Statistics: Num rows: 191667562 Data size: 26061245514 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   keys: _col1 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
@@ -598,11 +598,11 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col0 (type: int)
-                  1 _col3 (type: int)
-                outputColumnNames: _col1, _col8
+                  1 _col2 (type: int)
+                outputColumnNames: _col1, _col7
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  aggregations: sum(_col8)
+                  aggregations: sum(_col7)
                   keys: _col1 (type: int)
                   mode: hash
                   outputColumnNames: _col0, _col1
@@ -654,14 +654,14 @@ STAGE PLANS:
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col1 (type: int), _col3 (type: decimal(7,2))
-                  outputColumnNames: _col3, _col5
+                  outputColumnNames: _col2, _col4
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                   Reduce Output Operator
-                    key expressions: _col3 (type: int)
+                    key expressions: _col2 (type: int)
                     sort order: +
-                    Map-reduce partition columns: _col3 (type: int)
+                    Map-reduce partition columns: _col2 (type: int)
                     Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
-                    value expressions: _col5 (type: decimal(7,2))
+                    value expressions: _col4 (type: decimal(7,2))
         Reducer 4 
             Execution mode: vectorized
             Reduce Operator Tree:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query36.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query36.q.out b/ql/src/test/results/clientpositive/perf/spark/query36.q.out
index b8654b8..c6088be 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query36.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query36.q.out
@@ -202,10 +202,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col4, _col10, _col11
+                outputColumnNames: _col3, _col4, _col8, _col9
                 Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col11 (type: string), _col10 (type: string), _col4 (type: decimal(7,2)), _col3 (type: decimal(7,2))
+                  expressions: _col9 (type: string), _col8 (type: string), _col4 (type: decimal(7,2)), _col3 (type: decimal(7,2))
                   outputColumnNames: _col0, _col1, _col2, _col3
                   Statistics: Num rows: 766650239 Data size: 67634106676 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query38.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query38.q.out b/ql/src/test/results/clientpositive/perf/spark/query38.q.out
index 73fbf85..98558ae 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query38.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query38.q.out
@@ -239,10 +239,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col6, _col7
+                outputColumnNames: _col3, _col5, _col6
                 Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  keys: _col7 (type: string), _col6 (type: string), _col3 (type: string)
+                  keys: _col6 (type: string), _col5 (type: string), _col3 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 348467716 Data size: 47189528877 Basic stats: COMPLETE Column stats: NONE
@@ -305,10 +305,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col6, _col7
+                outputColumnNames: _col3, _col5, _col6
                 Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  keys: _col7 (type: string), _col6 (type: string), _col3 (type: string)
+                  keys: _col6 (type: string), _col5 (type: string), _col3 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 174243235 Data size: 23692040863 Basic stats: COMPLETE Column stats: NONE
@@ -371,10 +371,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col3, _col6, _col7
+                outputColumnNames: _col3, _col5, _col6
                 Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE
                 Group By Operator
-                  keys: _col7 (type: string), _col6 (type: string), _col3 (type: string)
+                  keys: _col6 (type: string), _col5 (type: string), _col3 (type: string)
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 696954748 Data size: 61485550191 Basic stats: COMPLETE Column stats: NONE

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/spark/query39.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/spark/query39.q.out b/ql/src/test/results/clientpositive/perf/spark/query39.q.out
index f1cce16..d83395f 100644
--- a/ql/src/test/results/clientpositive/perf/spark/query39.q.out
+++ b/ql/src/test/results/clientpositive/perf/spark/query39.q.out
@@ -272,7 +272,7 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col7
+                outputColumnNames: _col2, _col3, _col5
                 Statistics: Num rows: 45476640 Data size: 718523566 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -280,12 +280,12 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col3, _col7, _col8, _col9
+                  outputColumnNames: _col3, _col5, _col6, _col7
                   input vertices:
                     1 Map 16
                   Statistics: Num rows: 50024305 Data size: 790375939 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col9 (type: string), _col8 (type: int), _col7 (type: int), _col3 (type: int), UDFToDouble(_col3) (type: double), (UDFToDouble(_col3) * UDFToDouble(_col3)) (type: double)
+                    expressions: _col7 (type: string), _col6 (type: int), _col5 (type: int), _col3 (type: int), UDFToDouble(_col3) (type: double), (UDFToDouble(_col3) * UDFToDouble(_col3)) (type: double)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                     Statistics: Num rows: 50024305 Data size: 790375939 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
@@ -352,7 +352,7 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col2, _col3, _col7
+                outputColumnNames: _col2, _col3, _col5
                 Statistics: Num rows: 45476640 Data size: 718523566 Basic stats: COMPLETE Column stats: NONE
                 Map Join Operator
                   condition map:
@@ -360,12 +360,12 @@ STAGE PLANS:
                   keys:
                     0 _col2 (type: int)
                     1 _col0 (type: int)
-                  outputColumnNames: _col3, _col7, _col8, _col9
+                  outputColumnNames: _col3, _col5, _col6, _col7
                   input vertices:
                     1 Map 9
                   Statistics: Num rows: 50024305 Data size: 790375939 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: _col9 (type: string), _col8 (type: int), _col7 (type: int), _col3 (type: int), UDFToDouble(_col3) (type: double), (UDFToDouble(_col3) * UDFToDouble(_col3)) (type: double)
+                    expressions: _col7 (type: string), _col6 (type: int), _col5 (type: int), _col3 (type: int), UDFToDouble(_col3) (type: double), (UDFToDouble(_col3) * UDFToDouble(_col3)) (type: double)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                     Statistics: Num rows: 50024305 Data size: 790375939 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator


[46/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join_filters_overlap.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join_filters_overlap.q.out b/ql/src/test/results/clientpositive/join_filters_overlap.q.out
index 7b5c9f2..847b45d 100644
--- a/ql/src/test/results/clientpositive/join_filters_overlap.q.out
+++ b/ql/src/test/results/clientpositive/join_filters_overlap.q.out
@@ -18,15 +18,6 @@ POSTHOOK: query: explain extended select * from a_n4 left outer join a_n4 b on (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT *
-FROM (SELECT `key`, `value`
-FROM `default`.`a_n4`) AS `t`
-LEFT JOIN (SELECT `key`, CAST(50 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 50) AS `t1` ON `t`.`key` = `t1`.`key` AND `t`.`value` = 50
-LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 60) AS `t3` ON `t`.`key` = `t3`.`key` AND `t`.`value` = 60
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -40,8 +31,8 @@ STAGE PLANS:
             Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
             GatherStats: false
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (value = 60) (type: boolean), (value = 50) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: int)
@@ -50,7 +41,7 @@ STAGE PLANS:
                 Map-reduce partition columns: _col0 (type: int)
                 Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                 tag: 0
-                value expressions: _col1 (type: int)
+                value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean)
                 auto parallelism: false
           TableScan
             alias: b
@@ -158,37 +149,41 @@ STAGE PLANS:
           filter mappings:
             0 [1, 1, 2, 1]
           filter predicates:
-            0 {(VALUE._col0 = 50)} {(VALUE._col0 = 60)}
+            0 {VALUE._col2} {VALUE._col1}
             1 
             2 
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
             2 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col4, _col5, _col6, _col7
           Statistics: Num rows: 6 Data size: 39 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            GlobalTableId: 0
-#### A masked pattern was here ####
-            NumFilesPerFileSink: 1
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: int)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 6 Data size: 39 Basic stats: COMPLETE Column stats: NONE
-#### A masked pattern was here ####
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                properties:
-                  columns _col0,_col1,_col2,_col3,_col4,_col5
-                  columns.types int:int:int:int:int:int
-                  escape.delim \
-                  hive.serialization.extend.additional.nesting.levels true
-                  serialization.escape.crlf true
-                  serialization.format 1
-                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-            TotalFiles: 1
-            GatherStats: false
-            MultiFileSpray: false
+            File Output Operator
+              compressed: false
+              GlobalTableId: 0
+#### A masked pattern was here ####
+              NumFilesPerFileSink: 1
+              Statistics: Num rows: 6 Data size: 39 Basic stats: COMPLETE Column stats: NONE
+#### A masked pattern was here ####
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  properties:
+                    columns _col0,_col1,_col2,_col3,_col4,_col5
+                    columns.types int:int:int:int:int:int
+                    escape.delim \
+                    hive.serialization.extend.additional.nesting.levels true
+                    serialization.escape.crlf true
+                    serialization.format 1
+                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              TotalFiles: 1
+              GatherStats: false
+              MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator
@@ -226,15 +221,6 @@ POSTHOOK: query: explain extended select * from a_n4 right outer join a_n4 b on
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT *
-FROM (SELECT `key`, CAST(50 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 50) AS `t0`
-RIGHT JOIN (SELECT `key`, `value`
-FROM `default`.`a_n4`) AS `t1` ON `t0`.`key` = `t1`.`key` AND `t1`.`value` = 50
-LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 60) AS `t3` ON `t1`.`key` = `t3`.`key` AND `t1`.`value` = 60
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -270,8 +256,8 @@ STAGE PLANS:
             Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
             GatherStats: false
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (value = 60) (type: boolean), (value = 50) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: int)
@@ -280,7 +266,7 @@ STAGE PLANS:
                 Map-reduce partition columns: _col0 (type: int)
                 Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                 tag: 1
-                value expressions: _col1 (type: int)
+                value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean)
                 auto parallelism: false
           TableScan
             alias: c
@@ -367,36 +353,40 @@ STAGE PLANS:
             1 [0, 1, 2, 1]
           filter predicates:
             0 
-            1 {(VALUE._col0 = 50)} {(VALUE._col0 = 60)}
+            1 {VALUE._col2} {VALUE._col1}
             2 
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
             2 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3, _col6, _col7
           Statistics: Num rows: 6 Data size: 39 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            GlobalTableId: 0
-#### A masked pattern was here ####
-            NumFilesPerFileSink: 1
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col3 (type: int), _col6 (type: int), _col7 (type: int)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 6 Data size: 39 Basic stats: COMPLETE Column stats: NONE
-#### A masked pattern was here ####
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                properties:
-                  columns _col0,_col1,_col2,_col3,_col4,_col5
-                  columns.types int:int:int:int:int:int
-                  escape.delim \
-                  hive.serialization.extend.additional.nesting.levels true
-                  serialization.escape.crlf true
-                  serialization.format 1
-                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-            TotalFiles: 1
-            GatherStats: false
-            MultiFileSpray: false
+            File Output Operator
+              compressed: false
+              GlobalTableId: 0
+#### A masked pattern was here ####
+              NumFilesPerFileSink: 1
+              Statistics: Num rows: 6 Data size: 39 Basic stats: COMPLETE Column stats: NONE
+#### A masked pattern was here ####
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  properties:
+                    columns _col0,_col1,_col2,_col3,_col4,_col5
+                    columns.types int:int:int:int:int:int
+                    escape.delim \
+                    hive.serialization.extend.additional.nesting.levels true
+                    serialization.escape.crlf true
+                    serialization.format 1
+                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              TotalFiles: 1
+              GatherStats: false
+              MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator
@@ -434,15 +424,6 @@ POSTHOOK: query: explain extended select * from a_n4 right outer join a_n4 b on
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT *
-FROM (SELECT `key`, CAST(50 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 50) AS `t0`
-RIGHT JOIN (SELECT `key`, `value`
-FROM `default`.`a_n4`) AS `t1` ON `t0`.`key` = `t1`.`key` AND `t1`.`value` = 50
-LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 60) AS `t3` ON `t1`.`key` = `t3`.`key` AND `t1`.`value` = 60
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -478,8 +459,8 @@ STAGE PLANS:
             Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
             GatherStats: false
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (value = 60) (type: boolean), (value = 50) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: int)
@@ -488,7 +469,7 @@ STAGE PLANS:
                 Map-reduce partition columns: _col0 (type: int)
                 Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                 tag: 1
-                value expressions: _col1 (type: int)
+                value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean)
                 auto parallelism: false
           TableScan
             alias: c
@@ -575,36 +556,40 @@ STAGE PLANS:
             1 [0, 1, 2, 1]
           filter predicates:
             0 
-            1 {(VALUE._col0 = 50)} {(VALUE._col0 = 60)}
+            1 {VALUE._col2} {VALUE._col1}
             2 
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
             2 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3, _col6, _col7
           Statistics: Num rows: 6 Data size: 39 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            GlobalTableId: 0
-#### A masked pattern was here ####
-            NumFilesPerFileSink: 1
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int), _col3 (type: int), _col6 (type: int), _col7 (type: int)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 6 Data size: 39 Basic stats: COMPLETE Column stats: NONE
-#### A masked pattern was here ####
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                properties:
-                  columns _col0,_col1,_col2,_col3,_col4,_col5
-                  columns.types int:int:int:int:int:int
-                  escape.delim \
-                  hive.serialization.extend.additional.nesting.levels true
-                  serialization.escape.crlf true
-                  serialization.format 1
-                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-            TotalFiles: 1
-            GatherStats: false
-            MultiFileSpray: false
+            File Output Operator
+              compressed: false
+              GlobalTableId: 0
+#### A masked pattern was here ####
+              NumFilesPerFileSink: 1
+              Statistics: Num rows: 6 Data size: 39 Basic stats: COMPLETE Column stats: NONE
+#### A masked pattern was here ####
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  properties:
+                    columns _col0,_col1,_col2,_col3,_col4,_col5
+                    columns.types int:int:int:int:int:int
+                    escape.delim \
+                    hive.serialization.extend.additional.nesting.levels true
+                    serialization.escape.crlf true
+                    serialization.format 1
+                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              TotalFiles: 1
+              GatherStats: false
+              MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator
@@ -642,17 +627,6 @@ POSTHOOK: query: explain extended select * from a_n4 full outer join a_n4 b on (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT *
-FROM (SELECT `key`, `value`
-FROM `default`.`a_n4`) AS `t`
-FULL JOIN (SELECT `key`, `value`
-FROM `default`.`a_n4`) AS `t0` ON `t`.`key` = `t0`.`key` AND `t`.`value` = 50 AND `t0`.`value` = 50
-LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 60) AS `t2` ON `t0`.`key` = `t2`.`key` AND `t0`.`value` = 60
-LEFT JOIN (SELECT `key`, CAST(40 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 40) AS `t4` ON `t`.`key` = `t4`.`key` AND `t`.`value` = 40
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -666,8 +640,8 @@ STAGE PLANS:
             Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
             GatherStats: false
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (value = 40) (type: boolean), (value = 50) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: int)
@@ -676,15 +650,15 @@ STAGE PLANS:
                 Map-reduce partition columns: _col0 (type: int)
                 Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                 tag: 0
-                value expressions: _col1 (type: int)
+                value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean)
                 auto parallelism: false
           TableScan
             alias: b
             Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
             GatherStats: false
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (value = 60) (type: boolean), (value = 50) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3
               Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: int)
@@ -693,7 +667,7 @@ STAGE PLANS:
                 Map-reduce partition columns: _col0 (type: int)
                 Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                 tag: 1
-                value expressions: _col1 (type: int)
+                value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean)
                 auto parallelism: false
           TableScan
             alias: c
@@ -803,8 +777,8 @@ STAGE PLANS:
             0 [1, 1, 3, 1]
             1 [0, 1, 2, 1]
           filter predicates:
-            0 {(VALUE._col0 = 50)} {(VALUE._col0 = 40)}
-            1 {(VALUE._col0 = 50)} {(VALUE._col0 = 60)}
+            0 {VALUE._col2} {VALUE._col1}
+            1 {VALUE._col2} {VALUE._col1}
             2 
             3 
           keys:
@@ -812,30 +786,34 @@ STAGE PLANS:
             1 _col0 (type: int)
             2 _col0 (type: int)
             3 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+          outputColumnNames: _col0, _col1, _col4, _col5, _col8, _col9, _col10, _col11
           Statistics: Num rows: 9 Data size: 59 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            GlobalTableId: 0
-#### A masked pattern was here ####
-            NumFilesPerFileSink: 1
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col4 (type: int), _col5 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int), _col11 (type: int)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
             Statistics: Num rows: 9 Data size: 59 Basic stats: COMPLETE Column stats: NONE
-#### A masked pattern was here ####
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                properties:
-                  columns _col0,_col1,_col2,_col3,_col4,_col5,_col6,_col7
-                  columns.types int:int:int:int:int:int:int:int
-                  escape.delim \
-                  hive.serialization.extend.additional.nesting.levels true
-                  serialization.escape.crlf true
-                  serialization.format 1
-                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-            TotalFiles: 1
-            GatherStats: false
-            MultiFileSpray: false
+            File Output Operator
+              compressed: false
+              GlobalTableId: 0
+#### A masked pattern was here ####
+              NumFilesPerFileSink: 1
+              Statistics: Num rows: 9 Data size: 59 Basic stats: COMPLETE Column stats: NONE
+#### A masked pattern was here ####
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  properties:
+                    columns _col0,_col1,_col2,_col3,_col4,_col5,_col6,_col7
+                    columns.types int:int:int:int:int:int:int:int
+                    escape.delim \
+                    hive.serialization.extend.additional.nesting.levels true
+                    serialization.escape.crlf true
+                    serialization.format 1
+                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              TotalFiles: 1
+              GatherStats: false
+              MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator
@@ -864,18 +842,6 @@ POSTHOOK: query: explain extended select * from a_n4 left outer join a_n4 b on (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@a_n4
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT *
-FROM (SELECT `key`, `value`
-FROM `default`.`a_n4`) AS `t`
-LEFT JOIN (SELECT `key`, CAST(50 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 50) AS `t1` ON `t`.`key` = `t1`.`key` AND `t`.`value` = 50
-LEFT JOIN (SELECT `key`, CAST(60 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 60) AS `t3` ON `t`.`key` = `t3`.`key` AND `t`.`value` = 60
-LEFT JOIN (SELECT `key`, CAST(40 AS INTEGER) AS `value`
-FROM `default`.`a_n4`
-WHERE `value` = 40) AS `t5` ON `t`.`key` = `t5`.`key` AND `t`.`value` = 40
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-0 depends on stages: Stage-1
@@ -889,8 +855,8 @@ STAGE PLANS:
             Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
             GatherStats: false
             Select Operator
-              expressions: key (type: int), value (type: int)
-              outputColumnNames: _col0, _col1
+              expressions: key (type: int), value (type: int), (value = 40) (type: boolean), (value = 60) (type: boolean), (value = 50) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4
               Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 key expressions: _col0 (type: int)
@@ -899,7 +865,7 @@ STAGE PLANS:
                 Map-reduce partition columns: _col0 (type: int)
                 Statistics: Num rows: 3 Data size: 18 Basic stats: COMPLETE Column stats: NONE
                 tag: 0
-                value expressions: _col1 (type: int)
+                value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
                 auto parallelism: false
           TableScan
             alias: b
@@ -1030,7 +996,7 @@ STAGE PLANS:
           filter mappings:
             0 [1, 1, 2, 1, 3, 1]
           filter predicates:
-            0 {(VALUE._col0 = 50)} {(VALUE._col0 = 60)} {(VALUE._col0 = 40)}
+            0 {VALUE._col3} {VALUE._col2} {VALUE._col1}
             1 
             2 
             3 
@@ -1039,30 +1005,34 @@ STAGE PLANS:
             1 _col0 (type: int)
             2 _col0 (type: int)
             3 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+          outputColumnNames: _col0, _col1, _col5, _col6, _col7, _col8, _col9, _col10
           Statistics: Num rows: 9 Data size: 59 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            GlobalTableId: 0
-#### A masked pattern was here ####
-            NumFilesPerFileSink: 1
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: int), _col8 (type: int), _col9 (type: int), _col10 (type: int)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
             Statistics: Num rows: 9 Data size: 59 Basic stats: COMPLETE Column stats: NONE
-#### A masked pattern was here ####
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                properties:
-                  columns _col0,_col1,_col2,_col3,_col4,_col5,_col6,_col7
-                  columns.types int:int:int:int:int:int:int:int
-                  escape.delim \
-                  hive.serialization.extend.additional.nesting.levels true
-                  serialization.escape.crlf true
-                  serialization.format 1
-                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-            TotalFiles: 1
-            GatherStats: false
-            MultiFileSpray: false
+            File Output Operator
+              compressed: false
+              GlobalTableId: 0
+#### A masked pattern was here ####
+              NumFilesPerFileSink: 1
+              Statistics: Num rows: 9 Data size: 59 Basic stats: COMPLETE Column stats: NONE
+#### A masked pattern was here ####
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  properties:
+                    columns _col0,_col1,_col2,_col3,_col4,_col5,_col6,_col7
+                    columns.types int:int:int:int:int:int:int:int
+                    escape.delim \
+                    hive.serialization.extend.additional.nesting.levels true
+                    serialization.escape.crlf true
+                    serialization.format 1
+                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+              TotalFiles: 1
+              GatherStats: false
+              MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join_merging.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join_merging.q.out b/ql/src/test/results/clientpositive/join_merging.q.out
index 80bde7f..17764ba 100644
--- a/ql/src/test/results/clientpositive/join_merging.q.out
+++ b/ql/src/test/results/clientpositive/join_merging.q.out
@@ -13,14 +13,28 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@part
 #### A masked pattern was here ####
 STAGE DEPENDENCIES:
-  Stage-1 is a root stage
+  Stage-2 is a root stage
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-1
+  Stage: Stage-2
     Map Reduce
       Map Operator Tree:
           TableScan
+            alias: p2
+            Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              expressions: p_partkey (type: int), p_size (type: int)
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+              Reduce Output Operator
+                key expressions: _col0 (type: int)
+                sort order: +
+                Map-reduce partition columns: _col0 (type: int)
+                Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                value expressions: _col1 (type: int)
+          TableScan
             alias: p1
             filterExpr: (p_size > 10) (type: boolean)
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
@@ -37,19 +51,29 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 8 Data size: 968 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: int)
-          TableScan
-            alias: p2
-            Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
-            Select Operator
-              expressions: p_partkey (type: int), p_size (type: int)
-              outputColumnNames: _col0, _col1
-              Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
-              Reduce Output Operator
-                key expressions: _col0 (type: int)
-                sort order: +
-                Map-reduce partition columns: _col0 (type: int)
-                Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
-                value expressions: _col1 (type: int)
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Right Outer Join 0 to 1
+          keys:
+            0 _col0 (type: int)
+            1 _col0 (type: int)
+          outputColumnNames: _col0, _col1, _col3
+          Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
+          Select Operator
+            expressions: _col3 (type: int), _col0 (type: int), _col1 (type: int)
+            outputColumnNames: _col0, _col1, _col2
+            Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
           TableScan
             alias: p3
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
@@ -62,24 +86,29 @@ STAGE PLANS:
                 sort order: +
                 Map-reduce partition columns: _col0 (type: int)
                 Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              sort order: +
+              Map-reduce partition columns: _col1 (type: int)
+              Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
+              value expressions: _col0 (type: int), _col2 (type: int)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Left Outer Join 0 to 1
-               Right Outer Join 1 to 2
           keys:
             0 _col0 (type: int)
-            1 _col0 (type: int)
-            2 _col0 (type: int)
+            1 _col1 (type: int)
           outputColumnNames: _col1, _col3
-          Statistics: Num rows: 57 Data size: 6923 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 30 Data size: 3807 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: _col1 (type: int), _col3 (type: int)
             outputColumnNames: _col0, _col1
-            Statistics: Num rows: 57 Data size: 6923 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 30 Data size: 3807 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 57 Data size: 6923 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 30 Data size: 3807 Basic stats: COMPLETE Column stats: NONE
               table:
                   input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -106,47 +135,74 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@part
 #### A masked pattern was here ####
 STAGE DEPENDENCIES:
-  Stage-1 is a root stage
+  Stage-2 is a root stage
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-1
+  Stage: Stage-2
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: p1
-            filterExpr: ((p_size > 10) and p_partkey is not null) (type: boolean)
+            alias: p2
+            filterExpr: p_partkey is not null (type: boolean)
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: ((p_size > 10) and p_partkey is not null) (type: boolean)
-              Statistics: Num rows: 8 Data size: 968 Basic stats: COMPLETE Column stats: NONE
+              predicate: p_partkey is not null (type: boolean)
+              Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: p_partkey (type: int), p_size (type: int)
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 8 Data size: 968 Basic stats: COMPLETE Column stats: NONE
+                expressions: p_partkey (type: int), p_size (type: int), (p_size + 10) (type: int)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 8 Data size: 968 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: int)
+                  Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: int), _col2 (type: int)
           TableScan
-            alias: p2
-            filterExpr: p_partkey is not null (type: boolean)
+            alias: p1
+            filterExpr: ((p_size > 10) and p_partkey is not null) (type: boolean)
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
             Filter Operator
-              predicate: p_partkey is not null (type: boolean)
-              Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+              predicate: ((p_size > 10) and p_partkey is not null) (type: boolean)
+              Statistics: Num rows: 8 Data size: 968 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: p_partkey (type: int), p_size (type: int)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 8 Data size: 968 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 8 Data size: 968 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col1 (type: int)
+      Reduce Operator Tree:
+        Join Operator
+          condition map:
+               Inner Join 0 to 1
+          keys:
+            0 _col0 (type: int)
+            1 _col0 (type: int)
+          outputColumnNames: _col0, _col1, _col2, _col4
+          Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
+          Filter Operator
+            predicate: (_col4 > _col2) (type: boolean)
+            Statistics: Num rows: 9 Data size: 1112 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              expressions: _col4 (type: int), _col0 (type: int), _col1 (type: int)
+              outputColumnNames: _col0, _col1, _col2
+              Statistics: Num rows: 9 Data size: 1112 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
           TableScan
             alias: p3
             Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
@@ -159,25 +215,29 @@ STAGE PLANS:
                 sort order: +
                 Map-reduce partition columns: _col0 (type: int)
                 Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              sort order: +
+              Map-reduce partition columns: _col1 (type: int)
+              Statistics: Num rows: 9 Data size: 1112 Basic stats: COMPLETE Column stats: NONE
+              value expressions: _col0 (type: int), _col2 (type: int)
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
-               Right Outer Join 1 to 2
+               Left Outer Join 0 to 1
           keys:
             0 _col0 (type: int)
-            1 _col0 (type: int)
-            2 _col0 (type: int)
+            1 _col1 (type: int)
           outputColumnNames: _col1, _col3
-          residual filter predicates: {(_col1 > (_col3 + 10))}
-          Statistics: Num rows: 57 Data size: 6923 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: _col1 (type: int), _col3 (type: int)
             outputColumnNames: _col0, _col1
-            Statistics: Num rows: 57 Data size: 6923 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 57 Data size: 6923 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 28 Data size: 3461 Basic stats: COMPLETE Column stats: NONE
               table:
                   input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/join_view.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/join_view.q.out b/ql/src/test/results/clientpositive/join_view.q.out
index c6241e1..da9ad9e 100644
--- a/ql/src/test/results/clientpositive/join_view.q.out
+++ b/ql/src/test/results/clientpositive/join_view.q.out
@@ -99,10 +99,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col2
+          outputColumnNames: _col0, _col1
           Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: _col0 (type: string), _col2 (type: int), '2011-09-01' (type: string)
+            expressions: _col0 (type: string), _col1 (type: int), '2011-09-01' (type: string)
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/auto_join_filters.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/auto_join_filters.q.out b/ql/src/test/results/clientpositive/llap/auto_join_filters.q.out
index d605110..8be0433 100644
--- a/ql/src/test/results/clientpositive/llap/auto_join_filters.q.out
+++ b/ql/src/test/results/clientpositive/llap/auto_join_filters.q.out
@@ -82,13 +82,13 @@ STAGE PLANS:
                   alias: a
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       sort order: 
                       Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 4 
@@ -97,13 +97,13 @@ STAGE PLANS:
                   alias: b
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       sort order: 
                       Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int), _col1 (type: int)
+                      value expressions: _col0 (type: int), _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -113,15 +113,15 @@ STAGE PLANS:
                 condition map:
                      Full Outer Join 0 to 1
                 filter predicates:
-                  0 {(VALUE._col0 > 40)} {(VALUE._col1 > 50)} {(VALUE._col0 = VALUE._col1)}
-                  1 {(VALUE._col0 > 40)} {(VALUE._col1 > 50)} {(VALUE._col0 = VALUE._col1)}
+                  0 {VALUE._col2} {VALUE._col3} {VALUE._col4}
+                  1 {VALUE._col2} {VALUE._col3} {VALUE._col4}
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col5, _col6
                 Statistics: Num rows: 1 Data size: 17 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+                  expressions: hash(_col0,_col1,_col5,_col6) (type: int)
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 17 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -336,15 +336,15 @@ STAGE PLANS:
                   alias: a
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
                       Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int)
+                      value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 4 
@@ -353,15 +353,15 @@ STAGE PLANS:
                   alias: b
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
                       Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int)
+                      value expressions: _col0 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -371,15 +371,15 @@ STAGE PLANS:
                 condition map:
                      Full Outer Join 0 to 1
                 filter predicates:
-                  0 {(KEY.reducesinkkey0 > 40)} {(VALUE._col0 > 50)} {(KEY.reducesinkkey0 = VALUE._col0)}
-                  1 {(VALUE._col0 > 40)} {(KEY.reducesinkkey0 > 50)} {(VALUE._col0 = KEY.reducesinkkey0)}
+                  0 {VALUE._col1} {VALUE._col2} {VALUE._col3}
+                  1 {VALUE._col1} {VALUE._col2} {VALUE._col3}
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col5, _col6
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+                  expressions: hash(_col0,_col1,_col5,_col6) (type: int)
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator
@@ -772,15 +772,15 @@ STAGE PLANS:
                   alias: a
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
                       Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col1 (type: int)
+                      value expressions: _col1 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 4 
@@ -789,15 +789,15 @@ STAGE PLANS:
                   alias: b
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
-                    expressions: key (type: int), value (type: int)
-                    outputColumnNames: _col0, _col1
+                    expressions: key (type: int), value (type: int), (key > 40) (type: boolean), (value > 50) (type: boolean), (key = value) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col1 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: int)
                       Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: int)
+                      value expressions: _col0 (type: int), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -807,15 +807,15 @@ STAGE PLANS:
                 condition map:
                      Full Outer Join 0 to 1
                 filter predicates:
-                  0 {(KEY.reducesinkkey0 > 40)} {(VALUE._col0 > 50)} {(KEY.reducesinkkey0 = VALUE._col0)}
-                  1 {(VALUE._col0 > 40)} {(KEY.reducesinkkey0 > 50)} {(VALUE._col0 = KEY.reducesinkkey0)}
+                  0 {VALUE._col1} {VALUE._col2} {VALUE._col3}
+                  1 {VALUE._col1} {VALUE._col2} {VALUE._col3}
                 keys:
                   0 _col0 (type: int)
                   1 _col1 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                outputColumnNames: _col0, _col1, _col5, _col6
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: hash(_col0,_col1,_col2,_col3) (type: int)
+                  expressions: hash(_col0,_col1,_col5,_col6) (type: int)
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_6.q.out b/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_6.q.out
index c1c611a..ebb8246 100644
--- a/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_6.q.out
+++ b/ql/src/test/results/clientpositive/llap/auto_sortmerge_join_6.q.out
@@ -563,14 +563,13 @@ STAGE PLANS:
 #### A masked pattern was here ####
       Edges:
         Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE)
-        Reducer 3 <- Map 6 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-        Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: a
+                  alias: b
                   filterExpr: key is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
@@ -580,52 +579,50 @@ STAGE PLANS:
                       expressions: key (type: int)
                       outputColumnNames: _col0
                       Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
-                        sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int)
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
-        Map 5 
             Map Operator Tree:
                 TableScan
-                  alias: c
+                  alias: a
                   filterExpr: key is not null (type: boolean)
-                  Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
-                        sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
-        Map 6 
+                      expressions: key (type: int), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 500 Data size: 6000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Merge Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: int)
+                          1 _col0 (type: int)
+                        outputColumnNames: _col1
+                        Statistics: Num rows: 825 Data size: 6600 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col1 (type: double)
+                          sort order: +
+                          Map-reduce partition columns: _col1 (type: double)
+                          Statistics: Num rows: 825 Data size: 6600 Basic stats: COMPLETE Column stats: COMPLETE
+            Execution mode: llap
+        Map 5 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: c
                   filterExpr: key is not null (type: boolean)
-                  Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: int)
+                      expressions: UDFToDouble(key) (type: double)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 4000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col0 (type: int)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 500 Data size: 4000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -635,24 +632,8 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
-                outputColumnNames: _col0
-                Statistics: Num rows: 791 Data size: 3164 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 791 Data size: 3164 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 3 
-            Execution mode: llap
-            Reduce Operator Tree:
-              Merge Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col0 (type: int)
-                  1 _col0 (type: int)
+                  0 _col1 (type: double)
+                  1 _col0 (type: double)
                 Statistics: Num rows: 1305 Data size: 10440 Basic stats: COMPLETE Column stats: COMPLETE
                 Group By Operator
                   aggregations: count()
@@ -663,7 +644,7 @@ STAGE PLANS:
                     sort order: 
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                     value expressions: _col0 (type: bigint)
-        Reducer 4 
+        Reducer 3 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Group By Operator
@@ -1149,14 +1130,13 @@ STAGE PLANS:
 #### A masked pattern was here ####
       Edges:
         Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 5 (SIMPLE_EDGE)
-        Reducer 3 <- Map 6 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-        Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (CUSTOM_SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
             Map Operator Tree:
                 TableScan
-                  alias: a
+                  alias: b
                   filterExpr: key is not null (type: boolean)
                   Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
@@ -1166,52 +1146,50 @@ STAGE PLANS:
                       expressions: key (type: int)
                       outputColumnNames: _col0
                       Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
-                        sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col0 (type: int)
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
-        Map 5 
             Map Operator Tree:
                 TableScan
-                  alias: c
+                  alias: a
                   filterExpr: key is not null (type: boolean)
-                  Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
-                        sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                        Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
-            Execution mode: vectorized, llap
-            LLAP IO: no inputs
-        Map 6 
+                      expressions: key (type: int), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 500 Data size: 6000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Merge Join Operator
+                        condition map:
+                             Inner Join 0 to 1
+                        keys:
+                          0 _col0 (type: int)
+                          1 _col0 (type: int)
+                        outputColumnNames: _col1
+                        Statistics: Num rows: 825 Data size: 6600 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col1 (type: double)
+                          sort order: +
+                          Map-reduce partition columns: _col1 (type: double)
+                          Statistics: Num rows: 825 Data size: 6600 Basic stats: COMPLETE Column stats: COMPLETE
+            Execution mode: llap
+        Map 5 
             Map Operator Tree:
                 TableScan
-                  alias: b
+                  alias: c
                   filterExpr: key is not null (type: boolean)
-                  Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 500 Data size: 43500 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: int)
+                      expressions: UDFToDouble(key) (type: double)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 4000 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col0 (type: int)
+                        key expressions: _col0 (type: double)
                         sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 500 Data size: 2000 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: double)
+                        Statistics: Num rows: 500 Data size: 4000 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1221,24 +1199,8 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
-                outputColumnNames: _col0
-                Statistics: Num rows: 791 Data size: 3164 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 791 Data size: 3164 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 3 
-            Execution mode: llap
-            Reduce Operator Tree:
-              Merge Join Operator
-                condition map:
-                     Inner Join 0 to 1
-                keys:
-                  0 _col0 (type: int)
-                  1 _col0 (type: int)
+                  0 _col1 (type: double)
+                  1 _col0 (type: double)
                 Statistics: Num rows: 1305 Data size: 10440 Basic stats: COMPLETE Column stats: COMPLETE
                 Group By Operator
                   aggregations: count()
@@ -1249,7 +1211,7 @@ STAGE PLANS:
                     sort order: 
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                     value expressions: _col0 (type: bigint)
-        Reducer 4 
+        Reducer 3 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
               Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/bucket_map_join_tez2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/bucket_map_join_tez2.q.out b/ql/src/test/results/clientpositive/llap/bucket_map_join_tez2.q.out
index 8fe30f0..5de5a69 100644
--- a/ql/src/test/results/clientpositive/llap/bucket_map_join_tez2.q.out
+++ b/ql/src/test/results/clientpositive/llap/bucket_map_join_tez2.q.out
@@ -494,14 +494,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 242 Data size: 24926 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col2 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                        Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col2 (type: double)
+                        Statistics: Num rows: 242 Data size: 24926 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col1 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -515,15 +515,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 49500 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 UDFToDouble(_col0) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 _col2 (type: double)
+                          1 _col1 (type: double)
                         outputColumnNames: _col0, _col1, _col3
                         input vertices:
                           0 Map 1
@@ -584,14 +584,14 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
-                      outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: key (type: int), value (type: string), UDFToDouble(key) (type: double)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 242 Data size: 24926 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col2 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                        Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col2 (type: double)
+                        Statistics: Num rows: 242 Data size: 24926 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col1 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -605,15 +605,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: string), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 500 Data size: 89000 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 500 Data size: 49500 Basic stats: COMPLETE Column stats: COMPLETE
                       Map Join Operator
                         condition map:
                              Inner Join 0 to 1
                         keys:
-                          0 UDFToDouble(_col0) (type: double)
-                          1 UDFToDouble(_col0) (type: double)
+                          0 _col2 (type: double)
+                          1 _col1 (type: double)
                         outputColumnNames: _col0, _col1, _col3
                         input vertices:
                           0 Map 1
@@ -1395,15 +1395,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 242 Data size: 23958 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col1 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                        Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col1 (type: string)
+                        Map-reduce partition columns: _col1 (type: double)
+                        Statistics: Num rows: 242 Data size: 23958 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1414,12 +1414,16 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 121 Data size: 11011 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
-                  sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                  Statistics: Num rows: 121 Data size: 11011 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: string)
+                Select Operator
+                  expressions: _col0 (type: string), UDFToDouble(_col0) (type: double)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 121 Data size: 11979 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col1 (type: double)
+                    sort order: +
+                    Map-reduce partition columns: _col1 (type: double)
+                    Statistics: Num rows: 121 Data size: 11979 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: string)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -1427,8 +1431,8 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
+                  0 _col1 (type: double)
+                  1 _col1 (type: double)
                 outputColumnNames: _col0, _col2
                 Statistics: Num rows: 200 Data size: 36400 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
@@ -1503,15 +1507,15 @@ STAGE PLANS:
                     predicate: key is not null (type: boolean)
                     Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: key (type: int), value (type: string)
+                      expressions: value (type: string), UDFToDouble(key) (type: double)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 242 Data size: 23958 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col1 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                        Statistics: Num rows: 242 Data size: 22990 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col1 (type: string)
+                        Map-reduce partition columns: _col1 (type: double)
+                        Statistics: Num rows: 242 Data size: 23958 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -1522,12 +1526,16 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 121 Data size: 11011 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
-                  sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                  Statistics: Num rows: 121 Data size: 11011 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: string)
+                Select Operator
+                  expressions: _col0 (type: string), UDFToDouble(_col0) (type: double)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 121 Data size: 11979 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col1 (type: double)
+                    sort order: +
+                    Map-reduce partition columns: _col1 (type: double)
+                    Statistics: Num rows: 121 Data size: 11979 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: string)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -1535,8 +1543,8 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
+                  0 _col1 (type: double)
+                  1 _col1 (type: double)
                 outputColumnNames: _col0, _col2
                 Statistics: Num rows: 200 Data size: 36400 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
@@ -2375,16 +2383,16 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 736 Basic stats: COMPLETE Column stats: PARTIAL
                     Select Operator
                       expressions: bucket_col (type: string), join_col (type: string), accounting_period (type: string)
-                      outputColumnNames: _col0, _col1, _col3
-                      Statistics: Num rows: 1 Data size: 640 Basic stats: COMPLETE Column stats: PARTIAL
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 1 Data size: 552 Basic stats: COMPLETE Column stats: PARTIAL
                       Reduce Output Operator
                         key expressions: _col1 (type: string)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col1 (type: string)
-                        Statistics: Num rows: 1 Data size: 640 Basic stats: COMPLETE Column stats: PARTIAL
+                        Statistics: Num rows: 1 Data size: 552 Basic stats: COMPLETE Column stats: PARTIAL
                         tag: 0
-                        value expressions: _col0 (type: string), _col3 (type: string)
+                        value expressions: _col0 (type: string), _col2 (type: string)
                         auto parallelism: true
             Execution mode: vectorized, llap
             LLAP IO: unknown
@@ -2410,13 +2418,13 @@ STAGE PLANS:
                         keys:
                           0 _col1 (type: string)
                           1 _col0 (type: string)
-                        outputColumnNames: _col0, _col3, _col4
+                        outputColumnNames: _col0, _col2, _col3
                         input vertices:
                           0 Map 1
                         Position of Big Table: 1
                         Statistics: Num rows: 4 Data size: 1619 Basic stats: COMPLETE Column stats: NONE
                         Select Operator
-                          expressions: _col0 (type: string), _col4 (type: string), _col3 (type: string)
+                          expressions: _col0 (type: string), _col3 (type: string), _col2 (type: string)
                           outputColumnNames: _col0, _col1, _col2
                           Statistics: Num rows: 4 Data size: 1619 Basic stats: COMPLETE Column stats: NONE
                           File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/bucketmapjoin1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/bucketmapjoin1.q.out b/ql/src/test/results/clientpositive/llap/bucketmapjoin1.q.out
index c9a3452..bb19305 100644
--- a/ql/src/test/results/clientpositive/llap/bucketmapjoin1.q.out
+++ b/ql/src/test/results/clientpositive/llap/bucketmapjoin1.q.out
@@ -42,7 +42,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n1`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n1`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -97,13 +97,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 282 Basic stats: COMPLETE Column stats: PARTIAL
+                      Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: PARTIAL
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 282 Basic stats: COMPLETE Column stats: PARTIAL
+                        Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: PARTIAL
                         tag: 1
                         value expressions: _col1 (type: string)
                         auto parallelism: true
@@ -120,7 +120,7 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col3
-                Position of Big Table: 1
+                Position of Big Table: 0
                 Statistics: Num rows: 1 Data size: 206 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: int), _col1 (type: string), _col3 (type: string)
@@ -189,7 +189,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n1`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n1`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -244,13 +244,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: int), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 282 Basic stats: COMPLETE Column stats: PARTIAL
+                      Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: PARTIAL
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 1 Data size: 282 Basic stats: COMPLETE Column stats: PARTIAL
+                        Statistics: Num rows: 1 Data size: 188 Basic stats: COMPLETE Column stats: PARTIAL
                         tag: 1
                         value expressions: _col1 (type: string)
                         auto parallelism: true
@@ -267,7 +267,7 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col3
-                Position of Big Table: 1
+                Position of Big Table: 0
                 Statistics: Num rows: 1 Data size: 206 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col0 (type: int), _col1 (type: string), _col3 (type: string)
@@ -430,7 +430,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_n1`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n1`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -872,7 +872,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_n1`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n1`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/bucketmapjoin2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/bucketmapjoin2.q.out b/ql/src/test/results/clientpositive/llap/bucketmapjoin2.q.out
index ca0e062..8a9739d 100644
--- a/ql/src/test/results/clientpositive/llap/bucketmapjoin2.q.out
+++ b/ql/src/test/results/clientpositive/llap/bucketmapjoin2.q.out
@@ -114,7 +114,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n6`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n5`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -563,7 +563,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n6`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_2_n5`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:


[37/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/subquery_select.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/subquery_select.q.out b/ql/src/test/results/clientpositive/llap/subquery_select.q.out
index 6870ad1..0435530 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_select.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_select.q.out
@@ -32,14 +32,15 @@ STAGE PLANS:
                   alias: part
                   Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: p_size (type: int)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: p_size (type: int), p_size is null (type: boolean)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: boolean)
                   Select Operator
                     expressions: p_size (type: int)
                     outputColumnNames: p_size
@@ -77,12 +78,12 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col2
-                Statistics: Num rows: 27 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col3
+                Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 27 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: int), _col2 (type: boolean)
+                  Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col0 (type: int), _col1 (type: boolean), _col3 (type: boolean)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -92,10 +93,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col2, _col3, _col4
-                Statistics: Num rows: 27 Data size: 548 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col3, _col4, _col5
+                Statistics: Num rows: 27 Data size: 440 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), CASE WHEN ((_col3 = 0L)) THEN (false) WHEN (_col2 is not null) THEN (true) WHEN (_col0 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (null) ELSE (false) END (type: boolean)
+                  expressions: _col0 (type: int), CASE WHEN (_col4) THEN (false) WHEN (_col3 is not null) THEN (true) WHEN (_col1) THEN (null) WHEN (_col5) THEN (null) ELSE (false) END (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 27 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -136,10 +137,14 @@ STAGE PLANS:
                   mode: complete
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    sort order: 
-                    Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: bigint), _col1 (type: bigint)
+                  Select Operator
+                    expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    Reduce Output Operator
+                      sort order: 
+                      Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: boolean), _col1 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator
@@ -219,15 +224,15 @@ STAGE PLANS:
                   alias: part
                   Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: p_type (type: string), p_size (type: int)
-                    outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: p_type (type: string), p_size (type: int), p_size is null (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2
+                    Statistics: Num rows: 26 Data size: 2912 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: string)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: string)
-                      Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col1 (type: int)
+                      Statistics: Num rows: 26 Data size: 2912 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: int), _col2 (type: boolean)
                   Filter Operator
                     predicate: p_type is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
@@ -269,14 +274,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col3, _col4
-                Statistics: Num rows: 40 Data size: 4560 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
+                Statistics: Num rows: 40 Data size: 4720 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col0 (type: string), _col1 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-                  Statistics: Num rows: 40 Data size: 4560 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col3 (type: bigint), _col4 (type: bigint)
+                  Statistics: Num rows: 40 Data size: 4720 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col2 (type: boolean), _col4 (type: bigint), _col5 (type: boolean), _col6 (type: boolean)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -286,10 +291,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string), _col1 (type: int)
                   1 _col1 (type: string), _col0 (type: int)
-                outputColumnNames: _col1, _col3, _col4, _col7
-                Statistics: Num rows: 48 Data size: 660 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col1, _col2, _col4, _col5, _col6, _col9
+                Statistics: Num rows: 48 Data size: 852 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), CASE WHEN ((_col3 = 0L)) THEN (false) WHEN (_col3 is null) THEN (false) WHEN (_col7 is not null) THEN (true) WHEN (_col1 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (null) ELSE (false) END (type: boolean)
+                  expressions: _col1 (type: int), CASE WHEN (_col5) THEN (false) WHEN (_col4 is null) THEN (false) WHEN (_col9 is not null) THEN (true) WHEN (_col2) THEN (null) WHEN (_col6) THEN (null) ELSE (false) END (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 48 Data size: 384 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -314,12 +319,16 @@ STAGE PLANS:
                   mode: complete
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 13 Data size: 1560 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
+                  Select Operator
+                    expressions: _col0 (type: string), _col1 (type: bigint), (_col1 = 0L) (type: boolean), (_col2 < _col1) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Statistics: Num rows: 13 Data size: 1560 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col1 (type: bigint), _col2 (type: bigint)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 13 Data size: 1560 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: bigint), _col2 (type: boolean), _col3 (type: boolean)
         Reducer 5 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
@@ -421,14 +430,15 @@ STAGE PLANS:
                   alias: part
                   Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: p_size (type: int)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: p_size (type: int), p_size is null (type: boolean)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: boolean)
                   Select Operator
                     expressions: p_size (type: int)
                     outputColumnNames: p_size
@@ -466,12 +476,12 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col2
-                Statistics: Num rows: 27 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col3
+                Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 27 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: int), _col2 (type: boolean)
+                  Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col0 (type: int), _col1 (type: boolean), _col3 (type: boolean)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -481,10 +491,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col2, _col3, _col4
-                Statistics: Num rows: 27 Data size: 548 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col3, _col4, _col5
+                Statistics: Num rows: 27 Data size: 440 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col2 is not null) THEN (false) WHEN (_col0 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (null) ELSE (true) END (type: boolean)
+                  expressions: _col0 (type: int), CASE WHEN (_col4) THEN (true) WHEN (_col3 is not null) THEN (false) WHEN (_col1) THEN (null) WHEN (_col5) THEN (null) ELSE (true) END (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 27 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -525,10 +535,14 @@ STAGE PLANS:
                   mode: complete
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    sort order: 
-                    Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: bigint), _col1 (type: bigint)
+                  Select Operator
+                    expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    Reduce Output Operator
+                      sort order: 
+                      Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: boolean), _col1 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator
@@ -708,15 +722,15 @@ STAGE PLANS:
                   predicate: (sq_count_check(CASE WHEN (_col3 is null) THEN (0) ELSE (_col3) END, true) > 0) (type: boolean)
                   Statistics: Num rows: 13 Data size: 1452 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: _col0 (type: string), _col1 (type: int)
-                    outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 13 Data size: 1404 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: _col0 (type: string), _col1 (type: int), _col1 is null (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2
+                    Statistics: Num rows: 13 Data size: 1456 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: string)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: string)
-                      Statistics: Num rows: 13 Data size: 1404 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col1 (type: int)
+                      Statistics: Num rows: 13 Data size: 1456 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: int), _col2 (type: boolean)
         Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
@@ -726,14 +740,14 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col3, _col4
-                Statistics: Num rows: 13 Data size: 1612 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col6
+                Statistics: Num rows: 13 Data size: 1664 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col1 (type: int), _col0 (type: string)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: int), _col0 (type: string)
-                  Statistics: Num rows: 13 Data size: 1612 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col3 (type: bigint), _col4 (type: bigint)
+                  Statistics: Num rows: 13 Data size: 1664 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col2 (type: boolean), _col4 (type: bigint), _col5 (type: boolean), _col6 (type: boolean)
         Reducer 5 
             Execution mode: llap
             Reduce Operator Tree:
@@ -743,10 +757,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: int), _col0 (type: string)
                   1 _col0 (type: int), _col1 (type: string)
-                outputColumnNames: _col1, _col3, _col4, _col7
-                Statistics: Num rows: 13 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col1, _col2, _col4, _col5, _col6, _col9
+                Statistics: Num rows: 13 Data size: 364 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), CASE WHEN ((_col3 = 0L)) THEN (true) WHEN (_col3 is null) THEN (true) WHEN (_col7 is not null) THEN (false) WHEN (_col1 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (null) ELSE (true) END (type: boolean)
+                  expressions: _col1 (type: int), CASE WHEN (_col5) THEN (true) WHEN (_col4 is null) THEN (true) WHEN (_col9 is not null) THEN (false) WHEN (_col2) THEN (null) WHEN (_col6) THEN (null) ELSE (true) END (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -793,12 +807,16 @@ STAGE PLANS:
                   mode: complete
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 13 Data size: 1560 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
+                  Select Operator
+                    expressions: _col0 (type: string), _col1 (type: bigint), (_col1 = 0L) (type: boolean), (_col2 < _col1) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Statistics: Num rows: 13 Data size: 1560 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col1 (type: bigint), _col2 (type: bigint)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 13 Data size: 1560 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: bigint), _col2 (type: boolean), _col3 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator
@@ -932,10 +950,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  sort order: 
+                Select Operator
+                  expressions: true (type: boolean)
+                  outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: boolean)
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator
@@ -1212,10 +1234,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  sort order: 
+                Select Operator
+                  expressions: true (type: boolean)
+                  outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: boolean)
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator
@@ -1616,16 +1642,16 @@ STAGE PLANS:
                      Left Outer Join 0 to 1
                 keys:
                   0 _col0 (type: string)
-                  1 _col2 (type: string)
-                outputColumnNames: _col1, _col2, _col3
-                Statistics: Num rows: 37 Data size: 2780 Basic stats: COMPLETE Column stats: COMPLETE
+                  1 _col0 (type: string)
+                outputColumnNames: _col1, _col3
+                Statistics: Num rows: 37 Data size: 2724 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), CASE WHEN (_col3 is null) THEN (null) ELSE (_col2) END (type: string)
+                  expressions: _col1 (type: int), _col3 (type: string)
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 37 Data size: 6956 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 37 Data size: 2724 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 37 Data size: 6956 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 37 Data size: 2724 Basic stats: COMPLETE Column stats: COMPLETE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -1639,16 +1665,12 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 13 Data size: 3744 Basic stats: COMPLETE Column stats: COMPLETE
-                Select Operator
-                  expressions: _col1 (type: string), true (type: boolean), _col0 (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Statistics: Num rows: 13 Data size: 3796 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col2 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col2 (type: string)
-                    Statistics: Num rows: 13 Data size: 3796 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: string), _col1 (type: boolean)
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 13 Data size: 3744 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col1 (type: string)
 
   Stage: Stage-0
     Fetch Operator
@@ -1876,12 +1898,12 @@ STAGE PLANS:
                     Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: value (type: string)
-                      outputColumnNames: _col1
-                      Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 166 Data size: 15106 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         sort order: 
-                        Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
-                        value expressions: _col1 (type: string)
+                        Statistics: Num rows: 166 Data size: 15106 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col0 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 4 
@@ -1931,22 +1953,18 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col1, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 166 Data size: 45650 Basic stats: COMPLETE Column stats: COMPLETE
-                Select Operator
-                  expressions: _col2 (type: string), _col1 (type: string)
+                Group By Operator
+                  keys: _col0 (type: string), _col1 (type: string)
+                  mode: hash
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 166 Data size: 45650 Basic stats: COMPLETE Column stats: COMPLETE
-                  Group By Operator
-                    keys: _col0 (type: string), _col1 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 83 Data size: 22825 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string)
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
                     Statistics: Num rows: 83 Data size: 22825 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: string), _col1 (type: string)
-                      sort order: ++
-                      Map-reduce partition columns: _col0 (type: string), _col1 (type: string)
-                      Statistics: Num rows: 83 Data size: 22825 Basic stats: COMPLETE Column stats: COMPLETE
         Reducer 5 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
@@ -2066,13 +2084,13 @@ STAGE PLANS:
                     Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: value (type: string)
-                      outputColumnNames: _col1
-                      Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 166 Data size: 15106 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: _col1 (type: string)
+                        key expressions: _col0 (type: string)
                         sort order: +
-                        Map-reduce partition columns: _col1 (type: string)
-                        Statistics: Num rows: 166 Data size: 29548 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col0 (type: string)
+                        Statistics: Num rows: 166 Data size: 15106 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -2105,16 +2123,12 @@ STAGE PLANS:
                 Filter Operator
                   predicate: _col1 is not null (type: boolean)
                   Statistics: Num rows: 250 Data size: 68750 Basic stats: COMPLETE Column stats: COMPLETE
-                  Select Operator
-                    expressions: _col1 (type: string), _col0 (type: string)
-                    outputColumnNames: _col0, _col1
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: string)
                     Statistics: Num rows: 250 Data size: 68750 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col1 (type: string)
-                      sort order: +
-                      Map-reduce partition columns: _col1 (type: string)
-                      Statistics: Num rows: 250 Data size: 68750 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: string)
+                    value expressions: _col1 (type: string)
         Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
@@ -2122,12 +2136,12 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 _col1 (type: string)
-                  1 _col1 (type: string)
-                outputColumnNames: _col0, _col3
+                  0 _col0 (type: string)
+                  1 _col0 (type: string)
+                outputColumnNames: _col1, _col2
                 Statistics: Num rows: 166 Data size: 45650 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: string), _col3 (type: string)
+                  expressions: _col1 (type: string), _col2 (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 166 Data size: 45650 Basic stats: COMPLETE Column stats: COMPLETE
                   Group By Operator
@@ -2225,14 +2239,15 @@ STAGE PLANS:
                   alias: part
                   Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: p_size (type: int)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: p_size (type: int), p_size is null (type: boolean)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 4 
@@ -2274,12 +2289,12 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col2
-                Statistics: Num rows: 27 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col3
+                Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 27 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: int), _col2 (type: boolean)
+                  Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col0 (type: int), _col1 (type: boolean), _col3 (type: boolean)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -2289,10 +2304,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col2, _col3, _col4
-                Statistics: Num rows: 27 Data size: 548 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col3, _col4, _col5
+                Statistics: Num rows: 27 Data size: 440 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), CASE WHEN ((_col3 = 0L)) THEN (false) WHEN (_col2 is not null) THEN (true) WHEN (_col0 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (null) ELSE (false) END (type: boolean)
+                  expressions: _col0 (type: int), CASE WHEN (_col4) THEN (false) WHEN (_col3 is not null) THEN (true) WHEN (_col1) THEN (null) WHEN (_col5) THEN (null) ELSE (false) END (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 27 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -2328,10 +2343,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  sort order: 
-                  Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: bigint), _col1 (type: bigint)
+                Select Operator
+                  expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: boolean), _col1 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator
@@ -2727,16 +2746,16 @@ STAGE PLANS:
                      Left Outer Join 0 to 1
                 keys:
                   0 _col0 (type: string)
-                  1 _col2 (type: string)
-                outputColumnNames: _col1, _col2, _col3
-                Statistics: Num rows: 36 Data size: 264 Basic stats: COMPLETE Column stats: COMPLETE
+                  1 _col0 (type: string)
+                outputColumnNames: _col1, _col3
+                Statistics: Num rows: 36 Data size: 204 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), (1 + CASE WHEN (_col3 is null) THEN (null) ELSE (_col2) END) (type: int)
+                  expressions: _col1 (type: int), _col3 (type: int)
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 36 Data size: 288 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 36 Data size: 204 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 36 Data size: 288 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 36 Data size: 204 Basic stats: COMPLETE Column stats: COMPLETE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -2751,15 +2770,15 @@ STAGE PLANS:
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 13 Data size: 1404 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), true (type: boolean), _col0 (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Statistics: Num rows: 13 Data size: 1456 Basic stats: COMPLETE Column stats: COMPLETE
+                  expressions: _col0 (type: string), (1 + _col1) (type: int)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 13 Data size: 1404 Basic stats: COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
-                    key expressions: _col2 (type: string)
+                    key expressions: _col0 (type: string)
                     sort order: +
-                    Map-reduce partition columns: _col2 (type: string)
-                    Statistics: Num rows: 13 Data size: 1456 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: int), _col1 (type: boolean)
+                    Map-reduce partition columns: _col0 (type: string)
+                    Statistics: Num rows: 13 Data size: 1404 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col1 (type: int)
 
   Stage: Stage-0
     Fetch Operator
@@ -3051,7 +3070,7 @@ STAGE PLANS:
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col1 (type: int)
+                  value expressions: _col1 (type: boolean)
         Reducer 5 
             Execution mode: llap
             Reduce Operator Tree:
@@ -3064,7 +3083,7 @@ STAGE PLANS:
                 outputColumnNames: _col1, _col2
                 Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col2 (type: string), (_col1 = 1) (type: boolean)
+                  expressions: _col2 (type: string), _col1 (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
@@ -3096,10 +3115,14 @@ STAGE PLANS:
                 Limit
                   Number of rows: 1
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    sort order: 
+                  Select Operator
+                    expressions: (_col0 = 1) (type: boolean)
+                    outputColumnNames: _col0
                     Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: int)
+                    Reduce Output Operator
+                      sort order: 
+                      Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator
@@ -3182,15 +3205,15 @@ STAGE PLANS:
                   alias: part
                   Statistics: Num rows: 26 Data size: 5954 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: p_name (type: string), p_type (type: string), p_size (type: int)
-                    outputColumnNames: _col0, _col1, _col2
-                    Statistics: Num rows: 26 Data size: 5954 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: p_name (type: string), p_type (type: string), p_size (type: int), p_size is null (type: boolean), p_name is null (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                    Statistics: Num rows: 26 Data size: 6162 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col1 (type: string)
                       sort order: +
                       Map-reduce partition columns: _col1 (type: string)
-                      Statistics: Num rows: 26 Data size: 5954 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: string), _col2 (type: int)
+                      Statistics: Num rows: 26 Data size: 6162 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: string), _col2 (type: int), _col3 (type: boolean), _col4 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 6 
@@ -3265,10 +3288,14 @@ STAGE PLANS:
                   mode: complete
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    sort order: 
-                    Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: bigint), _col1 (type: bigint)
+                  Select Operator
+                    expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    Reduce Output Operator
+                      sort order: 
+                      Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: boolean), _col1 (type: boolean)
         Reducer 2 
             Execution mode: llap
             Reduce Operator Tree:
@@ -3278,14 +3305,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col4, _col5
-                Statistics: Num rows: 40 Data size: 9400 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col6, _col7, _col8
+                Statistics: Num rows: 40 Data size: 9720 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col1 (type: string), _col2 (type: int)
                   sort order: ++
                   Map-reduce partition columns: _col1 (type: string), _col2 (type: int)
-                  Statistics: Num rows: 40 Data size: 9400 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: string), _col4 (type: bigint), _col5 (type: bigint)
+                  Statistics: Num rows: 40 Data size: 9720 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col0 (type: string), _col3 (type: boolean), _col4 (type: boolean), _col6 (type: bigint), _col7 (type: boolean), _col8 (type: boolean)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -3295,14 +3322,14 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: string), _col2 (type: int)
                   1 _col1 (type: string), _col0 (type: int)
-                outputColumnNames: _col0, _col2, _col4, _col5, _col8
-                Statistics: Num rows: 48 Data size: 6468 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col2, _col3, _col4, _col6, _col7, _col8, _col11
+                Statistics: Num rows: 48 Data size: 6852 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   key expressions: _col0 (type: string)
                   sort order: +
                   Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 48 Data size: 6468 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col2 (type: int), _col4 (type: bigint), _col5 (type: bigint), _col8 (type: boolean)
+                  Statistics: Num rows: 48 Data size: 6852 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col2 (type: int), _col3 (type: boolean), _col4 (type: boolean), _col6 (type: bigint), _col7 (type: boolean), _col8 (type: boolean), _col11 (type: boolean)
         Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
@@ -3312,12 +3339,12 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col2, _col4, _col5, _col8, _col10
-                Statistics: Num rows: 49 Data size: 6621 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col2, _col3, _col4, _col6, _col7, _col8, _col11, _col13
+                Statistics: Num rows: 49 Data size: 1084 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 49 Data size: 6621 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: string), _col2 (type: int), _col4 (type: bigint), _col5 (type: bigint), _col8 (type: boolean), _col10 (type: boolean)
+                  Statistics: Num rows: 49 Data size: 1084 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col2 (type: int), _col3 (type: boolean), _col4 (type: boolean), _col6 (type: bigint), _col7 (type: boolean), _col8 (type: boolean), _col11 (type: boolean), _col13 (type: boolean)
         Reducer 5 
             Execution mode: llap
             Reduce Operator Tree:
@@ -3327,10 +3354,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col2, _col4, _col5, _col8, _col10, _col11, _col12
-                Statistics: Num rows: 49 Data size: 7405 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col2, _col3, _col4, _col6, _col7, _col8, _col11, _col13, _col14, _col15
+                Statistics: Num rows: 49 Data size: 1476 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col2 (type: int), (CASE WHEN ((_col4 = 0L)) THEN (false) WHEN (_col4 is null) THEN (false) WHEN (_col8 is not null) THEN (true) WHEN (_col2 is null) THEN (null) WHEN ((_col5 < _col4)) THEN (null) ELSE (false) END and CASE WHEN ((_col11 = 0L)) THEN (false) WHEN (_col10 is not null) THEN (true) WHEN (_col0 is null) THEN (null) WHEN ((_col12 < _col11)) THEN (null) ELSE (false) END) (type: boolean)
+                  expressions: _col2 (type: int), (CASE WHEN (_col7) THEN (false) WHEN (_col6 is null) THEN (false) WHEN (_col11 is not null) THEN (true) WHEN (_col3) THEN (null) WHEN (_col8) THEN (null) ELSE (false) END and CASE WHEN (_col14) THEN (false) WHEN (_col13 is not null) THEN (true) WHEN (_col4) THEN (null) WHEN (_col15) THEN (null) ELSE (false) END) (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 49 Data size: 392 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -3355,12 +3382,16 @@ STAGE PLANS:
                   mode: complete
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 13 Data size: 1560 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col0 (type: string)
+                  Select Operator
+                    expressions: _col0 (type: string), _col1 (type: bigint), (_col1 = 0L) (type: boolean), (_col2 < _col1) (type: boolean)
+                    outputColumnNames: _col0, _col1, _col2, _col3
                     Statistics: Num rows: 13 Data size: 1560 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col1 (type: bigint), _col2 (type: bigint)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Map-reduce partition columns: _col0 (type: string)
+                      Statistics: Num rows: 13 Data size: 1560 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: bigint), _col2 (type: boolean), _col3 (type: boolean)
         Reducer 8 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
@@ -3613,14 +3644,15 @@ STAGE PLANS:
                   alias: part
                   Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
-                    expressions: p_size (type: int)
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                    expressions: p_size (type: int), p_size is null (type: boolean)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       key expressions: _col0 (type: int)
                       sort order: +
                       Map-reduce partition columns: _col0 (type: int)
-                      Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col1 (type: boolean)
                   Select Operator
                     expressions: p_size (type: int)
                     outputColumnNames: p_size
@@ -3657,12 +3689,12 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col2
-                Statistics: Num rows: 27 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col3
+                Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 27 Data size: 116 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: int), _col2 (type: boolean)
+                  Statistics: Num rows: 27 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col0 (type: int), _col1 (type: boolean), _col3 (type: boolean)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -3672,10 +3704,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col0, _col2, _col3, _col4
-                Statistics: Num rows: 27 Data size: 548 Basic stats: COMPLETE Column stats: COMPLETE
+                outputColumnNames: _col0, _col1, _col3, _col4, _col5
+                Statistics: Num rows: 27 Data size: 440 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: int), CASE WHEN ((_col3 = 0L)) THEN (false) WHEN (_col2 is not null) THEN (true) WHEN (_col0 is null) THEN (null) WHEN ((_col4 < _col3)) THEN (null) ELSE (false) END (type: boolean)
+                  expressions: _col0 (type: int), CASE WHEN (_col4) THEN (false) WHEN (_col3 is not null) THEN (true) WHEN (_col1) THEN (null) WHEN (_col5) THEN (null) ELSE (false) END (type: boolean)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 27 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -3768,10 +3800,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  sort order: 
-                  Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: bigint), _col1 (type: bigint)
+                Select Operator
+                  expressions: (_col0 = 0L) (type: boolean), (_col1 < _col0) (type: boolean)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: boolean), _col1 (type: boolean)
 
   Stage: Stage-0
     Fetch Operator
@@ -3965,11 +4001,11 @@ STAGE PLANS:
                   0 
                   1 
                 outputColumnNames: _col1
-                Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col1 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col1 (type: boolean)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -3980,11 +4016,11 @@ STAGE PLANS:
                   0 
                   1 
                 outputColumnNames: _col1, _col2
-                Statistics: Num rows: 26 Data size: 416 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 26 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
-                  Statistics: Num rows: 26 Data size: 416 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col1 (type: bigint), _col2 (type: double)
+                  Statistics: Num rows: 26 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col1 (type: boolean), _col2 (type: double)
         Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
@@ -3995,9 +4031,9 @@ STAGE PLANS:
                   0 
                   1 
                 outputColumnNames: _col1, _col2, _col3
-                Statistics: Num rows: 26 Data size: 520 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 26 Data size: 416 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: CASE WHEN ((_col1 > 409437L)) THEN (_col2) ELSE (_col3) END (type: double)
+                  expressions: CASE WHEN (_col1) THEN (_col2) ELSE (_col3) END (type: double)
                   outputColumnNames: _col0
                   Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -4015,10 +4051,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  sort order: 
-                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: bigint)
+                Select Operator
+                  expressions: (_col0 > 409437L) (type: boolean)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: boolean)
         Reducer 8 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
@@ -4166,10 +4206,14 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  sort order: 
-                  Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: int)
+                Select Operator
+                  expressions: UDFToLong(_col0) (type: bigint)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: bigint)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -4180,9 +4224,9 @@ STAGE PLANS:
                   0 
                   1 
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 1 Data size: 12 Basic stats: COMPLETE Column stats: COMPLETE
+                Statistics: Num rows: 1 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: (UDFToLong(_col0) > _col1) (type: boolean)
+                  expressions: (_col0 > _col1) (type: boolean)
                   outputColumnNames: _col0
                   Statistics: Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -4267,13 +4311,13 @@ STAGE PLANS:
                       Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
                       value expressions: _col1 (type: int)
                   Select Operator
-                    expressions: p_partkey (type: int), p_size (type: int)
+                    expressions: p_partkey (type: int), UDFToDouble(p_size) (type: double)
                     outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 26 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
                     Reduce Output Operator
                       sort order: 
-                      Statistics: Num rows: 26 Data size: 208 Basic stats: COMPLETE Column stats: COMPLETE
-                      value expressions: _col0 (type: int), _col1 (type: int)
+                      Statistics: Num rows: 26 Data size: 312 Basic stats: COMPLETE Column stats: COMPLETE
+                      value expressions: _col0 (type: int), _col1 (type: double)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 4 
@@ -4351,8 +4395,8 @@ STAGE PLANS:
                   0 
                   1 
                 outputColumnNames: _col0, _col1, _col2
-                residual filter predicates: {(UDFToDouble(_col1) > _col2)}
-                Statistics: Num rows: 8 Data size: 128 Basic stats: COMPLETE Column stats: COMPLETE
+                residual filter predicates: {(_col1 > _col2)}
+                Statistics: Num rows: 8 Data size: 160 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
                   expressions: _col0 (type: int)
                   outputColumnNames: _col0
@@ -5132,12 +5176,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: _col0 (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 4 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 4 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -5364,12 +5408,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: _col0 (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 4 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 4 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
         Reducer 11 
             Execution mode: llap
             Reduce Operator Tree:
@@ -5414,12 +5458,12 @@ STAGE PLANS:
                   0 _col0 (type: int)
                   1 _col0 (type: int)
                   2 _col1 (type: int)
-                outputColumnNames: _col1, _col4
+                outputColumnNames: _col1, _col3
                 Statistics: Num rows: 4 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 4 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col1 (type: int), _col4 (type: bigint)
+                  value expressions: _col1 (type: int), _col3 (type: bigint)
         Reducer 3 
             Execution mode: llap
             Reduce Operator Tree:
@@ -5429,10 +5473,10 @@ STAGE PLANS:
                 keys:
                   0 
                   1 
-                outputColumnNames: _col1, _col4, _col6
+                outputColumnNames: _col1, _col3, _col5
                 Statistics: Num rows: 4 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), _col4 (type: bigint), _col6 (type: bigint)
+                  expressions: _col1 (type: int), _col3 (type: bigint), _col5 (type: bigint)
                   outputColumnNames: _col0, _col1, _col2
                   Statistics: Num rows: 4 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -5518,12 +5562,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: _col0 (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 4 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 4 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
         Reducer 9 
             Execution mode: vectorized, llap
             Reduce Operator Tree:
@@ -5656,11 +5700,11 @@ STAGE PLANS:
                      Left Outer Join 0 to 1
                 keys:
                   0 _col0 (type: string)
-                  1 _col2 (type: string)
-                outputColumnNames: _col1, _col2, _col3
-                Statistics: Num rows: 36 Data size: 264 Basic stats: COMPLETE Column stats: COMPLETE
+                  1 _col0 (type: string)
+                outputColumnNames: _col1, _col3
+                Statistics: Num rows: 36 Data size: 204 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col1 (type: int), exp(CASE WHEN (_col3 is null) THEN (null) ELSE (_col2) END) (type: double)
+                  expressions: _col1 (type: int), exp(_col3) (type: double)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 36 Data size: 432 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -5679,16 +5723,12 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 13 Data size: 1404 Basic stats: COMPLETE Column stats: COMPLETE
-                Select Operator
-                  expressions: _col1 (type: int), true (type: boolean), _col0 (type: string)
-                  outputColumnNames: _col0, _col1, _col2
-                  Statistics: Num rows: 13 Data size: 1456 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col2 (type: string)
-                    sort order: +
-                    Map-reduce partition columns: _col2 (type: string)
-                    Statistics: Num rows: 13 Data size: 1456 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: int), _col1 (type: boolean)
+                Reduce Output Operator
+                  key expressions: _col0 (type: string)
+                  sort order: +
+                  Map-reduce partition columns: _col0 (type: string)
+                  Statistics: Num rows: 13 Data size: 1404 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col1 (type: int)
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/table_access_keys_stats.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/table_access_keys_stats.q.out b/ql/src/test/results/clientpositive/llap/table_access_keys_stats.q.out
index 1b6fdbd..27d0459 100644
--- a/ql/src/test/results/clientpositive/llap/table_access_keys_stats.q.out
+++ b/ql/src/test/results/clientpositive/llap/table_access_keys_stats.q.out
@@ -496,7 +496,7 @@ Keys:val
 13.0	1
 17.0	1
 46.0	1
-Warning: Shuffle Join MERGEJOIN[39][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 2' is a cross product
+Warning: Shuffle Join MERGEJOIN[39][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 4' is a cross product
 PREHOOK: query: SELECT *
 FROM
 (
@@ -519,7 +519,7 @@ PREHOOK: Input: default@t1_n13
 PREHOOK: Input: default@t2_n8
 PREHOOK: Input: default@t3_n4
 #### A masked pattern was here ####
-Operator:JOIN_11
+Operator:JOIN_8
 Table:default@t2_n8
 Keys:key
 Table:default@t1_n13

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_1.q.out b/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_1.q.out
index 828d25d..6a0b71f 100644
--- a/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_1.q.out
+++ b/ql/src/test/results/clientpositive/llap/tez_dynpart_hashjoin_1.q.out
@@ -468,15 +468,15 @@ STAGE PLANS:
                     predicate: cint BETWEEN 1000000 AND 3000000 (type: boolean)
                     Statistics: Num rows: ###Masked### Data size: ###Masked### Basic stats: COMPLETE Column stats: NONE
                     Select Operator
-                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
+                      expressions: ctinyint (type: tinyint), csmallint (type: smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), cdouble (type: double), cstring1 (type: string), cstring2 (type: string), ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: boolean), cboolean2 (type: boolean), (UDFToInteger(csmallint) <> cint) (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
                       Statistics: Num rows: ###Masked### Data size: ###Masked### Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col2 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col2 (type: int)
                         Statistics: Num rows: ###Masked### Data size: ###Masked### Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
+                        value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: boolean)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
         Map 4 
@@ -507,22 +507,26 @@ STAGE PLANS:
                 condition map:
                      Left Outer Join 0 to 1
                 filter predicates:
-                  0 {(UDFToInteger(VALUE._col1) <> KEY.reducesinkkey0)}
+                  0 {VALUE._col11}
                   1 
                 keys:
                   0 KEY.reducesinkkey0 (type: int)
                   1 KEY.reducesinkkey0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23, _col24
                 input vertices:
                   1 Map 4
                 Statistics: Num rows: ###Masked### Data size: ###Masked### Basic stats: COMPLETE Column stats: NONE
                 DynamicPartitionHashJoin: true
                 HybridGraceHashJoin: true
-                Reduce Output Operator
-                  key expressions: _col2 (type: int)
-                  sort order: +
+                Select Operator
+                  expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean), _col13 (type: tinyint), _col14 (type: smallint), _col15 (type: int), _col16 (type: bigint), _col17 (type: float), _col18 (type: double), _col19 (type: string), _col20 (type: string), _col21 (type: timestamp), _col22 (type: timestamp), _col23 (type: boolean), _col24 (type: boolean)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23
                   Statistics: Num rows: ###Masked### Data size: ###Masked### Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: tinyint), _col13 (type: smallint), _col14 (type: int), _col15 (type: bigint), _col16 (type: float), _col17 (type: double), _col18 (type: string), _col19 (type: string), _col20 (type: timestamp), _col21 (type: timestamp), _col22 (type: boolean), _col23 (type: boolean)
+                  Reduce Output Operator
+                    key expressions: _col2 (type: int)
+                    sort order: +
+                    Statistics: Num rows: ###Masked### Data size: ###Masked### Basic stats: COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: boolean), _col12 (type: tinyint), _col13 (type: smallint), _col14 (type: int), _col15 (type: bigint), _col16 (type: float), _col17 (type: double), _col18 (type: string), _col19 (type: string), _col20 (type: timestamp), _col21 (type: timestamp), _col22 (type: boolean), _col23 (type: boolean)
         Reducer 3 
             Execution mode: vectorized, llap
             Reduce Operator Tree:


[39/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/partition_shared_scan.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/partition_shared_scan.q.out b/ql/src/test/results/clientpositive/llap/partition_shared_scan.q.out
index ba9e81d..f84d13f 100644
--- a/ql/src/test/results/clientpositive/llap/partition_shared_scan.q.out
+++ b/ql/src/test/results/clientpositive/llap/partition_shared_scan.q.out
@@ -98,12 +98,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: i (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 10 Data size: 940 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 10 Data size: 940 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Map 5 
@@ -118,12 +118,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: i (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 10 Data size: 910 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 10 Data size: 910 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -152,10 +152,10 @@ STAGE PLANS:
                 keys:
                   0 _col9 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col11
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 100 Data size: 62700 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col9 (type: int), 'foo_n1' (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col11 (type: int), 'bar' (type: string)
+                  expressions: _col9 (type: int), 'foo_n1' (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col10 (type: int), 'bar' (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
                   Statistics: Num rows: 100 Data size: 80400 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator
@@ -240,17 +240,17 @@ STAGE PLANS:
                     Select Operator
                       expressions: i (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 10 Data size: 940 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 10 Data size: 940 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 10 Data size: 940 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 10 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
             Execution mode: vectorized, llap
             LLAP IO: no inputs
         Reducer 2 
@@ -279,10 +279,10 @@ STAGE PLANS:
                 keys:
                   0 _col9 (type: int)
                   1 _col0 (type: int)
-                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col11
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 100 Data size: 62700 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col9 (type: int), 'foo_n1' (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col11 (type: int), 'foo_n1' (type: string)
+                  expressions: _col9 (type: int), 'foo_n1' (type: string), _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string), _col10 (type: int), 'foo_n1' (type: string)
                   outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12
                   Statistics: Num rows: 100 Data size: 80700 Basic stats: COMPLETE Column stats: COMPLETE
                   File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/ppd_union_view.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/ppd_union_view.q.out b/ql/src/test/results/clientpositive/llap/ppd_union_view.q.out
index 4c9a224..cba2434 100644
--- a/ql/src/test/results/clientpositive/llap/ppd_union_view.q.out
+++ b/ql/src/test/results/clientpositive/llap/ppd_union_view.q.out
@@ -156,10 +156,10 @@ FROM `default`.`t1_new_n0`
 WHERE `ds` = '2011-10-13'
 UNION ALL
 SELECT `t4`.`key`, `t2`.`value`
-FROM (SELECT `keymap`, `value`, CAST('2011-10-13' AS STRING) AS `ds`
+FROM (SELECT `keymap`, `value`
 FROM `default`.`t1_old`
 WHERE `ds` = '2011-10-13' AND `keymap` IS NOT NULL) AS `t2`
-INNER JOIN (SELECT `key`, `keymap`, CAST('2011-10-13' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `keymap`
 FROM `default`.`t1_mapping`
 WHERE '2011-10-13' = `ds` AND `keymap` IS NOT NULL) AS `t4` ON `t2`.`keymap` = `t4`.`keymap`) AS `t6`
 STAGE DEPENDENCIES:
@@ -234,13 +234,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: keymap (type: string), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 275 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 181 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 1 Data size: 275 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 181 Basic stats: COMPLETE Column stats: COMPLETE
                         tag: 0
                         value expressions: _col1 (type: string)
                         auto parallelism: true
@@ -317,13 +317,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: string), keymap (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 273 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 1 Data size: 179 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: string)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col1 (type: string)
-                        Statistics: Num rows: 1 Data size: 273 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 1 Data size: 179 Basic stats: COMPLETE Column stats: COMPLETE
                         tag: 1
                         value expressions: _col0 (type: string)
                         auto parallelism: true
@@ -394,11 +394,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col1 (type: string)
-                outputColumnNames: _col1, _col3
+                outputColumnNames: _col1, _col2
                 Position of Big Table: 0
                 Statistics: Num rows: 1 Data size: 178 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col3 (type: string), _col1 (type: string)
+                  expressions: _col2 (type: string), _col1 (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 178 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
@@ -498,10 +498,10 @@ FROM `default`.`t1_new_n0`
 WHERE `ds` = '2011-10-15'
 UNION ALL
 SELECT `t4`.`key`, `t2`.`value`
-FROM (SELECT `keymap`, `value`, CAST('2011-10-15' AS STRING) AS `ds`
+FROM (SELECT `keymap`, `value`
 FROM `default`.`t1_old`
 WHERE `ds` = '2011-10-15' AND `keymap` IS NOT NULL) AS `t2`
-INNER JOIN (SELECT `key`, `keymap`, CAST('2011-10-15' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `keymap`
 FROM `default`.`t1_mapping`
 WHERE '2011-10-15' = `ds` AND `keymap` IS NOT NULL) AS `t4` ON `t2`.`keymap` = `t4`.`keymap`) AS `t6`
 STAGE DEPENDENCIES:
@@ -627,13 +627,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: keymap (type: string), value (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 462 Basic stats: COMPLETE Column stats: PARTIAL
+                      Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: PARTIAL
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 1 Data size: 462 Basic stats: COMPLETE Column stats: PARTIAL
+                        Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: PARTIAL
                         tag: 0
                         value expressions: _col1 (type: string)
                         auto parallelism: true
@@ -655,13 +655,13 @@ STAGE PLANS:
                     Select Operator
                       expressions: key (type: string), keymap (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 1 Data size: 462 Basic stats: COMPLETE Column stats: PARTIAL
+                      Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: PARTIAL
                       Reduce Output Operator
                         key expressions: _col1 (type: string)
                         null sort order: a
                         sort order: +
                         Map-reduce partition columns: _col1 (type: string)
-                        Statistics: Num rows: 1 Data size: 462 Basic stats: COMPLETE Column stats: PARTIAL
+                        Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: PARTIAL
                         tag: 1
                         value expressions: _col0 (type: string)
                         auto parallelism: true
@@ -677,11 +677,11 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: string)
                   1 _col1 (type: string)
-                outputColumnNames: _col1, _col3
+                outputColumnNames: _col1, _col2
                 Position of Big Table: 0
                 Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: PARTIAL
                 Select Operator
-                  expressions: _col3 (type: string), _col1 (type: string)
+                  expressions: _col2 (type: string), _col1 (type: string)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 368 Basic stats: COMPLETE Column stats: PARTIAL
                   Select Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/q93_with_constraints.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/q93_with_constraints.q.out b/ql/src/test/results/clientpositive/llap/q93_with_constraints.q.out
index 4f6e404..34865ac 100644
--- a/ql/src/test/results/clientpositive/llap/q93_with_constraints.q.out
+++ b/ql/src/test/results/clientpositive/llap/q93_with_constraints.q.out
@@ -323,10 +323,10 @@ STAGE PLANS:
                 keys:
                   0 _col0 (type: int), _col2 (type: int)
                   1 _col0 (type: int), _col2 (type: int)
-                outputColumnNames: _col3, _col7, _col9, _col10
+                outputColumnNames: _col3, _col6, _col8, _col9
                 Statistics: Num rows: 570235690 Data size: 69340660054 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
-                  expressions: _col7 (type: int), CASE WHEN (_col3 is not null) THEN ((CAST( (_col9 - _col3) AS decimal(10,0)) * _col10)) ELSE ((CAST( _col9 AS decimal(10,0)) * _col10)) END (type: decimal(18,2))
+                  expressions: _col6 (type: int), CASE WHEN (_col3 is not null) THEN ((CAST( (_col8 - _col3) AS decimal(10,0)) * _col9)) ELSE ((CAST( _col8 AS decimal(10,0)) * _col9)) END (type: decimal(18,2))
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 570235690 Data size: 69340660054 Basic stats: COMPLETE Column stats: NONE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/reopt_dpp.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/reopt_dpp.q.out b/ql/src/test/results/clientpositive/llap/reopt_dpp.q.out
index 2db8740..426d92f 100644
--- a/ql/src/test/results/clientpositive/llap/reopt_dpp.q.out
+++ b/ql/src/test/results/clientpositive/llap/reopt_dpp.q.out
@@ -160,16 +160,16 @@ Stage-0
               <-Map 3 [BROADCAST_EDGE] vectorized, llap
                 BROADCAST [RS_26]
                   PartitionCols:_col0
-                  Select Operator [SEL_25] (rows=28 width=8)
+                  Select Operator [SEL_25] (rows=28 width=4)
                     Output:["_col0"]
                     Filter Operator [FIL_24] (rows=28 width=8)
                       predicate:((d_year = 2000) and d_date_sk is not null)
                       TableScan [TS_3] (rows=56 width=8)
                         default@x1_date_dim,d,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                Dynamic Partitioning Event Operator [EVENT_29] (rows=1 width=8)
-                  Group By Operator [GBY_28] (rows=1 width=8)
+                Dynamic Partitioning Event Operator [EVENT_29] (rows=1 width=4)
+                  Group By Operator [GBY_28] (rows=1 width=4)
                     Output:["_col0"],keys:_col0
-                    Select Operator [SEL_27] (rows=28 width=8)
+                    Select Operator [SEL_27] (rows=28 width=4)
                       Output:["_col0"]
                        Please refer to the previous Select Operator [SEL_25]
               <-Select Operator [SEL_30] (rows=123457 width=4)
@@ -260,16 +260,16 @@ Stage-0
               <-Map 3 [BROADCAST_EDGE] vectorized, llap
                 BROADCAST [RS_26]
                   PartitionCols:_col0
-                  Select Operator [SEL_25] (runtime: rows=1 width=8)
+                  Select Operator [SEL_25] (runtime: rows=1 width=4)
                     Output:["_col0"]
                     Filter Operator [FIL_24] (runtime: rows=1 width=8)
                       predicate:((d_year = 2000) and d_date_sk is not null)
                       TableScan [TS_3] (runtime: rows=1 width=8)
                         default@x1_date_dim,d,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                Dynamic Partitioning Event Operator [EVENT_29] (runtime: rows=1 width=8)
-                  Group By Operator [GBY_28] (runtime: rows=1 width=8)
+                Dynamic Partitioning Event Operator [EVENT_29] (runtime: rows=1 width=4)
+                  Group By Operator [GBY_28] (runtime: rows=1 width=4)
                     Output:["_col0"],keys:_col0
-                    Select Operator [SEL_27] (runtime: rows=1 width=8)
+                    Select Operator [SEL_27] (runtime: rows=1 width=4)
                       Output:["_col0"]
                        Please refer to the previous Select Operator [SEL_25]
               <-Select Operator [SEL_30] (runtime: rows=1 width=4)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/reopt_semijoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/reopt_semijoin.q.out b/ql/src/test/results/clientpositive/llap/reopt_semijoin.q.out
index 10485bb..e508e14 100644
--- a/ql/src/test/results/clientpositive/llap/reopt_semijoin.q.out
+++ b/ql/src/test/results/clientpositive/llap/reopt_semijoin.q.out
@@ -180,12 +180,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: d_date_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
                       Select Operator
                         expressions: _col0 (type: int)
                         outputColumnNames: _col0
@@ -355,12 +355,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: d_date_sk (type: int)
                       outputColumnNames: _col0
-                      Statistics: (RUNTIME) Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: (RUNTIME) Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col0 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: int)
-                        Statistics: (RUNTIME) Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: (RUNTIME) Num rows: 1 Data size: 4 Basic stats: COMPLETE Column stats: COMPLETE
                       Select Operator
                         expressions: _col0 (type: int)
                         outputColumnNames: _col0

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/sharedworkext.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/sharedworkext.q.out b/ql/src/test/results/clientpositive/llap/sharedworkext.q.out
index ca2b4d6..e348815 100644
--- a/ql/src/test/results/clientpositive/llap/sharedworkext.q.out
+++ b/ql/src/test/results/clientpositive/llap/sharedworkext.q.out
@@ -121,12 +121,12 @@ STAGE PLANS:
                 Select Operator
                   expressions: _col0 (type: string)
                   outputColumnNames: _col0
-                  Statistics: Num rows: 395 Data size: 70310 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 395 Data size: 34365 Basic stats: COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col0 (type: string)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 395 Data size: 70310 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 395 Data size: 34365 Basic stats: COMPLETE Column stats: COMPLETE
         Reducer 4 
             Execution mode: llap
             Reduce Operator Tree:
@@ -156,12 +156,12 @@ STAGE PLANS:
                 Select Operator
                   expressions: _col0 (type: string)
                   outputColumnNames: _col0
-                  Statistics: Num rows: 395 Data size: 70310 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 395 Data size: 34365 Basic stats: COMPLETE Column stats: COMPLETE
                   Reduce Output Operator
                     key expressions: _col0 (type: string)
                     sort order: +
                     Map-reduce partition columns: _col0 (type: string)
-                    Statistics: Num rows: 395 Data size: 70310 Basic stats: COMPLETE Column stats: COMPLETE
+                    Statistics: Num rows: 395 Data size: 34365 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/stats11.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/stats11.q.out b/ql/src/test/results/clientpositive/llap/stats11.q.out
index d244ddf..c9d5145 100644
--- a/ql/src/test/results/clientpositive/llap/stats11.q.out
+++ b/ql/src/test/results/clientpositive/llap/stats11.q.out
@@ -311,7 +311,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_n15`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n16`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -753,7 +753,7 @@ OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`value` AS `value1`
 FROM (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_n15`
 WHERE `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcbucket_mapjoin_part_n16`
 WHERE `ds` = '2008-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/subquery_in.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/subquery_in.q.out b/ql/src/test/results/clientpositive/llap/subquery_in.q.out
index 039b52a..9cfc960 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_in.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_in.q.out
@@ -1098,12 +1098,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: l_orderkey (type: int), l_partkey (type: int), l_suppkey (type: int)
                       outputColumnNames: _col0, _col1, _col2
-                      Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 14 Data size: 168 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: int)
                         sort order: +
                         Map-reduce partition columns: _col1 (type: int)
-                        Statistics: Num rows: 14 Data size: 224 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 14 Data size: 168 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col2 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -1592,9 +1592,8 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 5 (ONE_TO_ONE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
         Reducer 4 <- Map 3 (SIMPLE_EDGE)
-        Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -1607,14 +1606,14 @@ STAGE PLANS:
                     predicate: p_size is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string), (p_size - 1) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                      Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (_col5 - 1) (type: int)
+                        key expressions: _col9 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (_col5 - 1) (type: int)
-                        Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col9 (type: int)
+                        Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -1646,9 +1645,9 @@ STAGE PLANS:
             Reduce Operator Tree:
               Merge Join Operator
                 condition map:
-                     Inner Join 0 to 1
+                     Left Semi Join 0 to 1
                 keys:
-                  0 (_col5 - 1) (type: int)
+                  0 _col9 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                 Statistics: Num rows: 7 Data size: 4333 Basic stats: COMPLETE Column stats: COMPLETE
@@ -1675,29 +1674,20 @@ STAGE PLANS:
                   Filter Operator
                     predicate: _col1 is not null (type: boolean)
                     Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      keys: _col1 (type: int)
-                      mode: hash
+                    Select Operator
+                      expressions: _col1 (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
+                      Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: _col0 (type: int)
+                        mode: hash
+                        outputColumnNames: _col0
                         Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 5 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
-                keys: KEY._col0 (type: int)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: int)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: int)
+                          Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -1740,9 +1730,8 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 5 (ONE_TO_ONE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
         Reducer 4 <- Map 3 (SIMPLE_EDGE)
-        Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -1755,14 +1744,14 @@ STAGE PLANS:
                     predicate: (p_partkey is not null and p_size is not null) (type: boolean)
                     Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string), (p_partkey * p_size) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                      Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (_col0 * _col5) (type: int)
+                        key expressions: _col9 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (_col0 * _col5) (type: int)
-                        Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col9 (type: int)
+                        Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -1794,9 +1783,9 @@ STAGE PLANS:
             Reduce Operator Tree:
               Merge Join Operator
                 condition map:
-                     Inner Join 0 to 1
+                     Left Semi Join 0 to 1
                 keys:
-                  0 (_col0 * _col5) (type: int)
+                  0 _col9 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                 Statistics: Num rows: 6 Data size: 3714 Basic stats: COMPLETE Column stats: COMPLETE
@@ -1823,29 +1812,20 @@ STAGE PLANS:
                   Filter Operator
                     predicate: _col1 is not null (type: boolean)
                     Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      keys: _col1 (type: int)
-                      mode: hash
+                    Select Operator
+                      expressions: _col1 (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
+                      Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: _col0 (type: int)
+                        mode: hash
+                        outputColumnNames: _col0
                         Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 5 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
-                keys: KEY._col0 (type: int)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: int)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: int)
+                          Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -1995,9 +1975,8 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 5 (ONE_TO_ONE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
         Reducer 4 <- Map 3 (SIMPLE_EDGE)
-        Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -2010,14 +1989,14 @@ STAGE PLANS:
                     predicate: p_retailprice is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string), floor(p_retailprice) (type: bigint)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                      Statistics: Num rows: 26 Data size: 16302 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: floor(_col7) (type: bigint)
+                        key expressions: _col9 (type: bigint)
                         sort order: +
-                        Map-reduce partition columns: floor(_col7) (type: bigint)
-                        Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col9 (type: bigint)
+                        Statistics: Num rows: 26 Data size: 16302 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -2049,9 +2028,9 @@ STAGE PLANS:
             Reduce Operator Tree:
               Merge Join Operator
                 condition map:
-                     Inner Join 0 to 1
+                     Left Semi Join 0 to 1
                 keys:
-                  0 floor(_col7) (type: bigint)
+                  0 _col9 (type: bigint)
                   1 _col0 (type: bigint)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                 Statistics: Num rows: 6 Data size: 3714 Basic stats: COMPLETE Column stats: COMPLETE
@@ -2092,19 +2071,6 @@ STAGE PLANS:
                           sort order: +
                           Map-reduce partition columns: _col0 (type: bigint)
                           Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 5 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
-                keys: KEY._col0 (type: bigint)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: bigint)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: bigint)
-                  Statistics: Num rows: 6 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -2256,7 +2222,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col2 (type: int), _col0 (type: int)
-                  1 _col0 (type: int), (_col0 + 121150) (type: int)
+                  1 _col0 (type: int), _col1 (type: int)
                 outputColumnNames: _col1, _col3
                 Statistics: Num rows: 13 Data size: 1625 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
@@ -2281,11 +2247,15 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int), (_col0 + 121150) (type: int)
-                  sort order: ++
-                  Map-reduce partition columns: _col0 (type: int), (_col0 + 121150) (type: int)
-                  Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), (_col0 + 121150) (type: int)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col1 (type: int)
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                    Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -2606,13 +2576,13 @@ STAGE PLANS:
                     predicate: (p_size is not null and p_type is not null) (type: boolean)
                     Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_type (type: string), p_size (type: int)
+                      expressions: p_type (type: string), (p_size + 1) (type: int)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (_col1 + 1) (type: int)
+                        key expressions: _col1 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (_col1 + 1) (type: int)
+                        Map-reduce partition columns: _col1 (type: int)
                         Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: string)
             Execution mode: vectorized, llap
@@ -2667,7 +2637,7 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 (_col1 + 1) (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col2
                 Statistics: Num rows: 16 Data size: 1728 Basic stats: COMPLETE Column stats: COMPLETE
@@ -3213,10 +3183,9 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 6 (ONE_TO_ONE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
         Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
         Reducer 5 <- Map 4 (SIMPLE_EDGE)
-        Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -3229,14 +3198,14 @@ STAGE PLANS:
                     predicate: p_size is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string), (p_size - 1) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                      Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (_col5 - 1) (type: int)
+                        key expressions: _col9 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (_col5 - 1) (type: int)
-                        Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col9 (type: int)
+                        Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -3268,9 +3237,9 @@ STAGE PLANS:
             Reduce Operator Tree:
               Merge Join Operator
                 condition map:
-                     Inner Join 0 to 1
+                     Left Semi Join 0 to 1
                 keys:
-                  0 (_col5 - 1) (type: int)
+                  0 _col9 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                 Statistics: Num rows: 7 Data size: 4333 Basic stats: COMPLETE Column stats: COMPLETE
@@ -3309,29 +3278,20 @@ STAGE PLANS:
                   Filter Operator
                     predicate: _col1 is not null (type: boolean)
                     Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      keys: _col1 (type: int)
-                      mode: hash
+                    Select Operator
+                      expressions: _col1 (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
+                      Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: _col0 (type: int)
+                        mode: hash
+                        outputColumnNames: _col0
                         Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 6 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
-                keys: KEY._col0 (type: int)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: int)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: int)
+                          Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -3374,10 +3334,9 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 6 (ONE_TO_ONE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
         Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
         Reducer 5 <- Map 4 (SIMPLE_EDGE)
-        Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -3390,14 +3349,14 @@ STAGE PLANS:
                     predicate: p_size is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string)
-                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                      Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: p_partkey (type: int), p_name (type: string), p_mfgr (type: string), p_brand (type: string), p_type (type: string), p_size (type: int), p_container (type: string), p_retailprice (type: double), p_comment (type: string), (p_size - 1) (type: int)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9
+                      Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (_col5 - 1) (type: int)
+                        key expressions: _col9 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (_col5 - 1) (type: int)
-                        Statistics: Num rows: 26 Data size: 16094 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col9 (type: int)
+                        Statistics: Num rows: 26 Data size: 16198 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string), _col5 (type: int), _col6 (type: string), _col7 (type: double), _col8 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -3429,9 +3388,9 @@ STAGE PLANS:
             Reduce Operator Tree:
               Merge Join Operator
                 condition map:
-                     Inner Join 0 to 1
+                     Left Semi Join 0 to 1
                 keys:
-                  0 (_col5 - 1) (type: int)
+                  0 _col9 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
                 Statistics: Num rows: 7 Data size: 4333 Basic stats: COMPLETE Column stats: COMPLETE
@@ -3474,29 +3433,20 @@ STAGE PLANS:
                   Filter Operator
                     predicate: _col1 is not null (type: boolean)
                     Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      keys: _col1 (type: int)
-                      mode: hash
+                    Select Operator
+                      expressions: _col1 (type: int)
                       outputColumnNames: _col0
-                      Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                      Reduce Output Operator
-                        key expressions: _col0 (type: int)
-                        sort order: +
-                        Map-reduce partition columns: _col0 (type: int)
+                      Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: _col0 (type: int)
+                        mode: hash
+                        outputColumnNames: _col0
                         Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 6 
-            Execution mode: vectorized, llap
-            Reduce Operator Tree:
-              Group By Operator
-                keys: KEY._col0 (type: int)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+                        Reduce Output Operator
+                          key expressions: _col0 (type: int)
+                          sort order: +
+                          Map-reduce partition columns: _col0 (type: int)
+                          Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -4000,12 +3950,12 @@ STAGE PLANS:
                     Select Operator
                       expressions: p_name (type: string), p_type (type: string)
                       outputColumnNames: _col0, _col1
-                      Statistics: Num rows: 26 Data size: 5954 Basic stats: COMPLETE Column stats: COMPLETE
+                      Statistics: Num rows: 26 Data size: 5850 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
                         key expressions: _col1 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col1 (type: string)
-                        Statistics: Num rows: 26 Data size: 5954 Basic stats: COMPLETE Column stats: COMPLETE
+                        Statistics: Num rows: 26 Data size: 5850 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: string)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -4057,10 +4007,10 @@ STAGE PLANS:
                 keys:
                   0 _col1 (type: string)
                   1 _col0 (type: string)
-                outputColumnNames: _col0, _col4
+                outputColumnNames: _col0, _col3
                 Statistics: Num rows: 28 Data size: 3500 Basic stats: COMPLETE Column stats: COMPLETE
                 Select Operator
-                  expressions: _col0 (type: string), _col4 (type: int)
+                  expressions: _col0 (type: string), _col3 (type: int)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 28 Data size: 3500 Basic stats: COMPLETE Column stats: COMPLETE
                   Group By Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/llap/subquery_notin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/subquery_notin.q.out b/ql/src/test/results/clientpositive/llap/subquery_notin.q.out
index 37e7562..29d8bbf 100644
--- a/ql/src/test/results/clientpositive/llap/subquery_notin.q.out
+++ b/ql/src/test/results/clientpositive/llap/subquery_notin.q.out
@@ -2783,16 +2783,20 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int), (_col0 + 121150) (type: int)
-                  sort order: ++
-                  Map-reduce partition columns: _col0 (type: int), (_col0 + 121150) (type: int)
-                  Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int), (_col0 + 121150) (type: int)
-                  sort order: ++
-                  Map-reduce partition columns: _col0 (type: int), (_col0 + 121150) (type: int)
-                  Statistics: Num rows: 13 Data size: 52 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), (_col0 + 121150) (type: int)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col1 (type: int)
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                    Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col1 (type: int)
+                    sort order: ++
+                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                    Statistics: Num rows: 13 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
         Reducer 2 
             Execution mode: llap
             Reduce Operator Tree:
@@ -2843,7 +2847,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col2 (type: int), _col0 (type: int)
-                  1 _col0 (type: int), (_col0 + 121150) (type: int)
+                  1 _col0 (type: int), _col1 (type: int)
                 outputColumnNames: _col1, _col3
                 Statistics: Num rows: 13 Data size: 1625 Basic stats: COMPLETE Column stats: COMPLETE
                 Group By Operator
@@ -2881,7 +2885,7 @@ STAGE PLANS:
                      Inner Join 0 to 1
                 keys:
                   0 _col2 (type: int), _col0 (type: int)
-                  1 _col0 (type: int), (_col0 + 121150) (type: int)
+                  1 _col0 (type: int), _col1 (type: int)
                 outputColumnNames: _col1, _col3
                 Statistics: Num rows: 13 Data size: 1625 Basic stats: COMPLETE Column stats: COMPLETE
                 Group By Operator
@@ -3345,26 +3349,26 @@ STAGE PLANS:
                     predicate: p_size is not null (type: boolean)
                     Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_type (type: string), p_size (type: int)
+                      expressions: p_type (type: string), (p_size + 1) (type: int)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (_col1 + 1) (type: int)
+                        key expressions: _col1 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (_col1 + 1) (type: int)
+                        Map-reduce partition columns: _col1 (type: int)
                         Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: string)
                   Filter Operator
                     predicate: (p_size is not null and p_type is not null) (type: boolean)
                     Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: p_type (type: string), p_size (type: int)
+                      expressions: p_type (type: string), (p_size + 1) (type: int)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: (_col1 + 1) (type: int)
+                        key expressions: _col1 (type: int)
                         sort order: +
-                        Map-reduce partition columns: (_col1 + 1) (type: int)
+                        Map-reduce partition columns: _col1 (type: int)
                         Statistics: Num rows: 26 Data size: 2808 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: string)
             Execution mode: vectorized, llap
@@ -3486,7 +3490,7 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 (_col1 + 1) (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col2
                 Statistics: Num rows: 16 Data size: 1728 Basic stats: COMPLETE Column stats: COMPLETE
@@ -3524,7 +3528,7 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 (_col1 + 1) (type: int)
+                  0 _col1 (type: int)
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col2
                 Statistics: Num rows: 16 Data size: 1728 Basic stats: COMPLETE Column stats: COMPLETE
@@ -5836,14 +5840,14 @@ STAGE PLANS:
                     predicate: c1 is not null (type: boolean)
                     Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
-                      expressions: c1 (type: int)
-                      outputColumnNames: _col0
-                      Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                      expressions: c1 (type: int), UDFToDouble(c1) (type: double)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
                       Reduce Output Operator
-                        key expressions: UDFToDouble(_col0) (type: double)
+                        key expressions: _col1 (type: double)
                         sort order: +
-                        Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                        Statistics: Num rows: 2 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                        Map-reduce partition columns: _col1 (type: double)
+                        Statistics: Num rows: 2 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
                         value expressions: _col0 (type: int)
             Execution mode: vectorized, llap
             LLAP IO: no inputs
@@ -5897,12 +5901,16 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
-                  sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-                  Statistics: Num rows: 1 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
-                  value expressions: _col0 (type: char(100))
+                Select Operator
+                  expressions: _col0 (type: char(100)), UDFToDouble(_col0) (type: double)
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 1 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col1 (type: double)
+                    sort order: +
+                    Map-reduce partition columns: _col1 (type: double)
+                    Statistics: Num rows: 1 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+                    value expressions: _col0 (type: char(100))
         Reducer 6 
             Execution mode: llap
             Reduce Operator Tree:
@@ -5910,12 +5918,12 @@ STAGE PLANS:
                 condition map:
                      Inner Join 0 to 1
                 keys:
-                  0 UDFToDouble(_col0) (type: double)
-                  1 UDFToDouble(_col0) (type: double)
-                outputColumnNames: _col0, _col1
+                  0 _col1 (type: double)
+                  1 _col1 (type: double)
+                outputColumnNames: _col0, _col2
                 Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE
                 Group By Operator
-                  aggregations: count(), count(_col1)
+                  aggregations: count(), count(_col2)
                   keys: _col0 (type: char(100))
                   mode: hash
                   outputColumnNames: _col0, _col1, _col2
@@ -5927,7 +5935,7 @@ STAGE PLANS:
                     Statistics: Num rows: 1 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
                     value expressions: _col1 (type: bigint), _col2 (type: bigint)
                 Group By Operator
-                  keys: _col1 (type: int), _col0 (type: char(100))
+                  keys: _col2 (type: int), _col0 (type: char(100))
                   mode: hash
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 1 Data size: 92 Basic stats: COMPLETE Column stats: COMPLETE


[08/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query66.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query66.q.out b/ql/src/test/results/clientpositive/perf/tez/query66.q.out
index 225b62f..767d47b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query66.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query66.q.out
@@ -511,10 +511,10 @@ Stage-0
                                 PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
                                 Group By Operator [GBY_62] (rows=5559759 width=3166)
                                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col20","_col21","_col22","_col23","_col24","_col25","_col26","_col27","_col28","_col29"],aggregations:["sum(_col6)","sum(_col7)","sum(_col8)","sum(_col9)","sum(_col10)","sum(_col11)","sum(_col12)","sum(_col13)","sum(_col14)","sum(_col15)","sum(_col16)","sum(_col17)","sum(_col18)","sum(_col19)","sum(_col20)","sum(_col21)","sum(_col22)","sum(_col23)","sum(_col24)","sum(_col25)","sum(_col26)","sum(_col27)","sum(_col28)","sum(_col29)"],keys:_col0, _col1, _col2, _col3, _col4, _col5
-                                  Select Operator [SEL_60] (rows=5559759 width=680)
+                                  Select Operator [SEL_60] (rows=5559759 width=750)
                                     Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col20","_col21","_col22","_col23","_col24","_col25","_col26","_col27","_col28","_col29"]
-                                    Merge Join Operator [MERGEJOIN_204] (rows=5559759 width=680)
-                                      Conds:RS_57._col3=RS_259._col0(Inner),Output:["_col4","_col5","_col6","_col11","_col15","_col16","_col17","_col18","_col19","_col20"]
+                                    Merge Join Operator [MERGEJOIN_204] (rows=5559759 width=750)
+                                      Conds:RS_57._col3=RS_259._col0(Inner),Output:["_col4","_col5","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col22","_col23","_col24","_col25","_col26","_col27"]
                                     <-Map 24 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_259]
                                         PartitionCols:_col0
@@ -527,12 +527,12 @@ Stage-0
                                     <-Reducer 14 [SIMPLE_EDGE]
                                       SHUFFLE [RS_57]
                                         PartitionCols:_col3
-                                        Merge Join Operator [MERGEJOIN_203] (rows=5559759 width=205)
-                                          Conds:RS_54._col2=RS_245._col0(Inner),Output:["_col3","_col4","_col5","_col6","_col11"]
+                                        Merge Join Operator [MERGEJOIN_203] (rows=5559759 width=274)
+                                          Conds:RS_54._col2=RS_245._col0(Inner),Output:["_col3","_col4","_col5","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19"]
                                         <-Map 21 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_245]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_242] (rows=1 width=88)
+                                            Select Operator [SEL_242] (rows=1 width=4)
                                               Output:["_col0"]
                                               Filter Operator [FIL_241] (rows=1 width=88)
                                                 predicate:((sm_carrier) IN ('DIAMOND', 'AIRBORNE') and sm_ship_mode_sk is not null)
@@ -541,13 +541,13 @@ Stage-0
                                         <-Reducer 13 [SIMPLE_EDGE]
                                           SHUFFLE [RS_54]
                                             PartitionCols:_col2
-                                            Merge Join Operator [MERGEJOIN_202] (rows=11119518 width=224)
-                                              Conds:RS_51._col0=RS_233._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col6","_col11"]
+                                            Merge Join Operator [MERGEJOIN_202] (rows=11119518 width=278)
+                                              Conds:RS_51._col0=RS_233._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19"]
                                             <-Map 18 [SIMPLE_EDGE] vectorized
                                               SHUFFLE [RS_233]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_230] (rows=652 width=12)
-                                                  Output:["_col0","_col2"]
+                                                Select Operator [SEL_230] (rows=652 width=52)
+                                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12"]
                                                   Filter Operator [FIL_229] (rows=652 width=12)
                                                     predicate:((d_year = 2002) and d_date_sk is not null)
                                                     TableScan [TS_6] (rows=73049 width=12)
@@ -555,12 +555,12 @@ Stage-0
                                             <-Reducer 12 [SIMPLE_EDGE]
                                               SHUFFLE [RS_51]
                                                 PartitionCols:_col0
-                                                Merge Join Operator [MERGEJOIN_201] (rows=31363607 width=234)
-                                                  Conds:RS_279._col1=RS_221._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6"]
+                                                Merge Join Operator [MERGEJOIN_201] (rows=31363607 width=235)
+                                                  Conds:RS_279._col1=RS_221._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
                                                 <-Map 10 [SIMPLE_EDGE] vectorized
                                                   SHUFFLE [RS_221]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_218] (rows=9600 width=8)
+                                                    Select Operator [SEL_218] (rows=9600 width=4)
                                                       Output:["_col0"]
                                                       Filter Operator [FIL_217] (rows=9600 width=8)
                                                         predicate:(t_time BETWEEN 49530 AND 78330 and t_time_sk is not null)
@@ -569,8 +569,8 @@ Stage-0
                                                 <-Map 25 [SIMPLE_EDGE] vectorized
                                                   SHUFFLE [RS_279]
                                                     PartitionCols:_col1
-                                                    Select Operator [SEL_278] (rows=282272460 width=243)
-                                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                                    Select Operator [SEL_278] (rows=282272460 width=239)
+                                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                                       Filter Operator [FIL_277] (rows=282272460 width=243)
                                                         predicate:((cs_ship_mode_sk BETWEEN DynamicValue(RS_55_ship_mode_sm_ship_mode_sk_min) AND DynamicValue(RS_55_ship_mode_sm_ship_mode_sk_max) and in_bloom_filter(cs_ship_mode_sk, DynamicValue(RS_55_ship_mode_sm_ship_mode_sk_bloom_filter))) and (cs_sold_date_sk BETWEEN DynamicValue(RS_52_date_dim_d_date_sk_min) AND DynamicValue(RS_52_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_52_date_dim_d_date_sk_bloom_filter))) and (cs_sold_time_sk BETWEEN DynamicValue(RS_49_time_dim_t_time_sk_min) AND DynamicValue(RS_49_time_dim_t_time_sk_max) and in_bloom_filter(cs_sold_time_sk, DynamicValue(RS_49_time_dim_t_time_sk_bloom_filter))) and cs_ship_mode_sk is not null and cs_sold_date_sk is not null and cs_sold_time_sk is not null and cs_warehouse_sk is not null)
                                                         TableScan [TS_33] (rows=287989836 width=243)
@@ -624,10 +624,10 @@ Stage-0
                                 PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
                                 Group By Operator [GBY_29] (rows=27 width=3166)
                                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col20","_col21","_col22","_col23","_col24","_col25","_col26","_col27","_col28","_col29"],aggregations:["sum(_col6)","sum(_col7)","sum(_col8)","sum(_col9)","sum(_col10)","sum(_col11)","sum(_col12)","sum(_col13)","sum(_col14)","sum(_col15)","sum(_col16)","sum(_col17)","sum(_col18)","sum(_col19)","sum(_col20)","sum(_col21)","sum(_col22)","sum(_col23)","sum(_col24)","sum(_col25)","sum(_col26)","sum(_col27)","sum(_col28)","sum(_col29)"],keys:_col0, _col1, _col2, _col3, _col4, _col5
-                                  Select Operator [SEL_27] (rows=2853684 width=707)
+                                  Select Operator [SEL_27] (rows=2853684 width=750)
                                     Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col20","_col21","_col22","_col23","_col24","_col25","_col26","_col27","_col28","_col29"]
-                                    Merge Join Operator [MERGEJOIN_200] (rows=2853684 width=707)
-                                      Conds:RS_24._col3=RS_258._col0(Inner),Output:["_col4","_col5","_col6","_col11","_col15","_col16","_col17","_col18","_col19","_col20"]
+                                    Merge Join Operator [MERGEJOIN_200] (rows=2853684 width=750)
+                                      Conds:RS_24._col3=RS_258._col0(Inner),Output:["_col4","_col5","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19","_col22","_col23","_col24","_col25","_col26","_col27"]
                                     <-Map 24 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_258]
                                         PartitionCols:_col0
@@ -635,8 +635,8 @@ Stage-0
                                     <-Reducer 4 [SIMPLE_EDGE]
                                       SHUFFLE [RS_24]
                                         PartitionCols:_col3
-                                        Merge Join Operator [MERGEJOIN_199] (rows=2853684 width=233)
-                                          Conds:RS_21._col2=RS_243._col0(Inner),Output:["_col3","_col4","_col5","_col6","_col11"]
+                                        Merge Join Operator [MERGEJOIN_199] (rows=2853684 width=275)
+                                          Conds:RS_21._col2=RS_243._col0(Inner),Output:["_col3","_col4","_col5","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19"]
                                         <-Map 21 [SIMPLE_EDGE] vectorized
                                           SHUFFLE [RS_243]
                                             PartitionCols:_col0
@@ -644,8 +644,8 @@ Stage-0
                                         <-Reducer 3 [SIMPLE_EDGE]
                                           SHUFFLE [RS_21]
                                             PartitionCols:_col2
-                                            Merge Join Operator [MERGEJOIN_198] (rows=5707369 width=238)
-                                              Conds:RS_18._col0=RS_231._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col6","_col11"]
+                                            Merge Join Operator [MERGEJOIN_198] (rows=5707369 width=279)
+                                              Conds:RS_18._col0=RS_231._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18","_col19"]
                                             <-Map 18 [SIMPLE_EDGE] vectorized
                                               SHUFFLE [RS_231]
                                                 PartitionCols:_col0
@@ -653,8 +653,8 @@ Stage-0
                                             <-Reducer 2 [SIMPLE_EDGE]
                                               SHUFFLE [RS_18]
                                                 PartitionCols:_col0
-                                                Merge Join Operator [MERGEJOIN_197] (rows=15984351 width=239)
-                                                  Conds:RS_255._col1=RS_219._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6"]
+                                                Merge Join Operator [MERGEJOIN_197] (rows=15984351 width=235)
+                                                  Conds:RS_255._col1=RS_219._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
                                                 <-Map 10 [SIMPLE_EDGE] vectorized
                                                   SHUFFLE [RS_219]
                                                     PartitionCols:_col0
@@ -662,8 +662,8 @@ Stage-0
                                                 <-Map 1 [SIMPLE_EDGE] vectorized
                                                   SHUFFLE [RS_255]
                                                     PartitionCols:_col1
-                                                    Select Operator [SEL_254] (rows=143859154 width=243)
-                                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                                                    Select Operator [SEL_254] (rows=143859154 width=239)
+                                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                                                       Filter Operator [FIL_253] (rows=143859154 width=243)
                                                         predicate:((ws_ship_mode_sk BETWEEN DynamicValue(RS_22_ship_mode_sm_ship_mode_sk_min) AND DynamicValue(RS_22_ship_mode_sm_ship_mode_sk_max) and in_bloom_filter(ws_ship_mode_sk, DynamicValue(RS_22_ship_mode_sm_ship_mode_sk_bloom_filter))) and (ws_sold_date_sk BETWEEN DynamicValue(RS_19_date_dim_d_date_sk_min) AND DynamicValue(RS_19_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_19_date_dim_d_date_sk_bloom_filter))) and (ws_sold_time_sk BETWEEN DynamicValue(RS_16_time_dim_t_time_sk_min) AND DynamicValue(RS_16_time_dim_t_time_sk_max) and in_bloom_filter(ws_sold_time_sk, DynamicValue(RS_16_time_dim_t_time_sk_bloom_filter))) and ws_ship_mode_sk is not null and ws_sold_date_sk is not null and ws_sold_time_sk is not null and ws_warehouse_sk is not null)
                                                         TableScan [TS_0] (rows=144002668 width=243)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query67.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query67.q.out b/ql/src/test/results/clientpositive/perf/tez/query67.q.out
index b290331..442abc8 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query67.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query67.q.out
@@ -111,92 +111,90 @@ Stage-0
     limit:100
     Stage-1
       Reducer 7 vectorized
-      File Output Operator [FS_112]
-        Limit [LIM_111] (rows=100 width=617)
+      File Output Operator [FS_111]
+        Limit [LIM_110] (rows=100 width=617)
           Number of rows:100
-          Select Operator [SEL_110] (rows=273593580 width=617)
+          Select Operator [SEL_109] (rows=273593580 width=617)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
           <-Reducer 6 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_109]
-              Select Operator [SEL_108] (rows=273593580 width=617)
+            SHUFFLE [RS_108]
+              Select Operator [SEL_107] (rows=273593580 width=617)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
-                Filter Operator [FIL_107] (rows=273593580 width=613)
+                Filter Operator [FIL_106] (rows=273593580 width=613)
                   predicate:(rank_window_0 <= 100)
-                  PTF Operator [PTF_106] (rows=820780740 width=613)
-                    Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col8 DESC NULLS LAST","partition by:":"_col0"}]
-                    Select Operator [SEL_105] (rows=820780740 width=613)
+                  PTF Operator [PTF_105] (rows=820780740 width=613)
+                    Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col8 DESC NULLS LAST","partition by:":"_col2"}]
+                    Select Operator [SEL_104] (rows=820780740 width=613)
                       Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
                     <-Reducer 5 [SIMPLE_EDGE] vectorized
-                      SHUFFLE [RS_104]
-                        PartitionCols:_col0
-                        Select Operator [SEL_103] (rows=820780740 width=613)
+                      SHUFFLE [RS_103]
+                        PartitionCols:_col2
+                        Select Operator [SEL_102] (rows=820780740 width=613)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
-                          Group By Operator [GBY_102] (rows=820780740 width=621)
+                          Group By Operator [GBY_101] (rows=820780740 width=621)
                             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col9"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5, KEY._col6, KEY._col7, KEY._col8
                           <-Reducer 4 [SIMPLE_EDGE]
-                            SHUFFLE [RS_24]
+                            SHUFFLE [RS_23]
                               PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                              Group By Operator [GBY_23] (rows=820780740 width=621)
-                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"],aggregations:["sum(_col8)"],keys:_col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, 0L
-                                Select Operator [SEL_21] (rows=91197860 width=586)
-                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
-                                  Merge Join Operator [MERGEJOIN_84] (rows=91197860 width=586)
-                                    Conds:RS_18._col1=RS_101._col0(Inner),Output:["_col3","_col4","_col7","_col8","_col9","_col11","_col13","_col14","_col15","_col16"]
-                                  <-Map 11 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_101]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_100] (rows=462000 width=393)
-                                        Output:["_col0","_col1","_col2","_col3","_col4"]
-                                        Filter Operator [FIL_99] (rows=462000 width=393)
-                                          predicate:i_item_sk is not null
-                                          TableScan [TS_9] (rows=462000 width=393)
-                                            default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_brand","i_class","i_category","i_product_name"]
-                                  <-Reducer 3 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_18]
-                                      PartitionCols:_col1
-                                      Merge Join Operator [MERGEJOIN_83] (rows=91197860 width=201)
-                                        Conds:RS_15._col2=RS_98._col0(Inner),Output:["_col1","_col3","_col4","_col7","_col8","_col9","_col11"]
-                                      <-Map 10 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_98]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_97] (rows=1704 width=104)
-                                            Output:["_col0","_col1"]
-                                            Filter Operator [FIL_96] (rows=1704 width=104)
-                                              predicate:s_store_sk is not null
-                                              TableScan [TS_6] (rows=1704 width=104)
-                                                default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_id"]
-                                      <-Reducer 2 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_15]
-                                          PartitionCols:_col2
-                                          Merge Join Operator [MERGEJOIN_82] (rows=91197860 width=104)
-                                            Conds:RS_95._col0=RS_87._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col7","_col8","_col9"]
-                                          <-Map 8 [SIMPLE_EDGE] vectorized
-                                            PARTITION_ONLY_SHUFFLE [RS_87]
-                                              PartitionCols:_col0
-                                              Select Operator [SEL_86] (rows=317 width=20)
-                                                Output:["_col0","_col2","_col3","_col4"]
-                                                Filter Operator [FIL_85] (rows=317 width=20)
-                                                  predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)
-                                                  TableScan [TS_3] (rows=73049 width=20)
-                                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_month_seq","d_year","d_moy","d_qoy"]
-                                          <-Map 1 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_95]
-                                              PartitionCols:_col0
-                                              Select Operator [SEL_94] (rows=525329897 width=122)
-                                                Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                Filter Operator [FIL_93] (rows=525329897 width=122)
-                                                  predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_13_date_dim_d_date_sk_min) AND DynamicValue(RS_13_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_13_date_dim_d_date_sk_bloom_filter))) and ss_item_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
-                                                  TableScan [TS_0] (rows=575995635 width=122)
-                                                    default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_store_sk","ss_quantity","ss_sales_price"]
-                                                  <-Reducer 9 [BROADCAST_EDGE] vectorized
-                                                    BROADCAST [RS_92]
-                                                      Group By Operator [GBY_91] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                      <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                        PARTITION_ONLY_SHUFFLE [RS_90]
-                                                          Group By Operator [GBY_89] (rows=1 width=12)
-                                                            Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                            Select Operator [SEL_88] (rows=317 width=4)
-                                                              Output:["_col0"]
-                                                               Please refer to the previous Select Operator [SEL_86]
+                              Group By Operator [GBY_22] (rows=820780740 width=621)
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"],aggregations:["sum(_col3)"],keys:_col11, _col12, _col13, _col14, _col5, _col6, _col7, _col9, 0L
+                                Merge Join Operator [MERGEJOIN_83] (rows=91197860 width=613)
+                                  Conds:RS_18._col1=RS_100._col0(Inner),Output:["_col3","_col5","_col6","_col7","_col9","_col11","_col12","_col13","_col14"]
+                                <-Map 11 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_100]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_99] (rows=462000 width=393)
+                                      Output:["_col0","_col1","_col2","_col3","_col4"]
+                                      Filter Operator [FIL_98] (rows=462000 width=393)
+                                        predicate:i_item_sk is not null
+                                        TableScan [TS_9] (rows=462000 width=393)
+                                          default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_brand","i_class","i_category","i_product_name"]
+                                <-Reducer 3 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_18]
+                                    PartitionCols:_col1
+                                    Merge Join Operator [MERGEJOIN_82] (rows=91197860 width=228)
+                                      Conds:RS_15._col2=RS_97._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col9"]
+                                    <-Map 10 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_97]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_96] (rows=1704 width=104)
+                                          Output:["_col0","_col1"]
+                                          Filter Operator [FIL_95] (rows=1704 width=104)
+                                            predicate:s_store_sk is not null
+                                            TableScan [TS_6] (rows=1704 width=104)
+                                              default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_id"]
+                                    <-Reducer 2 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_15]
+                                        PartitionCols:_col2
+                                        Merge Join Operator [MERGEJOIN_81] (rows=91197860 width=130)
+                                          Conds:RS_94._col0=RS_86._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col7"]
+                                        <-Map 8 [SIMPLE_EDGE] vectorized
+                                          PARTITION_ONLY_SHUFFLE [RS_86]
+                                            PartitionCols:_col0
+                                            Select Operator [SEL_85] (rows=317 width=16)
+                                              Output:["_col0","_col1","_col2","_col3"]
+                                              Filter Operator [FIL_84] (rows=317 width=20)
+                                                predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)
+                                                TableScan [TS_3] (rows=73049 width=20)
+                                                  default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_month_seq","d_year","d_moy","d_qoy"]
+                                        <-Map 1 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_94]
+                                            PartitionCols:_col0
+                                            Select Operator [SEL_93] (rows=525329897 width=123)
+                                              Output:["_col0","_col1","_col2","_col3"]
+                                              Filter Operator [FIL_92] (rows=525329897 width=122)
+                                                predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_13_date_dim_d_date_sk_min) AND DynamicValue(RS_13_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_13_date_dim_d_date_sk_bloom_filter))) and ss_item_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
+                                                TableScan [TS_0] (rows=575995635 width=122)
+                                                  default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_store_sk","ss_quantity","ss_sales_price"]
+                                                <-Reducer 9 [BROADCAST_EDGE] vectorized
+                                                  BROADCAST [RS_91]
+                                                    Group By Operator [GBY_90] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                    <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                      PARTITION_ONLY_SHUFFLE [RS_89]
+                                                        Group By Operator [GBY_88] (rows=1 width=12)
+                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                          Select Operator [SEL_87] (rows=317 width=4)
+                                                            Output:["_col0"]
+                                                             Please refer to the previous Select Operator [SEL_85]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query68.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query68.q.out b/ql/src/test/results/clientpositive/perf/tez/query68.q.out
index 0a7a53a..390b41b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query68.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query68.q.out
@@ -162,9 +162,9 @@ Stage-0
                           SHUFFLE [RS_35]
                             PartitionCols:_col0, _col1, _col2, _col3
                             Group By Operator [GBY_34] (rows=727776 width=433)
-                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col1, _col18, _col3, _col5
+                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col1, _col13, _col3, _col5
                               Merge Join Operator [MERGEJOIN_144] (rows=727776 width=97)
-                                Conds:RS_30._col3=RS_152._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col8","_col18"]
+                                Conds:RS_30._col3=RS_152._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col8","_col13"]
                               <-Map 5 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_152]
                                   PartitionCols:_col0
@@ -177,7 +177,7 @@ Stage-0
                                   <-Map 16 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_171]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_170] (rows=1855 width=12)
+                                      Select Operator [SEL_170] (rows=1855 width=4)
                                         Output:["_col0"]
                                         Filter Operator [FIL_169] (rows=1855 width=12)
                                           predicate:(((hd_dep_count = 2) or (hd_vehicle_count = 1)) and hd_demo_sk is not null)
@@ -191,7 +191,7 @@ Stage-0
                                       <-Map 14 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_163]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_162] (rows=14 width=97)
+                                          Select Operator [SEL_162] (rows=14 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_161] (rows=14 width=97)
                                               predicate:((s_city) IN ('Cedar Grove', 'Wildwood') and s_store_sk is not null)
@@ -205,7 +205,7 @@ Stage-0
                                           <-Map 12 [SIMPLE_EDGE] vectorized
                                             SHUFFLE [RS_155]
                                               PartitionCols:_col0
-                                              Select Operator [SEL_154] (rows=170 width=12)
+                                              Select Operator [SEL_154] (rows=170 width=4)
                                                 Output:["_col0"]
                                                 Filter Operator [FIL_153] (rows=170 width=12)
                                                   predicate:((d_year) IN (1998, 1999, 2000) and d_date_sk is not null and d_dom BETWEEN 1 AND 2)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query69.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query69.q.out b/ql/src/test/results/clientpositive/perf/tez/query69.q.out
index 65601d7..4da7a69 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query69.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query69.q.out
@@ -223,7 +223,7 @@ Stage-0
                                                 <-Map 16 [SIMPLE_EDGE] vectorized
                                                   PARTITION_ONLY_SHUFFLE [RS_196]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_195] (rows=150 width=12)
+                                                    Select Operator [SEL_195] (rows=150 width=4)
                                                       Output:["_col0"]
                                                       Filter Operator [FIL_194] (rows=150 width=12)
                                                         predicate:((d_year = 1999) and d_date_sk is not null and d_moy BETWEEN 1 AND 3)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query7.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query7.q.out b/ql/src/test/results/clientpositive/perf/tez/query7.q.out
index 6cd8fb5..fece637 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query7.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query7.q.out
@@ -83,11 +83,11 @@ Stage-0
                   SHUFFLE [RS_29]
                     PartitionCols:_col0
                     Group By Operator [GBY_28] (rows=462000 width=476)
-                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"],aggregations:["sum(_col4)","count(_col4)","sum(_col5)","count(_col5)","sum(_col7)","count(_col7)","sum(_col6)","count(_col6)"],keys:_col18
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"],aggregations:["sum(_col4)","count(_col4)","sum(_col5)","count(_col5)","sum(_col7)","count(_col7)","sum(_col6)","count(_col6)"],keys:_col12
                       Top N Key Operator [TNK_55] (rows=1441769 width=100)
-                        keys:_col18,sort order:+,top n:100
+                        keys:_col12,sort order:+,top n:100
                         Merge Join Operator [MERGEJOIN_99] (rows=1441769 width=100)
-                          Conds:RS_24._col1=RS_124._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col18"]
+                          Conds:RS_24._col1=RS_124._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col12"]
                         <-Map 13 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_124]
                             PartitionCols:_col0
@@ -105,7 +105,7 @@ Stage-0
                             <-Map 12 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_121]
                                 PartitionCols:_col0
-                                Select Operator [SEL_120] (rows=2300 width=174)
+                                Select Operator [SEL_120] (rows=2300 width=4)
                                   Output:["_col0"]
                                   Filter Operator [FIL_119] (rows=2300 width=174)
                                     predicate:(((p_channel_email = 'N') or (p_channel_event = 'N')) and p_promo_sk is not null)
@@ -119,7 +119,7 @@ Stage-0
                                 <-Map 10 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_110]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_109] (rows=652 width=8)
+                                    Select Operator [SEL_109] (rows=652 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_108] (rows=652 width=8)
                                         predicate:((d_year = 1998) and d_date_sk is not null)
@@ -133,7 +133,7 @@ Stage-0
                                     <-Map 8 [SIMPLE_EDGE] vectorized
                                       PARTITION_ONLY_SHUFFLE [RS_102]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_101] (rows=14776 width=265)
+                                        Select Operator [SEL_101] (rows=14776 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_100] (rows=14776 width=268)
                                             predicate:((cd_education_status = 'Primary') and (cd_gender = 'F') and (cd_marital_status = 'W') and cd_demo_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query70.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query70.q.out b/ql/src/test/results/clientpositive/perf/tez/query70.q.out
index e8743e3..4650ef6 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query70.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query70.q.out
@@ -149,9 +149,9 @@ Stage-0
                                                 SHUFFLE [RS_26]
                                                   PartitionCols:_col0
                                                   Group By Operator [GBY_25] (rows=1704 width=198)
-                                                    Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col6
+                                                    Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col5
                                                     Merge Join Operator [MERGEJOIN_133] (rows=91197860 width=168)
-                                                      Conds:RS_21._col1=RS_151._col0(Inner),Output:["_col2","_col6"]
+                                                      Conds:RS_21._col1=RS_151._col0(Inner),Output:["_col2","_col5"]
                                                     <-Reducer 2 [SIMPLE_EDGE]
                                                       SHUFFLE [RS_21]
                                                         PartitionCols:_col1

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query71.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query71.q.out b/ql/src/test/results/clientpositive/perf/tez/query71.q.out
index e031c3a..3654e99 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query71.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query71.q.out
@@ -125,13 +125,13 @@ Stage-0
                 SHUFFLE [RS_46]
                   PartitionCols:_col0, _col1, _col2, _col3
                   Group By Operator [GBY_45] (rows=1991967 width=223)
-                    Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col0)"],keys:_col4, _col8, _col9, _col5
+                    Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col0)"],keys:_col4, _col7, _col8, _col5
                     Merge Join Operator [MERGEJOIN_140] (rows=1991967 width=112)
-                      Conds:RS_41._col2=RS_173._col0(Inner),Output:["_col0","_col4","_col5","_col8","_col9"]
+                      Conds:RS_41._col2=RS_173._col0(Inner),Output:["_col0","_col4","_col5","_col7","_col8"]
                     <-Map 20 [SIMPLE_EDGE] vectorized
                       SHUFFLE [RS_173]
                         PartitionCols:_col0
-                        Select Operator [SEL_172] (rows=43200 width=99)
+                        Select Operator [SEL_172] (rows=43200 width=12)
                           Output:["_col0","_col1","_col2"]
                           Filter Operator [FIL_171] (rows=43200 width=99)
                             predicate:((t_meal_time) IN ('breakfast', 'dinner') and t_time_sk is not null)
@@ -145,7 +145,7 @@ Stage-0
                         <-Map 18 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_163]
                             PartitionCols:_col0
-                            Select Operator [SEL_162] (rows=7333 width=111)
+                            Select Operator [SEL_162] (rows=7333 width=107)
                               Output:["_col0","_col1","_col2"]
                               Filter Operator [FIL_161] (rows=7333 width=111)
                                 predicate:((i_manager_id = 1) and i_item_sk is not null)
@@ -162,7 +162,7 @@ Stage-0
                                 <-Map 12 [SIMPLE_EDGE] vectorized
                                   PARTITION_ONLY_SHUFFLE [RS_191]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_190] (rows=50 width=12)
+                                    Select Operator [SEL_190] (rows=50 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_189] (rows=50 width=12)
                                         predicate:((d_moy = 12) and (d_year = 2001) and d_date_sk is not null)
@@ -220,7 +220,7 @@ Stage-0
                                 <-Map 16 [SIMPLE_EDGE] vectorized
                                   PARTITION_ONLY_SHUFFLE [RS_202]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_201] (rows=50 width=12)
+                                    Select Operator [SEL_201] (rows=50 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_200] (rows=50 width=12)
                                         predicate:((d_moy = 12) and (d_year = 2001) and d_date_sk is not null)
@@ -262,7 +262,7 @@ Stage-0
                                 <-Map 8 [SIMPLE_EDGE] vectorized
                                   PARTITION_ONLY_SHUFFLE [RS_155]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_154] (rows=50 width=12)
+                                    Select Operator [SEL_154] (rows=50 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_153] (rows=50 width=12)
                                         predicate:((d_moy = 12) and (d_year = 2001) and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query72.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query72.q.out b/ql/src/test/results/clientpositive/perf/tez/query72.q.out
index 700a876..cffb09b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query72.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query72.q.out
@@ -120,7 +120,7 @@ Stage-0
                     Select Operator [SEL_66] (rows=1574305390 width=292)
                       Output:["_col0","_col1","_col2","_col3","_col4"]
                       Merge Join Operator [MERGEJOIN_251] (rows=1574305390 width=292)
-                        Conds:RS_63._col4, _col6=RS_298._col0, _col1(Left Outer),Output:["_col13","_col15","_col22","_col28"]
+                        Conds:RS_63._col4, _col6=RS_298._col0, _col1(Left Outer),Output:["_col13","_col15","_col19","_col25"]
                       <-Map 26 [SIMPLE_EDGE] vectorized
                         SHUFFLE [RS_298]
                           PartitionCols:_col0, _col1
@@ -134,9 +134,9 @@ Stage-0
                         SHUFFLE [RS_63]
                           PartitionCols:_col4, _col6
                           Select Operator [SEL_59] (rows=610435044 width=300)
-                            Output:["_col4","_col6","_col13","_col15","_col22","_col28"]
+                            Output:["_col4","_col6","_col13","_col15","_col19","_col25"]
                             Merge Join Operator [MERGEJOIN_250] (rows=610435044 width=300)
-                              Conds:RS_56._col0, _col20=RS_295._col0, _col1(Inner),Output:["_col5","_col9","_col14","_col16","_col20","_col26"]
+                              Conds:RS_56._col0, _col19=RS_295._col0, _col1(Inner),Output:["_col5","_col9","_col14","_col16","_col19","_col23"]
                             <-Map 25 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_295]
                                 PartitionCols:_col0, _col1
@@ -148,24 +148,24 @@ Stage-0
                                       default@date_dim,d2,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_week_seq"]
                             <-Reducer 3 [SIMPLE_EDGE]
                               SHUFFLE [RS_56]
-                                PartitionCols:_col0, _col20
+                                PartitionCols:_col0, _col19
                                 Filter Operator [FIL_55] (rows=545947820 width=311)
                                   predicate:(_col3 < _col17)
                                   Merge Join Operator [MERGEJOIN_249] (rows=1637843460 width=311)
-                                    Conds:RS_52._col1=RS_53._col8(Inner),Output:["_col0","_col3","_col5","_col9","_col14","_col16","_col17","_col20","_col26"]
+                                    Conds:RS_52._col1=RS_53._col8(Inner),Output:["_col0","_col3","_col5","_col9","_col14","_col16","_col17","_col19","_col23"]
                                   <-Reducer 15 [SIMPLE_EDGE]
                                     SHUFFLE [RS_53]
                                       PartitionCols:_col8
-                                      Select Operator [SEL_45] (rows=2726340 width=391)
-                                        Output:["_col3","_col8","_col10","_col11","_col14","_col20"]
-                                        Filter Operator [FIL_44] (rows=2726340 width=391)
-                                          predicate:(UDFToDouble(_col20) > (UDFToDouble(_col9) + 5.0D))
-                                          Merge Join Operator [MERGEJOIN_248] (rows=8179022 width=391)
-                                            Conds:RS_41._col1=RS_292._col0(Inner),Output:["_col4","_col6","_col7","_col9","_col10","_col16","_col18","_col20"]
+                                      Select Operator [SEL_45] (rows=2726340 width=219)
+                                        Output:["_col3","_col8","_col10","_col11","_col13","_col17"]
+                                        Filter Operator [FIL_44] (rows=2726340 width=219)
+                                          predicate:(_col17 > _col10)
+                                          Merge Join Operator [MERGEJOIN_248] (rows=8179022 width=219)
+                                            Conds:RS_41._col1=RS_292._col0(Inner),Output:["_col4","_col6","_col7","_col9","_col10","_col13","_col15","_col17"]
                                           <-Map 24 [SIMPLE_EDGE] vectorized
                                             SHUFFLE [RS_292]
                                               PartitionCols:_col0
-                                              Select Operator [SEL_291] (rows=73049 width=98)
+                                              Select Operator [SEL_291] (rows=73049 width=12)
                                                 Output:["_col0","_col1"]
                                                 Filter Operator [FIL_290] (rows=73049 width=98)
                                                   predicate:d_date_sk is not null
@@ -174,8 +174,8 @@ Stage-0
                                           <-Reducer 14 [SIMPLE_EDGE]
                                             SHUFFLE [RS_41]
                                               PartitionCols:_col1
-                                              Merge Join Operator [MERGEJOIN_247] (rows=8179022 width=300)
-                                                Conds:RS_38._col4=RS_289._col0(Inner),Output:["_col1","_col4","_col6","_col7","_col9","_col10","_col16","_col18"]
+                                              Merge Join Operator [MERGEJOIN_247] (rows=8179022 width=214)
+                                                Conds:RS_38._col4=RS_289._col0(Inner),Output:["_col1","_col4","_col6","_col7","_col9","_col10","_col13","_col15"]
                                               <-Map 23 [SIMPLE_EDGE] vectorized
                                                 SHUFFLE [RS_289]
                                                   PartitionCols:_col0
@@ -188,8 +188,8 @@ Stage-0
                                               <-Reducer 13 [SIMPLE_EDGE]
                                                 SHUFFLE [RS_38]
                                                   PartitionCols:_col4
-                                                  Merge Join Operator [MERGEJOIN_246] (rows=8179022 width=116)
-                                                    Conds:RS_35._col5=RS_286._col0(Left Outer),Output:["_col1","_col4","_col6","_col7","_col9","_col10","_col16"]
+                                                  Merge Join Operator [MERGEJOIN_246] (rows=8179022 width=30)
+                                                    Conds:RS_35._col5=RS_286._col0(Left Outer),Output:["_col1","_col4","_col6","_col7","_col9","_col10","_col13"]
                                                   <-Map 22 [SIMPLE_EDGE] vectorized
                                                     SHUFFLE [RS_286]
                                                       PartitionCols:_col0
@@ -200,12 +200,12 @@ Stage-0
                                                   <-Reducer 12 [SIMPLE_EDGE]
                                                     SHUFFLE [RS_35]
                                                       PartitionCols:_col5
-                                                      Merge Join Operator [MERGEJOIN_245] (rows=8179022 width=115)
+                                                      Merge Join Operator [MERGEJOIN_245] (rows=8179022 width=29)
                                                         Conds:RS_32._col3=RS_276._col0(Inner),Output:["_col1","_col4","_col5","_col6","_col7","_col9","_col10"]
                                                       <-Map 20 [SIMPLE_EDGE] vectorized
                                                         PARTITION_ONLY_SHUFFLE [RS_276]
                                                           PartitionCols:_col0
-                                                          Select Operator [SEL_275] (rows=1440 width=97)
+                                                          Select Operator [SEL_275] (rows=1440 width=4)
                                                             Output:["_col0"]
                                                             Filter Operator [FIL_274] (rows=1440 width=96)
                                                               predicate:((hd_buy_potential = '1001-5000') and hd_demo_sk is not null)
@@ -214,12 +214,12 @@ Stage-0
                                                       <-Reducer 11 [SIMPLE_EDGE]
                                                         SHUFFLE [RS_32]
                                                           PartitionCols:_col3
-                                                          Merge Join Operator [MERGEJOIN_244] (rows=40895108 width=121)
+                                                          Merge Join Operator [MERGEJOIN_244] (rows=40895108 width=35)
                                                             Conds:RS_29._col2=RS_268._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7","_col9","_col10"]
                                                           <-Map 18 [SIMPLE_EDGE] vectorized
                                                             PARTITION_ONLY_SHUFFLE [RS_268]
                                                               PartitionCols:_col0
-                                                              Select Operator [SEL_267] (rows=265971 width=89)
+                                                              Select Operator [SEL_267] (rows=265971 width=4)
                                                                 Output:["_col0"]
                                                                 Filter Operator [FIL_266] (rows=265971 width=89)
                                                                   predicate:((cd_marital_status = 'M') and cd_demo_sk is not null)
@@ -228,12 +228,12 @@ Stage-0
                                                           <-Reducer 10 [SIMPLE_EDGE]
                                                             SHUFFLE [RS_29]
                                                               PartitionCols:_col2
-                                                              Merge Join Operator [MERGEJOIN_243] (rows=100076475 width=125)
+                                                              Merge Join Operator [MERGEJOIN_243] (rows=100076475 width=39)
                                                                 Conds:RS_284._col0=RS_260._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col9","_col10"]
                                                               <-Map 16 [SIMPLE_EDGE] vectorized
                                                                 PARTITION_ONLY_SHUFFLE [RS_260]
                                                                   PartitionCols:_col0
-                                                                  Select Operator [SEL_259] (rows=652 width=106)
+                                                                  Select Operator [SEL_259] (rows=652 width=16)
                                                                     Output:["_col0","_col1","_col2"]
                                                                     Filter Operator [FIL_258] (rows=652 width=106)
                                                                       predicate:((d_year = 2001) and d_date_sk is not null and d_week_seq is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query73.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query73.q.out b/ql/src/test/results/clientpositive/perf/tez/query73.q.out
index 14852d8..a3ec378 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query73.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query73.q.out
@@ -120,7 +120,7 @@ Stage-0
                             <-Map 13 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_122]
                                 PartitionCols:_col0
-                                Select Operator [SEL_121] (rows=56 width=102)
+                                Select Operator [SEL_121] (rows=56 width=4)
                                   Output:["_col0"]
                                   Filter Operator [FIL_120] (rows=56 width=102)
                                     predicate:((s_county) IN ('Mobile County', 'Maverick County', 'Huron County', 'Kittitas County') and s_store_sk is not null)
@@ -134,7 +134,7 @@ Stage-0
                                 <-Map 11 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_114]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_113] (rows=480 width=104)
+                                    Select Operator [SEL_113] (rows=480 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_112] (rows=480 width=104)
                                         predicate:((hd_buy_potential) IN ('>10000', 'unknown') and (hd_vehicle_count > 0) and CASE WHEN ((hd_vehicle_count > 0)) THEN (((UDFToDouble(hd_dep_count) / UDFToDouble(hd_vehicle_count)) > 1.0D)) ELSE (null) END and hd_demo_sk is not null)
@@ -148,7 +148,7 @@ Stage-0
                                     <-Map 9 [SIMPLE_EDGE] vectorized
                                       SHUFFLE [RS_106]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_105] (rows=170 width=12)
+                                        Select Operator [SEL_105] (rows=170 width=4)
                                           Output:["_col0"]
                                           Filter Operator [FIL_104] (rows=170 width=12)
                                             predicate:((d_year) IN (2000, 2001, 2002) and d_date_sk is not null and d_dom BETWEEN 1 AND 2)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query74.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query74.q.out b/ql/src/test/results/clientpositive/perf/tez/query74.q.out
index 4b174fe..20aade2 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query74.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query74.q.out
@@ -161,99 +161,97 @@ Stage-0
     limit:100
     Stage-1
       Reducer 8 vectorized
-      File Output Operator [FS_354]
-        Limit [LIM_353] (rows=100 width=280)
+      File Output Operator [FS_353]
+        Limit [LIM_352] (rows=100 width=280)
           Number of rows:100
-          Select Operator [SEL_352] (rows=12248093 width=280)
+          Select Operator [SEL_351] (rows=12248093 width=280)
             Output:["_col0","_col1","_col2"]
           <-Reducer 7 [SIMPLE_EDGE]
             SHUFFLE [RS_93]
               Select Operator [SEL_92] (rows=12248093 width=280)
                 Output:["_col0","_col1","_col2"]
-                Filter Operator [FIL_91] (rows=12248093 width=728)
-                  predicate:CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col5 is not null) THEN (((_col1 / _col5) > (_col9 / _col3))) ELSE ((null > (_col9 / _col3))) END) ELSE (CASE WHEN (_col5 is not null) THEN (((_col1 / _col5) > null)) ELSE (null) END) END
-                  Merge Join Operator [MERGEJOIN_287] (rows=24496186 width=728)
-                    Conds:RS_88._col2=RS_351._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col8","_col9"]
+                Filter Operator [FIL_91] (rows=12248093 width=732)
+                  predicate:CASE WHEN (_col3 is not null) THEN (CASE WHEN (_col6) THEN (((_col1 / _col5) > (_col10 / _col3))) ELSE ((null > (_col10 / _col3))) END) ELSE (CASE WHEN (_col6) THEN (((_col1 / _col5) > null)) ELSE (null) END) END
+                  Merge Join Operator [MERGEJOIN_287] (rows=24496186 width=732)
+                    Conds:RS_88._col2=RS_350._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col7","_col8","_col9","_col10"]
                   <-Reducer 20 [SIMPLE_EDGE] vectorized
-                    SHUFFLE [RS_351]
+                    SHUFFLE [RS_350]
                       PartitionCols:_col0
-                      Select Operator [SEL_350] (rows=80000000 width=392)
-                        Output:["_col0","_col1","_col2","_col3"]
-                        Group By Operator [GBY_349] (rows=80000000 width=396)
-                          Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["max(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3
-                        <-Reducer 19 [SIMPLE_EDGE]
-                          SHUFFLE [RS_79]
-                            PartitionCols:_col0, _col1, _col2, _col3
-                            Group By Operator [GBY_78] (rows=80000000 width=396)
-                              Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["max(_col2)"],keys:_col6, _col7, _col8, _col4
-                              Merge Join Operator [MERGEJOIN_284] (rows=187573258 width=381)
-                                Conds:RS_74._col1=RS_317._col0(Inner),Output:["_col2","_col4","_col6","_col7","_col8"]
-                              <-Map 26 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_317]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_316] (rows=80000000 width=284)
-                                    Output:["_col0","_col1","_col2","_col3"]
-                                    Filter Operator [FIL_315] (rows=80000000 width=284)
-                                      predicate:(c_customer_id is not null and c_customer_sk is not null)
-                                      TableScan [TS_68] (rows=80000000 width=284)
-                                        default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk","c_customer_id","c_first_name","c_last_name"]
-                              <-Reducer 18 [SIMPLE_EDGE]
-                                SHUFFLE [RS_74]
-                                  PartitionCols:_col1
-                                  Merge Join Operator [MERGEJOIN_283] (rows=187573258 width=105)
-                                    Conds:RS_348._col0=RS_294._col0(Inner),Output:["_col1","_col2","_col4"]
-                                  <-Map 21 [SIMPLE_EDGE] vectorized
-                                    PARTITION_ONLY_SHUFFLE [RS_294]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_291] (rows=652 width=8)
-                                        Output:["_col0","_col1"]
-                                        Filter Operator [FIL_288] (rows=652 width=8)
-                                          predicate:((d_year = 2002) and (d_year) IN (2001, 2002) and d_date_sk is not null)
-                                          TableScan [TS_65] (rows=73049 width=8)
-                                            default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                                  <-Map 17 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_348]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_347] (rows=525327388 width=114)
-                                        Output:["_col0","_col1","_col2"]
-                                        Filter Operator [FIL_346] (rows=525327388 width=114)
-                                          predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_72_date_dim_d_date_sk_min) AND DynamicValue(RS_72_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_72_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
-                                          TableScan [TS_62] (rows=575995635 width=114)
-                                            default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_net_paid"]
-                                          <-Reducer 22 [BROADCAST_EDGE] vectorized
-                                            BROADCAST [RS_345]
-                                              Group By Operator [GBY_344] (rows=1 width=12)
-                                                Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                              <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                PARTITION_ONLY_SHUFFLE [RS_306]
-                                                  Group By Operator [GBY_302] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                    Select Operator [SEL_295] (rows=652 width=4)
-                                                      Output:["_col0"]
-                                                       Please refer to the previous Select Operator [SEL_291]
+                      Group By Operator [GBY_349] (rows=80000000 width=392)
+                        Output:["_col0","_col1","_col2","_col3"],aggregations:["max(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
+                      <-Reducer 19 [SIMPLE_EDGE]
+                        SHUFFLE [RS_79]
+                          PartitionCols:_col0, _col1, _col2
+                          Group By Operator [GBY_78] (rows=80000000 width=392)
+                            Output:["_col0","_col1","_col2","_col3"],aggregations:["max(_col2)"],keys:_col5, _col6, _col7
+                            Merge Join Operator [MERGEJOIN_284] (rows=187573258 width=377)
+                              Conds:RS_74._col1=RS_317._col0(Inner),Output:["_col2","_col5","_col6","_col7"]
+                            <-Map 26 [SIMPLE_EDGE] vectorized
+                              SHUFFLE [RS_317]
+                                PartitionCols:_col0
+                                Select Operator [SEL_316] (rows=80000000 width=284)
+                                  Output:["_col0","_col1","_col2","_col3"]
+                                  Filter Operator [FIL_315] (rows=80000000 width=284)
+                                    predicate:(c_customer_id is not null and c_customer_sk is not null)
+                                    TableScan [TS_68] (rows=80000000 width=284)
+                                      default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk","c_customer_id","c_first_name","c_last_name"]
+                            <-Reducer 18 [SIMPLE_EDGE]
+                              SHUFFLE [RS_74]
+                                PartitionCols:_col1
+                                Merge Join Operator [MERGEJOIN_283] (rows=187573258 width=101)
+                                  Conds:RS_348._col0=RS_294._col0(Inner),Output:["_col1","_col2"]
+                                <-Map 21 [SIMPLE_EDGE] vectorized
+                                  PARTITION_ONLY_SHUFFLE [RS_294]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_291] (rows=652 width=4)
+                                      Output:["_col0"]
+                                      Filter Operator [FIL_288] (rows=652 width=8)
+                                        predicate:((d_year = 2002) and (d_year) IN (2001, 2002) and d_date_sk is not null)
+                                        TableScan [TS_65] (rows=73049 width=8)
+                                          default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                <-Map 17 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_348]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_347] (rows=525327388 width=114)
+                                      Output:["_col0","_col1","_col2"]
+                                      Filter Operator [FIL_346] (rows=525327388 width=114)
+                                        predicate:((ss_sold_date_sk BETWEEN DynamicValue(RS_72_date_dim_d_date_sk_min) AND DynamicValue(RS_72_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_72_date_dim_d_date_sk_bloom_filter))) and ss_customer_sk is not null and ss_sold_date_sk is not null)
+                                        TableScan [TS_62] (rows=575995635 width=114)
+                                          default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_customer_sk","ss_net_paid"]
+                                        <-Reducer 22 [BROADCAST_EDGE] vectorized
+                                          BROADCAST [RS_345]
+                                            Group By Operator [GBY_344] (rows=1 width=12)
+                                              Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                            <-Map 21 [CUSTOM_SIMPLE_EDGE] vectorized
+                                              PARTITION_ONLY_SHUFFLE [RS_306]
+                                                Group By Operator [GBY_302] (rows=1 width=12)
+                                                  Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                  Select Operator [SEL_295] (rows=652 width=4)
+                                                    Output:["_col0"]
+                                                     Please refer to the previous Select Operator [SEL_291]
                   <-Reducer 6 [ONE_TO_ONE_EDGE]
                     FORWARD [RS_88]
                       PartitionCols:_col2
-                      Merge Join Operator [MERGEJOIN_286] (rows=20485011 width=436)
-                        Conds:RS_85._col2=RS_343._col0(Inner),Output:["_col1","_col2","_col3","_col5"]
+                      Merge Join Operator [MERGEJOIN_286] (rows=20485011 width=440)
+                        Conds:RS_85._col2=RS_343._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
                       <-Reducer 16 [SIMPLE_EDGE] vectorized
                         SHUFFLE [RS_343]
                           PartitionCols:_col0
-                          Select Operator [SEL_342] (rows=17130654 width=212)
-                            Output:["_col0","_col1"]
+                          Select Operator [SEL_342] (rows=17130654 width=216)
+                            Output:["_col0","_col1","_col2"]
                             Filter Operator [FIL_341] (rows=17130654 width=212)
-                              predicate:(_col4 > 0)
+                              predicate:(_col3 > 0)
                               Select Operator [SEL_340] (rows=51391963 width=212)
-                                Output:["_col0","_col4"]
-                                Group By Operator [GBY_339] (rows=51391963 width=396)
-                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["max(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3
+                                Output:["_col0","_col3"]
+                                Group By Operator [GBY_339] (rows=51391963 width=392)
+                                  Output:["_col0","_col1","_col2","_col3"],aggregations:["max(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                 <-Reducer 15 [SIMPLE_EDGE]
                                   SHUFFLE [RS_58]
-                                    PartitionCols:_col0, _col1, _col2, _col3
-                                    Group By Operator [GBY_57] (rows=51391963 width=396)
-                                      Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["max(_col2)"],keys:_col6, _col7, _col8, _col4
-                                      Merge Join Operator [MERGEJOIN_282] (rows=51391963 width=395)
-                                        Conds:RS_53._col1=RS_320._col0(Inner),Output:["_col2","_col4","_col6","_col7","_col8"]
+                                    PartitionCols:_col0, _col1, _col2
+                                    Group By Operator [GBY_57] (rows=51391963 width=392)
+                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["max(_col2)"],keys:_col5, _col6, _col7
+                                      Merge Join Operator [MERGEJOIN_282] (rows=51391963 width=391)
+                                        Conds:RS_53._col1=RS_320._col0(Inner),Output:["_col2","_col5","_col6","_col7"]
                                       <-Map 26 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_320]
                                           PartitionCols:_col0
@@ -261,13 +259,13 @@ Stage-0
                                       <-Reducer 14 [SIMPLE_EDGE]
                                         SHUFFLE [RS_53]
                                           PartitionCols:_col1
-                                          Merge Join Operator [MERGEJOIN_281] (rows=51391963 width=119)
-                                            Conds:RS_338._col0=RS_300._col0(Inner),Output:["_col1","_col2","_col4"]
+                                          Merge Join Operator [MERGEJOIN_281] (rows=51391963 width=115)
+                                            Conds:RS_338._col0=RS_300._col0(Inner),Output:["_col1","_col2"]
                                           <-Map 21 [SIMPLE_EDGE] vectorized
                                             PARTITION_ONLY_SHUFFLE [RS_300]
                                               PartitionCols:_col0
-                                              Select Operator [SEL_293] (rows=652 width=8)
-                                                Output:["_col0","_col1"]
+                                              Select Operator [SEL_293] (rows=652 width=4)
+                                                Output:["_col0"]
                                                 Filter Operator [FIL_290] (rows=652 width=8)
                                                   predicate:((d_year = 2001) and (d_year) IN (2001, 2002) and d_date_sk is not null)
                                                    Please refer to the previous TableScan [TS_65]
@@ -302,18 +300,18 @@ Stage-0
                               Select Operator [SEL_332] (rows=26666666 width=212)
                                 Output:["_col0","_col1"]
                                 Filter Operator [FIL_331] (rows=26666666 width=212)
-                                  predicate:(_col4 > 0)
+                                  predicate:(_col3 > 0)
                                   Select Operator [SEL_330] (rows=80000000 width=212)
-                                    Output:["_col0","_col4"]
-                                    Group By Operator [GBY_329] (rows=80000000 width=396)
-                                      Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["max(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3
+                                    Output:["_col0","_col3"]
+                                    Group By Operator [GBY_329] (rows=80000000 width=392)
+                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["max(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                     <-Reducer 11 [SIMPLE_EDGE]
                                       SHUFFLE [RS_37]
-                                        PartitionCols:_col0, _col1, _col2, _col3
-                                        Group By Operator [GBY_36] (rows=80000000 width=396)
-                                          Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["max(_col2)"],keys:_col6, _col7, _col8, _col4
-                                          Merge Join Operator [MERGEJOIN_280] (rows=187573258 width=381)
-                                            Conds:RS_32._col1=RS_319._col0(Inner),Output:["_col2","_col4","_col6","_col7","_col8"]
+                                        PartitionCols:_col0, _col1, _col2
+                                        Group By Operator [GBY_36] (rows=80000000 width=392)
+                                          Output:["_col0","_col1","_col2","_col3"],aggregations:["max(_col2)"],keys:_col5, _col6, _col7
+                                          Merge Join Operator [MERGEJOIN_280] (rows=187573258 width=377)
+                                            Conds:RS_32._col1=RS_319._col0(Inner),Output:["_col2","_col5","_col6","_col7"]
                                           <-Map 26 [SIMPLE_EDGE] vectorized
                                             SHUFFLE [RS_319]
                                               PartitionCols:_col0
@@ -321,13 +319,13 @@ Stage-0
                                           <-Reducer 10 [SIMPLE_EDGE]
                                             SHUFFLE [RS_32]
                                               PartitionCols:_col1
-                                              Merge Join Operator [MERGEJOIN_279] (rows=187573258 width=105)
-                                                Conds:RS_328._col0=RS_298._col0(Inner),Output:["_col1","_col2","_col4"]
+                                              Merge Join Operator [MERGEJOIN_279] (rows=187573258 width=101)
+                                                Conds:RS_328._col0=RS_298._col0(Inner),Output:["_col1","_col2"]
                                               <-Map 21 [SIMPLE_EDGE] vectorized
                                                 PARTITION_ONLY_SHUFFLE [RS_298]
                                                   PartitionCols:_col0
-                                                  Select Operator [SEL_292] (rows=652 width=8)
-                                                    Output:["_col0","_col1"]
+                                                  Select Operator [SEL_292] (rows=652 width=4)
+                                                    Output:["_col0"]
                                                     Filter Operator [FIL_289] (rows=652 width=8)
                                                       predicate:((d_year = 2001) and (d_year) IN (2001, 2002) and d_date_sk is not null)
                                                        Please refer to the previous TableScan [TS_65]
@@ -356,15 +354,15 @@ Stage-0
                               PartitionCols:_col0
                               Select Operator [SEL_322] (rows=51391963 width=212)
                                 Output:["_col0","_col1"]
-                                Group By Operator [GBY_321] (rows=51391963 width=396)
-                                  Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["max(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3
+                                Group By Operator [GBY_321] (rows=51391963 width=392)
+                                  Output:["_col0","_col1","_col2","_col3"],aggregations:["max(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                 <-Reducer 3 [SIMPLE_EDGE]
                                   SHUFFLE [RS_17]
-                                    PartitionCols:_col0, _col1, _col2, _col3
-                                    Group By Operator [GBY_16] (rows=51391963 width=396)
-                                      Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["max(_col2)"],keys:_col6, _col7, _col8, _col4
-                                      Merge Join Operator [MERGEJOIN_278] (rows=51391963 width=395)
-                                        Conds:RS_12._col1=RS_318._col0(Inner),Output:["_col2","_col4","_col6","_col7","_col8"]
+                                    PartitionCols:_col0, _col1, _col2
+                                    Group By Operator [GBY_16] (rows=51391963 width=392)
+                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["max(_col2)"],keys:_col5, _col6, _col7
+                                      Merge Join Operator [MERGEJOIN_278] (rows=51391963 width=391)
+                                        Conds:RS_12._col1=RS_318._col0(Inner),Output:["_col2","_col5","_col6","_col7"]
                                       <-Map 26 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_318]
                                           PartitionCols:_col0
@@ -372,8 +370,8 @@ Stage-0
                                       <-Reducer 2 [SIMPLE_EDGE]
                                         SHUFFLE [RS_12]
                                           PartitionCols:_col1
-                                          Merge Join Operator [MERGEJOIN_277] (rows=51391963 width=119)
-                                            Conds:RS_314._col0=RS_296._col0(Inner),Output:["_col1","_col2","_col4"]
+                                          Merge Join Operator [MERGEJOIN_277] (rows=51391963 width=115)
+                                            Conds:RS_314._col0=RS_296._col0(Inner),Output:["_col1","_col2"]
                                           <-Map 21 [SIMPLE_EDGE] vectorized
                                             PARTITION_ONLY_SHUFFLE [RS_296]
                                               PartitionCols:_col0


[15/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query17.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query17.q.out b/ql/src/test/results/clientpositive/perf/tez/query17.q.out
index bb18527..642a67f 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query17.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query17.q.out
@@ -147,7 +147,7 @@ Stage-0
                         Select Operator [SEL_47] (rows=8581091759 width=381)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11"]
                           Merge Join Operator [MERGEJOIN_213] (rows=8581091759 width=381)
-                            Conds:RS_44._col3=RS_257._col0(Inner),Output:["_col5","_col9","_col10","_col14","_col21","_col25"]
+                            Conds:RS_44._col3=RS_257._col0(Inner),Output:["_col5","_col8","_col9","_col13","_col19","_col22"]
                           <-Map 21 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_257]
                               PartitionCols:_col0
@@ -161,12 +161,12 @@ Stage-0
                             SHUFFLE [RS_44]
                               PartitionCols:_col3
                               Merge Join Operator [MERGEJOIN_212] (rows=8581091759 width=299)
-                                Conds:RS_41._col1, _col2, _col4=RS_42._col7, _col8, _col9(Inner),Output:["_col3","_col5","_col9","_col10","_col14","_col21"]
+                                Conds:RS_41._col1, _col2, _col4=RS_42._col6, _col7, _col8(Inner),Output:["_col3","_col5","_col8","_col9","_col13","_col19"]
                               <-Reducer 11 [SIMPLE_EDGE]
                                 SHUFFLE [RS_42]
-                                  PartitionCols:_col7, _col8, _col9
+                                  PartitionCols:_col6, _col7, _col8
                                   Merge Join Operator [MERGEJOIN_211] (rows=1640229377 width=19)
-                                    Conds:RS_28._col2, _col1=RS_29._col1, _col2(Inner),Output:["_col3","_col7","_col8","_col9","_col10"]
+                                    Conds:RS_28._col2, _col1=RS_29._col1, _col2(Inner),Output:["_col3","_col6","_col7","_col8","_col9"]
                                   <-Reducer 10 [SIMPLE_EDGE]
                                     PARTITION_ONLY_SHUFFLE [RS_28]
                                       PartitionCols:_col2, _col1
@@ -175,7 +175,7 @@ Stage-0
                                       <-Map 8 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_222]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_218] (rows=304 width=94)
+                                          Select Operator [SEL_218] (rows=304 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_215] (rows=304 width=94)
                                               predicate:((d_quarter_name) IN ('2000Q1', '2000Q2', '2000Q3') and d_date_sk is not null)
@@ -205,7 +205,7 @@ Stage-0
                                                           <-Map 8 [SIMPLE_EDGE] vectorized
                                                             PARTITION_ONLY_SHUFFLE [RS_224]
                                                               PartitionCols:_col0
-                                                              Select Operator [SEL_219] (rows=304 width=94)
+                                                              Select Operator [SEL_219] (rows=304 width=4)
                                                                 Output:["_col0"]
                                                                 Filter Operator [FIL_216] (rows=304 width=94)
                                                                   predicate:((d_quarter_name) IN ('2000Q1', '2000Q2', '2000Q3') and d_date_sk is not null)
@@ -249,7 +249,7 @@ Stage-0
                                 SHUFFLE [RS_41]
                                   PartitionCols:_col1, _col2, _col4
                                   Merge Join Operator [MERGEJOIN_208] (rows=27749405 width=294)
-                                    Conds:RS_38._col1=RS_254._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col9","_col10"]
+                                    Conds:RS_38._col1=RS_254._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col8","_col9"]
                                   <-Map 18 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_254]
                                       PartitionCols:_col0
@@ -267,7 +267,7 @@ Stage-0
                                       <-Map 8 [SIMPLE_EDGE] vectorized
                                         PARTITION_ONLY_SHUFFLE [RS_220]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_217] (rows=101 width=94)
+                                          Select Operator [SEL_217] (rows=101 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_214] (rows=101 width=94)
                                               predicate:((d_quarter_name = '2000Q1') and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query18.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query18.q.out b/ql/src/test/results/clientpositive/perf/tez/query18.q.out
index 58fb7a7..f51e75b 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query18.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query18.q.out
@@ -99,147 +99,145 @@ Stage-0
     limit:100
     Stage-1
       Reducer 6 vectorized
-      File Output Operator [FS_182]
-        Limit [LIM_181] (rows=100 width=1165)
+      File Output Operator [FS_181]
+        Limit [LIM_180] (rows=100 width=1165)
           Number of rows:100
-          Select Operator [SEL_180] (rows=10969055 width=1165)
+          Select Operator [SEL_179] (rows=10969055 width=1165)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"]
           <-Reducer 5 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_179]
-              Select Operator [SEL_178] (rows=10969055 width=1165)
+            SHUFFLE [RS_178]
+              Select Operator [SEL_177] (rows=10969055 width=1165)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"]
-                Group By Operator [GBY_177] (rows=10969055 width=1229)
+                Group By Operator [GBY_176] (rows=10969055 width=1229)
                   Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)","sum(VALUE._col2)","count(VALUE._col3)","sum(VALUE._col4)","count(VALUE._col5)","sum(VALUE._col6)","count(VALUE._col7)","sum(VALUE._col8)","count(VALUE._col9)","sum(VALUE._col10)","count(VALUE._col11)","sum(VALUE._col12)","count(VALUE._col13)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
                 <-Reducer 4 [SIMPLE_EDGE]
-                  SHUFFLE [RS_43]
+                  SHUFFLE [RS_42]
                     PartitionCols:_col0, _col1, _col2, _col3, _col4
-                    Group By Operator [GBY_42] (rows=10969055 width=1229)
-                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18"],aggregations:["sum(_col4)","count(_col4)","sum(_col5)","count(_col5)","sum(_col6)","count(_col6)","sum(_col7)","count(_col7)","sum(_col8)","count(_col8)","sum(_col9)","count(_col9)","sum(_col10)","count(_col10)"],keys:_col0, _col1, _col2, _col3, 0L
-                      Select Operator [SEL_40] (rows=2193811 width=618)
-                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"]
-                        Merge Join Operator [MERGEJOIN_143] (rows=2193811 width=618)
-                          Conds:RS_37._col0=RS_38._col3(Inner),Output:["_col4","_col6","_col7","_col8","_col11","_col16","_col17","_col18","_col19","_col20","_col26"]
-                        <-Reducer 3 [SIMPLE_EDGE]
-                          PARTITION_ONLY_SHUFFLE [RS_37]
-                            PartitionCols:_col0
-                            Merge Join Operator [MERGEJOIN_139] (rows=4959744 width=287)
-                              Conds:RS_34._col1=RS_152._col0(Inner),Output:["_col0","_col4","_col6","_col7","_col8"]
-                            <-Map 9 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_152]
+                    Group By Operator [GBY_41] (rows=10969055 width=1229)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10","_col11","_col12","_col13","_col14","_col15","_col16","_col17","_col18"],aggregations:["sum(_col15)","count(_col15)","sum(_col16)","count(_col16)","sum(_col17)","count(_col17)","sum(_col18)","count(_col18)","sum(_col19)","count(_col19)","sum(_col3)","count(_col3)","sum(_col22)","count(_col22)"],keys:_col5, _col6, _col7, _col10, 0L
+                      Merge Join Operator [MERGEJOIN_142] (rows=2193811 width=811)
+                        Conds:RS_37._col0=RS_38._col3(Inner),Output:["_col3","_col5","_col6","_col7","_col10","_col15","_col16","_col17","_col18","_col19","_col22"]
+                      <-Reducer 3 [SIMPLE_EDGE]
+                        PARTITION_ONLY_SHUFFLE [RS_37]
+                          PartitionCols:_col0
+                          Merge Join Operator [MERGEJOIN_138] (rows=4959744 width=368)
+                            Conds:RS_34._col1=RS_151._col0(Inner),Output:["_col0","_col3","_col5","_col6","_col7"]
+                          <-Map 9 [SIMPLE_EDGE] vectorized
+                            SHUFFLE [RS_151]
+                              PartitionCols:_col0
+                              Select Operator [SEL_150] (rows=1861800 width=4)
+                                Output:["_col0"]
+                                Filter Operator [FIL_149] (rows=1861800 width=4)
+                                  predicate:cd_demo_sk is not null
+                                  TableScan [TS_6] (rows=1861800 width=4)
+                                    default@customer_demographics,cd2,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk"]
+                          <-Reducer 2 [SIMPLE_EDGE]
+                            SHUFFLE [RS_34]
+                              PartitionCols:_col1
+                              Merge Join Operator [MERGEJOIN_137] (rows=4890586 width=371)
+                                Conds:RS_145._col2=RS_148._col0(Inner),Output:["_col0","_col1","_col3","_col5","_col6","_col7"]
+                              <-Map 1 [SIMPLE_EDGE] vectorized
+                                SHUFFLE [RS_145]
+                                  PartitionCols:_col2
+                                  Select Operator [SEL_144] (rows=35631408 width=119)
+                                    Output:["_col0","_col1","_col2","_col3"]
+                                    Filter Operator [FIL_143] (rows=35631408 width=19)
+                                      predicate:((c_birth_month) IN (9, 5, 12, 4, 1, 10) and c_current_addr_sk is not null and c_current_cdemo_sk is not null and c_customer_sk is not null)
+                                      TableScan [TS_0] (rows=80000000 width=19)
+                                        default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk","c_current_cdemo_sk","c_current_addr_sk","c_birth_month","c_birth_year"]
+                              <-Map 8 [SIMPLE_EDGE] vectorized
+                                SHUFFLE [RS_148]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_147] (rows=5490196 width=285)
+                                    Output:["_col0","_col1","_col2","_col3"]
+                                    Filter Operator [FIL_146] (rows=5490196 width=285)
+                                      predicate:((ca_state) IN ('ND', 'WI', 'AL', 'NC', 'OK', 'MS', 'TN') and ca_address_sk is not null)
+                                      TableScan [TS_3] (rows=40000000 width=285)
+                                        default@customer_address,customer_address,Tbl:COMPLETE,Col:COMPLETE,Output:["ca_address_sk","ca_county","ca_state","ca_country"]
+                      <-Reducer 13 [SIMPLE_EDGE]
+                        SHUFFLE [RS_38]
+                          PartitionCols:_col3
+                          Select Operator [SEL_30] (rows=15983481 width=735)
+                            Output:["_col1","_col3","_col6","_col7","_col8","_col9","_col10","_col13"]
+                            Merge Join Operator [MERGEJOIN_141] (rows=15983481 width=735)
+                              Conds:RS_27._col3=RS_175._col0(Inner),Output:["_col1","_col4","_col5","_col6","_col7","_col8","_col11","_col13"]
+                            <-Map 18 [SIMPLE_EDGE] vectorized
+                              SHUFFLE [RS_175]
                                 PartitionCols:_col0
-                                Select Operator [SEL_151] (rows=1861800 width=4)
-                                  Output:["_col0"]
-                                  Filter Operator [FIL_150] (rows=1861800 width=4)
-                                    predicate:cd_demo_sk is not null
-                                    TableScan [TS_6] (rows=1861800 width=4)
-                                      default@customer_demographics,cd2,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk"]
-                            <-Reducer 2 [SIMPLE_EDGE]
-                              SHUFFLE [RS_34]
-                                PartitionCols:_col1
-                                Merge Join Operator [MERGEJOIN_138] (rows=4890586 width=290)
-                                  Conds:RS_146._col2=RS_149._col0(Inner),Output:["_col0","_col1","_col4","_col6","_col7","_col8"]
-                                <-Map 1 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_146]
-                                    PartitionCols:_col2
-                                    Select Operator [SEL_145] (rows=35631408 width=19)
-                                      Output:["_col0","_col1","_col2","_col4"]
-                                      Filter Operator [FIL_144] (rows=35631408 width=19)
-                                        predicate:((c_birth_month) IN (9, 5, 12, 4, 1, 10) and c_current_addr_sk is not null and c_current_cdemo_sk is not null and c_customer_sk is not null)
-                                        TableScan [TS_0] (rows=80000000 width=19)
-                                          default@customer,customer,Tbl:COMPLETE,Col:COMPLETE,Output:["c_customer_sk","c_current_cdemo_sk","c_current_addr_sk","c_birth_month","c_birth_year"]
-                                <-Map 8 [SIMPLE_EDGE] vectorized
-                                  SHUFFLE [RS_149]
+                                Select Operator [SEL_174] (rows=462000 width=104)
+                                  Output:["_col0","_col1"]
+                                  Filter Operator [FIL_173] (rows=462000 width=104)
+                                    predicate:i_item_sk is not null
+                                    TableScan [TS_18] (rows=462000 width=104)
+                                      default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
+                            <-Reducer 12 [SIMPLE_EDGE]
+                              SHUFFLE [RS_27]
+                                PartitionCols:_col3
+                                Merge Join Operator [MERGEJOIN_140] (rows=15983481 width=639)
+                                  Conds:RS_24._col2=RS_162._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7","_col8","_col11"]
+                                <-Map 16 [SIMPLE_EDGE] vectorized
+                                  PARTITION_ONLY_SHUFFLE [RS_162]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_148] (rows=5490196 width=285)
-                                      Output:["_col0","_col1","_col2","_col3"]
-                                      Filter Operator [FIL_147] (rows=5490196 width=285)
-                                        predicate:((ca_state) IN ('ND', 'WI', 'AL', 'NC', 'OK', 'MS', 'TN') and ca_address_sk is not null)
-                                        TableScan [TS_3] (rows=40000000 width=285)
-                                          default@customer_address,customer_address,Tbl:COMPLETE,Col:COMPLETE,Output:["ca_address_sk","ca_county","ca_state","ca_country"]
-                        <-Reducer 13 [SIMPLE_EDGE]
-                          SHUFFLE [RS_38]
-                            PartitionCols:_col3
-                            Select Operator [SEL_30] (rows=15983481 width=529)
-                              Output:["_col1","_col3","_col6","_col7","_col8","_col9","_col10","_col16"]
-                              Merge Join Operator [MERGEJOIN_142] (rows=15983481 width=529)
-                                Conds:RS_27._col3=RS_176._col0(Inner),Output:["_col1","_col4","_col5","_col6","_col7","_col8","_col14","_col16"]
-                              <-Map 18 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_176]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_175] (rows=462000 width=104)
-                                    Output:["_col0","_col1"]
-                                    Filter Operator [FIL_174] (rows=462000 width=104)
-                                      predicate:i_item_sk is not null
-                                      TableScan [TS_18] (rows=462000 width=104)
-                                        default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
-                              <-Reducer 12 [SIMPLE_EDGE]
-                                SHUFFLE [RS_27]
-                                  PartitionCols:_col3
-                                  Merge Join Operator [MERGEJOIN_141] (rows=15983481 width=433)
-                                    Conds:RS_24._col2=RS_163._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7","_col8","_col14"]
-                                  <-Map 16 [SIMPLE_EDGE] vectorized
-                                    PARTITION_ONLY_SHUFFLE [RS_163]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_162] (rows=103433 width=184)
-                                        Output:["_col0","_col3"]
-                                        Filter Operator [FIL_161] (rows=103433 width=187)
-                                          predicate:((cd_education_status = 'College') and (cd_gender = 'M') and cd_demo_sk is not null)
-                                          TableScan [TS_15] (rows=1861800 width=187)
-                                            default@customer_demographics,cd1,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_gender","cd_education_status","cd_dep_count"]
-                                  <-Reducer 11 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_24]
-                                      PartitionCols:_col2
-                                      Merge Join Operator [MERGEJOIN_140] (rows=100578970 width=459)
-                                        Conds:RS_173._col0=RS_155._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
-                                      <-Map 14 [SIMPLE_EDGE] vectorized
-                                        PARTITION_ONLY_SHUFFLE [RS_155]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_154] (rows=652 width=8)
-                                            Output:["_col0"]
-                                            Filter Operator [FIL_153] (rows=652 width=8)
-                                              predicate:((d_year = 2001) and d_date_sk is not null)
-                                              TableScan [TS_12] (rows=73049 width=8)
-                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                                      <-Map 10 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_173]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_172] (rows=283692098 width=466)
-                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
-                                            Filter Operator [FIL_171] (rows=283692098 width=466)
-                                              predicate:((cs_bill_cdemo_sk BETWEEN DynamicValue(RS_25_cd1_cd_demo_sk_min) AND DynamicValue(RS_25_cd1_cd_demo_sk_max) and in_bloom_filter(cs_bill_cdemo_sk, DynamicValue(RS_25_cd1_cd_demo_sk_bloom_filter))) and (cs_bill_customer_sk BETWEEN DynamicValue(RS_37_customer_c_customer_sk_min) AND DynamicValue(RS_37_customer_c_customer_sk_max) and in_bloom_filter(cs_bill_customer_sk, DynamicValue(RS_37_customer_c_customer_sk_bloom_filter))) and (cs_sold_date_sk BETWEEN DynamicValue(RS_22_date_dim_d_date_sk_min) AND DynamicValue(RS_22_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_22_date_dim_d_date_sk_bloom_filter))) and cs_bill_cdemo_sk is not null and cs_bill_customer_sk is not null and cs_item_sk is not null and cs_sold_date_sk is not null)
-                                              TableScan [TS_9] (rows=287989836 width=466)
-                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_bill_customer_sk","cs_bill_cdemo_sk","cs_item_sk","cs_quantity","cs_list_price","cs_sales_price","cs_coupon_amt","cs_net_profit"]
-                                              <-Reducer 15 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_160]
-                                                  Group By Operator [GBY_159] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                  <-Map 14 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_158]
-                                                      Group By Operator [GBY_157] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_156] (rows=652 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_154]
-                                              <-Reducer 17 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_168]
-                                                  Group By Operator [GBY_167] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                  <-Map 16 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_166]
-                                                      Group By Operator [GBY_165] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_164] (rows=103433 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_162]
-                                              <-Reducer 7 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_170]
-                                                  Group By Operator [GBY_169] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=4890586)"]
-                                                  <-Reducer 3 [CUSTOM_SIMPLE_EDGE]
-                                                    PARTITION_ONLY_SHUFFLE [RS_120]
-                                                      Group By Operator [GBY_119] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=4890586)"]
-                                                        Select Operator [SEL_118] (rows=4959744 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Merge Join Operator [MERGEJOIN_139]
+                                    Select Operator [SEL_161] (rows=103433 width=116)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_160] (rows=103433 width=187)
+                                        predicate:((cd_education_status = 'College') and (cd_gender = 'M') and cd_demo_sk is not null)
+                                        TableScan [TS_15] (rows=1861800 width=187)
+                                          default@customer_demographics,cd1,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_gender","cd_education_status","cd_dep_count"]
+                                <-Reducer 11 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_24]
+                                    PartitionCols:_col2
+                                    Merge Join Operator [MERGEJOIN_139] (rows=100578970 width=565)
+                                      Conds:RS_172._col0=RS_154._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                                    <-Map 14 [SIMPLE_EDGE] vectorized
+                                      PARTITION_ONLY_SHUFFLE [RS_154]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_153] (rows=652 width=4)
+                                          Output:["_col0"]
+                                          Filter Operator [FIL_152] (rows=652 width=8)
+                                            predicate:((d_year = 2001) and d_date_sk is not null)
+                                            TableScan [TS_12] (rows=73049 width=8)
+                                              default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                    <-Map 10 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_172]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_171] (rows=283692098 width=573)
+                                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                                          Filter Operator [FIL_170] (rows=283692098 width=466)
+                                            predicate:((cs_bill_cdemo_sk BETWEEN DynamicValue(RS_25_cd1_cd_demo_sk_min) AND DynamicValue(RS_25_cd1_cd_demo_sk_max) and in_bloom_filter(cs_bill_cdemo_sk, DynamicValue(RS_25_cd1_cd_demo_sk_bloom_filter))) and (cs_bill_customer_sk BETWEEN DynamicValue(RS_37_customer_c_customer_sk_min) AND DynamicValue(RS_37_customer_c_customer_sk_max) and in_bloom_filter(cs_bill_customer_sk, DynamicValue(RS_37_customer_c_customer_sk_bloom_filter))) and (cs_sold_date_sk BETWEEN DynamicValue(RS_22_date_dim_d_date_sk_min) AND DynamicValue(RS_22_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_22_date_dim_d_date_sk_bloom_filter))) and cs_bill_cdemo_sk is not null and cs_bill_customer_sk is not null and cs_item_sk is not null and cs_sold_date_sk is not null)
+                                            TableScan [TS_9] (rows=287989836 width=466)
+                                              default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_bill_customer_sk","cs_bill_cdemo_sk","cs_item_sk","cs_quantity","cs_list_price","cs_sales_price","cs_coupon_amt","cs_net_profit"]
+                                            <-Reducer 15 [BROADCAST_EDGE] vectorized
+                                              BROADCAST [RS_159]
+                                                Group By Operator [GBY_158] (rows=1 width=12)
+                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                <-Map 14 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                  PARTITION_ONLY_SHUFFLE [RS_157]
+                                                    Group By Operator [GBY_156] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                      Select Operator [SEL_155] (rows=652 width=4)
+                                                        Output:["_col0"]
+                                                         Please refer to the previous Select Operator [SEL_153]
+                                            <-Reducer 17 [BROADCAST_EDGE] vectorized
+                                              BROADCAST [RS_167]
+                                                Group By Operator [GBY_166] (rows=1 width=12)
+                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                <-Map 16 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                  PARTITION_ONLY_SHUFFLE [RS_165]
+                                                    Group By Operator [GBY_164] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                      Select Operator [SEL_163] (rows=103433 width=4)
+                                                        Output:["_col0"]
+                                                         Please refer to the previous Select Operator [SEL_161]
+                                            <-Reducer 7 [BROADCAST_EDGE] vectorized
+                                              BROADCAST [RS_169]
+                                                Group By Operator [GBY_168] (rows=1 width=12)
+                                                  Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=4890586)"]
+                                                <-Reducer 3 [CUSTOM_SIMPLE_EDGE]
+                                                  PARTITION_ONLY_SHUFFLE [RS_119]
+                                                    Group By Operator [GBY_118] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=4890586)"]
+                                                      Select Operator [SEL_117] (rows=4959744 width=4)
+                                                        Output:["_col0"]
+                                                         Please refer to the previous Merge Join Operator [MERGEJOIN_138]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query19.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query19.q.out b/ql/src/test/results/clientpositive/perf/tez/query19.q.out
index fd8578f..ebb4d17 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query19.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query19.q.out
@@ -94,17 +94,17 @@ Stage-0
                   SHUFFLE [RS_37]
                     PartitionCols:_col0, _col1, _col2, _col3
                     Group By Operator [GBY_36] (rows=2098703 width=314)
-                      Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col8)"],keys:_col14, _col13, _col15, _col16
-                      Select Operator [SEL_35] (rows=2098703 width=380)
-                        Output:["_col8","_col13","_col14","_col15","_col16"]
-                        Filter Operator [FIL_34] (rows=2098703 width=380)
-                          predicate:(substr(_col3, 1, 5) <> substr(_col19, 1, 5))
-                          Merge Join Operator [MERGEJOIN_123] (rows=2098703 width=380)
-                            Conds:RS_31._col7=RS_151._col0(Inner),Output:["_col3","_col8","_col13","_col14","_col15","_col16","_col19"]
+                      Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col8)"],keys:_col12, _col11, _col13, _col14
+                      Select Operator [SEL_35] (rows=2098703 width=570)
+                        Output:["_col8","_col11","_col12","_col13","_col14"]
+                        Filter Operator [FIL_34] (rows=2098703 width=570)
+                          predicate:(_col3 <> _col16)
+                          Merge Join Operator [MERGEJOIN_123] (rows=2098703 width=570)
+                            Conds:RS_31._col7=RS_151._col0(Inner),Output:["_col3","_col8","_col11","_col12","_col13","_col14","_col16"]
                           <-Map 15 [SIMPLE_EDGE] vectorized
                             SHUFFLE [RS_151]
                               PartitionCols:_col0
-                              Select Operator [SEL_150] (rows=1704 width=93)
+                              Select Operator [SEL_150] (rows=1704 width=188)
                                 Output:["_col0","_col1"]
                                 Filter Operator [FIL_149] (rows=1704 width=93)
                                   predicate:s_store_sk is not null
@@ -113,17 +113,17 @@ Stage-0
                           <-Reducer 3 [SIMPLE_EDGE]
                             SHUFFLE [RS_31]
                               PartitionCols:_col7
-                              Merge Join Operator [MERGEJOIN_122] (rows=2098703 width=291)
-                                Conds:RS_28._col0=RS_29._col2(Inner),Output:["_col3","_col7","_col8","_col13","_col14","_col15","_col16"]
+                              Merge Join Operator [MERGEJOIN_122] (rows=2098703 width=386)
+                                Conds:RS_28._col0=RS_29._col2(Inner),Output:["_col3","_col7","_col8","_col11","_col12","_col13","_col14"]
                               <-Reducer 10 [SIMPLE_EDGE]
                                 SHUFFLE [RS_29]
                                   PartitionCols:_col2
                                   Merge Join Operator [MERGEJOIN_121] (rows=2098703 width=202)
-                                    Conds:RS_18._col1=RS_140._col0(Inner),Output:["_col2","_col3","_col4","_col9","_col10","_col11","_col12"]
+                                    Conds:RS_18._col1=RS_140._col0(Inner),Output:["_col2","_col3","_col4","_col7","_col8","_col9","_col10"]
                                   <-Map 13 [SIMPLE_EDGE] vectorized
                                     PARTITION_ONLY_SHUFFLE [RS_140]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_139] (rows=7333 width=210)
+                                      Select Operator [SEL_139] (rows=7333 width=206)
                                         Output:["_col0","_col1","_col2","_col3","_col4"]
                                         Filter Operator [FIL_138] (rows=7333 width=210)
                                           predicate:((i_manager_id = 7) and i_item_sk is not null)
@@ -137,7 +137,7 @@ Stage-0
                                       <-Map 11 [SIMPLE_EDGE] vectorized
                                         SHUFFLE [RS_132]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_131] (rows=50 width=12)
+                                          Select Operator [SEL_131] (rows=50 width=4)
                                             Output:["_col0"]
                                             Filter Operator [FIL_130] (rows=50 width=12)
                                               predicate:((d_moy = 11) and (d_year = 1999) and d_date_sk is not null)
@@ -177,7 +177,7 @@ Stage-0
                               <-Reducer 2 [SIMPLE_EDGE]
                                 SHUFFLE [RS_28]
                                   PartitionCols:_col0
-                                  Merge Join Operator [MERGEJOIN_119] (rows=80000000 width=93)
+                                  Merge Join Operator [MERGEJOIN_119] (rows=80000000 width=188)
                                     Conds:RS_126._col1=RS_129._col0(Inner),Output:["_col0","_col3"]
                                   <-Map 1 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_126]
@@ -191,7 +191,7 @@ Stage-0
                                   <-Map 7 [SIMPLE_EDGE] vectorized
                                     SHUFFLE [RS_129]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_128] (rows=40000000 width=93)
+                                      Select Operator [SEL_128] (rows=40000000 width=188)
                                         Output:["_col0","_col1"]
                                         Filter Operator [FIL_127] (rows=40000000 width=93)
                                           predicate:ca_address_sk is not null

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query2.q.out b/ql/src/test/results/clientpositive/perf/tez/query2.q.out
index f46b336..2bea1c7 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query2.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query2.q.out
@@ -149,7 +149,7 @@ Stage-0
             Select Operator [SEL_56] (rows=12881 width=788)
               Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
               Merge Join Operator [MERGEJOIN_146] (rows=12881 width=1572)
-                Conds:RS_53._col0=RS_54.(_col0 - 53)(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col11","_col12","_col13","_col14","_col15","_col16","_col17"]
+                Conds:RS_53._col0=RS_54.(_col0 - 53)(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col10","_col11","_col12","_col13","_col14","_col15","_col16"]
               <-Reducer 5 [ONE_TO_ONE_EDGE]
                 FORWARD [RS_53]
                   PartitionCols:_col0
@@ -158,7 +158,7 @@ Stage-0
                   <-Map 11 [SIMPLE_EDGE] vectorized
                     SHUFFLE [RS_170]
                       PartitionCols:_col0
-                      Select Operator [SEL_168] (rows=652 width=8)
+                      Select Operator [SEL_168] (rows=652 width=4)
                         Output:["_col0"]
                         Filter Operator [FIL_166] (rows=652 width=8)
                           predicate:((d_year = 2001) and d_week_seq is not null)
@@ -172,17 +172,17 @@ Stage-0
                       <-Reducer 3 [SIMPLE_EDGE]
                         SHUFFLE [RS_17]
                           PartitionCols:_col0
-                          Group By Operator [GBY_16] (rows=4576896 width=788)
+                          Group By Operator [GBY_16] (rows=3182784 width=788)
                             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)","sum(_col4)","sum(_col5)","sum(_col6)","sum(_col7)"],keys:_col0
-                            Select Operator [SEL_14] (rows=430516591 width=206)
+                            Select Operator [SEL_14] (rows=430516591 width=143)
                               Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                              Merge Join Operator [MERGEJOIN_142] (rows=430516591 width=206)
-                                Conds:Union 2._col0=RS_162._col0(Inner),Output:["_col1","_col3","_col4"]
+                              Merge Join Operator [MERGEJOIN_142] (rows=430516591 width=143)
+                                Conds:Union 2._col0=RS_162._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"]
                               <-Map 10 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_162]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_161] (rows=73049 width=99)
-                                    Output:["_col0","_col1","_col2"]
+                                  Select Operator [SEL_161] (rows=73049 width=36)
+                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
                                     Filter Operator [FIL_160] (rows=73049 width=99)
                                       predicate:(d_date_sk is not null and d_week_seq is not null)
                                       TableScan [TS_8] (rows=73049 width=99)
@@ -214,7 +214,7 @@ Stage-0
                   <-Map 11 [SIMPLE_EDGE] vectorized
                     SHUFFLE [RS_171]
                       PartitionCols:_col0
-                      Select Operator [SEL_169] (rows=652 width=8)
+                      Select Operator [SEL_169] (rows=652 width=4)
                         Output:["_col0"]
                         Filter Operator [FIL_167] (rows=652 width=8)
                           predicate:((d_year = 2002) and d_week_seq is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query20.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query20.q.out b/ql/src/test/results/clientpositive/perf/tez/query20.q.out
index 892beb3..0fa6f79 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query20.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query20.q.out
@@ -101,9 +101,9 @@ Stage-0
                         SHUFFLE [RS_17]
                           PartitionCols:_col0, _col1, _col2, _col3, _col4
                           Group By Operator [GBY_16] (rows=138600 width=689)
-                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)"],keys:_col10, _col9, _col6, _col7, _col8
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)"],keys:_col9, _col8, _col5, _col6, _col7
                             Merge Join Operator [MERGEJOIN_58] (rows=9551005 width=673)
-                              Conds:RS_12._col1=RS_69._col0(Inner),Output:["_col2","_col6","_col7","_col8","_col9","_col10"]
+                              Conds:RS_12._col1=RS_69._col0(Inner),Output:["_col2","_col5","_col6","_col7","_col8","_col9"]
                             <-Map 9 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_69]
                                 PartitionCols:_col0
@@ -121,7 +121,7 @@ Stage-0
                                 <-Map 7 [SIMPLE_EDGE] vectorized
                                   PARTITION_ONLY_SHUFFLE [RS_61]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_60] (rows=8116 width=98)
+                                    Select Operator [SEL_60] (rows=8116 width=4)
                                       Output:["_col0"]
                                       Filter Operator [FIL_59] (rows=8116 width=98)
                                         predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'2001-01-12 00:00:00' AND TIMESTAMP'2001-02-11 00:00:00' and d_date_sk is not null)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query21.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query21.q.out b/ql/src/test/results/clientpositive/perf/tez/query21.q.out
index be040df..382775a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query21.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query21.q.out
@@ -96,10 +96,10 @@ Stage-0
                     PartitionCols:_col0, _col1
                     Group By Operator [GBY_23] (rows=463966 width=216)
                       Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col0, _col1
-                      Select Operator [SEL_21] (rows=463966 width=294)
+                      Select Operator [SEL_21] (rows=463966 width=208)
                         Output:["_col0","_col1","_col2","_col3"]
-                        Merge Join Operator [MERGEJOIN_77] (rows=463966 width=294)
-                          Conds:RS_18._col2=RS_89._col0(Inner),Output:["_col3","_col5","_col7","_col10"]
+                        Merge Join Operator [MERGEJOIN_77] (rows=463966 width=208)
+                          Conds:RS_18._col2=RS_89._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col10"]
                         <-Map 9 [SIMPLE_EDGE] vectorized
                           SHUFFLE [RS_89]
                             PartitionCols:_col0
@@ -112,12 +112,12 @@ Stage-0
                         <-Reducer 3 [SIMPLE_EDGE]
                           SHUFFLE [RS_18]
                             PartitionCols:_col2
-                            Merge Join Operator [MERGEJOIN_76] (rows=463966 width=198)
-                              Conds:RS_15._col1=RS_86._col0(Inner),Output:["_col2","_col3","_col5","_col7"]
+                            Merge Join Operator [MERGEJOIN_76] (rows=463966 width=112)
+                              Conds:RS_15._col1=RS_86._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8"]
                             <-Map 8 [SIMPLE_EDGE] vectorized
                               SHUFFLE [RS_86]
                                 PartitionCols:_col0
-                                Select Operator [SEL_85] (rows=51333 width=215)
+                                Select Operator [SEL_85] (rows=51333 width=104)
                                   Output:["_col0","_col1"]
                                   Filter Operator [FIL_84] (rows=51333 width=215)
                                     predicate:(i_current_price BETWEEN 0.99 AND 1.49 and i_item_sk is not null)
@@ -126,8 +126,8 @@ Stage-0
                             <-Reducer 2 [SIMPLE_EDGE]
                               SHUFFLE [RS_15]
                                 PartitionCols:_col1
-                                Merge Join Operator [MERGEJOIN_75] (rows=4175715 width=104)
-                                  Conds:RS_80._col0=RS_83._col0(Inner),Output:["_col1","_col2","_col3","_col5"]
+                                Merge Join Operator [MERGEJOIN_75] (rows=4175715 width=18)
+                                  Conds:RS_80._col0=RS_83._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
                                 <-Map 1 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_80]
                                     PartitionCols:_col0
@@ -140,8 +140,8 @@ Stage-0
                                 <-Map 7 [SIMPLE_EDGE] vectorized
                                   SHUFFLE [RS_83]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_82] (rows=8116 width=98)
-                                      Output:["_col0","_col1"]
+                                    Select Operator [SEL_82] (rows=8116 width=12)
+                                      Output:["_col0","_col1","_col2"]
                                       Filter Operator [FIL_81] (rows=8116 width=98)
                                         predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-03-09 00:00:00' AND TIMESTAMP'1998-05-08 00:00:00' and d_date_sk is not null)
                                         TableScan [TS_3] (rows=73049 width=98)

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/perf/tez/query22.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query22.q.out b/ql/src/test/results/clientpositive/perf/tez/query22.q.out
index df6889b..2d88d8f 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query22.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query22.q.out
@@ -79,9 +79,9 @@ Stage-0
                   SHUFFLE [RS_23]
                     PartitionCols:_col0, _col1, _col2, _col3, _col4
                     Group By Operator [GBY_22] (rows=32730675 width=413)
-                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)","count(_col3)"],keys:_col8, _col9, _col10, _col11, 0L
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)","count(_col3)"],keys:_col7, _col8, _col9, _col10, 0L
                       Merge Join Operator [MERGEJOIN_75] (rows=6546135 width=391)
-                        Conds:RS_18._col1=RS_87._col0(Inner),Output:["_col3","_col8","_col9","_col10","_col11"]
+                        Conds:RS_18._col1=RS_87._col0(Inner),Output:["_col3","_col7","_col8","_col9","_col10"]
                       <-Map 9 [SIMPLE_EDGE] vectorized
                         SHUFFLE [RS_87]
                           PartitionCols:_col0
@@ -122,7 +122,7 @@ Stage-0
                               <-Map 7 [SIMPLE_EDGE] vectorized
                                 SHUFFLE [RS_81]
                                   PartitionCols:_col0
-                                  Select Operator [SEL_80] (rows=317 width=8)
+                                  Select Operator [SEL_80] (rows=317 width=4)
                                     Output:["_col0"]
                                     Filter Operator [FIL_79] (rows=317 width=8)
                                       predicate:(d_date_sk is not null and d_month_seq BETWEEN 1212 AND 1223)


[04/51] [partial] hive git commit: HIVE-20850: Push case conditional from projections to dimension tables if possible (Zoltan Haindrich via Jesus Camacho Rodriguez)

Posted by jc...@apache.org.
http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/pointlookup3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/pointlookup3.q.out b/ql/src/test/results/clientpositive/pointlookup3.q.out
index a5fa5e8..a3056a5 100644
--- a/ql/src/test/results/clientpositive/pointlookup3.q.out
+++ b/ql/src/test/results/clientpositive/pointlookup3.q.out
@@ -391,15 +391,15 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@pcr_t1_n1
 POSTHOOK: Input: default@pcr_t1_n1@ds1=2000-04-08/ds2=2001-04-08
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds1`, `t4`.`ds2`, `t4`.`key1`, `t4`.`value1`, `t4`.`ds11`, CAST('2001-04-08' AS STRING) AS `ds21`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t0`.`ds2`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`, `t2`.`ds1` AS `ds11`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds1`, `ds2`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds1`, `t3`.`ds2`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, `t3`.`ds1` AS `ds11`, CAST('2001-04-08' AS STRING) AS `ds21`
+FROM (SELECT *
+FROM (SELECT `key`, `value`, `ds2`
 FROM `default`.`pcr_t1_n1`
 WHERE `ds1` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, `ds1`, CAST('2001-04-08' AS STRING) AS `ds2`
+INNER JOIN (SELECT `key`, `value`, `ds1`
 FROM `default`.`pcr_t1_n1`
 WHERE `ds2` = '2001-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t2`.`key`, `t2`.`value`) AS `t4`
+ORDER BY `t2`.`key`, `t2`.`value`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -420,7 +420,7 @@ STAGE PLANS:
               Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string), ds2 (type: string)
-                outputColumnNames: _col0, _col1, _col3
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
@@ -429,7 +429,7 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string)
                   auto parallelism: false
           TableScan
             alias: t2
@@ -515,30 +515,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3,_col4,_col5
-                    columns.types int,string,string,int,string,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3,_col4,_col5
+                  columns.types int,string,string,int,string,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -636,15 +632,15 @@ POSTHOOK: Input: default@pcr_t1_n1
 POSTHOOK: Input: default@pcr_t1_n1@ds1=2000-04-08/ds2=2001-04-08
 POSTHOOK: Input: default@pcr_t1_n1@ds1=2000-04-09/ds2=2001-04-09
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds1`, `t4`.`ds2`, `t4`.`key1`, `t4`.`value1`, CAST('2000-04-09' AS STRING) AS `ds11`, `t4`.`ds21`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t0`.`ds2`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`, `t2`.`ds2` AS `ds21`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds1`, `ds2`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds1`, `t3`.`ds2`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, CAST('2000-04-09' AS STRING) AS `ds11`, `t3`.`ds20` AS `ds21`
+FROM (SELECT *
+FROM (SELECT `key`, `value`, `ds2`
 FROM `default`.`pcr_t1_n1`
 WHERE `ds1` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2000-04-09' AS STRING) AS `ds1`, `ds2`
+INNER JOIN (SELECT `key`, `value`, `ds2`
 FROM `default`.`pcr_t1_n1`
 WHERE `ds1` = '2000-04-09' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t2`.`key`, `t2`.`value`) AS `t4`
+ORDER BY `t2`.`key`, `t2`.`value`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -665,7 +661,7 @@ STAGE PLANS:
               Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string), ds2 (type: string)
-                outputColumnNames: _col0, _col1, _col3
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
@@ -674,7 +670,7 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string)
                   auto parallelism: false
           TableScan
             alias: t2
@@ -687,7 +683,7 @@ STAGE PLANS:
               Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string), ds2 (type: string)
-                outputColumnNames: _col0, _col1, _col3
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
@@ -696,7 +692,7 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                   tag: 1
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string)
                   auto parallelism: false
       Path -> Alias:
 #### A masked pattern was here ####
@@ -810,30 +806,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col7
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col7 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3,_col4,_col5
-                    columns.types int,string,string,int,string,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3,_col4,_col5
+                  columns.types int,string,string,int,string,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -934,14 +926,6 @@ POSTHOOK: Input: default@pcr_t1_n1@ds1=2000-04-08/ds2=2001-04-08
 POSTHOOK: Input: default@pcr_t1_n1@ds1=2000-04-09/ds2=2001-04-09
 POSTHOOK: Input: default@pcr_t1_n1@ds1=2000-04-10/ds2=2001-04-10
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT *
-FROM (SELECT `key`, `value`, `ds1`, `ds2`
-FROM `default`.`pcr_t1_n1`
-WHERE `ds1` = '2000-04-08' OR `ds1` = '2000-04-09') AS `t0`
-INNER JOIN (SELECT `key`, `value`, `ds1`, `ds2`
-FROM `default`.`pcr_t1_n1`
-WHERE `key` = 1 OR `key` = 2) AS `t2` ON `t0`.`ds1` = '2000-04-08' AND `t2`.`key` = 1 OR `t0`.`ds1` = '2000-04-09' AND `t2`.`key` = 2
-ORDER BY `t2`.`key`, `t2`.`value`, `t0`.`ds1`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -957,15 +941,15 @@ STAGE PLANS:
             Statistics: Num rows: 40 Data size: 320 Basic stats: COMPLETE Column stats: NONE
             GatherStats: false
             Select Operator
-              expressions: key (type: int), value (type: string), ds1 (type: string), ds2 (type: string)
-              outputColumnNames: _col0, _col1, _col2, _col3
+              expressions: key (type: int), value (type: string), ds1 (type: string), ds2 (type: string), (ds1 = '2000-04-08') (type: boolean), (ds1 = '2000-04-09') (type: boolean)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
               Statistics: Num rows: 40 Data size: 320 Basic stats: COMPLETE Column stats: NONE
               Reduce Output Operator
                 null sort order: 
                 sort order: 
                 Statistics: Num rows: 40 Data size: 320 Basic stats: COMPLETE Column stats: NONE
                 tag: 0
-                value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: boolean), _col5 (type: boolean)
                 auto parallelism: false
           TableScan
             alias: t2
@@ -977,15 +961,15 @@ STAGE PLANS:
               predicate: ((key = 1) or (key = 2)) (type: boolean)
               Statistics: Num rows: 60 Data size: 480 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: int), value (type: string), ds1 (type: string), ds2 (type: string)
-                outputColumnNames: _col0, _col1, _col2, _col3
+                expressions: key (type: int), value (type: string), ds1 (type: string), ds2 (type: string), (key = 1) (type: boolean), (key = 2) (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
                 Statistics: Num rows: 60 Data size: 480 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   null sort order: 
                   sort order: 
                   Statistics: Num rows: 60 Data size: 480 Basic stats: COMPLETE Column stats: NONE
                   tag: 1
-                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: boolean), _col5 (type: boolean)
                   auto parallelism: false
       Path -> Alias:
 #### A masked pattern was here ####
@@ -1149,30 +1133,34 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11
           Statistics: Num rows: 2400 Data size: 40800 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
             isSamplingPred: false
-            predicate: (((_col2 = '2000-04-08') and (_col4 = 1)) or ((_col2 = '2000-04-09') and (_col4 = 2))) (type: boolean)
+            predicate: ((_col4 and _col10) or (_col5 and _col11)) (type: boolean)
             Statistics: Num rows: 1200 Data size: 20400 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
-#### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3,_col4,_col5,_col6,_col7
-                    columns.types int,string,string,string,int,string,string,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            Select Operator
+              expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col6 (type: int), _col7 (type: string), _col8 (type: string), _col9 (type: string)
+              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7
+              Statistics: Num rows: 1200 Data size: 20400 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                GlobalTableId: 0
+#### A masked pattern was here ####
+                NumFilesPerFileSink: 1
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    properties:
+                      column.name.delimiter ,
+                      columns _col0,_col1,_col2,_col3,_col4,_col5,_col6,_col7
+                      columns.types int,string,string,string,int,string,string,string
+                      escape.delim \
+                      serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                    serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                TotalFiles: 1
+                GatherStats: false
+                MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -1818,15 +1806,15 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@pcr_t1_n1
 POSTHOOK: Input: default@pcr_t1_n1@ds1=2000-04-08/ds2=2001-04-08
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds1`, `t4`.`ds2`, `t4`.`key1`, `t4`.`value1`, `t4`.`ds11`, CAST('2001-04-08' AS STRING) AS `ds21`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t0`.`ds2`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`, `t2`.`ds1` AS `ds11`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds1`, `ds2`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds1`, `t3`.`ds2`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, `t3`.`ds1` AS `ds11`, CAST('2001-04-08' AS STRING) AS `ds21`
+FROM (SELECT *
+FROM (SELECT `key`, `value`, `ds2`
 FROM `default`.`pcr_t1_n1`
 WHERE `ds1` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, `ds1`, CAST('2001-04-08' AS STRING) AS `ds2`
+INNER JOIN (SELECT `key`, `value`, `ds1`
 FROM `default`.`pcr_t1_n1`
 WHERE `ds2` = '2001-04-08' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t2`.`key`, `t2`.`value`) AS `t4`
+ORDER BY `t2`.`key`, `t2`.`value`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -1847,7 +1835,7 @@ STAGE PLANS:
               Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string), ds2 (type: string)
-                outputColumnNames: _col0, _col1, _col3
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
@@ -1856,7 +1844,7 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string)
                   auto parallelism: false
           TableScan
             alias: t2
@@ -1942,30 +1930,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3,_col4,_col5
-                    columns.types int,string,string,int,string,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3,_col4,_col5
+                  columns.types int,string,string,int,string,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce
@@ -2063,15 +2047,15 @@ POSTHOOK: Input: default@pcr_t1_n1
 POSTHOOK: Input: default@pcr_t1_n1@ds1=2000-04-08/ds2=2001-04-08
 POSTHOOK: Input: default@pcr_t1_n1@ds1=2000-04-09/ds2=2001-04-09
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t4`.`key`, `t4`.`value`, CAST('2000-04-08' AS STRING) AS `ds1`, `t4`.`ds2`, `t4`.`key1`, `t4`.`value1`, CAST('2000-04-09' AS STRING) AS `ds11`, `t4`.`ds21`
-FROM (SELECT `t0`.`key`, `t0`.`value`, `t0`.`ds2`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`, `t2`.`ds2` AS `ds21`
-FROM (SELECT `key`, `value`, CAST('2000-04-08' AS STRING) AS `ds1`, `ds2`
+OPTIMIZED SQL: SELECT `t3`.`key`, `t3`.`value`, CAST('2000-04-08' AS STRING) AS `ds1`, `t3`.`ds2`, `t3`.`key0` AS `key1`, `t3`.`value0` AS `value1`, CAST('2000-04-09' AS STRING) AS `ds11`, `t3`.`ds20` AS `ds21`
+FROM (SELECT *
+FROM (SELECT `key`, `value`, `ds2`
 FROM `default`.`pcr_t1_n1`
 WHERE `ds1` = '2000-04-08' AND `key` IS NOT NULL) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2000-04-09' AS STRING) AS `ds1`, `ds2`
+INNER JOIN (SELECT `key`, `value`, `ds2`
 FROM `default`.`pcr_t1_n1`
 WHERE `ds1` = '2000-04-09' AND `key` IS NOT NULL) AS `t2` ON `t0`.`key` = `t2`.`key`
-ORDER BY `t2`.`key`, `t2`.`value`) AS `t4`
+ORDER BY `t2`.`key`, `t2`.`value`) AS `t3`
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
   Stage-2 depends on stages: Stage-1
@@ -2092,7 +2076,7 @@ STAGE PLANS:
               Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string), ds2 (type: string)
-                outputColumnNames: _col0, _col1, _col3
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
@@ -2101,7 +2085,7 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                   tag: 0
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string)
                   auto parallelism: false
           TableScan
             alias: t2
@@ -2114,7 +2098,7 @@ STAGE PLANS:
               Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: key (type: int), value (type: string), ds2 (type: string)
-                outputColumnNames: _col0, _col1, _col3
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   key expressions: _col0 (type: int)
@@ -2123,7 +2107,7 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 20 Data size: 160 Basic stats: COMPLETE Column stats: NONE
                   tag: 1
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col1 (type: string), _col2 (type: string)
                   auto parallelism: false
       Path -> Alias:
 #### A masked pattern was here ####
@@ -2237,30 +2221,26 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col7
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
           Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col7 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-            Statistics: Num rows: 22 Data size: 176 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
 #### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    column.name.delimiter ,
-                    columns _col0,_col1,_col2,_col3,_col4,_col5
-                    columns.types int,string,string,int,string,string
-                    escape.delim \
-                    serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+            NumFilesPerFileSink: 1
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  column.name.delimiter ,
+                  columns _col0,_col1,_col2,_col3,_col4,_col5
+                  columns.types int,string,string,int,string,string
+                  escape.delim \
+                  serialization.lib org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-2
     Map Reduce

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/pointlookup5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/pointlookup5.q.out b/ql/src/test/results/clientpositive/pointlookup5.q.out
index 49dc6a7..3b447fc 100644
--- a/ql/src/test/results/clientpositive/pointlookup5.q.out
+++ b/ql/src/test/results/clientpositive/pointlookup5.q.out
@@ -80,15 +80,15 @@ STAGE PLANS:
               predicate: (a) IN (1, 2, 3) (type: boolean)
               Statistics: Num rows: 4 Data size: 4 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: a (type: int)
-                outputColumnNames: _col0
+                expressions: a (type: int), (a * a) (type: int), (a) IN (1, 2) (type: boolean), (a) IN (2, 3) (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 4 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: (_col0 * _col0) (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: (_col0 * _col0) (type: int)
+                  Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 4 Data size: 4 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int)
+                  value expressions: _col0 (type: int), _col2 (type: boolean), _col3 (type: boolean)
           TableScan
             alias: t2
             filterExpr: (b) IN (1, 2, 3) (type: boolean)
@@ -97,34 +97,38 @@ STAGE PLANS:
               predicate: (b) IN (1, 2, 3) (type: boolean)
               Statistics: Num rows: 4 Data size: 4 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: b (type: int)
-                outputColumnNames: _col0
+                expressions: b (type: int), (b + 3) (type: int), (b) IN (1, 2) (type: boolean), (b) IN (2, 3) (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 4 Data size: 4 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: (_col0 + 3) (type: int)
+                  key expressions: _col1 (type: int)
                   sort order: +
-                  Map-reduce partition columns: (_col0 + 3) (type: int)
+                  Map-reduce partition columns: _col1 (type: int)
                   Statistics: Num rows: 4 Data size: 4 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col0 (type: int)
+                  value expressions: _col0 (type: int), _col2 (type: boolean), _col3 (type: boolean)
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 (_col0 * _col0) (type: int)
-            1 (_col0 + 3) (type: int)
-          outputColumnNames: _col0, _col1
+            0 _col1 (type: int)
+            1 _col1 (type: int)
+          outputColumnNames: _col0, _col2, _col3, _col4, _col6, _col7
           Statistics: Num rows: 4 Data size: 4 Basic stats: COMPLETE Column stats: NONE
           Filter Operator
-            predicate: (((_col0) IN (1, 2) and (_col1) IN (1, 2)) or ((_col0) IN (2, 3) and (_col1) IN (2, 3))) (type: boolean)
-            Statistics: Num rows: 4 Data size: 4 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              Statistics: Num rows: 4 Data size: 4 Basic stats: COMPLETE Column stats: NONE
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            predicate: ((_col2 and _col6) or (_col3 and _col7)) (type: boolean)
+            Statistics: Num rows: 2 Data size: 2 Basic stats: COMPLETE Column stats: NONE
+            Select Operator
+              expressions: _col0 (type: int), _col4 (type: int)
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 2 Data size: 2 Basic stats: COMPLETE Column stats: NONE
+              File Output Operator
+                compressed: false
+                Statistics: Num rows: 2 Data size: 2 Basic stats: COMPLETE Column stats: NONE
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/position_alias_test_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/position_alias_test_1.q.out b/ql/src/test/results/clientpositive/position_alias_test_1.q.out
index 613df44..f17d3b3 100644
--- a/ql/src/test/results/clientpositive/position_alias_test_1.q.out
+++ b/ql/src/test/results/clientpositive/position_alias_test_1.q.out
@@ -107,13 +107,13 @@ STAGE PLANS:
             alias: alias01
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Select Operator
-              expressions: a (type: int), b (type: string)
-              outputColumnNames: _col0, _col1
+              expressions: a (type: int), b (type: string), (a = 2017) (type: boolean)
+              outputColumnNames: _col0, _col1, _col2
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Reduce Output Operator
                 sort order: 
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                value expressions: _col0 (type: int), _col1 (type: string)
+                value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: boolean)
           TableScan
             Reduce Output Operator
               sort order: 
@@ -124,12 +124,12 @@ STAGE PLANS:
           condition map:
                Left Outer Join 0 to 1
           filter predicates:
-            0 {(VALUE._col0 = 2017)}
+            0 {VALUE._col2}
             1 
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col3
+          outputColumnNames: _col0, _col1, _col3, _col4
           Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
           File Output Operator
             compressed: false
@@ -147,7 +147,7 @@ STAGE PLANS:
               sort order: +
               Map-reduce partition columns: _col0 (type: int)
               Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
-              value expressions: _col1 (type: string), _col2 (type: int), _col3 (type: string)
+              value expressions: _col1 (type: string), _col3 (type: int), _col4 (type: string)
           TableScan
             alias: alias03
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
@@ -168,15 +168,19 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col3, _col4, _col5, _col6
           Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: int), _col4 (type: string), _col5 (type: int), _col6 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
             Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/ppd_outer_join5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_outer_join5.q.out b/ql/src/test/results/clientpositive/ppd_outer_join5.q.out
index fe6286d..3b8af4d 100644
--- a/ql/src/test/results/clientpositive/ppd_outer_join5.q.out
+++ b/ql/src/test/results/clientpositive/ppd_outer_join5.q.out
@@ -77,12 +77,12 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)
-                outputColumnNames: _col1, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col1 (type: string), _col2 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -93,7 +93,7 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
           Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
           File Output Operator
             compressed: false
@@ -109,7 +109,7 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
-              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col4 (type: string), _col5 (type: string)
+              value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), _col3 (type: string), _col4 (type: string)
           TableScan
             alias: t3_n23
             filterExpr: (id = 20) (type: boolean)
@@ -119,12 +119,12 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)
-                outputColumnNames: _col1, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col1 (type: string), _col2 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -132,10 +132,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col0, _col1, _col2, _col4, _col5, _col7, _col8
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
           Statistics: Num rows: 1 Data size: 2 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), 20 (type: int), _col4 (type: string), _col5 (type: string), 20 (type: int), _col7 (type: string), _col8 (type: string)
+            expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string), 20 (type: int), _col3 (type: string), _col4 (type: string), 20 (type: int), _col5 (type: string), _col6 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
             Statistics: Num rows: 1 Data size: 2 Basic stats: PARTIAL Column stats: NONE
             File Output Operator
@@ -184,35 +184,35 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)
-                outputColumnNames: _col1, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col1 (type: string), _col2 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
           TableScan
-            alias: t3_n23
+            alias: t2_n61
             filterExpr: (id = 20) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Filter Operator
               predicate: (id = 20) (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: 20 (type: int), key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1, _col2
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Left Outer Join 0 to 1
+               Inner Join 0 to 1
           keys:
             0 
             1 
-          outputColumnNames: _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
           File Output Operator
             compressed: false
@@ -228,33 +228,33 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
-              value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: int), _col4 (type: string), _col5 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
           TableScan
-            alias: t2_n61
+            alias: t3_n23
             filterExpr: (id = 20) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Filter Operator
               predicate: (id = 20) (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col1, _col2
+                expressions: 20 (type: int), key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col1 (type: string), _col2 (type: string)
+                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Outer Join 0 to 1
           keys:
             0 
             1 
-          outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col7, _col8
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
           Statistics: Num rows: 1 Data size: 2 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: 20 (type: int), _col1 (type: string), _col2 (type: string), 20 (type: int), _col7 (type: string), _col8 (type: string), _col3 (type: int), _col4 (type: string), _col5 (type: string)
+            expressions: 20 (type: int), _col0 (type: string), _col1 (type: string), 20 (type: int), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
             Statistics: Num rows: 1 Data size: 2 Basic stats: PARTIAL Column stats: NONE
             File Output Operator
@@ -303,35 +303,35 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: key (type: string), value (type: string)
-                outputColumnNames: _col1, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col1 (type: string), _col2 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
           TableScan
-            alias: t3_n23
+            alias: t2_n61
             filterExpr: (id = 20) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Filter Operator
               predicate: (id = 20) (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: 20 (type: int), key (type: string), value (type: string)
-                outputColumnNames: _col0, _col1, _col2
+                expressions: key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Left Outer Join 0 to 1
+               Inner Join 0 to 1
           keys:
             0 
             1 
-          outputColumnNames: _col1, _col2, _col3, _col4, _col5
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
           File Output Operator
             compressed: false
@@ -347,33 +347,33 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
-              value expressions: _col1 (type: string), _col2 (type: string), _col3 (type: int), _col4 (type: string), _col5 (type: string)
+              value expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
           TableScan
-            alias: t2_n61
+            alias: t3_n23
             filterExpr: (id = 20) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Filter Operator
               predicate: (id = 20) (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: key (type: string), value (type: string)
-                outputColumnNames: _col1, _col2
+                expressions: 20 (type: int), key (type: string), value (type: string)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col1 (type: string), _col2 (type: string)
+                  value expressions: _col0 (type: int), _col1 (type: string), _col2 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Outer Join 0 to 1
           keys:
             0 
             1 
-          outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col7, _col8
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6
           Statistics: Num rows: 1 Data size: 2 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: 20 (type: int), _col1 (type: string), _col2 (type: string), 20 (type: int), _col7 (type: string), _col8 (type: string), _col3 (type: int), _col4 (type: string), _col5 (type: string)
+            expressions: 20 (type: int), _col0 (type: string), _col1 (type: string), 20 (type: int), _col2 (type: string), _col3 (type: string), _col4 (type: int), _col5 (type: string), _col6 (type: string)
             outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
             Statistics: Num rows: 1 Data size: 2 Basic stats: PARTIAL Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/ppd_repeated_alias.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_repeated_alias.q.out b/ql/src/test/results/clientpositive/ppd_repeated_alias.q.out
index 8d29914..8b84ab1 100644
--- a/ql/src/test/results/clientpositive/ppd_repeated_alias.q.out
+++ b/ql/src/test/results/clientpositive/ppd_repeated_alias.q.out
@@ -261,10 +261,10 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col0, _col2
+          outputColumnNames: _col0, _col1
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: _col0 (type: int), _col2 (type: int), 3 (type: int)
+            expressions: _col0 (type: int), _col1 (type: int), 3 (type: int)
             outputColumnNames: _col0, _col1, _col2
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             File Output Operator
@@ -300,11 +300,11 @@ STAGE PLANS:
     Map Reduce
       Map Operator Tree:
           TableScan
-            alias: b
-            filterExpr: ((bar = 2) and foo is not null) (type: boolean)
+            alias: c
+            filterExpr: foo is not null (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Filter Operator
-              predicate: ((bar = 2) and foo is not null) (type: boolean)
+              predicate: foo is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: foo (type: int)
@@ -316,11 +316,11 @@ STAGE PLANS:
                   Map-reduce partition columns: _col0 (type: int)
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
           TableScan
-            alias: c
-            filterExpr: foo is not null (type: boolean)
+            alias: b
+            filterExpr: ((bar = 2) and foo is not null) (type: boolean)
             Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
             Filter Operator
-              predicate: foo is not null (type: boolean)
+              predicate: ((bar = 2) and foo is not null) (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: foo (type: int)
@@ -338,7 +338,7 @@ STAGE PLANS:
           keys:
             0 _col0 (type: int)
             1 _col0 (type: int)
-          outputColumnNames: _col2
+          outputColumnNames: _col0
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
           File Output Operator
             compressed: false
@@ -354,7 +354,7 @@ STAGE PLANS:
             Reduce Output Operator
               sort order: 
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-              value expressions: _col2 (type: int)
+              value expressions: _col0 (type: int)
           TableScan
             alias: d
             filterExpr: (foo = 1) (type: boolean)
@@ -364,12 +364,12 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: bar (type: int)
-                outputColumnNames: _col1
+                outputColumnNames: _col0
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
-                  value expressions: _col1 (type: int)
+                  value expressions: _col0 (type: int)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -377,10 +377,10 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col2, _col4
+          outputColumnNames: _col0, _col2
           Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
           Select Operator
-            expressions: _col2 (type: int), _col4 (type: int)
+            expressions: _col0 (type: int), _col2 (type: int)
             outputColumnNames: _col0, _col1
             Statistics: Num rows: 1 Data size: 1 Basic stats: PARTIAL Column stats: NONE
             File Output Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/ppd_udf_case.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/ppd_udf_case.q.out b/ql/src/test/results/clientpositive/ppd_udf_case.q.out
index 3ab6967..b791a9f 100644
--- a/ql/src/test/results/clientpositive/ppd_udf_case.q.out
+++ b/ql/src/test/results/clientpositive/ppd_udf_case.q.out
@@ -51,12 +51,12 @@ STAGE PLANS:
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: value (type: string), hr (type: string)
-                outputColumnNames: _col1, _col3
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
           TableScan
             alias: b
             filterExpr: ((ds = '2008-04-08') and (key = '27')) (type: boolean)
@@ -66,12 +66,12 @@ STAGE PLANS:
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: value (type: string), hr (type: string)
-                outputColumnNames: _col1, _col3
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -79,18 +79,14 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col1, _col3, _col5, _col7
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 250000 Data size: 5562000 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col1 (type: string), _col3 (type: string), _col5 (type: string), _col7 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 250000 Data size: 5562000 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce
@@ -210,12 +206,12 @@ STAGE PLANS:
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: value (type: string), hr (type: string)
-                outputColumnNames: _col1, _col3
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
           TableScan
             alias: b
             filterExpr: ((ds = '2008-04-08') and (key = '27')) (type: boolean)
@@ -225,12 +221,12 @@ STAGE PLANS:
               Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
               Select Operator
                 expressions: value (type: string), hr (type: string)
-                outputColumnNames: _col1, _col3
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
                   sort order: 
                   Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                  value expressions: _col1 (type: string), _col3 (type: string)
+                  value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
         Join Operator
           condition map:
@@ -238,18 +234,14 @@ STAGE PLANS:
           keys:
             0 
             1 
-          outputColumnNames: _col1, _col3, _col5, _col7
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 250000 Data size: 5562000 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col1 (type: string), _col3 (type: string), _col5 (type: string), _col7 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
-            Statistics: Num rows: 250000 Data size: 5562000 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
   Stage: Stage-2
     Map Reduce

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/router_join_ppr.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/router_join_ppr.q.out b/ql/src/test/results/clientpositive/router_join_ppr.q.out
index cad5f4e..bec5949 100644
--- a/ql/src/test/results/clientpositive/router_join_ppr.q.out
+++ b/ql/src/test/results/clientpositive/router_join_ppr.q.out
@@ -26,11 +26,11 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
+OPTIMIZED SQL: SELECT *
 FROM (SELECT `key`, `value`
 FROM `default`.`src`
 WHERE `key` < 20 AND `key` > 15) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `key` > 15 AND `ds` = '2008-04-08' AND `key` < 20) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -343,8 +343,8 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `ds` = '2008-04-08' AND `key` < 20 AND `key` > 15) AS `t0`
 INNER JOIN (SELECT `key`, `value`
@@ -563,34 +563,30 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
+#### A masked pattern was here ####
+            NumFilesPerFileSink: 1
             Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
-#### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-#### A masked pattern was here ####
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    columns _col0,_col1,_col2,_col3
-                    columns.types string:string:string:string
-                    escape.delim \
-                    hive.serialization.extend.additional.nesting.levels true
-                    serialization.escape.crlf true
-                    serialization.format 1
-                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+#### A masked pattern was here ####
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  columns _col0,_col1,_col2,_col3
+                  columns.types string:string:string:string
+                  escape.delim \
+                  hive.serialization.extend.additional.nesting.levels true
+                  serialization.escape.crlf true
+                  serialization.format 1
+                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator
@@ -664,11 +660,11 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
+OPTIMIZED SQL: SELECT *
 FROM (SELECT `key`, `value`
 FROM `default`.`src`
 WHERE `key` < 20 AND `key` > 15) AS `t0`
-INNER JOIN (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+INNER JOIN (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `key` > 15 AND `ds` = '2008-04-08' AND `key` < 20) AS `t2` ON `t0`.`key` = `t2`.`key`
 STAGE DEPENDENCIES:
@@ -981,8 +977,8 @@ POSTHOOK: Input: default@srcpart
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=11
 POSTHOOK: Input: default@srcpart@ds=2008-04-08/hr=12
 #### A masked pattern was here ####
-OPTIMIZED SQL: SELECT `t0`.`key`, `t0`.`value`, `t2`.`key` AS `key1`, `t2`.`value` AS `value1`
-FROM (SELECT `key`, `value`, CAST('2008-04-08' AS STRING) AS `ds`
+OPTIMIZED SQL: SELECT *
+FROM (SELECT `key`, `value`
 FROM `default`.`srcpart`
 WHERE `key` < 20 AND `ds` = '2008-04-08' AND `key` > 15) AS `t0`
 INNER JOIN (SELECT `key`, `value`
@@ -1201,34 +1197,30 @@ STAGE PLANS:
           keys:
             0 _col0 (type: string)
             1 _col0 (type: string)
-          outputColumnNames: _col0, _col1, _col3, _col4
+          outputColumnNames: _col0, _col1, _col2, _col3
           Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: _col0 (type: string), _col1 (type: string), _col3 (type: string), _col4 (type: string)
-            outputColumnNames: _col0, _col1, _col2, _col3
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
+#### A masked pattern was here ####
+            NumFilesPerFileSink: 1
             Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
-#### A masked pattern was here ####
-              NumFilesPerFileSink: 1
-              Statistics: Num rows: 122 Data size: 1296 Basic stats: COMPLETE Column stats: NONE
-#### A masked pattern was here ####
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  properties:
-                    columns _col0,_col1,_col2,_col3
-                    columns.types string:string:string:string
-                    escape.delim \
-                    hive.serialization.extend.additional.nesting.levels true
-                    serialization.escape.crlf true
-                    serialization.format 1
-                    serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-              TotalFiles: 1
-              GatherStats: false
-              MultiFileSpray: false
+#### A masked pattern was here ####
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                properties:
+                  columns _col0,_col1,_col2,_col3
+                  columns.types string:string:string:string
+                  escape.delim \
+                  hive.serialization.extend.additional.nesting.levels true
+                  serialization.escape.crlf true
+                  serialization.format 1
+                  serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            TotalFiles: 1
+            GatherStats: false
+            MultiFileSpray: false
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/semijoin4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/semijoin4.q.out b/ql/src/test/results/clientpositive/semijoin4.q.out
index 72b75ad..8feab99 100644
--- a/ql/src/test/results/clientpositive/semijoin4.q.out
+++ b/ql/src/test/results/clientpositive/semijoin4.q.out
@@ -81,12 +81,12 @@ STAGE PLANS:
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
                 expressions: bigint_col_13 (type: bigint), decimal1309_col_65 (type: decimal(13,9))
-                outputColumnNames: _col0, _col2
+                outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col2 (type: decimal(27,9)), _col0 (type: bigint)
+                  key expressions: _col0 (type: bigint), _col1 (type: decimal(27,9))
                   sort order: ++
-                  Map-reduce partition columns: _col2 (type: decimal(27,9)), _col0 (type: bigint)
+                  Map-reduce partition columns: _col0 (type: bigint), _col1 (type: decimal(27,9))
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
           TableScan
             alias: t2
@@ -96,21 +96,21 @@ STAGE PLANS:
               predicate: ((tinyint_col_21 = -92Y) and decimal2709_col_9 is not null and tinyint_col_18 is not null) (type: boolean)
               Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
               Select Operator
-                expressions: decimal2709_col_9 (type: decimal(27,9)), tinyint_col_18 (type: tinyint)
+                expressions: decimal2709_col_9 (type: decimal(27,9)), UDFToLong(tinyint_col_18) (type: bigint)
                 outputColumnNames: _col0, _col1
                 Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
                 Reduce Output Operator
-                  key expressions: _col0 (type: decimal(27,9)), UDFToLong(_col1) (type: bigint)
+                  key expressions: _col1 (type: bigint), _col0 (type: decimal(27,9))
                   sort order: ++
-                  Map-reduce partition columns: _col0 (type: decimal(27,9)), UDFToLong(_col1) (type: bigint)
+                  Map-reduce partition columns: _col1 (type: bigint), _col0 (type: decimal(27,9))
                   Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
                Inner Join 0 to 1
           keys:
-            0 _col2 (type: decimal(27,9)), _col0 (type: bigint)
-            1 _col0 (type: decimal(27,9)), UDFToLong(_col1) (type: bigint)
+            0 _col0 (type: bigint), _col1 (type: decimal(27,9))
+            1 _col1 (type: bigint), _col0 (type: decimal(27,9))
           Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column stats: NONE
           File Output Operator
             compressed: false

http://git-wip-us.apache.org/repos/asf/hive/blob/55887646/ql/src/test/results/clientpositive/skewjoinopt18.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/skewjoinopt18.q.out b/ql/src/test/results/clientpositive/skewjoinopt18.q.out
index 41b4f37..94ae1a2 100644
--- a/ql/src/test/results/clientpositive/skewjoinopt18.q.out
+++ b/ql/src/test/results/clientpositive/skewjoinopt18.q.out
@@ -78,13 +78,13 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: int), val (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: int), val (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col2 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col2 (type: double)
                   Statistics: Num rows: 6 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: int), _col1 (type: string)
           TableScan
@@ -95,13 +95,13 @@ STAGE PLANS:
               predicate: key is not null (type: boolean)
               Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
               Select Operator
-                expressions: key (type: string), val (type: string)
-                outputColumnNames: _col0, _col1
+                expressions: key (type: string), val (type: string), UDFToDouble(key) (type: double)
+                outputColumnNames: _col0, _col1, _col2
                 Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                 Reduce Output Operator
-                  key expressions: UDFToDouble(_col0) (type: double)
+                  key expressions: _col2 (type: double)
                   sort order: +
-                  Map-reduce partition columns: UDFToDouble(_col0) (type: double)
+                  Map-reduce partition columns: _col2 (type: double)
                   Statistics: Num rows: 1 Data size: 300 Basic stats: COMPLETE Column stats: NONE
                   value expressions: _col0 (type: string), _col1 (type: string)
       Reduce Operator Tree:
@@ -109,17 +109,21 @@ STAGE PLANS:
           condition map:
                Inner Join 0 to 1
           keys:
-            0 UDFToDouble(_col0) (type: double)
-            1 UDFToDouble(_col0) (type: double)
-          outputColumnNames: _col0, _col1, _col2, _col3
+            0 _col2 (type: double)
+            1 _col2 (type: double)
+          outputColumnNames: _col0, _col1, _col3, _col4
           Statistics: Num rows: 6 Data size: 26 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: string), _col3 (type: string), _col4 (type: string)
+            outputColumnNames: _col0, _col1, _col2, _col3
             Statistics: Num rows: 6 Data size: 26 Basic stats: COMPLETE Column stats: NONE
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 6 Data size: 26 Basic stats: COMPLETE Column stats: NONE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator