You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2017/02/05 21:34:52 UTC

[3/7] hive git commit: HIVE-15458 : Fix semi-join conversion rule for subquery (Vineet Garg via Ashutosh Chauhan)

http://git-wip-us.apache.org/repos/asf/hive/blob/f63dc2d4/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out b/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out
index dfae461..7cbd4f6 100644
--- a/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_mapjoin_reduce.q.out
@@ -23,8 +23,7 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 3 (BROADCAST_EDGE), Reducer 5 (BROADCAST_EDGE)
-        Reducer 5 <- Map 4 (SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 3 (BROADCAST_EDGE), Map 4 (BROADCAST_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -89,14 +88,14 @@ STAGE PLANS:
                     Statistics: Num rows: 14 Data size: 1288 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: l_orderkey (type: int)
-                      outputColumnNames: l_orderkey
-                      Statistics: Num rows: 14 Data size: 1288 Basic stats: COMPLETE Column stats: COMPLETE
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 14 Data size: 56 Basic stats: COMPLETE Column stats: COMPLETE
                       Group By Operator
                         Group By Vectorization:
                             vectorOutput: false
                             native: false
                             projectedOutputColumns: null
-                        keys: l_orderkey (type: int)
+                        keys: _col0 (type: int)
                         mode: hash
                         outputColumnNames: _col0
                         Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
@@ -148,17 +147,17 @@ STAGE PLANS:
                   Statistics: Num rows: 5 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
                   Map Join Operator
                     condition map:
-                         Inner Join 0 to 1
+                         Left Semi Join 0 to 1
                     keys:
                       0 _col1 (type: int)
                       1 _col0 (type: int)
                     Map Join Vectorization:
-                        className: VectorMapJoinInnerBigOnlyLongOperator
+                        className: VectorMapJoinLeftSemiLongOperator
                         native: true
                         nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Optimized Table and Supports Key Types IS true
                     outputColumnNames: _col0, _col3
                     input vertices:
-                      1 Reducer 5
+                      1 Map 4
                     Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                     Select Operator
                       expressions: _col0 (type: int), _col3 (type: int)
@@ -178,36 +177,6 @@ STAGE PLANS:
                             input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                             output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                             serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
-        Reducer 5 
-            Execution mode: vectorized, llap
-            Reduce Vectorization:
-                enabled: true
-                enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true
-                groupByVectorOutput: true
-                allNative: false
-                usesVectorUDFAdaptor: false
-                vectorized: true
-            Reduce Operator Tree:
-              Group By Operator
-                Group By Vectorization:
-                    className: VectorGroupByOperator
-                    vectorOutput: true
-                    keyExpressions: col 0
-                    native: false
-                    projectedOutputColumns: []
-                keys: KEY._col0 (type: int)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: int)
-                  Reduce Sink Vectorization:
-                      className: VectorReduceSinkLongOperator
-                      native: true
-                      nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, Not ACID UPDATE or DELETE IS true, No buckets IS true, No TopN IS true, Uniform Hash IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                  Statistics: Num rows: 4 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator
@@ -265,10 +234,9 @@ STAGE PLANS:
 #### A masked pattern was here ####
       Edges:
         Map 7 <- Reducer 6 (BROADCAST_EDGE)
-        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 3 (BROADCAST_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 3 (BROADCAST_EDGE), Reducer 8 (BROADCAST_EDGE)
         Reducer 6 <- Map 5 (SIMPLE_EDGE)
         Reducer 8 <- Map 4 (BROADCAST_EDGE), Map 7 (SIMPLE_EDGE)
-        Reducer 9 <- Reducer 2 (BROADCAST_EDGE), Reducer 8 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -452,16 +420,38 @@ STAGE PLANS:
                   input vertices:
                     1 Map 3
                   Statistics: Num rows: 5 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
-                  Reduce Output Operator
-                    key expressions: _col1 (type: int), _col4 (type: int)
-                    sort order: ++
-                    Map-reduce partition columns: _col1 (type: int), _col4 (type: int)
-                    Reduce Sink Vectorization:
-                        className: VectorReduceSinkMultiKeyOperator
+                  Map Join Operator
+                    condition map:
+                         Left Semi Join 0 to 1
+                    keys:
+                      0 _col1 (type: int), _col4 (type: int)
+                      1 _col0 (type: int), _col1 (type: int)
+                    Map Join Vectorization:
+                        className: VectorMapJoinLeftSemiMultiKeyOperator
                         native: true
-                        nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, Not ACID UPDATE or DELETE IS true, No buckets IS true, No TopN IS true, Uniform Hash IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                    Statistics: Num rows: 5 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
-                    value expressions: _col0 (type: int), _col3 (type: int)
+                        nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Optimized Table and Supports Key Types IS true
+                    outputColumnNames: _col0, _col3
+                    input vertices:
+                      1 Reducer 8
+                    Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: _col0 (type: int), _col3 (type: int)
+                      outputColumnNames: _col0, _col1
+                      Select Vectorization:
+                          className: VectorSelectOperator
+                          native: true
+                          projectedOutputColumns: [0, 2]
+                      Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+                      File Output Operator
+                        compressed: false
+                        File Sink Vectorization:
+                            className: VectorFileSinkOperator
+                            native: false
+                        Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
+                        table:
+                            input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                            output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                            serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
         Reducer 6 
             Execution mode: vectorized, llap
             Reduce Vectorization:
@@ -527,79 +517,34 @@ STAGE PLANS:
                   input vertices:
                     0 Map 4
                   Statistics: Num rows: 14 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
-                  Group By Operator
-                    Group By Vectorization:
-                        className: VectorGroupByOperator
-                        vectorOutput: true
-                        keyExpressions: col 1, col 0
-                        native: false
-                        projectedOutputColumns: []
-                    keys: _col0 (type: int), _col3 (type: int)
-                    mode: hash
-                    outputColumnNames: _col0, _col1
-                    Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
-                    Reduce Output Operator
-                      key expressions: _col0 (type: int), _col1 (type: int)
-                      sort order: ++
-                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                      Reduce Sink Vectorization:
-                          className: VectorReduceSinkMultiKeyOperator
-                          native: true
-                          nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, Not ACID UPDATE or DELETE IS true, No buckets IS true, No TopN IS true, Uniform Hash IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                      Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
-        Reducer 9 
-            Execution mode: vectorized, llap
-            Reduce Vectorization:
-                enabled: true
-                enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true
-                groupByVectorOutput: true
-                allNative: false
-                usesVectorUDFAdaptor: false
-                vectorized: true
-            Reduce Operator Tree:
-              Group By Operator
-                Group By Vectorization:
-                    className: VectorGroupByOperator
-                    vectorOutput: true
-                    keyExpressions: col 0, col 1
-                    native: false
-                    projectedOutputColumns: []
-                keys: KEY._col0 (type: int), KEY._col1 (type: int)
-                mode: mergepartial
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
-                Map Join Operator
-                  condition map:
-                       Inner Join 0 to 1
-                  keys:
-                    0 _col1 (type: int), _col4 (type: int)
-                    1 _col0 (type: int), _col1 (type: int)
-                  Map Join Vectorization:
-                      className: VectorMapJoinInnerMultiKeyOperator
-                      native: true
-                      nativeConditionsMet: hive.mapjoin.optimized.hashtable IS true, hive.vectorized.execution.mapjoin.native.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, One MapJoin Condition IS true, No nullsafe IS true, Small table vectorizes IS true, Optimized Table and Supports Key Types IS true
-                  outputColumnNames: _col0, _col3
-                  input vertices:
-                    0 Reducer 2
-                  Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
                   Select Operator
                     expressions: _col0 (type: int), _col3 (type: int)
                     outputColumnNames: _col0, _col1
                     Select Vectorization:
                         className: VectorSelectOperator
                         native: true
-                        projectedOutputColumns: [2, 3]
-                    Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
-                    File Output Operator
-                      compressed: false
-                      File Sink Vectorization:
-                          className: VectorFileSinkOperator
+                        projectedOutputColumns: [1, 0]
+                    Statistics: Num rows: 14 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      Group By Vectorization:
+                          className: VectorGroupByOperator
+                          vectorOutput: true
+                          keyExpressions: col 1, col 0
                           native: false
-                      Statistics: Num rows: 5 Data size: 40 Basic stats: COMPLETE Column stats: COMPLETE
-                      table:
-                          input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                          output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                          serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                          projectedOutputColumns: []
+                      keys: _col0 (type: int), _col1 (type: int)
+                      mode: hash
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int)
+                        sort order: ++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                        Reduce Sink Vectorization:
+                            className: VectorReduceSinkMultiKeyOperator
+                            native: true
+                            nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, Not ACID UPDATE or DELETE IS true, No buckets IS true, No TopN IS true, Uniform Hash IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                        Statistics: Num rows: 4 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
 
   Stage: Stage-0
     Fetch Operator

http://git-wip-us.apache.org/repos/asf/hive/blob/f63dc2d4/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out b/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
index 96cfd65..26a70ac 100644
--- a/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
+++ b/ql/src/test/results/clientpositive/llap/vectorized_dynamic_partition_pruning.q.out
@@ -4121,10 +4121,9 @@ STAGE PLANS:
     Tez
 #### A masked pattern was here ####
       Edges:
-        Reducer 10 <- Union 9 (SIMPLE_EDGE)
-        Reducer 12 <- Map 11 (CUSTOM_SIMPLE_EDGE), Union 9 (CONTAINS)
+        Reducer 11 <- Map 10 (CUSTOM_SIMPLE_EDGE), Union 9 (CONTAINS)
         Reducer 2 <- Map 1 (SIMPLE_EDGE), Union 3 (CONTAINS)
-        Reducer 4 <- Reducer 10 (SIMPLE_EDGE), Union 3 (SIMPLE_EDGE)
+        Reducer 4 <- Union 3 (SIMPLE_EDGE), Union 9 (SIMPLE_EDGE)
         Reducer 6 <- Map 5 (SIMPLE_EDGE), Union 3 (CONTAINS)
         Reducer 8 <- Map 7 (CUSTOM_SIMPLE_EDGE), Union 9 (CONTAINS)
 #### A masked pattern was here ####
@@ -4151,7 +4150,7 @@ STAGE PLANS:
                 enabled: false
                 enabledConditionsNotMet: hive.vectorized.use.vector.serde.deserialize IS false
                 inputFileFormats: org.apache.hadoop.mapred.TextInputFormat
-        Map 11 
+        Map 10 
             Map Operator Tree:
                 TableScan
                   alias: srcpart
@@ -4221,57 +4220,7 @@ STAGE PLANS:
                 enabled: false
                 enabledConditionsNotMet: hive.vectorized.use.vector.serde.deserialize IS false
                 inputFileFormats: org.apache.hadoop.mapred.TextInputFormat
-        Reducer 10 
-            Execution mode: vectorized, llap
-            Reduce Vectorization:
-                enabled: true
-                enableConditionsMet: hive.vectorized.execution.reduce.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true
-                groupByVectorOutput: true
-                allNative: false
-                usesVectorUDFAdaptor: false
-                vectorized: true
-            Reduce Operator Tree:
-              Group By Operator
-                keys: KEY._col0 (type: string)
-                mode: mergepartial
-                outputColumnNames: _col0
-                Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
-                Reduce Output Operator
-                  key expressions: _col0 (type: string)
-                  sort order: +
-                  Map-reduce partition columns: _col0 (type: string)
-                  Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
-                Select Operator
-                  expressions: _col0 (type: string)
-                  outputColumnNames: _col0
-                  Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
-                  Group By Operator
-                    keys: _col0 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
-                    Dynamic Partitioning Event Operator
-                      Target column: ds (string)
-                      Target Input: srcpart
-                      Partition key expr: ds
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
-                      Target Vertex: Map 1
-                Select Operator
-                  expressions: _col0 (type: string)
-                  outputColumnNames: _col0
-                  Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
-                  Group By Operator
-                    keys: _col0 (type: string)
-                    mode: hash
-                    outputColumnNames: _col0
-                    Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
-                    Dynamic Partitioning Event Operator
-                      Target column: ds (string)
-                      Target Input: srcpart
-                      Partition key expr: ds
-                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
-                      Target Vertex: Map 5
-        Reducer 12 
+        Reducer 11 
             Execution mode: vectorized, llap
             Reduce Vectorization:
                 enabled: true
@@ -4299,6 +4248,36 @@ STAGE PLANS:
                       sort order: +
                       Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: _col0 (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                        Dynamic Partitioning Event Operator
+                          Target column: ds (string)
+                          Target Input: srcpart
+                          Partition key expr: ds
+                          Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                          Target Vertex: Map 1
+                    Select Operator
+                      expressions: _col0 (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                        Dynamic Partitioning Event Operator
+                          Target column: ds (string)
+                          Target Input: srcpart
+                          Partition key expr: ds
+                          Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                          Target Vertex: Map 5
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
@@ -4324,7 +4303,7 @@ STAGE PLANS:
             Reduce Operator Tree:
               Merge Join Operator
                 condition map:
-                     Inner Join 0 to 1
+                     Left Semi Join 0 to 1
                 keys:
                   0 _col0 (type: string)
                   1 _col0 (type: string)
@@ -4385,6 +4364,36 @@ STAGE PLANS:
                       sort order: +
                       Map-reduce partition columns: _col0 (type: string)
                       Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                    Select Operator
+                      expressions: _col0 (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                        Dynamic Partitioning Event Operator
+                          Target column: ds (string)
+                          Target Input: srcpart
+                          Partition key expr: ds
+                          Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                          Target Vertex: Map 1
+                    Select Operator
+                      expressions: _col0 (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                      Group By Operator
+                        keys: _col0 (type: string)
+                        mode: hash
+                        outputColumnNames: _col0
+                        Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                        Dynamic Partitioning Event Operator
+                          Target column: ds (string)
+                          Target Input: srcpart
+                          Partition key expr: ds
+                          Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                          Target Vertex: Map 5
         Union 3 
             Vertex: Union 3
         Union 9 

http://git-wip-us.apache.org/repos/asf/hive/blob/f63dc2d4/ql/src/test/results/clientpositive/masking_3.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/masking_3.q.out b/ql/src/test/results/clientpositive/masking_3.q.out
index 2d8a79e..754cff0 100644
--- a/ql/src/test/results/clientpositive/masking_3.q.out
+++ b/ql/src/test/results/clientpositive/masking_3.q.out
@@ -15,14 +15,13 @@ PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from masking_test_subq
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-4 is a root stage
-  Stage-2 depends on stages: Stage-4
-  Stage-3 depends on stages: Stage-2
-  Stage-1 depends on stages: Stage-3
+  Stage-3 is a root stage
+  Stage-2 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-4
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -99,28 +98,6 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-3
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            Reduce Output Operator
-              key expressions: _col0 (type: string), _col1 (type: int)
-              sort order: ++
-              Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: string), KEY._col1 (type: int)
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-
   Stage: Stage-1
     Map Reduce
       Map Operator Tree:
@@ -142,19 +119,19 @@ STAGE PLANS:
               key expressions: UDFToDouble(_col0) (type: double), _col1 (type: int)
               sort order: ++
               Map-reduce partition columns: UDFToDouble(_col0) (type: double), _col1 (type: int)
-              Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Semi Join 0 to 1
           keys:
             0 UDFToDouble(_col0) (type: double), _col0 (type: int)
             1 UDFToDouble(_col0) (type: double), _col1 (type: int)
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
-            Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 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
@@ -681,14 +658,13 @@ PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from masking_test_subq where key > 0
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-4 is a root stage
-  Stage-2 depends on stages: Stage-4
-  Stage-3 depends on stages: Stage-2
-  Stage-1 depends on stages: Stage-3
+  Stage-3 is a root stage
+  Stage-2 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-4
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -765,28 +741,6 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-3
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            Reduce Output Operator
-              key expressions: _col0 (type: string), _col1 (type: int)
-              sort order: ++
-              Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: string), KEY._col1 (type: int)
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-
   Stage: Stage-1
     Map Reduce
       Map Operator Tree:
@@ -811,19 +765,19 @@ STAGE PLANS:
               key expressions: UDFToDouble(_col0) (type: double), _col1 (type: int)
               sort order: ++
               Map-reduce partition columns: UDFToDouble(_col0) (type: double), _col1 (type: int)
-              Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Semi Join 0 to 1
           keys:
             0 UDFToDouble(_col0) (type: double), _col0 (type: int)
             1 UDFToDouble(_col0) (type: double), _col1 (type: int)
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
-            Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+            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
@@ -1347,14 +1301,13 @@ PREHOOK: type: QUERY
 POSTHOOK: query: explain select key from masking_test_subq where key > 0
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-4 is a root stage
-  Stage-2 depends on stages: Stage-4
-  Stage-3 depends on stages: Stage-2
-  Stage-1 depends on stages: Stage-3
+  Stage-3 is a root stage
+  Stage-2 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-4
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -1431,28 +1384,6 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-3
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            Reduce Output Operator
-              key expressions: _col0 (type: string), _col1 (type: int)
-              sort order: ++
-              Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: string), KEY._col1 (type: int)
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-
   Stage: Stage-1
     Map Reduce
       Map Operator Tree:
@@ -1476,19 +1407,19 @@ STAGE PLANS:
               key expressions: UDFToDouble(_col0) (type: double), _col1 (type: int)
               sort order: ++
               Map-reduce partition columns: UDFToDouble(_col0) (type: double), _col1 (type: int)
-              Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Semi Join 0 to 1
           keys:
             0 UDFToDouble(_col0) (type: double), _col0 (type: int)
             1 UDFToDouble(_col0) (type: double), _col1 (type: int)
           outputColumnNames: _col0
-          Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
-            Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+            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
@@ -2012,14 +1943,13 @@ PREHOOK: type: QUERY
 POSTHOOK: query: explain select value from masking_test_subq where key > 0
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-4 is a root stage
-  Stage-2 depends on stages: Stage-4
-  Stage-3 depends on stages: Stage-2
-  Stage-1 depends on stages: Stage-3
+  Stage-3 is a root stage
+  Stage-2 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-4
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -2096,28 +2026,6 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-3
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            Reduce Output Operator
-              key expressions: _col0 (type: string), _col1 (type: int)
-              sort order: ++
-              Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: string), KEY._col1 (type: int)
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-
   Stage: Stage-1
     Map Reduce
       Map Operator Tree:
@@ -2142,23 +2050,23 @@ STAGE PLANS:
               key expressions: UDFToDouble(_col0) (type: double), _col1 (type: int)
               sort order: ++
               Map-reduce partition columns: UDFToDouble(_col0) (type: double), _col1 (type: int)
-              Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Semi Join 0 to 1
           keys:
             0 UDFToDouble(_col0) (type: double), _col0 (type: int)
             1 UDFToDouble(_col0) (type: double), _col1 (type: int)
           outputColumnNames: _col1
-          Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
           Select Operator
             expressions: _col1 (type: string)
             outputColumnNames: _col0
-            Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
             File Output Operator
               compressed: false
-              Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+              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
@@ -2682,15 +2590,14 @@ PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from masking_test_subq join srcpart on (masking_test_subq.key = srcpart.key)
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-5 is a root stage
-  Stage-3 depends on stages: Stage-5
-  Stage-4 depends on stages: Stage-3
-  Stage-1 depends on stages: Stage-4
+  Stage-4 is a root stage
+  Stage-3 depends on stages: Stage-4
+  Stage-1 depends on stages: Stage-3
   Stage-2 depends on stages: Stage-1
   Stage-0 depends on stages: Stage-2
 
 STAGE PLANS:
-  Stage: Stage-5
+  Stage: Stage-4
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -2767,28 +2674,6 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-4
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            Reduce Output Operator
-              key expressions: _col0 (type: string), _col1 (type: int)
-              sort order: ++
-              Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: string), KEY._col1 (type: int)
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-
   Stage: Stage-1
     Map Reduce
       Map Operator Tree:
