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:45 UTC

[5/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/query23.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query23.q.out b/ql/src/test/results/clientpositive/perf/tez/query23.q.out
index 7112de6..c7a5041 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query23.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query23.q.out
@@ -1,5 +1,5 @@
-Warning: Shuffle Join MERGEJOIN[367][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 25' is a cross product
-Warning: Shuffle Join MERGEJOIN[369][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 30' is a cross product
+Warning: Shuffle Join MERGEJOIN[367][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 22' is a cross product
+Warning: Shuffle Join MERGEJOIN[369][tables = [$hdt$_1, $hdt$_2, $hdt$_0]] in Stage 'Reducer 23' is a cross product
 PREHOOK: query: explain
 with frequent_ss_items as 
  (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt
@@ -105,41 +105,28 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 10 <- Reducer 30 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE), Union 5 (CONTAINS)
-Reducer 12 <- Map 11 (SIMPLE_EDGE), Map 18 (SIMPLE_EDGE)
-Reducer 13 <- Map 19 (SIMPLE_EDGE), Reducer 12 (SIMPLE_EDGE)
+Reducer 10 <- Reducer 23 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE), Union 5 (CONTAINS)
+Reducer 12 <- Map 11 (SIMPLE_EDGE), Map 15 (SIMPLE_EDGE)
+Reducer 13 <- Map 16 (SIMPLE_EDGE), Reducer 12 (SIMPLE_EDGE)
 Reducer 14 <- Reducer 13 (SIMPLE_EDGE)
-Reducer 15 <- Map 11 (SIMPLE_EDGE), Map 18 (SIMPLE_EDGE)
-Reducer 16 <- Map 19 (SIMPLE_EDGE), Reducer 15 (SIMPLE_EDGE)
-Reducer 17 <- Reducer 16 (SIMPLE_EDGE)
+Reducer 18 <- Map 17 (SIMPLE_EDGE), Map 24 (SIMPLE_EDGE)
+Reducer 19 <- Map 33 (SIMPLE_EDGE), Reducer 18 (SIMPLE_EDGE)
 Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
-Reducer 21 <- Map 20 (SIMPLE_EDGE), Map 31 (SIMPLE_EDGE)
-Reducer 22 <- Map 46 (SIMPLE_EDGE), Reducer 21 (SIMPLE_EDGE)
-Reducer 23 <- Reducer 22 (SIMPLE_EDGE)
-Reducer 24 <- Reducer 23 (CUSTOM_SIMPLE_EDGE)
-Reducer 25 <- Reducer 24 (CUSTOM_SIMPLE_EDGE), Reducer 35 (CUSTOM_SIMPLE_EDGE), Reducer 43 (CUSTOM_SIMPLE_EDGE)
-Reducer 26 <- Map 20 (SIMPLE_EDGE), Map 31 (SIMPLE_EDGE)
-Reducer 27 <- Map 46 (SIMPLE_EDGE), Reducer 26 (SIMPLE_EDGE)
-Reducer 28 <- Reducer 27 (SIMPLE_EDGE)
-Reducer 29 <- Reducer 28 (CUSTOM_SIMPLE_EDGE)
+Reducer 20 <- Reducer 19 (SIMPLE_EDGE)
+Reducer 21 <- Reducer 20 (CUSTOM_SIMPLE_EDGE)
+Reducer 22 <- Reducer 21 (CUSTOM_SIMPLE_EDGE), Reducer 28 (CUSTOM_SIMPLE_EDGE), Reducer 32 (CUSTOM_SIMPLE_EDGE)
+Reducer 23 <- Reducer 21 (CUSTOM_SIMPLE_EDGE), Reducer 28 (CUSTOM_SIMPLE_EDGE), Reducer 32 (CUSTOM_SIMPLE_EDGE)
+Reducer 25 <- Map 24 (SIMPLE_EDGE), Map 29 (SIMPLE_EDGE)
+Reducer 26 <- Map 33 (SIMPLE_EDGE), Reducer 25 (SIMPLE_EDGE)
+Reducer 27 <- Reducer 26 (SIMPLE_EDGE)
+Reducer 28 <- Reducer 27 (CUSTOM_SIMPLE_EDGE)
 Reducer 3 <- Reducer 14 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-Reducer 30 <- Reducer 29 (CUSTOM_SIMPLE_EDGE), Reducer 39 (CUSTOM_SIMPLE_EDGE), Reducer 45 (CUSTOM_SIMPLE_EDGE)
-Reducer 32 <- Map 31 (SIMPLE_EDGE), Map 40 (SIMPLE_EDGE)
-Reducer 33 <- Map 46 (SIMPLE_EDGE), Reducer 32 (SIMPLE_EDGE)
-Reducer 34 <- Reducer 33 (SIMPLE_EDGE)
-Reducer 35 <- Reducer 34 (CUSTOM_SIMPLE_EDGE)
-Reducer 36 <- Map 31 (SIMPLE_EDGE), Map 40 (SIMPLE_EDGE)
-Reducer 37 <- Map 46 (SIMPLE_EDGE), Reducer 36 (SIMPLE_EDGE)
-Reducer 38 <- Reducer 37 (SIMPLE_EDGE)
-Reducer 39 <- Reducer 38 (CUSTOM_SIMPLE_EDGE)
-Reducer 4 <- Reducer 25 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE), Union 5 (CONTAINS)
-Reducer 42 <- Map 41 (SIMPLE_EDGE), Map 46 (SIMPLE_EDGE)
-Reducer 43 <- Reducer 42 (SIMPLE_EDGE)
-Reducer 44 <- Map 41 (SIMPLE_EDGE), Map 46 (SIMPLE_EDGE)
-Reducer 45 <- Reducer 44 (SIMPLE_EDGE)
+Reducer 31 <- Map 30 (SIMPLE_EDGE), Map 33 (SIMPLE_EDGE)
+Reducer 32 <- Reducer 31 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 22 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE), Union 5 (CONTAINS)
 Reducer 6 <- Union 5 (CUSTOM_SIMPLE_EDGE)
-Reducer 8 <- Map 47 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
-Reducer 9 <- Reducer 17 (SIMPLE_EDGE), Reducer 8 (SIMPLE_EDGE)
+Reducer 8 <- Map 34 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
+Reducer 9 <- Reducer 14 (SIMPLE_EDGE), Reducer 8 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
@@ -160,7 +147,7 @@ Stage-0
                     Output:["_col0"]
                     Merge Join Operator [MERGEJOIN_370] (rows=191667562 width=135)
                       Conds:RS_234._col2=RS_235._col0(Inner),Output:["_col3","_col4"]
-                    <-Reducer 30 [SIMPLE_EDGE]
+                    <-Reducer 23 [SIMPLE_EDGE]
                       SHUFFLE [RS_235]
                         PartitionCols:_col0
                         Select Operator [SEL_227] (rows=105599202 width=321)
@@ -169,31 +156,31 @@ Stage-0
                             predicate:(_col3 > (0.95 * _col1))
                             Merge Join Operator [MERGEJOIN_369] (rows=316797606 width=321)
                               Conds:(Inner),(Inner),Output:["_col1","_col2","_col3"]
-                            <-Reducer 29 [CUSTOM_SIMPLE_EDGE]
+                            <-Reducer 21 [CUSTOM_SIMPLE_EDGE]
                               PARTITION_ONLY_SHUFFLE [RS_222]
-                                Select Operator [SEL_180] (rows=1 width=8)
-                                  Filter Operator [FIL_179] (rows=1 width=8)
+                                Select Operator [SEL_61] (rows=1 width=8)
+                                  Filter Operator [FIL_60] (rows=1 width=8)
                                     predicate:(sq_count_check(_col0) <= 1)
-                                    Group By Operator [GBY_177] (rows=1 width=8)
+                                    Group By Operator [GBY_58] (rows=1 width=8)
                                       Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                                    <-Reducer 28 [CUSTOM_SIMPLE_EDGE]
-                                      PARTITION_ONLY_SHUFFLE [RS_176]
-                                        Group By Operator [GBY_175] (rows=1 width=8)
+                                    <-Reducer 20 [CUSTOM_SIMPLE_EDGE]
+                                      PARTITION_ONLY_SHUFFLE [RS_57]
+                                        Group By Operator [GBY_56] (rows=1 width=8)
                                           Output:["_col0"],aggregations:["count()"]
-                                          Select Operator [SEL_172] (rows=348477374 width=88)
-                                            Group By Operator [GBY_171] (rows=348477374 width=88)
+                                          Select Operator [SEL_53] (rows=348477374 width=88)
+                                            Group By Operator [GBY_52] (rows=348477374 width=88)
                                               Output:["_col0"],keys:KEY._col0
-                                            <-Reducer 27 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_170]
+                                            <-Reducer 19 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_51]
                                                 PartitionCols:_col0
