You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jc...@apache.org on 2018/01/05 02:44:44 UTC

[4/8] hive git commit: HIVE-18361: Extend shared work optimizer to reuse computation beyond work boundaries (Jesus Camacho Rodriguez, reviewed by Ashutosh Chauhan)

http://git-wip-us.apache.org/repos/asf/hive/blob/96a409e1/ql/src/test/results/clientpositive/perf/tez/query47.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query47.q.out b/ql/src/test/results/clientpositive/perf/tez/query47.q.out
index 1288408..04354b9 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query47.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query47.q.out
@@ -101,24 +101,16 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 10 <- Map 21 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
-Reducer 11 <- Map 22 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
-Reducer 12 <- Reducer 11 (SIMPLE_EDGE)
-Reducer 13 <- Reducer 12 (SIMPLE_EDGE)
-Reducer 14 <- Map 1 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
-Reducer 15 <- Map 21 (SIMPLE_EDGE), Reducer 14 (SIMPLE_EDGE)
-Reducer 16 <- Map 22 (SIMPLE_EDGE), Reducer 15 (SIMPLE_EDGE)
-Reducer 17 <- Reducer 16 (SIMPLE_EDGE)
-Reducer 18 <- Reducer 17 (SIMPLE_EDGE)
-Reducer 19 <- Reducer 18 (SIMPLE_EDGE)
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
-Reducer 3 <- Map 21 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Map 22 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 10 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 11 <- Reducer 10 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 12 (SIMPLE_EDGE)
+Reducer 3 <- Map 13 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 14 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
 Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
 Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
-Reducer 7 <- Reducer 13 (SIMPLE_EDGE), Reducer 19 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 11 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
 Reducer 8 <- Reducer 7 (SIMPLE_EDGE)
-Reducer 9 <- Map 1 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
+Reducer 9 <- Reducer 5 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
@@ -136,78 +128,7 @@ Stage-0
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
                 Merge Join Operator [MERGEJOIN_189] (rows=843315280 width=88)
                   Conds:RS_103._col0, _col1, _col2, _col3, (_col7 + 1)=RS_104._col0, _col1, _col2, _col3, _col8(Inner),RS_104._col0, _col1, _col2, _col3, _col8=RS_105._col0, _col1, _col2, _col3, (_col7 - 1)(Inner),Output:["_col6","_col8","_col12","_col13","_col14","_col15","_col23"]
-                <-Reducer 13 [SIMPLE_EDGE]
-                  SHUFFLE [RS_103]
-                    PartitionCols:_col0, _col1, _col2, _col3, (_col7 + 1)
-                    Select Operator [SEL_29] (rows=383325119 width=88)
-                      Output:["_col0","_col1","_col2","_col3","_col6","_col7"]
-                      Filter Operator [FIL_164] (rows=383325119 width=88)
-                        predicate:rank_window_0 is not null
-                        PTF Operator [PTF_28] (rows=383325119 width=88)
-                          Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col4 ASC NULLS FIRST, _col5 ASC NULLS FIRST","partition by:":"_col0, _col1, _col2, _col3"}]
-                          Select Operator [SEL_27] (rows=383325119 width=88)
-                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                          <-Reducer 12 [SIMPLE_EDGE]
-                            SHUFFLE [RS_26]
-                              PartitionCols:_col0, _col1, _col2, _col3
-                              Select Operator [SEL_25] (rows=383325119 width=88)
-                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                Group By Operator [GBY_24] (rows=383325119 width=88)
-                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5
-                                <-Reducer 11 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_23]
-                                    PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
-                                    Group By Operator [GBY_22] (rows=766650239 width=88)
-                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col8, _col9, _col11, _col12
-                                      Merge Join Operator [MERGEJOIN_182] (rows=766650239 width=88)
-                                        Conds:RS_18._col2=RS_19._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col9","_col11","_col12"]
-                                      <-Map 22 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_19]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_81] (rows=1704 width=1910)
-                                            Output:["_col0","_col1","_col2"]
-                                            Filter Operator [FIL_179] (rows=1704 width=1910)
-                                              predicate:(s_company_name is not null and s_store_name is not null and s_store_sk is not null)
-                                              TableScan [TS_79] (rows=1704 width=1910)
-                                                default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_store_name","s_company_name"]
-                                      <-Reducer 10 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_18]
-                                          PartitionCols:_col2
-                                          Merge Join Operator [MERGEJOIN_181] (rows=696954748 width=88)
-                                            Conds:RS_15._col1=RS_16._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8","_col9"]
-                                          <-Map 21 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_16]
-                                              PartitionCols:_col0
-                                              Select Operator [SEL_78] (rows=462000 width=1436)
-                                                Output:["_col0","_col1","_col2"]
-                                                Filter Operator [FIL_178] (rows=462000 width=1436)
-                                                  predicate:(i_brand is not null and i_category is not null and i_item_sk is not null)
-                                                  TableScan [TS_76] (rows=462000 width=1436)
-                                                    default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_brand","i_category"]
-                                          <-Reducer 9 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_15]
-                                              PartitionCols:_col1
-                                              Merge Join Operator [MERGEJOIN_180] (rows=633595212 width=88)
-                                                Conds:RS_12._col0=RS_13._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
-                                              <-Map 1 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_12]
-                                                  PartitionCols:_col0
-                                                  Select Operator [SEL_72] (rows=575995635 width=88)
-                                                    Output:["_col0","_col1","_col2","_col3"]
-                                                    Filter Operator [FIL_176] (rows=575995635 width=88)
-                                                      predicate:(ss_item_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
-                                                      TableScan [TS_70] (rows=575995635 width=88)
-                                                        default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_store_sk","ss_sales_price"]
-                                              <-Map 20 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_13]
-                                                  PartitionCols:_col0
-                                                  Select Operator [SEL_75] (rows=73048 width=1119)
-                                                    Output:["_col0","_col1","_col2"]
-                                                    Filter Operator [FIL_177] (rows=73048 width=1119)
-                                                      predicate:(((d_year = 2000) or ((d_year = 1999) and (d_moy = 12)) or ((d_year = 2001) and (d_moy = 1))) and d_date_sk is not null)
-                                                      TableScan [TS_73] (rows=73049 width=1119)
-                                                        default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
-                <-Reducer 19 [SIMPLE_EDGE]
+                <-Reducer 11 [SIMPLE_EDGE]
                   SHUFFLE [RS_104]
                     PartitionCols:_col0, _col1, _col2, _col3, _col8
                     Select Operator [SEL_67] (rows=31943759 width=88)
@@ -222,7 +143,7 @@ Stage-0
                               Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col5 ASC NULLS FIRST, _col6 ASC NULLS FIRST","partition by:":"_col1, _col2, _col3, _col4"}]
                               Select Operator [SEL_64] (rows=383325119 width=88)
                                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                              <-Reducer 18 [SIMPLE_EDGE]
+                              <-Reducer 10 [SIMPLE_EDGE]
                                 SHUFFLE [RS_63]
                                   PartitionCols:_col0, _col1, _col2, _col3
                                   Select Operator [SEL_62] (rows=383325119 width=88)