@@ -2813,16 +2698,16 @@ STAGE PLANS:
               key expressions: UDFToDouble(_col0) (type: double), _col1 (type: int)
               sort order: ++
               Map-reduce partition columns: UDFToDouble(_col0) (type: double), _col1 (type: int)
-              Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Semi Join 0 to 1
           keys:
             0 UDFToDouble(_col0) (type: double), _col0 (type: int)
             1 UDFToDouble(_col0) (type: double), _col1 (type: int)
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
             table:
@@ -2838,7 +2723,7 @@ STAGE PLANS:
               key expressions: UDFToDouble(_col0) (type: double)
               sort order: +
               Map-reduce partition columns: UDFToDouble(_col0) (type: double)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
               value expressions: _col0 (type: int), _col1 (type: string)
           TableScan
             alias: srcpart
@@ -7016,14 +6901,13 @@ PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from default.masking_test_subq where key > 0
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-4 is a root stage
-  Stage-2 depends on stages: Stage-4
-  Stage-3 depends on stages: Stage-2
-  Stage-1 depends on stages: Stage-3
+  Stage-3 is a root stage
+  Stage-2 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-4
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -7100,28 +6984,6 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-3
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            Reduce Output Operator
-              key expressions: _col0 (type: string), _col1 (type: int)
-              sort order: ++
-              Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: string), KEY._col1 (type: int)
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-
   Stage: Stage-1
     Map Reduce
       Map Operator Tree:
