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

Reply via email to