@@ -231,46 +152,66 @@ Stage-0
                                       Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col0 ASC NULLS FIRST, _col1 ASC NULLS FIRST, _col2 ASC NULLS FIRST, _col3 ASC NULLS FIRST, _col4 ASC NULLS FIRST","partition by:":"_col0, _col1, _col2, _col3, _col4"}]
                                       Select Operator [SEL_60] (rows=383325119 width=88)
                                         Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                      <-Reducer 17 [SIMPLE_EDGE]
+                                      <-Reducer 5 [SIMPLE_EDGE]
                                         SHUFFLE [RS_59]
                                           PartitionCols:_col0, _col1, _col2, _col3, _col4
-                                          Select Operator [SEL_58] (rows=383325119 width=88)
+                                          Select Operator [SEL_95] (rows=383325119 width=88)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                            Group By Operator [GBY_57] (rows=383325119 width=88)
+                                            Group By Operator [GBY_94] (rows=383325119 width=88)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5
-                                            <-Reducer 16 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_56]
+                                            <-Reducer 4 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_93]
                                                 PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
-                                                Group By Operator [GBY_55] (rows=766650239 width=88)
+                                                Group By Operator [GBY_92] (rows=766650239 width=88)
                                                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col8, _col9, _col11, _col12
-                                                  Merge Join Operator [MERGEJOIN_185] (rows=766650239 width=88)
-                                                    Conds:RS_51._col2=RS_52._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col9","_col11","_col12"]
-                                                  <-Map 22 [SIMPLE_EDGE]
-                                                    SHUFFLE [RS_52]
+                                                  Merge Join Operator [MERGEJOIN_188] (rows=766650239 width=88)
+                                                    Conds:RS_88._col2=RS_89._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col9","_col11","_col12"]
+                                                  <-Map 14 [SIMPLE_EDGE]
+                                                    SHUFFLE [RS_89]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_81]
-                                                  <-Reducer 15 [SIMPLE_EDGE]
-                                                    SHUFFLE [RS_51]
+                                                      Select Operator [SEL_81] (rows=1704 width=1910)
+                                                        Output:["_col0","_col1","_col2"]
+                                                        Filter Operator [FIL_179] (rows=1704 width=1910)
+                                                          predicate:(s_company_name is not null and s_store_name is not null and s_store_sk is not null)
+                                                          TableScan [TS_79] (rows=1704 width=1910)
+                                                            default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_store_name","s_company_name"]
+                                                  <-Reducer 3 [SIMPLE_EDGE]
+                                                    SHUFFLE [RS_88]
                                                       PartitionCols:_col2
-                                                      Merge Join Operator [MERGEJOIN_184] (rows=696954748 width=88)
-                                                        Conds:RS_48._col1=RS_49._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8","_col9"]
-                                                      <-Map 21 [SIMPLE_EDGE]
-                                                        SHUFFLE [RS_49]
+                                                      Merge Join Operator [MERGEJOIN_187] (rows=696954748 width=88)
+                                                        Conds:RS_85._col1=RS_86._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8","_col9"]
+                                                      <-Map 13 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_86]
                                                           PartitionCols:_col0
-                                                           Please refer to the previous Select Operator [SEL_78]
-                                                      <-Reducer 14 [SIMPLE_EDGE]
-                                                        SHUFFLE [RS_48]
+                                                          Select Operator [SEL_78] (rows=462000 width=1436)
+                                                            Output:["_col0","_col1","_col2"]
+                                                            Filter Operator [FIL_178] (rows=462000 width=1436)
+                                                              predicate:(i_brand is not null and i_category is not null and i_item_sk is not null)
+                                                              TableScan [TS_76] (rows=462000 width=1436)
+                                                                default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_brand","i_category"]
+                                                      <-Reducer 2 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_85]
                                                           PartitionCols:_col1
-                                                          Merge Join Operator [MERGEJOIN_183] (rows=633595212 width=88)
-                                                            Conds:RS_45._col0=RS_46._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
+                                                          Merge Join Operator [MERGEJOIN_186] (rows=633595212 width=88)
+                                                            Conds:RS_82._col0=RS_83._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
                                                           <-Map 1 [SIMPLE_EDGE]
-                                                            SHUFFLE [RS_45]
+                                                            SHUFFLE [RS_82]
                                                               PartitionCols:_col0
-                                                               Please refer to the previous Select Operator [SEL_72]
-                                                          <-Map 20 [SIMPLE_EDGE]
-                                                            SHUFFLE [RS_46]
+                                                              Select Operator [SEL_72] (rows=575995635 width=88)
+                                                                Output:["_col0","_col1","_col2","_col3"]
+                                                                Filter Operator [FIL_176] (rows=575995635 width=88)
+                                                                  predicate:(ss_item_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null)
+                                                                  TableScan [TS_70] (rows=575995635 width=88)
+                                                                    default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_store_sk","ss_sales_price"]
+                                                          <-Map 12 [SIMPLE_EDGE]
+                                                            SHUFFLE [RS_83]
                                                               PartitionCols:_col0
-                                                               Please refer to the previous Select Operator [SEL_75]
+                                                              Select Operator [SEL_75] (rows=73048 width=1119)
+                                                                Output:["_col0","_col1","_col2"]
+                                                                Filter Operator [FIL_177] (rows=73048 width=1119)
+                                                                  predicate:(((d_year = 2000) or ((d_year = 1999) and (d_moy = 12)) or ((d_year = 2001) and (d_moy = 1))) and d_date_sk is not null)
+                                                                  TableScan [TS_73] (rows=73049 width=1119)
+                                                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
                 <-Reducer 6 [SIMPLE_EDGE]
                   SHUFFLE [RS_105]
                     PartitionCols:_col0, _col1, _col2, _col3, (_col7 - 1)
@@ -285,41 +226,20 @@ Stage-0
                           <-Reducer 5 [SIMPLE_EDGE]
                             SHUFFLE [RS_96]
                               PartitionCols:_col0, _col1, _col2, _col3