@@ -7146,19 +7008,19 @@ STAGE PLANS:
               key expressions: UDFToDouble(_col0) (type: double), _col1 (type: int)
               sort order: ++
               Map-reduce partition columns: UDFToDouble(_col0) (type: double), _col1 (type: int)
-              Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Semi Join 0 to 1
           keys:
             0 UDFToDouble(_col0) (type: double), _col0 (type: int)
             1 UDFToDouble(_col0) (type: double), _col1 (type: int)
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
-            Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+            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
@@ -7682,14 +7544,13 @@ PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from masking_test_subq where masking_test_subq.key > 0
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-4 is a root stage
-  Stage-2 depends on stages: Stage-4
-  Stage-3 depends on stages: Stage-2
-  Stage-1 depends on stages: Stage-3
+  Stage-3 is a root stage
+  Stage-2 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-4
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -7766,28 +7627,6 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-3
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            Reduce Output Operator
-              key expressions: _col0 (type: string), _col1 (type: int)
-              sort order: ++
-              Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: string), KEY._col1 (type: int)
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-
   Stage: Stage-1
     Map Reduce
       Map Operator Tree:
@@ -7812,19 +7651,19 @@ STAGE PLANS:
               key expressions: UDFToDouble(_col0) (type: double), _col1 (type: int)
               sort order: ++
               Map-reduce partition columns: UDFToDouble(_col0) (type: double), _col1 (type: int)
