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

Reply via email to