-                              Select Operator [SEL_95] (rows=383325119 width=88)
-                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                Group By Operator [GBY_94] (rows=383325119 width=88)
-                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4, KEY._col5
-                                <-Reducer 4 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_93]
-                                    PartitionCols:_col0, _col1, _col2, _col3, _col4, _col5
-                                    Group By Operator [GBY_92] (rows=766650239 width=88)
-                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col8, _col9, _col11, _col12
-                                      Merge Join Operator [MERGEJOIN_188] (rows=766650239 width=88)
-                                        Conds:RS_88._col2=RS_89._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col9","_col11","_col12"]
-                                      <-Map 22 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_89]
-                                          PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_81]
-                                      <-Reducer 3 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_88]
-                                          PartitionCols:_col2
-                                          Merge Join Operator [MERGEJOIN_187] (rows=696954748 width=88)
-                                            Conds:RS_85._col1=RS_86._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8","_col9"]
-                                          <-Map 21 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_86]
-                                              PartitionCols:_col0
-                                               Please refer to the previous Select Operator [SEL_78]
-                                          <-Reducer 2 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_85]
-                                              PartitionCols:_col1
-                                              Merge Join Operator [MERGEJOIN_186] (rows=633595212 width=88)
-                                                Conds:RS_82._col0=RS_83._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
-                                              <-Map 1 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_82]
-                                                  PartitionCols:_col0
-                                                   Please refer to the previous Select Operator [SEL_72]
-                                              <-Map 20 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_83]
-                                                  PartitionCols:_col0
-                                                   Please refer to the previous Select Operator [SEL_75]
+                               Please refer to the previous Select Operator [SEL_95]
+                <-Reducer 9 [SIMPLE_EDGE]
+                  SHUFFLE [RS_103]
+                    PartitionCols:_col0, _col1, _col2, _col3, (_col7 + 1)
+                    Select Operator [SEL_29] (rows=383325119 width=88)
+                      Output:["_col0","_col1","_col2","_col3","_col6","_col7"]
+                      Filter Operator [FIL_164] (rows=383325119 width=88)
+                        predicate:rank_window_0 is not null
+                        PTF Operator [PTF_28] (rows=383325119 width=88)
+                          Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col4 ASC NULLS FIRST, _col5 ASC NULLS FIRST","partition by:":"_col0, _col1, _col2, _col3"}]
+                          Select Operator [SEL_27] (rows=383325119 width=88)
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
+                          <-Reducer 5 [SIMPLE_EDGE]
+                            SHUFFLE [RS_26]
+                              PartitionCols:_col0, _col1, _col2, _col3
+                               Please refer to the previous Select Operator [SEL_95]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/96a409e1/ql/src/test/results/clientpositive/perf/tez/query54.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query54.q.out b/ql/src/test/results/clientpositive/perf/tez/query54.q.out
index e6b9b28..a674acc 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query54.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query54.q.out
@@ -1,6 +1,6 @@
 Warning: Shuffle Join MERGEJOIN[184][tables = [$hdt$_0, $hdt$_1, $hdt$_2, $hdt$_3]] in Stage 'Reducer 4' is a cross product
 Warning: Shuffle Join MERGEJOIN[185][tables = [$hdt$_0, $hdt$_1, $hdt$_2, $hdt$_3, $hdt$_4]] in Stage 'Reducer 5' is a cross product