-              Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Semi Join 0 to 1
           keys:
             0 UDFToDouble(_col0) (type: double), _col0 (type: int)
             1 UDFToDouble(_col0) (type: double), _col1 (type: int)
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
-            Statistics: Num rows: 302 Data size: 3213 Basic stats: COMPLETE Column stats: NONE
+            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

http://git-wip-us.apache.org/repos/asf/hive/blob/f63dc2d4/ql/src/test/results/clientpositive/masking_4.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/masking_4.q.out b/ql/src/test/results/clientpositive/masking_4.q.out
index 9ddba3a..36889e6 100644
--- a/ql/src/test/results/clientpositive/masking_4.q.out
+++ b/ql/src/test/results/clientpositive/masking_4.q.out
@@ -153,14 +153,13 @@ with q1 as ( select * from masking_test where key = '5')
 select * from masking_test_subq
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-4 is a root stage
-  Stage-2 depends on stages: Stage-4
-  Stage-3 depends on stages: Stage-2
-  Stage-1 depends on stages: Stage-3
+  Stage-3 is a root stage
+  Stage-2 depends on stages: Stage-3
+  Stage-1 depends on stages: Stage-2
   Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
-  Stage: Stage-4
+  Stage: Stage-3
     Map Reduce
       Map Operator Tree:
           TableScan
@@ -237,28 +236,6 @@ STAGE PLANS:
                   output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                   serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
 
-  Stage: Stage-3
-    Map Reduce
-      Map Operator Tree:
-          TableScan
-            Reduce Output Operator
-              key expressions: _col0 (type: string), _col1 (type: int)
-              sort order: ++
-              Map-reduce partition columns: _col0 (type: string), _col1 (type: int)
-              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
-      Reduce Operator Tree:
-        Group By Operator
-          keys: KEY._col0 (type: string), KEY._col1 (type: int)
-          mode: mergepartial
-          outputColumnNames: _col0, _col1
-          Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
-          File Output Operator
-            compressed: false
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
-
   Stage: Stage-1
     Map Reduce
       Map Operator Tree:
@@ -280,19 +257,19 @@ STAGE PLANS:
               key expressions: UDFToDouble(_col0) (type: double), _col1 (type: int)
               sort order: ++
               Map-reduce partition columns: UDFToDouble(_col0) (type: double), _col1 (type: int)
-              Statistics: Num rows: 275 Data size: 2921 Basic stats: COMPLETE Column stats: NONE
+              Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
       Reduce Operator Tree:
         Join Operator
           condition map:
-               Inner Join 0 to 1
+               Left Semi Join 0 to 1
           keys:
             0 UDFToDouble(_col0) (type: double), _col0 (type: int)
             1 UDFToDouble(_col0) (type: double), _col1 (type: int)
           outputColumnNames: _col0, _col1
-          Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+          Statistics: Num rows: 605 Data size: 6427 Basic stats: COMPLETE Column stats: NONE
           File Output Operator
             compressed: false
-            Statistics: Num rows: 550 Data size: 5843 Basic stats: COMPLETE Column stats: NONE
+            Statistics: Num rows: 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

http://git-wip-us.apache.org/repos/asf/hive/blob/f63dc2d4/ql/src/test/results/clientpositive/perf/query70.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query70.q.out b/ql/src/test/results/clientpositive/perf/query70.q.out
index d0900a8..bf90cdd 100644
--- a/ql/src/test/results/clientpositive/perf/query70.q.out
+++ b/ql/src/test/results/clientpositive/perf/query70.q.out
@@ -75,14 +75,13 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 11 <- Map 10 (SIMPLE_EDGE), Map 16 (SIMPLE_EDGE)
-Reducer 12 <- Map 17 (SIMPLE_EDGE), Reducer 11 (SIMPLE_EDGE)
+Reducer 11 <- Map 10 (SIMPLE_EDGE), Map 15 (SIMPLE_EDGE)
+Reducer 12 <- Map 16 (SIMPLE_EDGE), Reducer 11 (SIMPLE_EDGE)
 Reducer 13 <- Reducer 12 (SIMPLE_EDGE)
 Reducer 14 <- Reducer 13 (SIMPLE_EDGE)
-Reducer 15 <- Reducer 14 (SIMPLE_EDGE)
 Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
 Reducer 3 <- Map 9 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Reducer 15 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 14 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
 Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
 Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
 Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
@@ -92,133 +91,128 @@ Stage-0
     limit:100
     Stage-1
       Reducer 7
-      File Output Operator [FS_64]
-        Limit [LIM_63] (rows=100 width=88)
+      File Output Operator [FS_62]
+        Limit [LIM_61] (rows=100 width=88)
           Number of rows:100
-          Select Operator [SEL_62] (rows=1149975358 width=88)
+          Select Operator [SEL_60] (rows=1149975358 width=88)
             Output:["_col0","_col1","_col2","_col3","_col4"]
           <-Reducer 6 [SIMPLE_EDGE]
-            SHUFFLE [RS_61]
-              Select Operator [SEL_59] (rows=1149975358 width=88)
+            SHUFFLE [RS_59]
+              Select Operator [SEL_57] (rows=1149975358 width=88)
                 Output:["_col0","_col1","_col2","_col3","_col4"]
-                PTF Operator [PTF_58] (rows=1149975358 width=88)
+                PTF Operator [PTF_56] (rows=1149975358 width=88)
                   Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col4 DESC NULLS LAST","partition by:":"(grouping(_col5, 1) + grouping(_col5, 0)), CASE WHEN ((UDFToInteger(grouping(_col5, 0)) = 0)) THEN (_col0) ELSE (null) END"}]
-                  Select Operator [SEL_57] (rows=1149975358 width=88)
+                  Select Operator [SEL_55] (rows=1149975358 width=88)
                     Output:["_col0","_col1","_col4","_col5"]
                   <-Reducer 5 [SIMPLE_EDGE]
-                    SHUFFLE [RS_56]
+                    SHUFFLE [RS_54]
                       PartitionCols:(grouping(_col5, 1) + grouping(_col5, 0)), CASE WHEN ((UDFToInteger(grouping(_col5, 0)) = 0)) THEN (_col0) ELSE (null) END
-                      Select Operator [SEL_55] (rows=1149975358 width=88)
+                      Select Operator [SEL_53] (rows=1149975358 width=88)
                         Output:["_col0","_col1","_col4","_col5"]
-                        Group By Operator [GBY_54] (rows=1149975358 width=88)
+                        Group By Operator [GBY_52] (rows=1149975358 width=88)
                           Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                         <-Reducer 4 [SIMPLE_EDGE]
-                          SHUFFLE [RS_53]
+                          SHUFFLE [RS_51]
                             PartitionCols:_col0, _col1, _col2
-                            Group By Operator [GBY_52] (rows=2299950717 width=88)
+                            Group By Operator [GBY_50] (rows=2299950717 width=88)
                               Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col2)"],keys:_col0, _col1, 0
-                              Select Operator [SEL_50] (rows=766650239 width=88)
+                              Select Operator [SEL_48] (rows=766650239 width=88)
                                 Output:["_col0","_col1","_col2"]
-                                Merge Join Operator [MERGEJOIN_92] (rows=766650239 width=88)
-                                  Conds:RS_47._col7=RS_48._col0(Inner),Output:["_col2","_col6","_col7"]
-                                <-Reducer 15 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_48]
+                                Merge Join Operator [MERGEJOIN_90] (rows=766650239 width=88)
+                                  Conds:RS_45._col7=RS_46._col0(Left Semi),Output:["_col2","_col6","_col7"]
+                                <-Reducer 14 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_46]
                                     PartitionCols:_col0
-                                    Group By Operator [GBY_39] (rows=58079562 width=88)
-                                      Output:["_col0"],keys:KEY._col0
-                                    <-Reducer 14 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_38]
-                                        PartitionCols:_col0
-                                        Group By Operator [GBY_37] (rows=116159124 width=88)
-                                          Output:["_col0"],keys:_col0
-                                          Select Operator [SEL_32] (rows=116159124 width=88)
-                                            Output:["_col0"]
-                                            Filter Operator [FIL_84] (rows=116159124 width=88)
-                                              predicate:(rank_window_0 <= 5)
-                                              PTF Operator [PTF_31] (rows=348477374 width=88)
-                                                Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col1 DESC NULLS LAST","partition by:":"_col0"}]
-                                                Select Operator [SEL_30] (rows=348477374 width=88)
-                                                  Output:["_col0","_col1"]
-                                                <-Reducer 13 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_29]
+                                    Group By Operator [GBY_44] (rows=116159124 width=88)
+                                      Output:["_col0"],keys:_col0
+                                      Select Operator [SEL_32] (rows=116159124 width=88)
+                                        Output:["_col0"]
+                                        Filter Operator [FIL_82] (rows=116159124 width=88)
+                                          predicate:(rank_window_0 <= 5)
+                                          PTF Operator [PTF_31] (rows=348477374 width=88)
+                                            Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col1 DESC NULLS LAST","partition by:":"_col0"}]
+                                            Select Operator [SEL_30] (rows=348477374 width=88)
+                                              Output:["_col0","_col1"]
+                                            <-Reducer 13 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_29]
+                                                PartitionCols:_col0
+                                                Group By Operator [GBY_27] (rows=348477374 width=88)
+                                                  Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                                                <-Reducer 12 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_26]
                                                     PartitionCols:_col0