-                                                Group By Operator [GBY_169] (rows=696954748 width=88)
+                                                Group By Operator [GBY_50] (rows=696954748 width=88)
                                                   Output:["_col0"],keys:_col0
-                                                  Select Operator [SEL_167] (rows=696954748 width=88)
+                                                  Select Operator [SEL_48] (rows=696954748 width=88)
                                                     Output:["_col0"]
-                                                    Merge Join Operator [MERGEJOIN_361] (rows=696954748 width=88)
-                                                      Conds:RS_164._col1=RS_165._col0(Inner),Output:["_col6"]
-                                                    <-Map 46 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_165]
+                                                    Merge Join Operator [MERGEJOIN_353] (rows=696954748 width=88)
+                                                      Conds:RS_45._col1=RS_46._col0(Inner),Output:["_col6"]
+                                                    <-Map 33 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_46]
                                                         PartitionCols:_col0
                                                         Select Operator [SEL_93] (rows=80000000 width=860)
                                                           Output:["_col0"]
@@ -201,13 +188,13 @@ Stage-0
                                                             predicate:c_customer_sk is not null
                                                             TableScan [TS_91] (rows=80000000 width=860)
                                                               default@customer,customer,Tbl:COMPLETE,Col:NONE,Output:["c_customer_sk"]
-                                                    <-Reducer 26 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_164]
+                                                    <-Reducer 18 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_45]
                                                         PartitionCols:_col1
-                                                        Merge Join Operator [MERGEJOIN_360] (rows=633595212 width=88)
-                                                          Conds:RS_161._col0=RS_162._col0(Inner),Output:["_col1"]
-                                                        <-Map 31 [SIMPLE_EDGE]
-                                                          SHUFFLE [RS_162]
+                                                        Merge Join Operator [MERGEJOIN_352] (rows=633595212 width=88)
+                                                          Conds:RS_42._col0=RS_43._col0(Inner),Output:["_col1"]
+                                                        <-Map 24 [SIMPLE_EDGE]
+                                                          SHUFFLE [RS_43]
                                                             PartitionCols:_col0
                                                             Select Operator [SEL_38] (rows=36525 width=1119)
                                                               Output:["_col0"]