-Warning: Shuffle Join MERGEJOIN[183][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 30' is a cross product
+Warning: Shuffle Join MERGEJOIN[183][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 29' is a cross product
 Warning: Shuffle Join MERGEJOIN[186][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 6' is a cross product
 PREHOOK: query: explain
 with my_customers as (
@@ -127,14 +127,13 @@ Reducer 20 <- Reducer 19 (SIMPLE_EDGE)
 Reducer 26 <- Map 25 (SIMPLE_EDGE)
 Reducer 27 <- Reducer 26 (CUSTOM_SIMPLE_EDGE)
 Reducer 28 <- Map 25 (SIMPLE_EDGE)
-Reducer 29 <- Map 25 (SIMPLE_EDGE)
+Reducer 29 <- Reducer 28 (CUSTOM_SIMPLE_EDGE), Reducer 31 (CUSTOM_SIMPLE_EDGE)
 Reducer 3 <- Reducer 13 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-Reducer 30 <- Reducer 29 (CUSTOM_SIMPLE_EDGE), Reducer 32 (CUSTOM_SIMPLE_EDGE)
-Reducer 31 <- Map 25 (SIMPLE_EDGE)
-Reducer 32 <- Reducer 31 (CUSTOM_SIMPLE_EDGE)
+Reducer 30 <- Map 25 (SIMPLE_EDGE)
+Reducer 31 <- Reducer 30 (CUSTOM_SIMPLE_EDGE)
 Reducer 4 <- Reducer 27 (CUSTOM_SIMPLE_EDGE), Reducer 3 (CUSTOM_SIMPLE_EDGE)
-Reducer 5 <- Reducer 28 (CUSTOM_SIMPLE_EDGE), Reducer 4 (CUSTOM_SIMPLE_EDGE)
-Reducer 6 <- Reducer 30 (CUSTOM_SIMPLE_EDGE), Reducer 5 (CUSTOM_SIMPLE_EDGE)
+Reducer 5 <- Reducer 26 (CUSTOM_SIMPLE_EDGE), Reducer 4 (CUSTOM_SIMPLE_EDGE)
+Reducer 6 <- Reducer 29 (CUSTOM_SIMPLE_EDGE), Reducer 5 (CUSTOM_SIMPLE_EDGE)
 Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
 Reducer 8 <- Reducer 7 (SIMPLE_EDGE)
 Reducer 9 <- Reducer 8 (SIMPLE_EDGE)
@@ -177,11 +176,11 @@ Stage-0
                                     Output:["_col0","_col4","_col11","_col13","_col15"]
                                     Merge Join Operator [MERGEJOIN_186] (rows=58108714324214428 width=158)
                                       Conds:(Inner),Output:["_col0","_col2","_col6","_col13","_col15"]
-                                    <-Reducer 30 [CUSTOM_SIMPLE_EDGE]
+                                    <-Reducer 29 [CUSTOM_SIMPLE_EDGE]
                                       PARTITION_ONLY_SHUFFLE [RS_112]
                                         Merge Join Operator [MERGEJOIN_183] (rows=9131 width=1128)
                                           Conds:(Right Outer),Output:["_col0"]
-                                        <-Reducer 29 [CUSTOM_SIMPLE_EDGE]
+                                        <-Reducer 28 [CUSTOM_SIMPLE_EDGE]
                                           PARTITION_ONLY_SHUFFLE [RS_109]
                                             Group By Operator [GBY_6] (rows=9131 width=1119)
                                               Output:["_col0"],keys:KEY._col0
@@ -196,14 +195,14 @@ Stage-0
                                                       predicate:((d_moy = 3) and (d_year = 1999))
                                                       TableScan [TS_73] (rows=73049 width=1119)
                                                         default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_month_seq","d_year","d_moy"]
-                                        <-Reducer 32 [CUSTOM_SIMPLE_EDGE]
+                                        <-Reducer 31 [CUSTOM_SIMPLE_EDGE]
                                           PARTITION_ONLY_SHUFFLE [RS_110]
                                             Select Operator [SEL_22] (rows=1 width=8)
                                               Filter Operator [FIL_21] (rows=1 width=8)
                                                 predicate:(sq_count_check(_col0) <= 1)
                                                 Group By Operator [GBY_19] (rows=1 width=8)
                                                   Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                                                <-Reducer 31 [CUSTOM_SIMPLE_EDGE]
+                                                <-Reducer 30 [CUSTOM_SIMPLE_EDGE]
                                                   PARTITION_ONLY_SHUFFLE [RS_18]
                                                     Group By Operator [GBY_17] (rows=1 width=8)
                                                       Output:["_col0"],aggregations:["count()"]
@@ -224,12 +223,12 @@ Stage-0
                                           Output:["_col0","_col4","_col11","_col13"]
                                           Merge Join Operator [MERGEJOIN_185] (rows=6363893803988 width=1217)
                                             Conds:(Left Outer),Output:["_col2","_col4","_col10","_col13"]
-                                          <-Reducer 28 [CUSTOM_SIMPLE_EDGE]
+                                          <-Reducer 26 [CUSTOM_SIMPLE_EDGE]
                                             PARTITION_ONLY_SHUFFLE [RS_106]
-                                              Group By Operator [GBY_94] (rows=9131 width=1119)
+                                              Group By Operator [GBY_79] (rows=9131 width=1119)
                                                 Output:["_col0"],keys:KEY._col0
                                               <-Map 25 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_93]
+                                                SHUFFLE [RS_78]
                                                   PartitionCols:_col0
                                                   Group By Operator [GBY_77] (rows=18262 width=1119)
                                                     Output:["_col0"],keys:_col0
@@ -252,12 +251,7 @@ Stage-0
                                                           Group By Operator [GBY_82] (rows=1 width=8)
                                                             Output:["_col0"],aggregations:["count()"]
                                                             Select Operator [SEL_80] (rows=9131 width=1119)
-                                                              Group By Operator [GBY_79] (rows=9131 width=1119)
-                                                                Output:["_col0"],keys:KEY._col0
-                                                              <-Map 25 [SIMPLE_EDGE]
-                                                                SHUFFLE [RS_78]
-                                                                  PartitionCols:_col0
-                                                                   Please refer to the previous Group By Operator [GBY_77]
+                                                               Please refer to the previous Group By Operator [GBY_79]
                                               <-Reducer 3 [CUSTOM_SIMPLE_EDGE]
                                                 PARTITION_ONLY_SHUFFLE [RS_102]
                                                   Merge Join Operator [MERGEJOIN_182] (rows=696954748 width=88)

http://git-wip-us.apache.org/repos/asf/hive/blob/96a409e1/ql/src/test/results/clientpositive/perf/tez/query56.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query56.q.out b/ql/src/test/results/clientpositive/perf/tez/query56.q.out
index 4041740..93f8a1d 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query56.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query56.q.out
@@ -135,26 +135,22 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 10 <- Reducer 9 (SIMPLE_EDGE), Union 5 (CONTAINS)
-Reducer 11 <- Map 1 (SIMPLE_EDGE), Reducer 17 (ONE_TO_ONE_EDGE)
-Reducer 12 <- Reducer 11 (SIMPLE_EDGE), Reducer 25 (SIMPLE_EDGE)
-Reducer 13 <- Reducer 12 (SIMPLE_EDGE), Union 5 (CONTAINS)
-Reducer 15 <- Map 14 (SIMPLE_EDGE)
-Reducer 16 <- Map 14 (SIMPLE_EDGE)
-Reducer 17 <- Map 14 (SIMPLE_EDGE)
-Reducer 19 <- Map 18 (SIMPLE_EDGE), Map 21 (SIMPLE_EDGE)
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 15 (ONE_TO_ONE_EDGE)
-Reducer 20 <- Map 26 (SIMPLE_EDGE), Reducer 19 (SIMPLE_EDGE)
-Reducer 22 <- Map 21 (SIMPLE_EDGE), Map 27 (SIMPLE_EDGE)
-Reducer 23 <- Map 26 (SIMPLE_EDGE), Reducer 22 (SIMPLE_EDGE)
-Reducer 24 <- Map 21 (SIMPLE_EDGE), Map 28 (SIMPLE_EDGE)
-Reducer 25 <- Map 26 (SIMPLE_EDGE), Reducer 24 (SIMPLE_EDGE)
-Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 20 (SIMPLE_EDGE)
+Reducer 10 <- Reducer 2 (SIMPLE_EDGE), Reducer 21 (SIMPLE_EDGE)
+Reducer 11 <- Reducer 10 (SIMPLE_EDGE), Union 5 (CONTAINS)
+Reducer 13 <- Map 12 (SIMPLE_EDGE)
+Reducer 15 <- Map 14 (SIMPLE_EDGE), Map 17 (SIMPLE_EDGE)
+Reducer 16 <- Map 22 (SIMPLE_EDGE), Reducer 15 (SIMPLE_EDGE)
+Reducer 18 <- Map 17 (SIMPLE_EDGE), Map 23 (SIMPLE_EDGE)
+Reducer 19 <- Map 22 (SIMPLE_EDGE), Reducer 18 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 13 (ONE_TO_ONE_EDGE)
+Reducer 20 <- Map 17 (SIMPLE_EDGE), Map 24 (SIMPLE_EDGE)
+Reducer 21 <- Map 22 (SIMPLE_EDGE), Reducer 20 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 16 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
 Reducer 4 <- Reducer 3 (SIMPLE_EDGE), Union 5 (CONTAINS)
 Reducer 6 <- Union 5 (SIMPLE_EDGE)
 Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
-Reducer 8 <- Map 1 (SIMPLE_EDGE), Reducer 16 (ONE_TO_ONE_EDGE)
-Reducer 9 <- Reducer 23 (SIMPLE_EDGE), Reducer 8 (SIMPLE_EDGE)
+Reducer 8 <- Reducer 19 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 9 <- Reducer 8 (SIMPLE_EDGE), Union 5 (CONTAINS)
 
 Stage-0
   Fetch Operator
@@ -171,66 +167,27 @@ Stage-0
               Group By Operator [GBY_116] (rows=335408073 width=108)
                 Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
               <-Union 5 [SIMPLE_EDGE]
-                <-Reducer 10 [CONTAINS]
+                <-Reducer 11 [CONTAINS]
                   Reduce Output Operator [RS_115]
                     PartitionCols:_col0
                     Group By Operator [GBY_114] (rows=670816147 width=108)
                       Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                      Group By Operator [GBY_72] (rows=191657247 width=135)
+                      Group By Operator [GBY_110] (rows=95833781 width=135)
                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                      <-Reducer 9 [SIMPLE_EDGE]
-                        SHUFFLE [RS_71]
+                      <-Reducer 10 [SIMPLE_EDGE]
+                        SHUFFLE [RS_109]
                           PartitionCols:_col0
-                          Group By Operator [GBY_70] (rows=383314495 width=135)
+                          Group By Operator [GBY_108] (rows=191667562 width=135)
                             Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
-                            Merge Join Operator [MERGEJOIN_183] (rows=383314495 width=135)
-                              Conds:RS_66._col0=RS_67._col4(Inner),Output:["_col1","_col8"]
-                            <-Reducer 23 [SIMPLE_EDGE]
-                              SHUFFLE [RS_67]
-                                PartitionCols:_col4
-                                Select Operator [SEL_62] (rows=348467716 width=135)
-                                  Output:["_col4","_col5"]
-                                  Merge Join Operator [MERGEJOIN_178] (rows=348467716 width=135)
-                                    Conds:RS_59._col1=RS_60._col0(Inner),Output:["_col2","_col3"]
-                                  <-Map 26 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_60]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_18] (rows=20000000 width=1014)
-                                        Output:["_col0"]
-                                        Filter Operator [FIL_162] (rows=20000000 width=1014)
-                                          predicate:((ca_gmt_offset = -8) and ca_address_sk is not null)
-                                          TableScan [TS_16] (rows=40000000 width=1014)
-                                            default@customer_address,customer_address,Tbl:COMPLETE,Col:NONE,Output:["ca_address_sk","ca_gmt_offset"]
-                                  <-Reducer 22 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_59]
-                                      PartitionCols:_col1
-                                      Merge Join Operator [MERGEJOIN_177] (rows=316788826 width=135)
-                                        Conds:RS_56._col0=RS_57._col0(Inner),Output:["_col1","_col2","_col3"]
-                                      <-Map 21 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_57]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_15] (rows=18262 width=1119)
-                                            Output:["_col0"]
-                                            Filter Operator [FIL_161] (rows=18262 width=1119)
-                                              predicate:((d_moy = 1) and (d_year = 2000) and d_date_sk is not null)
-                                              TableScan [TS_13] (rows=73049 width=1119)
-                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
-                                      <-Map 27 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_56]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_49] (rows=287989836 width=135)
-                                            Output:["_col0","_col1","_col2","_col3"]
-                                            Filter Operator [FIL_165] (rows=287989836 width=135)
-                                              predicate:(cs_bill_addr_sk is not null and cs_item_sk is not null and cs_sold_date_sk is not null)
-                                              TableScan [TS_47] (rows=287989836 width=135)
-                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_bill_addr_sk","cs_item_sk","cs_ext_sales_price"]
-                            <-Reducer 8 [SIMPLE_EDGE]
-                              SHUFFLE [RS_66]
+                            Merge Join Operator [MERGEJOIN_184] (rows=191667562 width=135)
+                              Conds:RS_104._col0=RS_105._col3(Inner),Output:["_col1","_col8"]
+                            <-Reducer 2 [SIMPLE_EDGE]
+                              SHUFFLE [RS_104]
                                 PartitionCols:_col0