-                                                    Group By Operator [GBY_27] (rows=348477374 width=88)
-                                                      Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                                                    <-Reducer 12 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_26]
-                                                        PartitionCols:_col0
-                                                        Group By Operator [GBY_25] (rows=696954748 width=88)
-                                                          Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col6
-                                                          Select Operator [SEL_24] (rows=696954748 width=88)
-                                                            Output:["_col6","_col2"]
-                                                            Merge Join Operator [MERGEJOIN_91] (rows=696954748 width=88)
-                                                              Conds:RS_21._col1=RS_22._col0(Inner),Output:["_col2","_col6"]
-                                                            <-Map 17 [SIMPLE_EDGE]
-                                                              SHUFFLE [RS_22]
+                                                    Group By Operator [GBY_25] (rows=696954748 width=88)
+                                                      Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col6
+                                                      Select Operator [SEL_24] (rows=696954748 width=88)
+                                                        Output:["_col6","_col2"]
+                                                        Merge Join Operator [MERGEJOIN_89] (rows=696954748 width=88)
+                                                          Conds:RS_21._col1=RS_22._col0(Inner),Output:["_col2","_col6"]
+                                                        <-Map 16 [SIMPLE_EDGE]
+                                                          SHUFFLE [RS_22]
+                                                            PartitionCols:_col0
+                                                            Select Operator [SEL_17] (rows=1704 width=1910)
+                                                              Output:["_col0","_col1"]
+                                                              Filter Operator [FIL_85] (rows=1704 width=1910)
+                                                                predicate:(s_store_sk is not null and s_state is not null)
+                                                                TableScan [TS_15] (rows=1704 width=1910)
+                                                                  default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_state"]
+                                                        <-Reducer 11 [SIMPLE_EDGE]
+                                                          SHUFFLE [RS_21]
+                                                            PartitionCols:_col1
+                                                            Merge Join Operator [MERGEJOIN_88] (rows=633595212 width=88)
+                                                              Conds:RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col2"]
+                                                            <-Map 10 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_18]
+                                                                PartitionCols:_col0
+                                                                Select Operator [SEL_11] (rows=575995635 width=88)
+                                                                  Output:["_col0","_col1","_col2"]
+                                                                  Filter Operator [FIL_83] (rows=575995635 width=88)
+                                                                    predicate:(ss_store_sk is not null and ss_sold_date_sk is not null)
+                                                                    TableScan [TS_9] (rows=575995635 width=88)
+                                                                      default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_store_sk","ss_net_profit"]
+                                                            <-Map 15 [SIMPLE_EDGE]
+                                                              SHUFFLE [RS_19]
                                                                 PartitionCols:_col0
-                                                                Select Operator [SEL_17] (rows=1704 width=1910)
-                                                                  Output:["_col0","_col1"]
-                                                                  Filter Operator [FIL_87] (rows=1704 width=1910)
-                                                                    predicate:(s_store_sk is not null and s_state is not null)
-                                                                    TableScan [TS_15] (rows=1704 width=1910)
-                                                                      default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_state"]
-                                                            <-Reducer 11 [SIMPLE_EDGE]
-                                                              SHUFFLE [RS_21]
-                                                                PartitionCols:_col1
-                                                                Merge Join Operator [MERGEJOIN_90] (rows=633595212 width=88)
-                                                                  Conds:RS_18._col0=RS_19._col0(Inner),Output:["_col1","_col2"]
-                                                                <-Map 10 [SIMPLE_EDGE]
-                                                                  SHUFFLE [RS_18]
-                                                                    PartitionCols:_col0
-                                                                    Select Operator [SEL_11] (rows=575995635 width=88)
-                                                                      Output:["_col0","_col1","_col2"]
-                                                                      Filter Operator [FIL_85] (rows=575995635 width=88)
-                                                                        predicate:(ss_store_sk is not null and ss_sold_date_sk is not null)
-                                                                        TableScan [TS_9] (rows=575995635 width=88)
-                                                                          default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_store_sk","ss_net_profit"]
-                                                                <-Map 16 [SIMPLE_EDGE]
-                                                                  SHUFFLE [RS_19]
-                                                                    PartitionCols:_col0
-                                                                    Select Operator [SEL_14] (rows=8116 width=1119)
-                                                                      Output:["_col0"]
-                                                                      Filter Operator [FIL_86] (rows=8116 width=1119)
-                                                                        predicate:(d_month_seq BETWEEN 1212 AND 1223 and d_date_sk is not null)
-                                                                        TableScan [TS_12] (rows=73049 width=1119)
-                                                                          default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_month_seq"]
+                                                                Select Operator [SEL_14] (rows=8116 width=1119)
+                                                                  Output:["_col0"]
+                                                                  Filter Operator [FIL_84] (rows=8116 width=1119)
+                                                                    predicate:(d_month_seq BETWEEN 1212 AND 1223 and d_date_sk is not null)
+                                                                    TableScan [TS_12] (rows=73049 width=1119)
+                                                                      default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_month_seq"]
                                 <-Reducer 3 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_47]
+                                  SHUFFLE [RS_45]
                                     PartitionCols:_col7
-                                    Merge Join Operator [MERGEJOIN_89] (rows=696954748 width=88)
-                                      Conds:RS_44._col1=RS_45._col0(Inner),Output:["_col2","_col6","_col7"]
+                                    Merge Join Operator [MERGEJOIN_87] (rows=696954748 width=88)
+                                      Conds:RS_40._col1=RS_41._col0(Inner),Output:["_col2","_col6","_col7"]
                                     <-Map 9 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_45]
+                                      SHUFFLE [RS_41]
                                         PartitionCols:_col0
                                         Select Operator [SEL_8] (rows=1704 width=1910)
                                           Output:["_col0","_col1","_col2"]