@@ -215,8 +202,8 @@ Stage-0
                                                                 predicate:((d_year) IN (1999, 2000, 2001, 2002) and d_date_sk is not null)
                                                                 TableScan [TS_36] (rows=73049 width=1119)
                                                                   default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year"]
-                                                        <-Map 20 [SIMPLE_EDGE]
-                                                          SHUFFLE [RS_161]
+                                                        <-Map 17 [SIMPLE_EDGE]
+                                                          SHUFFLE [RS_42]
                                                             PartitionCols:_col0
                                                             Select Operator [SEL_35] (rows=575995635 width=88)
                                                               Output:["_col0","_col1"]
@@ -224,42 +211,42 @@ Stage-0
                                                                 predicate:(ss_customer_sk is not null and ss_sold_date_sk is not null)
                                                                 TableScan [TS_33] (rows=575995635 width=88)
                                                                   default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_customer_sk"]
-                            <-Reducer 39 [CUSTOM_SIMPLE_EDGE]
+                            <-Reducer 28 [CUSTOM_SIMPLE_EDGE]
                               PARTITION_ONLY_SHUFFLE [RS_223]
-                                Group By Operator [GBY_205] (rows=1 width=224)
+                                Group By Operator [GBY_86] (rows=1 width=224)
                                   Output:["_col0"],aggregations:["max(VALUE._col0)"]
-                                <-Reducer 38 [CUSTOM_SIMPLE_EDGE]
-                                  PARTITION_ONLY_SHUFFLE [RS_204]
-                                    Group By Operator [GBY_203] (rows=1 width=224)
+                                <-Reducer 27 [CUSTOM_SIMPLE_EDGE]
+                                  PARTITION_ONLY_SHUFFLE [RS_85]
+                                    Group By Operator [GBY_84] (rows=1 width=224)
                                       Output:["_col0"],aggregations:["max(_col1)"]
-                                      Select Operator [SEL_201] (rows=348477374 width=88)
+                                      Select Operator [SEL_82] (rows=348477374 width=88)
                                         Output:["_col1"]
-                                        Group By Operator [GBY_200] (rows=348477374 width=88)
+                                        Group By Operator [GBY_81] (rows=348477374 width=88)
                                           Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                                        <-Reducer 37 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_199]
+                                        <-Reducer 26 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_80]
                                             PartitionCols:_col0
-                                            Group By Operator [GBY_198] (rows=696954748 width=88)
+                                            Group By Operator [GBY_79] (rows=696954748 width=88)
                                               Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                                              Select Operator [SEL_196] (rows=696954748 width=88)
+                                              Select Operator [SEL_77] (rows=696954748 width=88)
                                                 Output:["_col0","_col1"]
-                                                Merge Join Operator [MERGEJOIN_363] (rows=696954748 width=88)
-                                                  Conds:RS_193._col1=RS_194._col0(Inner),Output:["_col2","_col3","_col6"]
-                                                <-Map 46 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_194]
+                                                Merge Join Operator [MERGEJOIN_355] (rows=696954748 width=88)
+                                                  Conds:RS_74._col1=RS_75._col0(Inner),Output:["_col2","_col3","_col6"]
+                                                <-Map 33 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_75]
                                                     PartitionCols:_col0
                                                      Please refer to the previous Select Operator [SEL_93]
-                                                <-Reducer 36 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_193]
+                                                <-Reducer 25 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_74]
                                                     PartitionCols:_col1
-                                                    Merge Join Operator [MERGEJOIN_362] (rows=633595212 width=88)
-                                                      Conds:RS_190._col0=RS_191._col0(Inner),Output:["_col1","_col2","_col3"]
-                                                    <-Map 31 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_191]
+                                                    Merge Join Operator [MERGEJOIN_354] (rows=633595212 width=88)
+                                                      Conds:RS_71._col0=RS_72._col0(Inner),Output:["_col1","_col2","_col3"]
+                                                    <-Map 24 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_72]
                                                         PartitionCols:_col0
                                                          Please refer to the previous Select Operator [SEL_38]
-                                                    <-Map 40 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_190]
+                                                    <-Map 29 [SIMPLE_EDGE]
+                                                      SHUFFLE [RS_71]
                                                         PartitionCols:_col0
                                                         Select Operator [SEL_64] (rows=575995635 width=88)
                                                           Output:["_col0","_col1","_col2","_col3"]
@@ -267,25 +254,25 @@ Stage-0
                                                             predicate:(ss_customer_sk is not null and ss_sold_date_sk is not null)
                                                             TableScan [TS_62] (rows=575995635 width=88)
                                                               default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_customer_sk","ss_quantity","ss_sales_price"]
-                            <-Reducer 45 [CUSTOM_SIMPLE_EDGE]
+                            <-Reducer 32 [CUSTOM_SIMPLE_EDGE]
                               PARTITION_ONLY_SHUFFLE [RS_224]
-                                Group By Operator [GBY_220] (rows=316797606 width=88)
+                                Group By Operator [GBY_101] (rows=316797606 width=88)
                                   Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                                <-Reducer 44 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_219]
+                                <-Reducer 31 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_100]
                                     PartitionCols:_col0
-                                    Group By Operator [GBY_218] (rows=633595212 width=88)
+                                    Group By Operator [GBY_99] (rows=633595212 width=88)
                                       Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                                      Select Operator [SEL_216] (rows=633595212 width=88)
+                                      Select Operator [SEL_97] (rows=633595212 width=88)
                                         Output:["_col0","_col1"]