-                                Merge Join Operator [MERGEJOIN_176] (rows=508200 width=1436)
-                                  Conds:RS_63._col1=RS_64._col0(Inner),Output:["_col0","_col1"]
+                                Merge Join Operator [MERGEJOIN_173] (rows=508200 width=1436)
+                                  Conds:RS_26._col1=RS_27._col0(Inner),Output:["_col0","_col1"]
                                 <-Map 1 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_63]
+                                  SHUFFLE [RS_26]
                                     PartitionCols:_col1
                                     Select Operator [SEL_2] (rows=462000 width=1436)
                                       Output:["_col0","_col1"]
@@ -238,13 +195,13 @@ Stage-0
                                         predicate:(i_item_id is not null and i_item_sk is not null)
                                         TableScan [TS_0] (rows=462000 width=1436)
                                           default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_item_id"]
-                                <-Reducer 16 [ONE_TO_ONE_EDGE]
-                                  FORWARD [RS_64]
+                                <-Reducer 13 [ONE_TO_ONE_EDGE]
+                                  FORWARD [RS_27]
                                     PartitionCols:_col0
-                                    Group By Operator [GBY_45] (rows=115500 width=1436)
+                                    Group By Operator [GBY_8] (rows=115500 width=1436)
                                       Output:["_col0"],keys:KEY._col0
-                                    <-Map 14 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_44]
+                                    <-Map 12 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_7]
                                         PartitionCols:_col0
                                         Group By Operator [GBY_6] (rows=231000 width=1436)
                                           Output:["_col0"],keys:i_item_id
@@ -254,59 +211,37 @@ Stage-0
                                               predicate:((i_color) IN ('orchid', 'chiffon', 'lace') and i_item_id is not null)
                                               TableScan [TS_3] (rows=462000 width=1436)
                                                 default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_id","i_color"]
-                <-Reducer 13 [CONTAINS]
-                  Reduce Output Operator [RS_115]
-                    PartitionCols:_col0
-                    Group By Operator [GBY_114] (rows=670816147 width=108)
-                      Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                      Group By Operator [GBY_110] (rows=95833781 width=135)
-                        Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                      <-Reducer 12 [SIMPLE_EDGE]
-                        SHUFFLE [RS_109]
-                          PartitionCols:_col0
-                          Group By Operator [GBY_108] (rows=191667562 width=135)
-                            Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
-                            Merge Join Operator [MERGEJOIN_184] (rows=191667562 width=135)
-                              Conds:RS_104._col0=RS_105._col3(Inner),Output:["_col1","_col8"]
-                            <-Reducer 11 [SIMPLE_EDGE]
-                              SHUFFLE [RS_104]
-                                PartitionCols:_col0
-                                Merge Join Operator [MERGEJOIN_179] (rows=508200 width=1436)
-                                  Conds:RS_101._col1=RS_102._col0(Inner),Output:["_col0","_col1"]
-                                <-Map 1 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_101]
-                                    PartitionCols:_col1
-                                     Please refer to the previous Select Operator [SEL_2]
-                                <-Reducer 17 [ONE_TO_ONE_EDGE]
-                                  FORWARD [RS_102]
-                                    PartitionCols:_col0
-                                    Group By Operator [GBY_83] (rows=115500 width=1436)
-                                      Output:["_col0"],keys:KEY._col0
-                                    <-Map 14 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_82]
-                                        PartitionCols:_col0
-                                         Please refer to the previous Group By Operator [GBY_6]
-                            <-Reducer 25 [SIMPLE_EDGE]
+                            <-Reducer 21 [SIMPLE_EDGE]
                               SHUFFLE [RS_105]
                                 PartitionCols:_col3
                                 Select Operator [SEL_100] (rows=174243235 width=135)
                                   Output:["_col3","_col5"]
                                   Merge Join Operator [MERGEJOIN_181] (rows=174243235 width=135)
                                     Conds:RS_97._col2=RS_98._col0(Inner),Output:["_col1","_col3"]
-                                  <-Map 26 [SIMPLE_EDGE]
+                                  <-Map 22 [SIMPLE_EDGE]
                                     SHUFFLE [RS_98]
                                       PartitionCols:_col0
-                                       Please refer to the previous Select Operator [SEL_18]
-                                  <-Reducer 24 [SIMPLE_EDGE]
+                                      Select Operator [SEL_18] (rows=20000000 width=1014)
+                                        Output:["_col0"]
+                                        Filter Operator [FIL_162] (rows=20000000 width=1014)
+                                          predicate:((ca_gmt_offset = -8) and ca_address_sk is not null)
+                                          TableScan [TS_16] (rows=40000000 width=1014)
+                                            default@customer_address,customer_address,Tbl:COMPLETE,Col:NONE,Output:["ca_address_sk","ca_gmt_offset"]
+                                  <-Reducer 20 [SIMPLE_EDGE]
                                     SHUFFLE [RS_97]
                                       PartitionCols:_col2
                                       Merge Join Operator [MERGEJOIN_180] (rows=158402938 width=135)
                                         Conds:RS_94._col0=RS_95._col0(Inner),Output:["_col1","_col2","_col3"]
-                                      <-Map 21 [SIMPLE_EDGE]
+                                      <-Map 17 [SIMPLE_EDGE]
                                         SHUFFLE [RS_95]
                                           PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_15]
-                                      <-Map 28 [SIMPLE_EDGE]
+                                          Select Operator [SEL_15] (rows=18262 width=1119)
+                                            Output:["_col0"]
+                                            Filter Operator [FIL_161] (rows=18262 width=1119)
+                                              predicate:((d_moy = 1) and (d_year = 2000) and d_date_sk is not null)
+                                              TableScan [TS_13] (rows=73049 width=1119)
+                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
+                                      <-Map 24 [SIMPLE_EDGE]
                                         SHUFFLE [RS_94]
                                           PartitionCols:_col0
                                           Select Operator [SEL_87] (rows=144002668 width=135)