-                                          Filter Operator [FIL_83] (rows=1704 width=1910)
+                                          Filter Operator [FIL_81] (rows=1704 width=1910)
                                             predicate:(s_state is not null and s_store_sk is not null)
                                             TableScan [TS_6] (rows=1704 width=1910)
                                               default@store,s,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_county","s_state"]
                                     <-Reducer 2 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_44]
+                                      SHUFFLE [RS_40]
                                         PartitionCols:_col1
-                                        Merge Join Operator [MERGEJOIN_88] (rows=633595212 width=88)
-                                          Conds:RS_41._col0=RS_42._col0(Inner),Output:["_col1","_col2"]
+                                        Merge Join Operator [MERGEJOIN_86] (rows=633595212 width=88)
+                                          Conds:RS_37._col0=RS_38._col0(Inner),Output:["_col1","_col2"]
                                         <-Map 1 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_41]
+                                          SHUFFLE [RS_37]
                                             PartitionCols:_col0
                                             Select Operator [SEL_2] (rows=575995635 width=88)
                                               Output:["_col0","_col1","_col2"]
-                                              Filter Operator [FIL_81] (rows=575995635 width=88)
+                                              Filter Operator [FIL_79] (rows=575995635 width=88)
                                                 predicate:(ss_sold_date_sk is not null and ss_store_sk is not null)
                                                 TableScan [TS_0] (rows=575995635 width=88)
                                                   default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_store_sk","ss_net_profit"]
                                         <-Map 8 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_42]
+                                          SHUFFLE [RS_38]
                                             PartitionCols:_col0
                                             Select Operator [SEL_5] (rows=8116 width=1119)
                                               Output:["_col0"]
-                                              Filter Operator [FIL_82] (rows=8116 width=1119)
+                                              Filter Operator [FIL_80] (rows=8116 width=1119)
                                                 predicate:(d_month_seq BETWEEN 1212 AND 1223 and d_date_sk is not null)
                                                 TableScan [TS_3] (rows=73049 width=1119)
                                                   default@date_dim,d1,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_month_seq"]

http://git-wip-us.apache.org/repos/asf/hive/blob/f63dc2d4/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out b/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out
index a40115c..5313e9b 100644
--- a/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out
+++ b/ql/src/test/results/clientpositive/spark/constprog_partitioner.q.out
@@ -95,10 +95,9 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 4), Reducer 5 (PARTITION-LEVEL SORT, 4)
-        Reducer 4 <- Map 3 (PARTITION-LEVEL SORT, 4), Reducer 7 (PARTITION-LEVEL SORT, 4)
-        Reducer 5 <- Reducer 4 (GROUP, 4)
-        Reducer 7 <- Map 6 (GROUP, 4)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 4), Reducer 4 (PARTITION-LEVEL SORT, 4)
+        Reducer 4 <- Map 3 (PARTITION-LEVEL SORT, 4), Reducer 6 (PARTITION-LEVEL SORT, 4)
+        Reducer 6 <- Map 5 (GROUP, 4)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -137,7 +136,7 @@ STAGE PLANS:
                         Map-reduce partition columns: _col1 (type: int)
                         Statistics: Num rows: 50 Data size: 5999 Basic stats: COMPLETE Column stats: NONE
                         value expressions: _col0 (type: int)
-        Map 6 
+        Map 5 
             Map Operator Tree:
                 TableScan
                   alias: li
@@ -160,19 +159,19 @@ STAGE PLANS:
             Reduce Operator Tree:
               Join Operator
                 condition map:
-                     Inner Join 0 to 1
+                     Left Semi Join 0 to 1
                 keys:
                   0 _col0 (type: int), 1 (type: int)
                   1 _col0 (type: int), _col1 (type: int)
                 outputColumnNames: _col1, _col2
-                Statistics: Num rows: 55 Data size: 6598 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 60 Data size: 7257 Basic stats: COMPLETE Column stats: NONE
                 Select Operator
                   expressions: _col1 (type: int), _col2 (type: int)
                   outputColumnNames: _col0, _col1
-                  Statistics: Num rows: 55 Data size: 6598 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 60 Data size: 7257 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 55 Data size: 6598 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 60 Data size: 7257 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.SequenceFileInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
@@ -187,29 +186,21 @@ STAGE PLANS:
                   1 _col0 (type: int)
                 outputColumnNames: _col0, _col3
                 Statistics: Num rows: 55 Data size: 6598 Basic stats: COMPLETE Column stats: NONE
-                Group By Operator
-                  keys: _col0 (type: int), _col3 (type: int)
-                  mode: hash
+                Select Operator
+                  expressions: _col0 (type: int), _col3 (type: int)
                   outputColumnNames: _col0, _col1
                   Statistics: Num rows: 55 Data size: 6598 Basic stats: COMPLETE Column stats: NONE
-                  Reduce Output Operator
-                    key expressions: _col0 (type: int), _col1 (type: int)
-                    sort order: ++
-                    Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                  Group By Operator
+                    keys: _col0 (type: int), _col1 (type: int)
+                    mode: hash
+                    outputColumnNames: _col0, _col1
                     Statistics: Num rows: 55 Data size: 6598 Basic stats: COMPLETE Column stats: NONE
-        Reducer 5 
-            Reduce Operator Tree:
-              Group By Operator
-                keys: KEY._col0 (type: int), KEY._col1 (type: int)
-                mode: mergepartial
-                outputColumnNames: _col0, _col1
-                Statistics: Num rows: 27 Data size: 3239 Basic stats: COMPLETE Column stats: NONE
-                Reduce Output Operator
-                  key expressions: _col0 (type: int), _col1 (type: int)
-                  sort order: ++
-                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
-                  Statistics: Num rows: 27 Data size: 3239 Basic stats: COMPLETE Column stats: NONE
-        Reducer 7 
+                    Reduce Output Operator
+                      key expressions: _col0 (type: int), _col1 (type: int)
+                      sort order: ++
+                      Map-reduce partition columns: _col0 (type: int), _col1 (type: int)
+                      Statistics: Num rows: 55 Data size: 6598 Basic stats: COMPLETE Column stats: NONE
+        Reducer 6 
             Reduce Operator Tree:
               Group By Operator
                 keys: KEY._col0 (type: int)