-                                        Merge Join Operator [MERGEJOIN_364] (rows=633595212 width=88)
-                                          Conds:RS_213._col0=RS_214._col0(Inner),Output:["_col1","_col2","_col3"]
-                                        <-Map 46 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_214]
+                                        Merge Join Operator [MERGEJOIN_356] (rows=633595212 width=88)
+                                          Conds:RS_94._col0=RS_95._col0(Inner),Output:["_col1","_col2","_col3"]
+                                        <-Map 33 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_95]
                                             PartitionCols:_col0
                                              Please refer to the previous Select Operator [SEL_93]
-                                        <-Map 41 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_213]
+                                        <-Map 30 [SIMPLE_EDGE]
+                                          SHUFFLE [RS_94]
                                             PartitionCols:_col0
                                             Select Operator [SEL_90] (rows=575995635 width=88)
                                               Output:["_col0","_col1","_col2"]
@@ -298,30 +285,30 @@ Stage-0
                         PartitionCols:_col2
                         Merge Join Operator [MERGEJOIN_366] (rows=174243235 width=135)
                           Conds:RS_231._col1=RS_232._col0(Inner),Output:["_col2","_col3","_col4"]
-                        <-Reducer 17 [SIMPLE_EDGE]
+                        <-Reducer 14 [SIMPLE_EDGE]
                           SHUFFLE [RS_232]
                             PartitionCols:_col0
-                            Group By Operator [GBY_150] (rows=58079562 width=88)
+                            Group By Operator [GBY_31] (rows=58079562 width=88)
                               Output:["_col0"],keys:_col1
-                              Select Operator [SEL_146] (rows=116159124 width=88)
+                              Select Operator [SEL_27] (rows=116159124 width=88)
                                 Output:["_col1"]
-                                Filter Operator [FIL_145] (rows=116159124 width=88)
+                                Filter Operator [FIL_26] (rows=116159124 width=88)
                                   predicate:(_col3 > 4)
-                                  Select Operator [SEL_348] (rows=348477374 width=88)
+                                  Select Operator [SEL_347] (rows=348477374 width=88)
                                     Output:["_col0","_col3"]
-                                    Group By Operator [GBY_144] (rows=348477374 width=88)
+                                    Group By Operator [GBY_25] (rows=348477374 width=88)
                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                    <-Reducer 16 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_143]
+                                    <-Reducer 13 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_24]
                                         PartitionCols:_col0
-                                        Group By Operator [GBY_142] (rows=696954748 width=88)
+                                        Group By Operator [GBY_23] (rows=696954748 width=88)
                                           Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col1, _col0, _col2
-                                          Select Operator [SEL_140] (rows=696954748 width=88)
+                                          Select Operator [SEL_21] (rows=696954748 width=88)
                                             Output:["_col0","_col1","_col2"]
-                                            Merge Join Operator [MERGEJOIN_359] (rows=696954748 width=88)
-                                              Conds:RS_137._col1=RS_138._col0(Inner),Output:["_col3","_col5","_col6"]
-                                            <-Map 19 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_138]
+                                            Merge Join Operator [MERGEJOIN_351] (rows=696954748 width=88)
+                                              Conds:RS_18._col1=RS_19._col0(Inner),Output:["_col3","_col5","_col6"]
+                                            <-Map 16 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_19]
                                                 PartitionCols:_col0
                                                 Select Operator [SEL_14] (rows=462000 width=1436)
                                                   Output:["_col0","_col1"]
@@ -329,13 +316,13 @@ Stage-0
                                                     predicate:i_item_sk is not null
                                                     TableScan [TS_12] (rows=462000 width=1436)
                                                       default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_item_desc"]
-                                            <-Reducer 15 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_137]
+                                            <-Reducer 12 [SIMPLE_EDGE]
+                                              SHUFFLE [RS_18]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_358] (rows=633595212 width=88)
-                                                  Conds:RS_134._col0=RS_135._col0(Inner),Output:["_col1","_col3"]
+                                                Merge Join Operator [MERGEJOIN_350] (rows=633595212 width=88)
+                                                  Conds:RS_15._col0=RS_16._col0(Inner),Output:["_col1","_col3"]
                                                 <-Map 11 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_134]
+                                                  SHUFFLE [RS_15]
                                                     PartitionCols:_col0
                                                     Select Operator [SEL_8] (rows=575995635 width=88)
                                                       Output:["_col0","_col1"]
@@ -343,8 +330,8 @@ Stage-0
                                                         predicate:(ss_item_sk is not null and ss_sold_date_sk is not null)
                                                         TableScan [TS_6] (rows=575995635 width=88)
                                                           default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk"]
-                                                <-Map 18 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_135]
+                                                <-Map 15 [SIMPLE_EDGE]
+                                                  SHUFFLE [RS_16]
                                                     PartitionCols:_col0
                                                     Select Operator [SEL_11] (rows=36525 width=1119)
                                                       Output:["_col0","_col1"]
@@ -366,7 +353,7 @@ Stage-0
                                     predicate:((d_moy = 1) and (d_year = 1999) and d_date_sk is not null)
                                     TableScan [TS_3] (rows=73049 width=1119)
                                       default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
-                            <-Map 47 [SIMPLE_EDGE]
+                            <-Map 34 [SIMPLE_EDGE]
                               SHUFFLE [RS_228]
                                 PartitionCols:_col0
                                 Select Operator [SEL_121] (rows=144002668 width=135)
@@ -383,7 +370,7 @@ Stage-0
                     Output:["_col0"]
                     Merge Join Operator [MERGEJOIN_368] (rows=383314495 width=135)
                       Conds:RS_115._col1=RS_116._col0(Inner),Output:["_col3","_col4"]