@@ -332,42 +267,28 @@ Stage-0
                             <-Reducer 2 [SIMPLE_EDGE]
                               SHUFFLE [RS_29]
                                 PartitionCols:_col0
-                                Merge Join Operator [MERGEJOIN_173] (rows=508200 width=1436)
-                                  Conds:RS_26._col1=RS_27._col0(Inner),Output:["_col0","_col1"]
-                                <-Map 1 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_26]
-                                    PartitionCols:_col1
-                                     Please refer to the previous Select Operator [SEL_2]
-                                <-Reducer 15 [ONE_TO_ONE_EDGE]
-                                  FORWARD [RS_27]
-                                    PartitionCols:_col0
-                                    Group By Operator [GBY_8] (rows=115500 width=1436)
-                                      Output:["_col0"],keys:KEY._col0
-                                    <-Map 14 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_7]
-                                        PartitionCols:_col0
-                                         Please refer to the previous Group By Operator [GBY_6]
-                            <-Reducer 20 [SIMPLE_EDGE]
+                                 Please refer to the previous Merge Join Operator [MERGEJOIN_173]
+                            <-Reducer 16 [SIMPLE_EDGE]
                               SHUFFLE [RS_30]
                                 PartitionCols:_col3
                                 Select Operator [SEL_25] (rows=696954748 width=88)
                                   Output:["_col3","_col5"]
                                   Merge Join Operator [MERGEJOIN_175] (rows=696954748 width=88)
                                     Conds:RS_22._col2=RS_23._col0(Inner),Output:["_col1","_col3"]
-                                  <-Map 26 [SIMPLE_EDGE]
+                                  <-Map 22 [SIMPLE_EDGE]
                                     SHUFFLE [RS_23]
                                       PartitionCols:_col0
                                        Please refer to the previous Select Operator [SEL_18]
-                                  <-Reducer 19 [SIMPLE_EDGE]
+                                  <-Reducer 15 [SIMPLE_EDGE]
                                     SHUFFLE [RS_22]
                                       PartitionCols:_col2
                                       Merge Join Operator [MERGEJOIN_174] (rows=633595212 width=88)
                                         Conds:RS_19._col0=RS_20._col0(Inner),Output:["_col1","_col2","_col3"]
-                                      <-Map 21 [SIMPLE_EDGE]
+                                      <-Map 17 [SIMPLE_EDGE]
                                         SHUFFLE [RS_20]
                                           PartitionCols:_col0
                                            Please refer to the previous Select Operator [SEL_15]
-                                      <-Map 18 [SIMPLE_EDGE]
+                                      <-Map 14 [SIMPLE_EDGE]
                                         SHUFFLE [RS_19]
                                           PartitionCols:_col0
                                           Select Operator [SEL_12] (rows=575995635 width=88)
@@ -376,4 +297,51 @@ Stage-0
                                               predicate:(ss_addr_sk is not null and ss_item_sk is not null and ss_sold_date_sk is not null)
                                               TableScan [TS_10] (rows=575995635 width=88)
                                                 default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_addr_sk","ss_ext_sales_price"]
+                <-Reducer 9 [CONTAINS]
+                  Reduce Output Operator [RS_115]
+                    PartitionCols:_col0
+                    Group By Operator [GBY_114] (rows=670816147 width=108)
+                      Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
+                      Group By Operator [GBY_72] (rows=191657247 width=135)
+                        Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
+                      <-Reducer 8 [SIMPLE_EDGE]
+                        SHUFFLE [RS_71]
+                          PartitionCols:_col0
+                          Group By Operator [GBY_70] (rows=383314495 width=135)
+                            Output:["_col0","_col1"],aggregations:["sum(_col8)"],keys:_col1
+                            Merge Join Operator [MERGEJOIN_183] (rows=383314495 width=135)
+                              Conds:RS_66._col0=RS_67._col4(Inner),Output:["_col1","_col8"]
+                            <-Reducer 2 [SIMPLE_EDGE]
+                              SHUFFLE [RS_66]
+                                PartitionCols:_col0
+                                 Please refer to the previous Merge Join Operator [MERGEJOIN_173]
+                            <-Reducer 19 [SIMPLE_EDGE]
+                              SHUFFLE [RS_67]
+                                PartitionCols:_col4
+                                Select Operator [SEL_62] (rows=348467716 width=135)
+                                  Output:["_col4","_col5"]
+                                  Merge Join Operator [MERGEJOIN_178] (rows=348467716 width=135)
+                                    Conds:RS_59._col1=RS_60._col0(Inner),Output:["_col2","_col3"]
+                                  <-Map 22 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_60]
+                                      PartitionCols:_col0
+                                       Please refer to the previous Select Operator [SEL_18]
+                                  <-Reducer 18 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_59]
+                                      PartitionCols:_col1
+                                      Merge Join Operator [MERGEJOIN_177] (rows=316788826 width=135)
+                                        Conds:RS_56._col0=RS_57._col0(Inner),Output:["_col1","_col2","_col3"]
+                                      <-Map 17 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_57]
+                                          PartitionCols:_col0
+                                           Please refer to the previous Select Operator [SEL_15]
+                                      <-Map 23 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_56]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_49] (rows=287989836 width=135)
+                                            Output:["_col0","_col1","_col2","_col3"]
+                                            Filter Operator [FIL_165] (rows=287989836 width=135)
+                                              predicate:(cs_bill_addr_sk is not null and cs_item_sk is not null and cs_sold_date_sk is not null)
+                                              TableScan [TS_47] (rows=287989836 width=135)
+                                                default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_bill_addr_sk","cs_item_sk","cs_ext_sales_price"]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/96a409e1/ql/src/test/results/clientpositive/perf/tez/query57.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query57.q.out b/ql/src/test/results/clientpositive/perf/tez/query57.q.out
index 1a1bbf1..7a275d2 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query57.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query57.q.out
@@ -95,24 +95,16 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 10 <- Map 21 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
-Reducer 11 <- Map 22 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
-Reducer 12 <- Reducer 11 (SIMPLE_EDGE)
-Reducer 13 <- Reducer 12 (SIMPLE_EDGE)
-Reducer 14 <- Map 1 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
-Reducer 15 <- Map 21 (SIMPLE_EDGE), Reducer 14 (SIMPLE_EDGE)
-Reducer 16 <- Map 22 (SIMPLE_EDGE), Reducer 15 (SIMPLE_EDGE)
-Reducer 17 <- Reducer 16 (SIMPLE_EDGE)
-Reducer 18 <- Reducer 17 (SIMPLE_EDGE)
-Reducer 19 <- Reducer 18 (SIMPLE_EDGE)
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
-Reducer 3 <- Map 21 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Map 22 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 10 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 11 <- Reducer 10 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 12 (SIMPLE_EDGE)
+Reducer 3 <- Map 13 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 14 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
 Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
 Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
-Reducer 7 <- Reducer 13 (SIMPLE_EDGE), Reducer 19 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 11 (SIMPLE_EDGE), Reducer 6 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
 Reducer 8 <- Reducer 7 (SIMPLE_EDGE)