http://git-wip-us.apache.org/repos/asf/hive/blob/f63dc2d4/ql/src/test/results/clientpositive/spark/leftsemijoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/leftsemijoin.q.out b/ql/src/test/results/clientpositive/spark/leftsemijoin.q.out
index a11bbc4..06df989 100644
--- a/ql/src/test/results/clientpositive/spark/leftsemijoin.q.out
+++ b/ql/src/test/results/clientpositive/spark/leftsemijoin.q.out
@@ -108,3 +108,200 @@ POSTHOOK: query: drop table things
 POSTHOOK: type: DROPTABLE
 POSTHOOK: Input: default@things
 POSTHOOK: Output: default@things
+Warning: Shuffle Join JOIN[10][tables = [$hdt$_1, $hdt$_2]] in Work 'Reducer 4' is a cross product
+PREHOOK: query: explain select part.p_type from part join (select p1.p_name from part p1, part p2 group by p1.p_name) pp ON pp.p_name = part.p_name
+PREHOOK: type: QUERY
+POSTHOOK: query: explain select part.p_type from part join (select p1.p_name from part p1, part p2 group by p1.p_name) pp ON pp.p_name = part.p_name
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Spark
+      Edges:
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 2), Reducer 4 (PARTITION-LEVEL SORT, 2)
+        Reducer 4 <- Map 3 (PARTITION-LEVEL SORT, 1), Map 5 (PARTITION-LEVEL SORT, 1)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: part
+                  Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: p_name is not null (type: boolean)
+                    Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: p_name (type: string), p_type (type: string)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 26 Data size: 3147 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: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col1 (type: string)
+        Map 3 
+            Map Operator Tree:
+                TableScan
+                  alias: p1
+                  Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: p_name is not null (type: boolean)
+                    Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: p_name (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        sort order: 
+                        Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: string)
+        Map 5 
+            Map Operator Tree:
+                TableScan
+                  alias: p2
+                  Statistics: Num rows: 26 Data size: 3147 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                    Reduce Output Operator
+                      sort order: 
+                      Statistics: Num rows: 26 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+        Reducer 2 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Left Semi Join 0 to 1
+                keys:
+                  0 _col0 (type: string)
+                  1 _col0 (type: string)
+                outputColumnNames: _col1
+                Statistics: Num rows: 743 Data size: 93722 Basic stats: COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col1 (type: string)
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 743 Data size: 93722 Basic stats: COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 743 Data size: 93722 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
+        Reducer 4 
+            Reduce Operator Tree:
+              Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 
+                  1 
+                outputColumnNames: _col0
+                Statistics: Num rows: 676 Data size: 85202 Basic stats: COMPLETE Column stats: NONE
+                Group By Operator
+                  keys: _col0 (type: string)
+                  mode: hash
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 676 Data size: 85202 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: 676 Data size: 85202 Basic stats: COMPLETE Column stats: NONE
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+Warning: Shuffle Join JOIN[10][tables = [$hdt$_1, $hdt$_2]] in Work 'Reducer 4' is a cross product
+PREHOOK: query: select part.p_type from part join (select p1.p_name from part p1, part p2 group by p1.p_name) pp ON pp.p_name = part.p_name
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part
+#### A masked pattern was here ####
+POSTHOOK: query: select part.p_type from part join (select p1.p_name from part p1, part p2 group by p1.p_name) pp ON pp.p_name = part.p_name
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part
+#### A masked pattern was here ####
+ECONOMY BRUSHED COPPER
+ECONOMY BURNISHED STEEL
+ECONOMY PLATED COPPER
+ECONOMY POLISHED STEEL
+LARGE BRUSHED BRASS
+LARGE BRUSHED STEEL
+LARGE BURNISHED STEEL
+MEDIUM ANODIZED COPPER
+MEDIUM BURNISHED BRASS
+MEDIUM BURNISHED COPPER
+MEDIUM BURNISHED TIN
+MEDIUM BURNISHED TIN
+PROMO ANODIZED TIN
+PROMO BURNISHED NICKEL
+PROMO PLATED TIN
+PROMO PLATED TIN
+PROMO POLISHED STEEL
+SMALL BRUSHED BRASS
+SMALL PLATED BRASS
+SMALL PLATED STEEL
+SMALL POLISHED NICKEL
+STANDARD ANODIZED STEEL
+STANDARD ANODIZED TIN
+STANDARD BURNISHED TIN
+STANDARD PLATED TIN
+STANDARD POLISHED STEEL
+PREHOOK: query: explain select part.p_type from part left join (select p1.p_name from part p1, part p2 group by p1.p_name) pp ON pp.p_name = part.p_name
+PREHOOK: type: QUERY
+POSTHOOK: query: explain select part.p_type from part left join (select p1.p_name from part p1, part p2 group by p1.p_name) pp ON pp.p_name = part.p_name
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        TableScan
+          alias: part
+          Select Operator
+            expressions: p_type (type: string)
+            outputColumnNames: _col0
+            ListSink
+
+PREHOOK: query: select part.p_type from part left join (select p1.p_name from part p1, part p2 group by p1.p_name) pp ON pp.p_name = part.p_name
+PREHOOK: type: QUERY
+PREHOOK: Input: default@part
+#### A masked pattern was here ####
+POSTHOOK: query: select part.p_type from part left join (select p1.p_name from part p1, part p2 group by p1.p_name) pp ON pp.p_name = part.p_name
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@part
+#### A masked pattern was here ####
+ECONOMY BRUSHED COPPER
+ECONOMY BURNISHED STEEL
+ECONOMY PLATED COPPER
+ECONOMY POLISHED STEEL
+LARGE BRUSHED BRASS
+LARGE BRUSHED STEEL
+LARGE BURNISHED STEEL
+MEDIUM ANODIZED COPPER
+MEDIUM BURNISHED BRASS
+MEDIUM BURNISHED COPPER
+MEDIUM BURNISHED TIN
+MEDIUM BURNISHED TIN
+PROMO ANODIZED TIN
+PROMO BURNISHED NICKEL
+PROMO PLATED TIN
+PROMO PLATED TIN
+PROMO POLISHED STEEL
+SMALL BRUSHED BRASS
+SMALL PLATED BRASS
+SMALL PLATED STEEL
+SMALL POLISHED NICKEL
+STANDARD ANODIZED STEEL
+STANDARD ANODIZED TIN
+STANDARD BURNISHED TIN
+STANDARD PLATED TIN
+STANDARD POLISHED STEEL