-                    <-Reducer 25 [SIMPLE_EDGE]
+                    <-Reducer 22 [SIMPLE_EDGE]
                       SHUFFLE [RS_116]
                         PartitionCols:_col0
                         Select Operator [SEL_108] (rows=105599202 width=321)
@@ -392,105 +379,15 @@ Stage-0
                             predicate:(_col3 > (0.95 * _col1))
                             Merge Join Operator [MERGEJOIN_367] (rows=316797606 width=321)
                               Conds:(Inner),(Inner),Output:["_col1","_col2","_col3"]
-                            <-Reducer 24 [CUSTOM_SIMPLE_EDGE]
+                            <-Reducer 21 [CUSTOM_SIMPLE_EDGE]
                               PARTITION_ONLY_SHUFFLE [RS_103]
-                                Select Operator [SEL_61] (rows=1 width=8)
-                                  Filter Operator [FIL_60] (rows=1 width=8)
-                                    predicate:(sq_count_check(_col0) <= 1)
-                                    Group By Operator [GBY_58] (rows=1 width=8)
-                                      Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                                    <-Reducer 23 [CUSTOM_SIMPLE_EDGE]
-                                      PARTITION_ONLY_SHUFFLE [RS_57]
-                                        Group By Operator [GBY_56] (rows=1 width=8)
-                                          Output:["_col0"],aggregations:["count()"]
-                                          Select Operator [SEL_53] (rows=348477374 width=88)
-                                            Group By Operator [GBY_52] (rows=348477374 width=88)
-                                              Output:["_col0"],keys:KEY._col0
-                                            <-Reducer 22 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_51]
-                                                PartitionCols:_col0
-                                                Group By Operator [GBY_50] (rows=696954748 width=88)
-                                                  Output:["_col0"],keys:_col0
-                                                  Select Operator [SEL_48] (rows=696954748 width=88)
-                                                    Output:["_col0"]
-                                                    Merge Join Operator [MERGEJOIN_353] (rows=696954748 width=88)
-                                                      Conds:RS_45._col1=RS_46._col0(Inner),Output:["_col6"]
-                                                    <-Map 46 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_46]
-                                                        PartitionCols:_col0
-                                                         Please refer to the previous Select Operator [SEL_93]
-                                                    <-Reducer 21 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_45]
-                                                        PartitionCols:_col1
-                                                        Merge Join Operator [MERGEJOIN_352] (rows=633595212 width=88)
-                                                          Conds:RS_42._col0=RS_43._col0(Inner),Output:["_col1"]
-                                                        <-Map 31 [SIMPLE_EDGE]
-                                                          SHUFFLE [RS_43]
-                                                            PartitionCols:_col0
-                                                             Please refer to the previous Select Operator [SEL_38]
-                                                        <-Map 20 [SIMPLE_EDGE]
-                                                          SHUFFLE [RS_42]
-                                                            PartitionCols:_col0
-                                                             Please refer to the previous Select Operator [SEL_35]
-                            <-Reducer 35 [CUSTOM_SIMPLE_EDGE]
+                                 Please refer to the previous Select Operator [SEL_61]
+                            <-Reducer 28 [CUSTOM_SIMPLE_EDGE]
                               PARTITION_ONLY_SHUFFLE [RS_104]
-                                Group By Operator [GBY_86] (rows=1 width=224)
-                                  Output:["_col0"],aggregations:["max(VALUE._col0)"]
-                                <-Reducer 34 [CUSTOM_SIMPLE_EDGE]
-                                  PARTITION_ONLY_SHUFFLE [RS_85]
-                                    Group By Operator [GBY_84] (rows=1 width=224)
-                                      Output:["_col0"],aggregations:["max(_col1)"]
-                                      Select Operator [SEL_82] (rows=348477374 width=88)
-                                        Output:["_col1"]
-                                        Group By Operator [GBY_81] (rows=348477374 width=88)
-                                          Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                                        <-Reducer 33 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_80]
-                                            PartitionCols:_col0
-                                            Group By Operator [GBY_79] (rows=696954748 width=88)
-                                              Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                                              Select Operator [SEL_77] (rows=696954748 width=88)
-                                                Output:["_col0","_col1"]
-                                                Merge Join Operator [MERGEJOIN_355] (rows=696954748 width=88)
-                                                  Conds:RS_74._col1=RS_75._col0(Inner),Output:["_col2","_col3","_col6"]
-                                                <-Map 46 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_75]
-                                                    PartitionCols:_col0
-                                                     Please refer to the previous Select Operator [SEL_93]
-                                                <-Reducer 32 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_74]
-                                                    PartitionCols:_col1
-                                                    Merge Join Operator [MERGEJOIN_354] (rows=633595212 width=88)
-                                                      Conds:RS_71._col0=RS_72._col0(Inner),Output:["_col1","_col2","_col3"]
-                                                    <-Map 31 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_72]
-                                                        PartitionCols:_col0
-                                                         Please refer to the previous Select Operator [SEL_38]
-                                                    <-Map 40 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_71]
-                                                        PartitionCols:_col0
-                                                         Please refer to the previous Select Operator [SEL_64]
-                            <-Reducer 43 [CUSTOM_SIMPLE_EDGE]
+                                 Please refer to the previous Group By Operator [GBY_86]
+                            <-Reducer 32 [CUSTOM_SIMPLE_EDGE]
                               PARTITION_ONLY_SHUFFLE [RS_105]