-Reducer 9 <- Map 1 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
+Reducer 9 <- Reducer 5 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
@@ -130,78 +122,7 @@ Stage-0
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
                 Merge Join Operator [MERGEJOIN_189] (rows=421645952 width=135)
                   Conds:RS_103._col0, _col2, _col1, (_col6 + 1)=RS_104._col0, _col2, _col1, _col7(Inner),RS_104._col0, _col2, _col1, _col7=RS_105._col0, _col2, _col1, (_col6 - 1)(Inner),Output:["_col5","_col7","_col8","_col10","_col11","_col12","_col13","_col20"]
-                <-Reducer 13 [SIMPLE_EDGE]
-                  SHUFFLE [RS_103]
-                    PartitionCols:_col0, _col2, _col1, (_col6 + 1)
-                    Select Operator [SEL_29] (rows=191657247 width=135)
-                      Output:["_col0","_col1","_col2","_col5","_col6"]
-                      Filter Operator [FIL_164] (rows=191657247 width=135)
-                        predicate:rank_window_0 is not null
-                        PTF Operator [PTF_28] (rows=191657247 width=135)
-                          Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col3 ASC NULLS FIRST, _col4 ASC NULLS FIRST","partition by:":"_col0, _col1, _col2"}]
-                          Select Operator [SEL_27] (rows=191657247 width=135)
-                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                          <-Reducer 12 [SIMPLE_EDGE]
-                            SHUFFLE [RS_26]
-                              PartitionCols:_col0, _col1, _col2
-                              Select Operator [SEL_25] (rows=191657247 width=135)
-                                Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                Group By Operator [GBY_24] (rows=191657247 width=135)
-                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
-                                <-Reducer 11 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_23]
-                                    PartitionCols:_col0, _col1, _col2, _col3, _col4
-                                    Group By Operator [GBY_22] (rows=383314495 width=135)
-                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col8, _col10, _col11
-                                      Merge Join Operator [MERGEJOIN_182] (rows=383314495 width=135)
-                                        Conds:RS_18._col2=RS_19._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col10","_col11"]
-                                      <-Map 22 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_19]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_81] (rows=462000 width=1436)
-                                            Output:["_col0","_col1","_col2"]
-                                            Filter Operator [FIL_179] (rows=462000 width=1436)
-                                              predicate:(i_brand is not null and i_category is not null and i_item_sk is not null)
-                                              TableScan [TS_79] (rows=462000 width=1436)
-                                                default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_brand","i_category"]
-                                      <-Reducer 10 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_18]
-                                          PartitionCols:_col2
-                                          Merge Join Operator [MERGEJOIN_181] (rows=348467716 width=135)
-                                            Conds:RS_15._col1=RS_16._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8"]
-                                          <-Map 21 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_16]
-                                              PartitionCols:_col0
-                                              Select Operator [SEL_78] (rows=60 width=2045)
-                                                Output:["_col0","_col1"]
-                                                Filter Operator [FIL_178] (rows=60 width=2045)
-                                                  predicate:(cc_call_center_sk is not null and cc_name is not null)
-                                                  TableScan [TS_76] (rows=60 width=2045)
-                                                    default@call_center,call_center,Tbl:COMPLETE,Col:NONE,Output:["cc_call_center_sk","cc_name"]
-                                          <-Reducer 9 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_15]
-                                              PartitionCols:_col1
-                                              Merge Join Operator [MERGEJOIN_180] (rows=316788826 width=135)
-                                                Conds:RS_12._col0=RS_13._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
-                                              <-Map 1 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_12]
-                                                  PartitionCols:_col0
-                                                  Select Operator [SEL_72] (rows=287989836 width=135)
-                                                    Output:["_col0","_col1","_col2","_col3"]
-                                                    Filter Operator [FIL_176] (rows=287989836 width=135)
-                                                      predicate:(cs_call_center_sk is not null and cs_item_sk is not null and cs_sold_date_sk is not null)
-                                                      TableScan [TS_70] (rows=287989836 width=135)
-                                                        default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_call_center_sk","cs_item_sk","cs_sales_price"]
-                                              <-Map 20 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_13]
-                                                  PartitionCols:_col0
-                                                  Select Operator [SEL_75] (rows=73048 width=1119)
-                                                    Output:["_col0","_col1","_col2"]
-                                                    Filter Operator [FIL_177] (rows=73048 width=1119)
-                                                      predicate:(((d_year = 2000) or ((d_year = 1999) and (d_moy = 12)) or ((d_year = 2001) and (d_moy = 1))) and d_date_sk is not null)
-                                                      TableScan [TS_73] (rows=73049 width=1119)
-                                                        default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
-                <-Reducer 19 [SIMPLE_EDGE]
+                <-Reducer 11 [SIMPLE_EDGE]
                   SHUFFLE [RS_104]
                     PartitionCols:_col0, _col2, _col1, _col7
                     Select Operator [SEL_67] (rows=15971437 width=135)
@@ -216,7 +137,7 @@ Stage-0
                               Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col4 ASC NULLS FIRST, _col5 ASC NULLS FIRST","partition by:":"_col1, _col2, _col3"}]
                               Select Operator [SEL_64] (rows=191657247 width=135)
                                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                              <-Reducer 18 [SIMPLE_EDGE]
+                              <-Reducer 10 [SIMPLE_EDGE]
                                 SHUFFLE [RS_63]
                                   PartitionCols:_col0, _col1, _col2
                                   Select Operator [SEL_62] (rows=191657247 width=135)
@@ -225,46 +146,66 @@ Stage-0
                                       Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col0 ASC NULLS FIRST, _col1 ASC NULLS FIRST, _col2 ASC NULLS FIRST, _col3 ASC NULLS FIRST","partition by:":"_col0, _col1, _col2, _col3"}]
                                       Select Operator [SEL_60] (rows=191657247 width=135)
                                         Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                      <-Reducer 17 [SIMPLE_EDGE]
+                                      <-Reducer 5 [SIMPLE_EDGE]
                                         SHUFFLE [RS_59]
                                           PartitionCols:_col0, _col1, _col2, _col3
-                                          Select Operator [SEL_58] (rows=191657247 width=135)
+                                          Select Operator [SEL_95] (rows=191657247 width=135)
                                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                            Group By Operator [GBY_57] (rows=191657247 width=135)
+                                            Group By Operator [GBY_94] (rows=191657247 width=135)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
-                                            <-Reducer 16 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_56]
+                                            <-Reducer 4 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_93]
                                                 PartitionCols:_col0, _col1, _col2, _col3, _col4
-                                                Group By Operator [GBY_55] (rows=383314495 width=135)
+                                                Group By Operator [GBY_92] (rows=383314495 width=135)
                                                   Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col8, _col10, _col11