-                                Group By Operator [GBY_101] (rows=316797606 width=88)
-                                  Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                                <-Reducer 42 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_100]
-                                    PartitionCols:_col0
-                                    Group By Operator [GBY_99] (rows=633595212 width=88)
-                                      Output:["_col0","_col1"],aggregations:["sum(_col1)"],keys:_col0
-                                      Select Operator [SEL_97] (rows=633595212 width=88)
-                                        Output:["_col0","_col1"]
-                                        Merge Join Operator [MERGEJOIN_356] (rows=633595212 width=88)
-                                          Conds:RS_94._col0=RS_95._col0(Inner),Output:["_col1","_col2","_col3"]
-                                        <-Map 46 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_95]
-                                            PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_93]
-                                        <-Map 41 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_94]
-                                            PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_90]
+                                 Please refer to the previous Group By Operator [GBY_101]
                     <-Reducer 3 [SIMPLE_EDGE]
                       SHUFFLE [RS_115]
                         PartitionCols:_col1
@@ -499,42 +396,7 @@ Stage-0
                         <-Reducer 14 [SIMPLE_EDGE]
                           SHUFFLE [RS_113]
                             PartitionCols:_col0
-                            Group By Operator [GBY_31] (rows=58079562 width=88)
-                              Output:["_col0"],keys:_col1
-                              Select Operator [SEL_27] (rows=116159124 width=88)
-                                Output:["_col1"]
-                                Filter Operator [FIL_26] (rows=116159124 width=88)
-                                  predicate:(_col3 > 4)
-                                  Select Operator [SEL_347] (rows=348477374 width=88)
-                                    Output:["_col0","_col3"]
-                                    Group By Operator [GBY_25] (rows=348477374 width=88)
-                                      Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
-                                    <-Reducer 13 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_24]
-                                        PartitionCols:_col0
-                                        Group By Operator [GBY_23] (rows=696954748 width=88)
-                                          Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col1, _col0, _col2
-                                          Select Operator [SEL_21] (rows=696954748 width=88)
-                                            Output:["_col0","_col1","_col2"]
-                                            Merge Join Operator [MERGEJOIN_351] (rows=696954748 width=88)
-                                              Conds:RS_18._col1=RS_19._col0(Inner),Output:["_col3","_col5","_col6"]
-                                            <-Map 19 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_19]
-                                                PartitionCols:_col0
-                                                 Please refer to the previous Select Operator [SEL_14]
-                                            <-Reducer 12 [SIMPLE_EDGE]
-                                              SHUFFLE [RS_18]
-                                                PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_350] (rows=633595212 width=88)
-                                                  Conds:RS_15._col0=RS_16._col0(Inner),Output:["_col1","_col3"]
-                                                <-Map 11 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_15]
-                                                    PartitionCols:_col0
-                                                     Please refer to the previous Select Operator [SEL_8]
-                                                <-Map 18 [SIMPLE_EDGE]
-                                                  SHUFFLE [RS_16]
-                                                    PartitionCols:_col0
-                                                     Please refer to the previous Select Operator [SEL_11]
+                             Please refer to the previous Group By Operator [GBY_31]
                         <-Reducer 2 [SIMPLE_EDGE]
                           SHUFFLE [RS_112]
                             PartitionCols:_col2

http://git-wip-us.apache.org/repos/asf/hive/blob/96a409e1/ql/src/test/results/clientpositive/perf/tez/query32.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query32.q.out b/ql/src/test/results/clientpositive/perf/tez/query32.q.out
index bba1bd8..3ad9595 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query32.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query32.q.out
@@ -55,12 +55,11 @@ POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
-Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 7 (ONE_TO_ONE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 6 (ONE_TO_ONE_EDGE)
 Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
-Reducer 5 <- Map 1 (SIMPLE_EDGE), Map 8 (SIMPLE_EDGE)
-Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
-Reducer 7 <- Map 9 (SIMPLE_EDGE), Reducer 6 (ONE_TO_ONE_EDGE)
+Reducer 5 <- Reducer 2 (SIMPLE_EDGE)
+Reducer 6 <- Map 8 (SIMPLE_EDGE), Reducer 5 (ONE_TO_ONE_EDGE)
 
 Stage-0
   Fetch Operator
@@ -96,7 +95,7 @@ Stage-0
                                 predicate:(cs_item_sk is not null and cs_sold_date_sk is not null)
                                 TableScan [TS_0] (rows=287989836 width=135)
                                   default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:NONE,Output:["cs_sold_date_sk","cs_item_sk","cs_ext_discount_amt"]
-                        <-Map 8 [SIMPLE_EDGE]
+                        <-Map 7 [SIMPLE_EDGE]
                           SHUFFLE [RS_28]
                             PartitionCols:_col0
                             Select Operator [SEL_5] (rows=8116 width=1119)
@@ -105,12 +104,12 @@ Stage-0
                                 predicate:(CAST( d_date AS TIMESTAMP) BETWEEN 1998-03-18 00:00:00.0 AND 1998-06-16 01:00:00.0 and d_date_sk is not null)
                                 TableScan [TS_3] (rows=73049 width=1119)
                                   default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_date"]
-                    <-Reducer 7 [ONE_TO_ONE_EDGE]
+                    <-Reducer 6 [ONE_TO_ONE_EDGE]
                       FORWARD [RS_31]
                         PartitionCols:_col2
                         Merge Join Operator [MERGEJOIN_60] (rows=174233858 width=135)
                           Conds:RS_23._col1=RS_24._col0(Inner),Output:["_col0","_col2"]
-                        <-Map 9 [SIMPLE_EDGE]
+                        <-Map 8 [SIMPLE_EDGE]
                           SHUFFLE [RS_24]
                             PartitionCols:_col0
                             Select Operator [SEL_22] (rows=231000 width=1436)
@@ -119,26 +118,17 @@ Stage-0
                                 predicate:((i_manufact_id = 269) and i_item_sk is not null)
                                 TableScan [TS_20] (rows=462000 width=1436)
                                   default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_manufact_id"]
-                        <-Reducer 6 [ONE_TO_ONE_EDGE]
+                        <-Reducer 5 [ONE_TO_ONE_EDGE]
                           FORWARD [RS_23]
                             PartitionCols:_col1
                             Select Operator [SEL_19] (rows=158394413 width=135)
                               Output:["_col0","_col1"]
                               Group By Operator [GBY_18] (rows=158394413 width=135)
                                 Output:["_col0","_col1"],aggregations:["avg(VALUE._col0)"],keys:KEY._col0
-                              <-Reducer 5 [SIMPLE_EDGE]
+                              <-Reducer 2 [SIMPLE_EDGE]
                                 SHUFFLE [RS_17]
                                   PartitionCols:_col0
                                   Group By Operator [GBY_16] (rows=316788826 width=135)
                                     Output:["_col0","_col1"],aggregations:["avg(_col2)"],keys:_col1
-                                    Merge Join Operator [MERGEJOIN_59] (rows=316788826 width=135)
-                                      Conds:RS_12._col0=RS_13._col0(Inner),Output:["_col1","_col2"]
-                                    <-Map 1 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_12]
-                                        PartitionCols:_col0
-                                         Please refer to the previous Select Operator [SEL_2]
-                                    <-Map 8 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_13]
-                                        PartitionCols:_col0
-                                         Please refer to the previous Select Operator [SEL_5]
+                                     Please refer to the previous Merge Join Operator [MERGEJOIN_58]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/96a409e1/ql/src/test/results/clientpositive/perf/tez/query33.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query33.q.out b/ql/src/test/results/clientpositive/perf/tez/query33.q.out
index 0810c28..a966865 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query33.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query33.q.out
@@ -149,26 +149,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
@@ -185,66 +181,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 = -6) 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 = 3) and (d_year = 1999) 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"]
@@ -252,13 +209,13 @@ Stage-0
                                         predicate:(i_item_sk is not null and i_manufact_id is not null)
                                         TableScan [TS_0] (rows=462000 width=1436)
                                           default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_manufact_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_manufact_id
@@ -268,59 +225,37 @@ Stage-0
                                               predicate:((i_category) IN ('Books') and i_manufact_id is not null)
                                               TableScan [TS_3] (rows=462000 width=1436)
                                                 default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_category","i_manufact_id"]
-                <-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 = -6) 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 = 3) and (d_year = 1999) 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)
@@ -346,42 +281,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)
@@ -390,4 +311,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/query44.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/tez/query44.q.out b/ql/src/test/results/clientpositive/perf/tez/query44.q.out
index 07187b1..b982de0 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query44.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query44.q.out
@@ -1,5 +1,4 @@
 Warning: Shuffle Join MERGEJOIN[131][tables = [$hdt$_2, $hdt$_3, $hdt$_1]] in Stage 'Reducer 9' is a cross product
-Warning: Shuffle Join MERGEJOIN[133][tables = [$hdt$_4, $hdt$_5, $hdt$_3]] in Stage 'Reducer 13' is a cross product
 PREHOOK: query: explain
 select  asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing
 from(select *
@@ -72,21 +71,16 @@ Plan optimized by CBO.
 
 Vertex dependency in root stage
 Reducer 10 <- Reducer 9 (SIMPLE_EDGE)
-Reducer 11 <- Map 6 (SIMPLE_EDGE)
-Reducer 12 <- Reducer 11 (CUSTOM_SIMPLE_EDGE)
-Reducer 13 <- Reducer 12 (CUSTOM_SIMPLE_EDGE), Reducer 17 (CUSTOM_SIMPLE_EDGE), Reducer 20 (CUSTOM_SIMPLE_EDGE)
-Reducer 14 <- Reducer 13 (SIMPLE_EDGE)
-Reducer 16 <- Map 15 (SIMPLE_EDGE)
-Reducer 17 <- Map 15 (SIMPLE_EDGE)
-Reducer 19 <- Map 18 (SIMPLE_EDGE)
+Reducer 11 <- Reducer 9 (SIMPLE_EDGE)
+Reducer 13 <- Map 12 (SIMPLE_EDGE)
+Reducer 15 <- Map 14 (SIMPLE_EDGE)
 Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
-Reducer 20 <- Map 18 (SIMPLE_EDGE)
 Reducer 3 <- Reducer 2 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
 Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
-Reducer 5 <- Map 1 (SIMPLE_EDGE), Reducer 14 (SIMPLE_EDGE)
+Reducer 5 <- Map 1 (SIMPLE_EDGE), Reducer 11 (SIMPLE_EDGE)
 Reducer 7 <- Map 6 (SIMPLE_EDGE)
 Reducer 8 <- Reducer 7 (CUSTOM_SIMPLE_EDGE)
-Reducer 9 <- Reducer 16 (CUSTOM_SIMPLE_EDGE), Reducer 19 (CUSTOM_SIMPLE_EDGE), Reducer 8 (CUSTOM_SIMPLE_EDGE)
+Reducer 9 <- Reducer 13 (CUSTOM_SIMPLE_EDGE), Reducer 15 (CUSTOM_SIMPLE_EDGE), Reducer 8 (CUSTOM_SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
@@ -136,13 +130,13 @@ Stage-0
                                     predicate:(_col3 > (0.9 * _col1))
                                     Merge Join Operator [MERGEJOIN_131] (rows=10367842752596232 width=185)
                                       Conds:(Inner),(Inner),Output:["_col1","_col2","_col3"]
-                                    <-Reducer 16 [CUSTOM_SIMPLE_EDGE]
+                                    <-Reducer 13 [CUSTOM_SIMPLE_EDGE]
                                       PARTITION_ONLY_SHUFFLE [RS_34]
                                         Select Operator [SEL_25] (rows=71999454 width=88)
                                           Output:["_col0"]
                                           Group By Operator [GBY_24] (rows=71999454 width=88)
                                             Output:["_col0","_col1"],aggregations:["avg(VALUE._col0)"],keys:KEY._col0
-                                          <-Map 15 [SIMPLE_EDGE]
+                                          <-Map 12 [SIMPLE_EDGE]
                                             SHUFFLE [RS_23]
                                               PartitionCols:_col0
                                               Group By Operator [GBY_22] (rows=143998908 width=88)
@@ -153,11 +147,11 @@ Stage-0
                                                     predicate:((ss_store_sk = 410) and ss_hdemo_sk is null)
                                                     TableScan [TS_18] (rows=575995635 width=88)
                                                       default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_hdemo_sk","ss_store_sk","ss_net_profit"]
-                                    <-Reducer 19 [CUSTOM_SIMPLE_EDGE]
+                                    <-Reducer 15 [CUSTOM_SIMPLE_EDGE]
                                       PARTITION_ONLY_SHUFFLE [RS_35]
                                         Group By Operator [GBY_31] (rows=143998908 width=88)
                                           Output:["_col0","_col1"],aggregations:["avg(VALUE._col0)"],keys:KEY._col0
-                                        <-Map 18 [SIMPLE_EDGE]
+                                        <-Map 14 [SIMPLE_EDGE]
                                           SHUFFLE [RS_30]
                                             PartitionCols:_col0
                                             Group By Operator [GBY_29] (rows=287997817 width=88)
@@ -201,7 +195,7 @@ Stage-0
                       SHUFFLE [RS_90]
                         PartitionCols:_col0
                          Please refer to the previous Select Operator [SEL_2]
-                    <-Reducer 14 [SIMPLE_EDGE]
+                    <-Reducer 11 [SIMPLE_EDGE]
                       SHUFFLE [RS_91]
                         PartitionCols:_col0
                         Select Operator [SEL_86] (rows=1151982528066248 width=185)
@@ -212,47 +206,8 @@ Stage-0
                               Function definitions:[{},{"name:":"windowingtablefunction","order by:":"_col3 DESC NULLS LAST","partition by:":"0"}]
                               Select Operator [SEL_84] (rows=3455947584198744 width=185)
                                 Output:["_col2","_col3"]
-                              <-Reducer 13 [SIMPLE_EDGE]
+                              <-Reducer 9 [SIMPLE_EDGE]
                                 SHUFFLE [RS_83]
                                   PartitionCols:0
-                                  Filter Operator [FIL_82] (rows=3455947584198744 width=185)
-                                    predicate:(_col3 > (0.9 * _col1))
-                                    Merge Join Operator [MERGEJOIN_133] (rows=10367842752596232 width=185)
-                                      Conds:(Inner),(Inner),Output:["_col1","_col2","_col3"]
-                                    <-Reducer 12 [CUSTOM_SIMPLE_EDGE]
-                                      PARTITION_ONLY_SHUFFLE [RS_78]
-                                        Select Operator [SEL_62] (rows=1 width=8)
-                                          Filter Operator [FIL_61] (rows=1 width=8)
-                                            predicate:(sq_count_check(_col0) <= 1)
-                                            Group By Operator [GBY_59] (rows=1 width=8)
-                                              Output:["_col0"],aggregations:["count(VALUE._col0)"]
-                                            <-Reducer 11 [CUSTOM_SIMPLE_EDGE]
-                                              PARTITION_ONLY_SHUFFLE [RS_58]
-                                                Group By Operator [GBY_57] (rows=1 width=8)
-                                                  Output:["_col0"],aggregations:["count()"]
-                                                  Select Operator [SEL_55] (rows=71999454 width=88)
-                                                    Group By Operator [GBY_54] (rows=71999454 width=88)
-                                                      Output:["_col0"],keys:KEY._col0
-                                                    <-Map 6 [SIMPLE_EDGE]
-                                                      SHUFFLE [RS_53]
-                                                        PartitionCols:_col0
-                                                         Please refer to the previous Group By Operator [GBY_7]
-                                    <-Reducer 17 [CUSTOM_SIMPLE_EDGE]
-                                      PARTITION_ONLY_SHUFFLE [RS_79]
-                                        Select Operator [SEL_70] (rows=71999454 width=88)
-                                          Output:["_col0"]
-                                          Group By Operator [GBY_69] (rows=71999454 width=88)
-                                            Output:["_col0","_col1"],aggregations:["avg(VALUE._col0)"],keys:KEY._col0
-                                          <-Map 15 [SIMPLE_EDGE]
-                                            SHUFFLE [RS_68]
-                                              PartitionCols:_col0
-                                               Please refer to the previous Group By Operator [GBY_22]
-                                    <-Reducer 20 [CUSTOM_SIMPLE_EDGE]
-                                      PARTITION_ONLY_SHUFFLE [RS_80]
-                                        Group By Operator [GBY_76] (rows=143998908 width=88)
-                                          Output:["_col0","_col1"],aggregations:["avg(VALUE._col0)"],keys:KEY._col0
-                                        <-Map 18 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_75]
-                                            PartitionCols:_col0
-                                             Please refer to the previous Group By Operator [GBY_29]
+                                   Please refer to the previous Filter Operator [FIL_37]