-                                                  Merge Join Operator [MERGEJOIN_185] (rows=383314495 width=135)
-                                                    Conds:RS_51._col2=RS_52._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col10","_col11"]
-                                                  <-Map 22 [SIMPLE_EDGE]
-                                                    SHUFFLE [RS_52]
+                                                  Merge Join Operator [MERGEJOIN_188] (rows=383314495 width=135)
+                                                    Conds:RS_88._col2=RS_89._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col10","_col11"]
+                                                  <-Map 14 [SIMPLE_EDGE]
+                                                    SHUFFLE [RS_89]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_81]
-                                                  <-Reducer 15 [SIMPLE_EDGE]
-                                                    SHUFFLE [RS_51]
+                                                      Select Operator [SEL_81] (rows=462000 width=1436)
+                                                        Output:["_col0","_col1","_col2"]
+                                                        Filter Operator [FIL_179] (rows=462000 width=1436)
+                                                          predicate:(i_brand is not null and i_category is not null and i_item_sk is not null)
+                                                          TableScan [TS_79] (rows=462000 width=1436)
+                                                            default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_brand","i_category"]
+                                                  <-Reducer 3 [SIMPLE_EDGE]
+                                                    SHUFFLE [RS_88]
                                                       PartitionCols:_col2
-                                                      Merge Join Operator [MERGEJOIN_184] (rows=348467716 width=135)
-                                                        Conds:RS_48._col1=RS_49._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8"]
-                                                      <-Map 21 [SIMPLE_EDGE]
-                                                        SHUFFLE [RS_49]
+                                                      Merge Join Operator [MERGEJOIN_187] (rows=348467716 width=135)
+                                                        Conds:RS_85._col1=RS_86._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8"]
+                                                      <-Map 13 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_86]
                                                           PartitionCols:_col0
-                                                           Please refer to the previous Select Operator [SEL_78]
-                                                      <-Reducer 14 [SIMPLE_EDGE]
-                                                        SHUFFLE [RS_48]
+                                                          Select Operator [SEL_78] (rows=60 width=2045)
+                                                            Output:["_col0","_col1"]
+                                                            Filter Operator [FIL_178] (rows=60 width=2045)
+                                                              predicate:(cc_call_center_sk is not null and cc_name is not null)
+                                                              TableScan [TS_76] (rows=60 width=2045)
+                                                                default@call_center,call_center,Tbl:COMPLETE,Col:NONE,Output:["cc_call_center_sk","cc_name"]
+                                                      <-Reducer 2 [SIMPLE_EDGE]
+                                                        SHUFFLE [RS_85]
                                                           PartitionCols:_col1
-                                                          Merge Join Operator [MERGEJOIN_183] (rows=316788826 width=135)
-                                                            Conds:RS_45._col0=RS_46._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
+                                                          Merge Join Operator [MERGEJOIN_186] (rows=316788826 width=135)
+                                                            Conds:RS_82._col0=RS_83._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
                                                           <-Map 1 [SIMPLE_EDGE]
-                                                            SHUFFLE [RS_45]
+                                                            SHUFFLE [RS_82]
                                                               PartitionCols:_col0
-                                                               Please refer to the previous Select Operator [SEL_72]
-                                                          <-Map 20 [SIMPLE_EDGE]
-                                                            SHUFFLE [RS_46]
+                                                              Select Operator [SEL_72] (rows=287989836 width=135)
+                                                                Output:["_col0","_col1","_col2","_col3"]
+                                                                Filter Operator [FIL_176] (rows=287989836 width=135)
+                                                                  predicate:(cs_call_center_sk is not null and cs_item_sk is not null and cs_sold_date_sk is not null)
+                                                                  TableScan [TS_70] (rows=287989836 width=135)
+                                                                    default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_call_center_sk","cs_item_sk","cs_sales_price"]
+                                                          <-Map 12 [SIMPLE_EDGE]
+                                                            SHUFFLE [RS_83]
                                                               PartitionCols:_col0
-                                                               Please refer to the previous Select Operator [SEL_75]
+                                                              Select Operator [SEL_75] (rows=73048 width=1119)
+                                                                Output:["_col0","_col1","_col2"]
+                                                                Filter Operator [FIL_177] (rows=73048 width=1119)
+                                                                  predicate:(((d_year = 2000) or ((d_year = 1999) and (d_moy = 12)) or ((d_year = 2001) and (d_moy = 1))) and d_date_sk is not null)
+                                                                  TableScan [TS_73] (rows=73049 width=1119)
+                                                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
                 <-Reducer 6 [SIMPLE_EDGE]
                   SHUFFLE [RS_105]
                     PartitionCols:_col0, _col2, _col1, (_col6 - 1)
@@ -279,41 +220,20 @@ Stage-0
                           <-Reducer 5 [SIMPLE_EDGE]
                             SHUFFLE [RS_96]
                               PartitionCols:_col0, _col1, _col2
-                              Select Operator [SEL_95] (rows=191657247 width=135)
-                                Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                Group By Operator [GBY_94] (rows=191657247 width=135)
-                                  Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
-                                <-Reducer 4 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_93]
-                                    PartitionCols:_col0, _col1, _col2, _col3, _col4
-                                    Group By Operator [GBY_92] (rows=383314495 width=135)
-                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col3)"],keys:_col5, _col6, _col8, _col10, _col11
-                                      Merge Join Operator [MERGEJOIN_188] (rows=383314495 width=135)
-                                        Conds:RS_88._col2=RS_89._col0(Inner),Output:["_col3","_col5","_col6","_col8","_col10","_col11"]
-                                      <-Map 22 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_89]
-                                          PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_81]
-                                      <-Reducer 3 [SIMPLE_EDGE]
-                                        SHUFFLE [RS_88]
-                                          PartitionCols:_col2
-                                          Merge Join Operator [MERGEJOIN_187] (rows=348467716 width=135)
-                                            Conds:RS_85._col1=RS_86._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col8"]
-                                          <-Map 21 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_86]
-                                              PartitionCols:_col0
-                                               Please refer to the previous Select Operator [SEL_78]
-                                          <-Reducer 2 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_85]
-                                              PartitionCols:_col1
-                                              Merge Join Operator [MERGEJOIN_186] (rows=316788826 width=135)
-                                                Conds:RS_82._col0=RS_83._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6"]
-                                              <-Map 1 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_82]
-                                                  PartitionCols:_col0
-                                                   Please refer to the previous Select Operator [SEL_72]
-                                              <-Map 20 [SIMPLE_EDGE]
-                                                SHUFFLE [RS_83]
-                                                  PartitionCols:_col0
-                                                   Please refer to the previous Select Operator [SEL_75]
+                               Please refer to the previous Select Operator [SEL_95]
+                <-Reducer 9 [SIMPLE_EDGE]
+                  SHUFFLE [RS_103]
+                    PartitionCols:_col0, _col2, _col1, (_col6 + 1)
+                    Select Operator [SEL_29] (rows=191657247 width=135)
+                      Output:["_col0","_col1","_col2","_col5","_col6"]
+                      Filter Operator [FIL_164] (rows=191657247 width=135)
+                        predicate:rank_window_0 is not null
+                        PTF Operator [PTF_28] (rows=191657247 width=135)
+                          Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col3 ASC NULLS FIRST, _col4 ASC NULLS FIRST","partition by:":"_col0, _col1, _col2"}]
+                          Select Operator [SEL_27] (rows=191657247 width=135)
+                            Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                          <-Reducer 5 [SIMPLE_EDGE]
+                            SHUFFLE [RS_26]
+                              PartitionCols:_col0, _col1, _col2
+                               Please refer to the previous Select Operator [SEL_95]