You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by we...@apache.org on 2017/05/31 00:11:46 UTC

[08/17] hive git commit: HIVE-16764: Support numeric as same as decimal (Pengcheng Xiong, reviewed by Ashutosh Chauhan)

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query58.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query58.q.out b/ql/src/test/results/clientpositive/perf/query58.q.out
index e73605a..acdfc07 100644
--- a/ql/src/test/results/clientpositive/perf/query58.q.out
+++ b/ql/src/test/results/clientpositive/perf/query58.q.out
@@ -1,4 +1,50 @@
-PREHOOK: query: explain select  ss_items.item_id
+Warning: Shuffle Join MERGEJOIN[265][tables = [$hdt$_4, $hdt$_5]] in Stage 'Reducer 20' is a cross product
+Warning: Shuffle Join MERGEJOIN[269][tables = [$hdt$_5, $hdt$_6]] in Stage 'Reducer 24' is a cross product
+Warning: Shuffle Join MERGEJOIN[273][tables = [$hdt$_6, $hdt$_7]] in Stage 'Reducer 28' is a cross product
+PREHOOK: query: explain
+with ss_items as
+ (select i_item_id item_id
+        ,sum(ss_ext_sales_price) ss_item_rev 
+ from store_sales
+     ,item
+     ,date_dim
+ where ss_item_sk = i_item_sk
+   and d_date in (select d_date
+                  from date_dim
+                  where d_week_seq = (select d_week_seq 
+                                      from date_dim
+                                      where d_date = '1998-02-19'))
+   and ss_sold_date_sk   = d_date_sk
+ group by i_item_id),
+ cs_items as
+ (select i_item_id item_id
+        ,sum(cs_ext_sales_price) cs_item_rev
+  from catalog_sales
+      ,item
+      ,date_dim
+ where cs_item_sk = i_item_sk
+  and  d_date in (select d_date
+                  from date_dim
+                  where d_week_seq = (select d_week_seq 
+                                      from date_dim
+                                      where d_date = '1998-02-19'))
+  and  cs_sold_date_sk = d_date_sk
+ group by i_item_id),
+ ws_items as
+ (select i_item_id item_id
+        ,sum(ws_ext_sales_price) ws_item_rev
+  from web_sales
+      ,item
+      ,date_dim
+ where ws_item_sk = i_item_sk
+  and  d_date in (select d_date
+                  from date_dim
+                  where d_week_seq =(select d_week_seq 
+                                     from date_dim
+                                     where d_date = '1998-02-19'))
+  and ws_sold_date_sk   = d_date_sk
+ group by i_item_id)
+  select  ss_items.item_id
        ,ss_item_rev
        ,ss_item_rev/(ss_item_rev+cs_item_rev+ws_item_rev)/3 * 100 ss_dev
        ,cs_item_rev
@@ -6,46 +52,63 @@ PREHOOK: query: explain select  ss_items.item_id
        ,ws_item_rev
        ,ws_item_rev/(ss_item_rev+cs_item_rev+ws_item_rev)/3 * 100 ws_dev
        ,(ss_item_rev+cs_item_rev+ws_item_rev)/3 average
-FROM
-( select i_item_id item_id ,sum(ss_ext_sales_price) as ss_item_rev 
- from store_sales
-     JOIN item ON store_sales.ss_item_sk = item.i_item_sk
-     JOIN date_dim ON store_sales.ss_sold_date_sk = date_dim.d_date_sk
-     JOIN (select d1.d_date
-                 from date_dim d1 JOIN date_dim d2 ON d1.d_week_seq = d2.d_week_seq
-                 where d2.d_date = '1998-08-04') sub ON date_dim.d_date = sub.d_date
- group by i_item_id ) ss_items
-JOIN
-( select i_item_id item_id ,sum(cs_ext_sales_price) as cs_item_rev 
- from catalog_sales
-     JOIN item ON catalog_sales.cs_item_sk = item.i_item_sk
-     JOIN date_dim ON catalog_sales.cs_sold_date_sk = date_dim.d_date_sk
-     JOIN (select d1.d_date
-                 from date_dim d1 JOIN date_dim d2 ON d1.d_week_seq = d2.d_week_seq
-                 where d2.d_date = '1998-08-04') sub ON date_dim.d_date = sub.d_date
- group by i_item_id ) cs_items
-ON ss_items.item_id=cs_items.item_id
-JOIN
-( select i_item_id item_id ,sum(ws_ext_sales_price) as ws_item_rev 
- from web_sales
-     JOIN item ON web_sales.ws_item_sk = item.i_item_sk
-     JOIN date_dim ON web_sales.ws_sold_date_sk = date_dim.d_date_sk
-     JOIN (select d1.d_date
-                 from date_dim d1 JOIN date_dim d2 ON d1.d_week_seq = d2.d_week_seq
-                 where d2.d_date = '1998-08-04') sub ON date_dim.d_date = sub.d_date
- group by i_item_id ) ws_items
-ON ss_items.item_id=ws_items.item_id 
- where
-       ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev
+ from ss_items,cs_items,ws_items
+ where ss_items.item_id=cs_items.item_id
+   and ss_items.item_id=ws_items.item_id 
+   and ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev
    and ss_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev
    and cs_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev
    and cs_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev
    and ws_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev
    and ws_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev
- order by item_id ,ss_item_rev
+ order by item_id
+         ,ss_item_rev
  limit 100
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select  ss_items.item_id
+POSTHOOK: query: explain
+with ss_items as
+ (select i_item_id item_id
+        ,sum(ss_ext_sales_price) ss_item_rev 
+ from store_sales
+     ,item
+     ,date_dim
+ where ss_item_sk = i_item_sk
+   and d_date in (select d_date
+                  from date_dim
+                  where d_week_seq = (select d_week_seq 
+                                      from date_dim
+                                      where d_date = '1998-02-19'))
+   and ss_sold_date_sk   = d_date_sk
+ group by i_item_id),
+ cs_items as
+ (select i_item_id item_id
+        ,sum(cs_ext_sales_price) cs_item_rev
+  from catalog_sales
+      ,item
+      ,date_dim
+ where cs_item_sk = i_item_sk
+  and  d_date in (select d_date
+                  from date_dim
+                  where d_week_seq = (select d_week_seq 
+                                      from date_dim
+                                      where d_date = '1998-02-19'))
+  and  cs_sold_date_sk = d_date_sk
+ group by i_item_id),
+ ws_items as
+ (select i_item_id item_id
+        ,sum(ws_ext_sales_price) ws_item_rev
+  from web_sales
+      ,item
+      ,date_dim
+ where ws_item_sk = i_item_sk
+  and  d_date in (select d_date
+                  from date_dim
+                  where d_week_seq =(select d_week_seq 
+                                     from date_dim
+                                     where d_date = '1998-02-19'))
+  and ws_sold_date_sk   = d_date_sk
+ group by i_item_id)
+  select  ss_items.item_id
        ,ss_item_rev
        ,ss_item_rev/(ss_item_rev+cs_item_rev+ws_item_rev)/3 * 100 ss_dev
        ,cs_item_rev
@@ -53,290 +116,351 @@ POSTHOOK: query: explain select  ss_items.item_id
        ,ws_item_rev
        ,ws_item_rev/(ss_item_rev+cs_item_rev+ws_item_rev)/3 * 100 ws_dev
        ,(ss_item_rev+cs_item_rev+ws_item_rev)/3 average
-FROM
-( select i_item_id item_id ,sum(ss_ext_sales_price) as ss_item_rev 
- from store_sales
-     JOIN item ON store_sales.ss_item_sk = item.i_item_sk
-     JOIN date_dim ON store_sales.ss_sold_date_sk = date_dim.d_date_sk
-     JOIN (select d1.d_date
-                 from date_dim d1 JOIN date_dim d2 ON d1.d_week_seq = d2.d_week_seq
-                 where d2.d_date = '1998-08-04') sub ON date_dim.d_date = sub.d_date
- group by i_item_id ) ss_items
-JOIN
-( select i_item_id item_id ,sum(cs_ext_sales_price) as cs_item_rev 
- from catalog_sales
-     JOIN item ON catalog_sales.cs_item_sk = item.i_item_sk
-     JOIN date_dim ON catalog_sales.cs_sold_date_sk = date_dim.d_date_sk
-     JOIN (select d1.d_date
-                 from date_dim d1 JOIN date_dim d2 ON d1.d_week_seq = d2.d_week_seq
-                 where d2.d_date = '1998-08-04') sub ON date_dim.d_date = sub.d_date
- group by i_item_id ) cs_items
-ON ss_items.item_id=cs_items.item_id
-JOIN
-( select i_item_id item_id ,sum(ws_ext_sales_price) as ws_item_rev 
- from web_sales
-     JOIN item ON web_sales.ws_item_sk = item.i_item_sk
-     JOIN date_dim ON web_sales.ws_sold_date_sk = date_dim.d_date_sk
-     JOIN (select d1.d_date
-                 from date_dim d1 JOIN date_dim d2 ON d1.d_week_seq = d2.d_week_seq
-                 where d2.d_date = '1998-08-04') sub ON date_dim.d_date = sub.d_date
- group by i_item_id ) ws_items
-ON ss_items.item_id=ws_items.item_id 
- where
-       ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev
+ from ss_items,cs_items,ws_items
+ where ss_items.item_id=cs_items.item_id
+   and ss_items.item_id=ws_items.item_id 
+   and ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev
    and ss_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev
    and cs_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev
    and cs_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev
    and ws_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev
    and ws_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev
- order by item_id ,ss_item_rev
+ order by item_id
+         ,ss_item_rev
  limit 100
 POSTHOOK: type: QUERY
 Plan optimized by CBO.
 
 Vertex dependency in root stage
-Reducer 10 <- Map 22 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
-Reducer 11 <- Reducer 10 (SIMPLE_EDGE)
-Reducer 12 <- Map 1 (SIMPLE_EDGE), Reducer 19 (SIMPLE_EDGE)
-Reducer 13 <- Map 24 (SIMPLE_EDGE), Reducer 12 (SIMPLE_EDGE)
-Reducer 14 <- Map 22 (SIMPLE_EDGE), Reducer 13 (SIMPLE_EDGE)
-Reducer 15 <- Reducer 14 (SIMPLE_EDGE)
-Reducer 17 <- Map 16 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
-Reducer 18 <- Map 16 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
-Reducer 19 <- Map 16 (SIMPLE_EDGE), Map 20 (SIMPLE_EDGE)
-Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 17 (SIMPLE_EDGE)
-Reducer 3 <- Map 21 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
-Reducer 4 <- Map 22 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
-Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
-Reducer 6 <- Reducer 11 (SIMPLE_EDGE), Reducer 15 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
-Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
-Reducer 8 <- Map 1 (SIMPLE_EDGE), Reducer 18 (SIMPLE_EDGE)
-Reducer 9 <- Map 23 (SIMPLE_EDGE), Reducer 8 (SIMPLE_EDGE)
+Reducer 10 <- Reducer 9 (SIMPLE_EDGE)
+Reducer 11 <- Map 33 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
+Reducer 12 <- Reducer 11 (SIMPLE_EDGE), Reducer 17 (SIMPLE_EDGE)
+Reducer 13 <- Reducer 12 (SIMPLE_EDGE)
+Reducer 15 <- Map 14 (SIMPLE_EDGE), Reducer 22 (SIMPLE_EDGE)
+Reducer 16 <- Map 14 (SIMPLE_EDGE), Reducer 26 (SIMPLE_EDGE)
+Reducer 17 <- Map 14 (SIMPLE_EDGE), Reducer 30 (SIMPLE_EDGE)
+Reducer 19 <- Map 18 (CUSTOM_SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
+Reducer 20 <- Map 31 (CUSTOM_SIMPLE_EDGE), Reducer 19 (CUSTOM_SIMPLE_EDGE)
+Reducer 21 <- Map 31 (SIMPLE_EDGE), Reducer 20 (SIMPLE_EDGE)
+Reducer 22 <- Reducer 21 (SIMPLE_EDGE)
+Reducer 23 <- Map 18 (CUSTOM_SIMPLE_EDGE)
+Reducer 24 <- Map 31 (CUSTOM_SIMPLE_EDGE), Reducer 23 (CUSTOM_SIMPLE_EDGE)
+Reducer 25 <- Map 31 (SIMPLE_EDGE), Reducer 24 (SIMPLE_EDGE)
+Reducer 26 <- Reducer 25 (SIMPLE_EDGE)
+Reducer 27 <- Map 18 (CUSTOM_SIMPLE_EDGE)
+Reducer 28 <- Map 31 (CUSTOM_SIMPLE_EDGE), Reducer 27 (CUSTOM_SIMPLE_EDGE)
+Reducer 29 <- Map 31 (SIMPLE_EDGE), Reducer 28 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 15 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 30 <- Reducer 29 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Reducer 10 (SIMPLE_EDGE), Reducer 13 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 8 <- Map 32 (SIMPLE_EDGE), Map 7 (SIMPLE_EDGE)
+Reducer 9 <- Reducer 16 (SIMPLE_EDGE), Reducer 8 (SIMPLE_EDGE)
 
 Stage-0
   Fetch Operator
     limit:100
     Stage-1
-      Reducer 7
-      File Output Operator [FS_113]
-        Limit [LIM_112] (rows=100 width=88)
+      Reducer 6
+      File Output Operator [FS_164]
+        Limit [LIM_163] (rows=100 width=88)
           Number of rows:100
-          Select Operator [SEL_111] (rows=1442 width=88)
+          Select Operator [SEL_162] (rows=1442 width=88)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-          <-Reducer 6 [SIMPLE_EDGE]
-            SHUFFLE [RS_110]
-              Select Operator [SEL_109] (rows=1442 width=88)
+          <-Reducer 5 [SIMPLE_EDGE]
+            SHUFFLE [RS_161]
+              Select Operator [SEL_160] (rows=1442 width=88)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                Filter Operator [FIL_103] (rows=1442 width=88)
+                Filter Operator [FIL_154] (rows=1442 width=88)
                   predicate:(_col5 BETWEEN (0.9 * _col1) AND (1.1 * _col1) and _col5 BETWEEN (0.9 * _col3) AND (1.1 * _col3) and _col1 BETWEEN (0.9 * _col5) AND (1.1 * _col5) and _col3 BETWEEN (0.9 * _col5) AND (1.1 * _col5) and _col1 BETWEEN (0.9 * _col3) AND (1.1 * _col3) and _col3 BETWEEN (0.9 * _col1) AND (1.1 * _col1))
-                  Merge Join Operator [MERGEJOIN_213] (rows=766650239 width=88)
-                    Conds:RS_99._col0=RS_100._col0(Inner),RS_99._col0=RS_101._col0(Inner),Output:["_col0","_col1","_col3","_col5"]
-                  <-Reducer 11 [SIMPLE_EDGE]
-                    SHUFFLE [RS_100]
+                  Merge Join Operator [MERGEJOIN_279] (rows=766650239 width=88)
+                    Conds:RS_150._col0=RS_151._col0(Inner),RS_150._col0=RS_152._col0(Inner),Output:["_col0","_col1","_col3","_col5"]
+                  <-Reducer 10 [SIMPLE_EDGE]
+                    SHUFFLE [RS_151]
                       PartitionCols:_col0
-                      Group By Operator [GBY_64] (rows=348477374 width=88)
+                      Group By Operator [GBY_98] (rows=348477374 width=88)
                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                      <-Reducer 10 [SIMPLE_EDGE]
-                        SHUFFLE [RS_63]
+                      <-Reducer 9 [SIMPLE_EDGE]
+                        SHUFFLE [RS_97]
                           PartitionCols:_col0
-                          Group By Operator [GBY_62] (rows=696954748 width=88)
-                            Output:["_col0","_col1"],aggregations:["sum(_col5)"],keys:_col7
-                            Merge Join Operator [MERGEJOIN_208] (rows=696954748 width=88)
-                              Conds:RS_58._col4=RS_59._col0(Inner),Output:["_col5","_col7"]
-                            <-Map 22 [SIMPLE_EDGE]
-                              SHUFFLE [RS_59]
+                          Group By Operator [GBY_96] (rows=696954748 width=88)
+                            Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                            Merge Join Operator [MERGEJOIN_277] (rows=696954748 width=88)
+                              Conds:RS_92._col0=RS_93._col0(Inner),Output:["_col2","_col4"]
+                            <-Reducer 16 [SIMPLE_EDGE]
+                              SHUFFLE [RS_93]
+                                PartitionCols:_col0
+                                Merge Join Operator [MERGEJOIN_271] (rows=80353 width=1119)
+                                  Conds:RS_85._col1=RS_86._col0(Inner),Output:["_col0"]
+                                <-Map 14 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_85]
+                                    PartitionCols:_col1
+                                    Select Operator [SEL_58] (rows=73049 width=1119)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_254] (rows=73049 width=1119)
+                                        predicate:(d_date is not null and d_date_sk is not null)
+                                        TableScan [TS_6] (rows=73049 width=1119)
+                                          default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_date"]
+                                <-Reducer 26 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_86]
+                                    PartitionCols:_col0
+                                    Group By Operator [GBY_83] (rows=40176 width=1119)
+                                      Output:["_col0"],keys:KEY._col0
+                                    <-Reducer 25 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_82]
+                                        PartitionCols:_col0
+                                        Group By Operator [GBY_81] (rows=80353 width=1119)
+                                          Output:["_col0"],keys:_col2
+                                          Merge Join Operator [MERGEJOIN_270] (rows=80353 width=1119)
+                                            Conds:RS_77._col1=RS_78._col1(Inner),Output:["_col2"]
+                                          <-Map 31 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_78]
+                                              PartitionCols:_col1
+                                              Select Operator [SEL_73] (rows=73049 width=1119)
+                                                Output:["_col0","_col1"]
+                                                Filter Operator [FIL_257] (rows=73049 width=1119)
+                                                  predicate:(d_week_seq is not null and d_date is not null)
+                                                  TableScan [TS_18] (rows=73049 width=1119)
+                                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date","d_week_seq"]
+                                          <-Reducer 24 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_77]
+                                              PartitionCols:_col1
+                                              Merge Join Operator [MERGEJOIN_269] (rows=36524 width=1128)
+                                                Conds:(Inner),Output:["_col1"]
+                                              <-Map 31 [CUSTOM_SIMPLE_EDGE]
+                                                SHUFFLE [RS_75]
+                                                  Select Operator [SEL_70] (rows=36524 width=1119)
+                                                    Output:["_col0"]
+                                                    Filter Operator [FIL_256] (rows=36524 width=1119)
+                                                      predicate:((d_date = '1998-02-19') and d_week_seq is not null)
+                                                       Please refer to the previous TableScan [TS_18]
+                                              <-Reducer 23 [CUSTOM_SIMPLE_EDGE]
+                                                PARTITION_ONLY_SHUFFLE [RS_74]
+                                                  Select Operator [SEL_67] (rows=1 width=8)
+                                                    Filter Operator [FIL_66] (rows=1 width=8)
+                                                      predicate:(sq_count_check(_col0) <= 1)
+                                                      Group By Operator [GBY_64] (rows=1 width=8)
+                                                        Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                                      <-Map 18 [CUSTOM_SIMPLE_EDGE]
+                                                        PARTITION_ONLY_SHUFFLE [RS_63]
+                                                          Group By Operator [GBY_62] (rows=1 width=8)
+                                                            Output:["_col0"],aggregations:["count()"]
+                                                            Select Operator [SEL_61] (rows=36524 width=1119)
+                                                              Filter Operator [FIL_255] (rows=36524 width=1119)
+                                                                predicate:(d_date = '1998-02-19')
+                                                                TableScan [TS_9] (rows=73049 width=1119)
+                                                                  default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date"]
+                            <-Reducer 8 [SIMPLE_EDGE]
+                              SHUFFLE [RS_92]
                                 PartitionCols:_col0
-                                Select Operator [SEL_51] (rows=462000 width=1436)
-                                  Output:["_col0","_col1"]
-                                  Filter Operator [FIL_195] (rows=462000 width=1436)
-                                    predicate:(i_item_sk is not null and i_item_id is not null)
-                                    TableScan [TS_16] (rows=462000 width=1436)
-                                      default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_item_id"]
-                            <-Reducer 9 [SIMPLE_EDGE]
-                              SHUFFLE [RS_58]
-                                PartitionCols:_col4
-                                Merge Join Operator [MERGEJOIN_207] (rows=633595212 width=88)
-                                  Conds:RS_55._col0=RS_56._col0(Inner),Output:["_col4","_col5"]
-                                <-Map 23 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_56]
+                                Merge Join Operator [MERGEJOIN_268] (rows=633595212 width=88)
+                                  Conds:RS_89._col1=RS_90._col0(Inner),Output:["_col0","_col2","_col4"]
+                                <-Map 7 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_90]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_48] (rows=575995635 width=88)
+                                    Select Operator [SEL_55] (rows=462000 width=1436)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_253] (rows=462000 width=1436)
+                                        predicate:(i_item_sk is not null and i_item_id is not null)
+                                        TableScan [TS_3] (rows=462000 width=1436)
+                                          default@item,item,Tbl:COMPLETE,Col:NONE,Output:["i_item_sk","i_item_id"]
+                                <-Map 32 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_89]
+                                    PartitionCols:_col1
+                                    Select Operator [SEL_52] (rows=575995635 width=88)
                                       Output:["_col0","_col1","_col2"]
-                                      Filter Operator [FIL_194] (rows=575995635 width=88)
+                                      Filter Operator [FIL_252] (rows=575995635 width=88)
                                         predicate:(ss_item_sk is not null and ss_sold_date_sk is not null)
-                                        TableScan [TS_46] (rows=575995635 width=88)
+                                        TableScan [TS_50] (rows=575995635 width=88)
                                           default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_ext_sales_price"]
-                                <-Reducer 8 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_55]
-                                    PartitionCols:_col0
-                                    Merge Join Operator [MERGEJOIN_206] (rows=88388 width=1119)
-                                      Conds:RS_52._col1=RS_53._col0(Inner),Output:["_col0"]
-                                    <-Map 1 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_52]
-                                        PartitionCols:_col1
-                                        Select Operator [SEL_35] (rows=73049 width=1119)
-                                          Output:["_col0","_col1"]
-                                          Filter Operator [FIL_191] (rows=73049 width=1119)
-                                            predicate:(d_date_sk is not null and d_date is not null)
-                                            TableScan [TS_0] (rows=73049 width=1119)
-                                              default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_date"]
-                                    <-Reducer 18 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_53]
-                                        PartitionCols:_col0
-                                        Merge Join Operator [MERGEJOIN_205] (rows=80353 width=1119)
-                                          Conds:RS_42._col1=RS_43._col1(Inner),Output:["_col0"]
-                                        <-Map 16 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_42]
-                                            PartitionCols:_col1
-                                            Select Operator [SEL_38] (rows=73049 width=1119)
-                                              Output:["_col0","_col1"]
-                                              Filter Operator [FIL_192] (rows=73049 width=1119)
-                                                predicate:(d_week_seq is not null and d_date is not null)
-                                                TableScan [TS_3] (rows=73049 width=1119)
-                                                  default@date_dim,d1,Tbl:COMPLETE,Col:NONE,Output:["d_date","d_week_seq"]
-                                        <-Map 20 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_43]
-                                            PartitionCols:_col1
-                                            Select Operator [SEL_41] (rows=36524 width=1119)
-                                              Output:["_col1"]
-                                              Filter Operator [FIL_193] (rows=36524 width=1119)
-                                                predicate:((d_date = '1998-08-04') and d_week_seq is not null)
-                                                TableScan [TS_6] (rows=73049 width=1119)
-                                                  default@date_dim,d2,Tbl:COMPLETE,Col:NONE,Output:["d_date","d_week_seq"]
-                  <-Reducer 15 [SIMPLE_EDGE]
-                    SHUFFLE [RS_101]
+                  <-Reducer 13 [SIMPLE_EDGE]
+                    SHUFFLE [RS_152]
                       PartitionCols:_col0
-                      Group By Operator [GBY_97] (rows=87121617 width=135)
+                      Group By Operator [GBY_148] (rows=87121617 width=135)
                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                      <-Reducer 14 [SIMPLE_EDGE]
-                        SHUFFLE [RS_96]
+                      <-Reducer 12 [SIMPLE_EDGE]
+                        SHUFFLE [RS_147]
                           PartitionCols:_col0
-                          Group By Operator [GBY_95] (rows=174243235 width=135)
-                            Output:["_col0","_col1"],aggregations:["sum(_col5)"],keys:_col7
-                            Merge Join Operator [MERGEJOIN_212] (rows=174243235 width=135)
-                              Conds:RS_91._col4=RS_92._col0(Inner),Output:["_col5","_col7"]
-                            <-Map 22 [SIMPLE_EDGE]
-                              SHUFFLE [RS_92]
+                          Group By Operator [GBY_146] (rows=174243235 width=135)
+                            Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                            Merge Join Operator [MERGEJOIN_278] (rows=174243235 width=135)
+                              Conds:RS_142._col0=RS_143._col0(Inner),Output:["_col2","_col4"]
+                            <-Reducer 11 [SIMPLE_EDGE]
+                              SHUFFLE [RS_142]
                                 PartitionCols:_col0
-                                Select Operator [SEL_84] (rows=462000 width=1436)
-                                  Output:["_col0","_col1"]
-                                  Filter Operator [FIL_200] (rows=462000 width=1436)
-                                    predicate:(i_item_sk is not null and i_item_id is not null)
-                                     Please refer to the previous TableScan [TS_16]
-                            <-Reducer 13 [SIMPLE_EDGE]
-                              SHUFFLE [RS_91]
-                                PartitionCols:_col4
-                                Merge Join Operator [MERGEJOIN_211] (rows=158402938 width=135)
-                                  Conds:RS_88._col0=RS_89._col0(Inner),Output:["_col4","_col5"]
-                                <-Map 24 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_89]
+                                Merge Join Operator [MERGEJOIN_272] (rows=158402938 width=135)
+                                  Conds:RS_139._col1=RS_140._col0(Inner),Output:["_col0","_col2","_col4"]
+                                <-Map 7 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_140]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_81] (rows=144002668 width=135)
+                                    Select Operator [SEL_105] (rows=462000 width=1436)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_259] (rows=462000 width=1436)
+                                        predicate:(i_item_sk is not null and i_item_id is not null)
+                                         Please refer to the previous TableScan [TS_3]
+                                <-Map 33 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_139]
+                                    PartitionCols:_col1
+                                    Select Operator [SEL_102] (rows=144002668 width=135)
                                       Output:["_col0","_col1","_col2"]
-                                      Filter Operator [FIL_199] (rows=144002668 width=135)
+                                      Filter Operator [FIL_258] (rows=144002668 width=135)
                                         predicate:(ws_item_sk is not null and ws_sold_date_sk is not null)
-                                        TableScan [TS_79] (rows=144002668 width=135)
+                                        TableScan [TS_100] (rows=144002668 width=135)
                                           default@web_sales,web_sales,Tbl:COMPLETE,Col:NONE,Output:["ws_sold_date_sk","ws_item_sk","ws_ext_sales_price"]
-                                <-Reducer 12 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_88]
+                            <-Reducer 17 [SIMPLE_EDGE]
+                              SHUFFLE [RS_143]
+                                PartitionCols:_col0
+                                Merge Join Operator [MERGEJOIN_275] (rows=80353 width=1119)
+                                  Conds:RS_135._col1=RS_136._col0(Inner),Output:["_col0"]
+                                <-Map 14 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_135]
+                                    PartitionCols:_col1
+                                    Select Operator [SEL_108] (rows=73049 width=1119)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_260] (rows=73049 width=1119)
+                                        predicate:(d_date is not null and d_date_sk is not null)
+                                         Please refer to the previous TableScan [TS_6]
+                                <-Reducer 30 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_136]
                                     PartitionCols:_col0
-                                    Merge Join Operator [MERGEJOIN_210] (rows=88388 width=1119)
-                                      Conds:RS_85._col1=RS_86._col0(Inner),Output:["_col0"]
-                                    <-Map 1 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_85]
-                                        PartitionCols:_col1
-                                        Select Operator [SEL_68] (rows=73049 width=1119)
-                                          Output:["_col0","_col1"]
-                                          Filter Operator [FIL_196] (rows=73049 width=1119)
-                                            predicate:(d_date_sk is not null and d_date is not null)
-                                             Please refer to the previous TableScan [TS_0]
-                                    <-Reducer 19 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_86]
+                                    Group By Operator [GBY_133] (rows=40176 width=1119)
+                                      Output:["_col0"],keys:KEY._col0
+                                    <-Reducer 29 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_132]
                                         PartitionCols:_col0
-                                        Merge Join Operator [MERGEJOIN_209] (rows=80353 width=1119)
-                                          Conds:RS_75._col1=RS_76._col1(Inner),Output:["_col0"]
-                                        <-Map 16 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_75]
-                                            PartitionCols:_col1
-                                            Select Operator [SEL_71] (rows=73049 width=1119)
-                                              Output:["_col0","_col1"]
-                                              Filter Operator [FIL_197] (rows=73049 width=1119)
-                                                predicate:(d_week_seq is not null and d_date is not null)
-                                                 Please refer to the previous TableScan [TS_3]
-                                        <-Map 20 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_76]
-                                            PartitionCols:_col1
-                                            Select Operator [SEL_74] (rows=36524 width=1119)
-                                              Output:["_col1"]
-                                              Filter Operator [FIL_198] (rows=36524 width=1119)
-                                                predicate:((d_date = '1998-08-04') and d_week_seq is not null)
-                                                 Please refer to the previous TableScan [TS_6]
-                  <-Reducer 5 [SIMPLE_EDGE]
-                    SHUFFLE [RS_99]
+                                        Group By Operator [GBY_131] (rows=80353 width=1119)
+                                          Output:["_col0"],keys:_col2
+                                          Merge Join Operator [MERGEJOIN_274] (rows=80353 width=1119)
+                                            Conds:RS_127._col1=RS_128._col1(Inner),Output:["_col2"]
+                                          <-Map 31 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_128]
+                                              PartitionCols:_col1
+                                              Select Operator [SEL_123] (rows=73049 width=1119)
+                                                Output:["_col0","_col1"]
+                                                Filter Operator [FIL_263] (rows=73049 width=1119)
+                                                  predicate:(d_week_seq is not null and d_date is not null)
+                                                   Please refer to the previous TableScan [TS_18]
+                                          <-Reducer 28 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_127]
+                                              PartitionCols:_col1
+                                              Merge Join Operator [MERGEJOIN_273] (rows=36524 width=1128)
+                                                Conds:(Inner),Output:["_col1"]
+                                              <-Map 31 [CUSTOM_SIMPLE_EDGE]
+                                                SHUFFLE [RS_125]
+                                                  Select Operator [SEL_120] (rows=36524 width=1119)
+                                                    Output:["_col0"]
+                                                    Filter Operator [FIL_262] (rows=36524 width=1119)
+                                                      predicate:((d_date = '1998-02-19') and d_week_seq is not null)
+                                                       Please refer to the previous TableScan [TS_18]
+                                              <-Reducer 27 [CUSTOM_SIMPLE_EDGE]
+                                                PARTITION_ONLY_SHUFFLE [RS_124]
+                                                  Select Operator [SEL_117] (rows=1 width=8)
+                                                    Filter Operator [FIL_116] (rows=1 width=8)
+                                                      predicate:(sq_count_check(_col0) <= 1)
+                                                      Group By Operator [GBY_114] (rows=1 width=8)
+                                                        Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                                      <-Map 18 [CUSTOM_SIMPLE_EDGE]
+                                                        PARTITION_ONLY_SHUFFLE [RS_113]
+                                                          Group By Operator [GBY_112] (rows=1 width=8)
+                                                            Output:["_col0"],aggregations:["count()"]
+                                                            Select Operator [SEL_111] (rows=36524 width=1119)
+                                                              Filter Operator [FIL_261] (rows=36524 width=1119)
+                                                                predicate:(d_date = '1998-02-19')
+                                                                 Please refer to the previous TableScan [TS_9]
+                  <-Reducer 4 [SIMPLE_EDGE]
+                    SHUFFLE [RS_150]
                       PartitionCols:_col0
-                      Group By Operator [GBY_31] (rows=174233858 width=135)
+                      Group By Operator [GBY_48] (rows=174233858 width=135)
                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)"],keys:KEY._col0
-                      <-Reducer 4 [SIMPLE_EDGE]
-                        SHUFFLE [RS_30]
+                      <-Reducer 3 [SIMPLE_EDGE]
+                        SHUFFLE [RS_47]
                           PartitionCols:_col0
-                          Group By Operator [GBY_29] (rows=348467716 width=135)
-                            Output:["_col0","_col1"],aggregations:["sum(_col5)"],keys:_col7
-                            Merge Join Operator [MERGEJOIN_204] (rows=348467716 width=135)
-                              Conds:RS_25._col4=RS_26._col0(Inner),Output:["_col5","_col7"]
-                            <-Map 22 [SIMPLE_EDGE]
-                              SHUFFLE [RS_26]
+                          Group By Operator [GBY_46] (rows=348467716 width=135)
+                            Output:["_col0","_col1"],aggregations:["sum(_col2)"],keys:_col4
+                            Merge Join Operator [MERGEJOIN_276] (rows=348467716 width=135)
+                              Conds:RS_42._col0=RS_43._col0(Inner),Output:["_col2","_col4"]
+                            <-Reducer 15 [SIMPLE_EDGE]
+                              SHUFFLE [RS_43]
                                 PartitionCols:_col0
-                                Select Operator [SEL_18] (rows=462000 width=1436)
-                                  Output:["_col0","_col1"]
-                                  Filter Operator [FIL_190] (rows=462000 width=1436)
-                                    predicate:(i_item_sk is not null and i_item_id is not null)
-                                     Please refer to the previous TableScan [TS_16]
-                            <-Reducer 3 [SIMPLE_EDGE]
-                              SHUFFLE [RS_25]
-                                PartitionCols:_col4
-                                Merge Join Operator [MERGEJOIN_203] (rows=316788826 width=135)
-                                  Conds:RS_22._col0=RS_23._col0(Inner),Output:["_col4","_col5"]
-                                <-Map 21 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_23]
+                                Merge Join Operator [MERGEJOIN_267] (rows=80353 width=1119)
+                                  Conds:RS_35._col1=RS_36._col0(Inner),Output:["_col0"]
+                                <-Map 14 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_35]
+                                    PartitionCols:_col1
+                                    Select Operator [SEL_8] (rows=73049 width=1119)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_248] (rows=73049 width=1119)
+                                        predicate:(d_date is not null and d_date_sk is not null)
+                                         Please refer to the previous TableScan [TS_6]
+                                <-Reducer 22 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_36]
                                     PartitionCols:_col0
-                                    Select Operator [SEL_15] (rows=287989836 width=135)
+                                    Group By Operator [GBY_33] (rows=40176 width=1119)
+                                      Output:["_col0"],keys:KEY._col0
+                                    <-Reducer 21 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_32]
+                                        PartitionCols:_col0
+                                        Group By Operator [GBY_31] (rows=80353 width=1119)
+                                          Output:["_col0"],keys:_col2
+                                          Merge Join Operator [MERGEJOIN_266] (rows=80353 width=1119)
+                                            Conds:RS_27._col1=RS_28._col1(Inner),Output:["_col2"]
+                                          <-Map 31 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_28]
+                                              PartitionCols:_col1
+                                              Select Operator [SEL_23] (rows=73049 width=1119)
+                                                Output:["_col0","_col1"]
+                                                Filter Operator [FIL_251] (rows=73049 width=1119)
+                                                  predicate:(d_week_seq is not null and d_date is not null)
+                                                   Please refer to the previous TableScan [TS_18]
+                                          <-Reducer 20 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_27]
+                                              PartitionCols:_col1
+                                              Merge Join Operator [MERGEJOIN_265] (rows=36524 width=1128)
+                                                Conds:(Inner),Output:["_col1"]
+                                              <-Map 31 [CUSTOM_SIMPLE_EDGE]
+                                                SHUFFLE [RS_25]
+                                                  Select Operator [SEL_20] (rows=36524 width=1119)
+                                                    Output:["_col0"]
+                                                    Filter Operator [FIL_250] (rows=36524 width=1119)
+                                                      predicate:((d_date = '1998-02-19') and d_week_seq is not null)
+                                                       Please refer to the previous TableScan [TS_18]
+                                              <-Reducer 19 [CUSTOM_SIMPLE_EDGE]
+                                                PARTITION_ONLY_SHUFFLE [RS_24]
+                                                  Select Operator [SEL_17] (rows=1 width=8)
+                                                    Filter Operator [FIL_16] (rows=1 width=8)
+                                                      predicate:(sq_count_check(_col0) <= 1)
+                                                      Group By Operator [GBY_14] (rows=1 width=8)
+                                                        Output:["_col0"],aggregations:["count(VALUE._col0)"]
+                                                      <-Map 18 [CUSTOM_SIMPLE_EDGE]
+                                                        PARTITION_ONLY_SHUFFLE [RS_13]
+                                                          Group By Operator [GBY_12] (rows=1 width=8)
+                                                            Output:["_col0"],aggregations:["count()"]
+                                                            Select Operator [SEL_11] (rows=36524 width=1119)
+                                                              Filter Operator [FIL_249] (rows=36524 width=1119)
+                                                                predicate:(d_date = '1998-02-19')
+                                                                 Please refer to the previous TableScan [TS_9]
+                            <-Reducer 2 [SIMPLE_EDGE]
+                              SHUFFLE [RS_42]
+                                PartitionCols:_col0
+                                Merge Join Operator [MERGEJOIN_264] (rows=316788826 width=135)
+                                  Conds:RS_39._col1=RS_40._col0(Inner),Output:["_col0","_col2","_col4"]
+                                <-Map 7 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_40]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_5] (rows=462000 width=1436)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_247] (rows=462000 width=1436)
+                                        predicate:(i_item_sk is not null and i_item_id is not null)
+                                         Please refer to the previous TableScan [TS_3]
+                                <-Map 1 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_39]
+                                    PartitionCols:_col1
+                                    Select Operator [SEL_2] (rows=287989836 width=135)
                                       Output:["_col0","_col1","_col2"]
-                                      Filter Operator [FIL_189] (rows=287989836 width=135)
+                                      Filter Operator [FIL_246] (rows=287989836 width=135)
                                         predicate:(cs_item_sk is not null and cs_sold_date_sk is not null)
-                                        TableScan [TS_13] (rows=287989836 width=135)
+                                        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_sales_price"]
-                                <-Reducer 2 [SIMPLE_EDGE]
-                                  SHUFFLE [RS_22]
-                                    PartitionCols:_col0
-                                    Merge Join Operator [MERGEJOIN_202] (rows=88388 width=1119)
-                                      Conds:RS_19._col1=RS_20._col0(Inner),Output:["_col0"]
-                                    <-Map 1 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_19]
-                                        PartitionCols:_col1
-                                        Select Operator [SEL_2] (rows=73049 width=1119)
-                                          Output:["_col0","_col1"]
-                                          Filter Operator [FIL_186] (rows=73049 width=1119)
-                                            predicate:(d_date_sk is not null and d_date is not null)
-                                             Please refer to the previous TableScan [TS_0]
-                                    <-Reducer 17 [SIMPLE_EDGE]
-                                      SHUFFLE [RS_20]
-                                        PartitionCols:_col0
-                                        Merge Join Operator [MERGEJOIN_201] (rows=80353 width=1119)
-                                          Conds:RS_9._col1=RS_10._col1(Inner),Output:["_col0"]
-                                        <-Map 16 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_9]
-                                            PartitionCols:_col1
-                                            Select Operator [SEL_5] (rows=73049 width=1119)
-                                              Output:["_col0","_col1"]
-                                              Filter Operator [FIL_187] (rows=73049 width=1119)
-                                                predicate:(d_week_seq is not null and d_date is not null)
-                                                 Please refer to the previous TableScan [TS_3]
-                                        <-Map 20 [SIMPLE_EDGE]
-                                          SHUFFLE [RS_10]
-                                            PartitionCols:_col1
-                                            Select Operator [SEL_8] (rows=36524 width=1119)
-                                              Output:["_col1"]
-                                              Filter Operator [FIL_188] (rows=36524 width=1119)
-                                                predicate:((d_date = '1998-08-04') and d_week_seq is not null)
-                                                 Please refer to the previous TableScan [TS_6]
 

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query59.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query59.q.out b/ql/src/test/results/clientpositive/perf/query59.q.out
new file mode 100644
index 0000000..b570b96
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query59.q.out
@@ -0,0 +1,238 @@
+PREHOOK: query: explain
+with wss as 
+ (select d_week_seq,
+        ss_store_sk,
+        sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales,
+        sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales,
+        sum(case when (d_day_name='Tuesday') then ss_sales_price else  null end) tue_sales,
+        sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales,
+        sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales,
+        sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales,
+        sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales
+ from store_sales,date_dim
+ where d_date_sk = ss_sold_date_sk
+ group by d_week_seq,ss_store_sk
+ )
+  select  s_store_name1,s_store_id1,d_week_seq1
+       ,sun_sales1/sun_sales2,mon_sales1/mon_sales2
+       ,tue_sales1/tue_sales1,wed_sales1/wed_sales2,thu_sales1/thu_sales2
+       ,fri_sales1/fri_sales2,sat_sales1/sat_sales2
+ from
+ (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1
+        ,s_store_id s_store_id1,sun_sales sun_sales1
+        ,mon_sales mon_sales1,tue_sales tue_sales1
+        ,wed_sales wed_sales1,thu_sales thu_sales1
+        ,fri_sales fri_sales1,sat_sales sat_sales1
+  from wss,store,date_dim d
+  where d.d_week_seq = wss.d_week_seq and
+        ss_store_sk = s_store_sk and 
+        d_month_seq between 1185 and 1185 + 11) y,
+ (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2
+        ,s_store_id s_store_id2,sun_sales sun_sales2
+        ,mon_sales mon_sales2,tue_sales tue_sales2
+        ,wed_sales wed_sales2,thu_sales thu_sales2
+        ,fri_sales fri_sales2,sat_sales sat_sales2
+  from wss,store,date_dim d
+  where d.d_week_seq = wss.d_week_seq and
+        ss_store_sk = s_store_sk and 
+        d_month_seq between 1185+ 12 and 1185 + 23) x
+ where s_store_id1=s_store_id2
+   and d_week_seq1=d_week_seq2-52
+ order by s_store_name1,s_store_id1,d_week_seq1
+limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+with wss as 
+ (select d_week_seq,
+        ss_store_sk,
+        sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales,
+        sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales,
+        sum(case when (d_day_name='Tuesday') then ss_sales_price else  null end) tue_sales,
+        sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales,
+        sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales,
+        sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales,
+        sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales
+ from store_sales,date_dim
+ where d_date_sk = ss_sold_date_sk
+ group by d_week_seq,ss_store_sk
+ )
+  select  s_store_name1,s_store_id1,d_week_seq1
+       ,sun_sales1/sun_sales2,mon_sales1/mon_sales2
+       ,tue_sales1/tue_sales1,wed_sales1/wed_sales2,thu_sales1/thu_sales2
+       ,fri_sales1/fri_sales2,sat_sales1/sat_sales2
+ from
+ (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1
+        ,s_store_id s_store_id1,sun_sales sun_sales1
+        ,mon_sales mon_sales1,tue_sales tue_sales1
+        ,wed_sales wed_sales1,thu_sales thu_sales1
+        ,fri_sales fri_sales1,sat_sales sat_sales1
+  from wss,store,date_dim d
+  where d.d_week_seq = wss.d_week_seq and
+        ss_store_sk = s_store_sk and 
+        d_month_seq between 1185 and 1185 + 11) y,
+ (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2
+        ,s_store_id s_store_id2,sun_sales sun_sales2
+        ,mon_sales mon_sales2,tue_sales tue_sales2
+        ,wed_sales wed_sales2,thu_sales thu_sales2
+        ,fri_sales fri_sales2,sat_sales sat_sales2
+  from wss,store,date_dim d
+  where d.d_week_seq = wss.d_week_seq and
+        ss_store_sk = s_store_sk and 
+        d_month_seq between 1185+ 12 and 1185 + 23) x
+ where s_store_id1=s_store_id2
+   and d_week_seq1=d_week_seq2-52
+ order by s_store_name1,s_store_id1,d_week_seq1
+limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 10 <- Map 13 (SIMPLE_EDGE), Reducer 9 (SIMPLE_EDGE)
+Reducer 11 <- Map 15 (SIMPLE_EDGE), Reducer 10 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 12 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Map 13 (SIMPLE_EDGE), Reducer 3 (SIMPLE_EDGE)
+Reducer 5 <- Map 14 (SIMPLE_EDGE), Reducer 4 (SIMPLE_EDGE)
+Reducer 6 <- Reducer 11 (SIMPLE_EDGE), Reducer 5 (SIMPLE_EDGE)
+Reducer 7 <- Reducer 6 (SIMPLE_EDGE)
+Reducer 8 <- Map 1 (SIMPLE_EDGE), Map 12 (SIMPLE_EDGE)
+Reducer 9 <- Reducer 8 (SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:100
+    Stage-1
+      Reducer 7
+      File Output Operator [FS_63]
+        Limit [LIM_62] (rows=100 width=88)
+          Number of rows:100
+          Select Operator [SEL_61] (rows=421657640 width=88)
+            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
+          <-Reducer 6 [SIMPLE_EDGE]
+            SHUFFLE [RS_60]
+              Select Operator [SEL_59] (rows=421657640 width=88)
+                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
+                Merge Join Operator [MERGEJOIN_104] (rows=421657640 width=88)
+                  Conds:RS_56._col2, _col1=RS_57._col1, (_col0 - 52)(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col12","_col13","_col14","_col15","_col16","_col17"]
+                <-Reducer 11 [SIMPLE_EDGE]
+                  SHUFFLE [RS_57]
+                    PartitionCols:_col1, (_col0 - 52)
+                    Select Operator [SEL_55] (rows=383325119 width=88)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                      Merge Join Operator [MERGEJOIN_103] (rows=383325119 width=88)
+                        Conds:RS_52._col1=RS_53._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6","_col7","_col11"]
+                      <-Map 15 [SIMPLE_EDGE]
+                        SHUFFLE [RS_53]
+                          PartitionCols:_col0
+                          Select Operator [SEL_48] (rows=1704 width=1910)
+                            Output:["_col0","_col1"]
+                            Filter Operator [FIL_97] (rows=1704 width=1910)
+                              predicate:(s_store_sk is not null and s_store_id is not null)
+                              TableScan [TS_46] (rows=1704 width=1910)
+                                default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_store_id"]
+                      <-Reducer 10 [SIMPLE_EDGE]
+                        SHUFFLE [RS_52]
+                          PartitionCols:_col1
+                          Merge Join Operator [MERGEJOIN_102] (rows=348477374 width=88)
+                            Conds:RS_49._col0=RS_50._col1(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                          <-Map 13 [SIMPLE_EDGE]
+                            SHUFFLE [RS_50]
+                              PartitionCols:_col1
+                              Select Operator [SEL_45] (rows=8116 width=1119)
+                                Output:["_col1"]
+                                Filter Operator [FIL_96] (rows=8116 width=1119)
+                                  predicate:(d_month_seq BETWEEN 1197 AND 1208 and d_week_seq is not null)
+                                  TableScan [TS_15] (rows=73049 width=1119)
+                                    default@date_dim,d,Tbl:COMPLETE,Col:NONE,Output:["d_month_seq","d_week_seq"]
+                          <-Reducer 9 [SIMPLE_EDGE]
+                            SHUFFLE [RS_49]
+                              PartitionCols:_col0
+                              Group By Operator [GBY_41] (rows=316797606 width=88)
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)","sum(VALUE._col4)","sum(VALUE._col5)"],keys:KEY._col0, KEY._col1
+                              <-Reducer 8 [SIMPLE_EDGE]
+                                SHUFFLE [RS_40]
+                                  PartitionCols:_col0, _col1
+                                  Group By Operator [GBY_39] (rows=633595212 width=88)
+                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"],aggregations:["sum(_col2)","sum(_col3)","sum(_col5)","sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col0, _col1
+                                    Select Operator [SEL_37] (rows=633595212 width=88)
+                                      Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col7","_col8"]
+                                      Merge Join Operator [MERGEJOIN_101] (rows=633595212 width=88)
+                                        Conds:RS_34._col0=RS_35._col0(Inner),Output:["_col1","_col2","_col4","_col5"]
+                                      <-Map 1 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_34]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_30] (rows=575995635 width=88)
+                                            Output:["_col0","_col1","_col2"]
+                                            Filter Operator [FIL_94] (rows=575995635 width=88)
+                                              predicate:(ss_sold_date_sk is not null and ss_store_sk is not null)
+                                              TableScan [TS_0] (rows=575995635 width=88)
+                                                default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_store_sk","ss_sales_price"]
+                                      <-Map 12 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_35]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_33] (rows=73049 width=1119)
+                                            Output:["_col0","_col1","_col2"]
+                                            Filter Operator [FIL_95] (rows=73049 width=1119)
+                                              predicate:(d_date_sk is not null and d_week_seq is not null)
+                                              TableScan [TS_3] (rows=73049 width=1119)
+                                                default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_week_seq","d_day_name"]
+                <-Reducer 5 [SIMPLE_EDGE]
+                  SHUFFLE [RS_56]
+                    PartitionCols:_col2, _col1
+                    Select Operator [SEL_27] (rows=383325119 width=88)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9"]
+                      Merge Join Operator [MERGEJOIN_100] (rows=383325119 width=88)
+                        Conds:RS_24._col1=RS_25._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col12","_col13"]
+                      <-Map 14 [SIMPLE_EDGE]
+                        SHUFFLE [RS_25]
+                          PartitionCols:_col0
+                          Select Operator [SEL_20] (rows=1704 width=1910)
+                            Output:["_col0","_col1","_col2"]
+                            Filter Operator [FIL_93] (rows=1704 width=1910)
+                              predicate:(s_store_sk is not null and s_store_id is not null)
+                              TableScan [TS_18] (rows=1704 width=1910)
+                                default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_store_id","s_store_name"]
+                      <-Reducer 4 [SIMPLE_EDGE]
+                        SHUFFLE [RS_24]
+                          PartitionCols:_col1
+                          Merge Join Operator [MERGEJOIN_99] (rows=348477374 width=88)
+                            Conds:RS_21._col0=RS_22._col1(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                          <-Map 13 [SIMPLE_EDGE]
+                            SHUFFLE [RS_22]
+                              PartitionCols:_col1
+                              Select Operator [SEL_17] (rows=8116 width=1119)
+                                Output:["_col1"]
+                                Filter Operator [FIL_92] (rows=8116 width=1119)
+                                  predicate:(d_month_seq BETWEEN 1185 AND 1196 and d_week_seq is not null)
+                                   Please refer to the previous TableScan [TS_15]
+                          <-Reducer 3 [SIMPLE_EDGE]
+                            SHUFFLE [RS_21]
+                              PartitionCols:_col0
+                              Group By Operator [GBY_13] (rows=316797606 width=88)
+                                Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)","sum(VALUE._col4)","sum(VALUE._col5)","sum(VALUE._col6)"],keys:KEY._col0, KEY._col1
+                              <-Reducer 2 [SIMPLE_EDGE]
+                                SHUFFLE [RS_12]
+                                  PartitionCols:_col0, _col1
+                                  Group By Operator [GBY_11] (rows=633595212 width=88)
+                                    Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)","sum(_col5)","sum(_col6)","sum(_col7)","sum(_col8)"],keys:_col0, _col1
+                                    Select Operator [SEL_9] (rows=633595212 width=88)
+                                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8"]
+                                      Merge Join Operator [MERGEJOIN_98] (rows=633595212 width=88)
+                                        Conds:RS_6._col0=RS_7._col0(Inner),Output:["_col1","_col2","_col4","_col5"]
+                                      <-Map 1 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_6]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_2] (rows=575995635 width=88)
+                                            Output:["_col0","_col1","_col2"]
+                                            Filter Operator [FIL_90] (rows=575995635 width=88)
+                                              predicate:(ss_sold_date_sk is not null and ss_store_sk is not null)
+                                               Please refer to the previous TableScan [TS_0]
+                                      <-Map 12 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_7]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_5] (rows=73049 width=1119)
+                                            Output:["_col0","_col1","_col2"]
+                                            Filter Operator [FIL_91] (rows=73049 width=1119)
+                                              predicate:(d_date_sk is not null and d_week_seq is not null)
+                                               Please refer to the previous TableScan [TS_3]
+

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query6.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query6.q.out b/ql/src/test/results/clientpositive/perf/query6.q.out
index 04bda70..03fff79 100644
--- a/ql/src/test/results/clientpositive/perf/query6.q.out
+++ b/ql/src/test/results/clientpositive/perf/query6.q.out
@@ -1,5 +1,6 @@
 Warning: Shuffle Join MERGEJOIN[111][tables = [$hdt$_5, $hdt$_6]] in Stage 'Reducer 16' is a cross product
-PREHOOK: query: explain select  a.ca_state state, count(*) cnt
+PREHOOK: query: explain
+select  a.ca_state state, count(*) cnt
  from customer_address a
      ,customer c
      ,store_sales s
@@ -23,7 +24,8 @@ PREHOOK: query: explain select  a.ca_state state, count(*) cnt
  order by cnt 
  limit 100
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select  a.ca_state state, count(*) cnt
+POSTHOOK: query: explain
+select  a.ca_state state, count(*) cnt
  from customer_address a
      ,customer c
      ,store_sales s

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query60.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query60.q.out b/ql/src/test/results/clientpositive/perf/query60.q.out
index bb05a42..12d8cdd 100644
--- a/ql/src/test/results/clientpositive/perf/query60.q.out
+++ b/ql/src/test/results/clientpositive/perf/query60.q.out
@@ -1,4 +1,5 @@
-PREHOOK: query: explain with ss as (
+PREHOOK: query: explain
+with ss as (
  select
           i_item_id,sum(ss_ext_sales_price) total_sales
  from
@@ -74,7 +75,8 @@ where i_category in ('Children'))
       ,total_sales
  limit 100
 PREHOOK: type: QUERY
-POSTHOOK: query: explain with ss as (
+POSTHOOK: query: explain
+with ss as (
  select
           i_item_id,sum(ss_ext_sales_price) total_sales
  from

http://git-wip-us.apache.org/repos/asf/hive/blob/86b18772/ql/src/test/results/clientpositive/perf/query61.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/perf/query61.q.out b/ql/src/test/results/clientpositive/perf/query61.q.out
new file mode 100644
index 0000000..6838332
--- /dev/null
+++ b/ql/src/test/results/clientpositive/perf/query61.q.out
@@ -0,0 +1,300 @@
+Warning: Shuffle Join MERGEJOIN[156][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 5' is a cross product
+PREHOOK: query: explain
+select  promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100
+from
+  (select sum(ss_ext_sales_price) promotions
+   from  store_sales
+        ,store
+        ,promotion
+        ,date_dim
+        ,customer
+        ,customer_address 
+        ,item
+   where ss_sold_date_sk = d_date_sk
+   and   ss_store_sk = s_store_sk
+   and   ss_promo_sk = p_promo_sk
+   and   ss_customer_sk= c_customer_sk
+   and   ca_address_sk = c_current_addr_sk
+   and   ss_item_sk = i_item_sk 
+   and   ca_gmt_offset = -7
+   and   i_category = 'Electronics'
+   and   (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y')
+   and   s_gmt_offset = -7
+   and   d_year = 1999
+   and   d_moy  = 11) promotional_sales,
+  (select sum(ss_ext_sales_price) total
+   from  store_sales
+        ,store
+        ,date_dim
+        ,customer
+        ,customer_address
+        ,item
+   where ss_sold_date_sk = d_date_sk
+   and   ss_store_sk = s_store_sk
+   and   ss_customer_sk= c_customer_sk
+   and   ca_address_sk = c_current_addr_sk
+   and   ss_item_sk = i_item_sk
+   and   ca_gmt_offset = -7
+   and   i_category = 'Electronics'
+   and   s_gmt_offset = -7
+   and   d_year = 1999
+   and   d_moy  = 11) all_sales
+order by promotions, total
+limit 100
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select  promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100
+from
+  (select sum(ss_ext_sales_price) promotions
+   from  store_sales
+        ,store
+        ,promotion
+        ,date_dim
+        ,customer
+        ,customer_address 
+        ,item
+   where ss_sold_date_sk = d_date_sk
+   and   ss_store_sk = s_store_sk
+   and   ss_promo_sk = p_promo_sk
+   and   ss_customer_sk= c_customer_sk
+   and   ca_address_sk = c_current_addr_sk
+   and   ss_item_sk = i_item_sk 
+   and   ca_gmt_offset = -7
+   and   i_category = 'Electronics'
+   and   (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y')
+   and   s_gmt_offset = -7
+   and   d_year = 1999
+   and   d_moy  = 11) promotional_sales,
+  (select sum(ss_ext_sales_price) total
+   from  store_sales
+        ,store
+        ,date_dim
+        ,customer
+        ,customer_address
+        ,item
+   where ss_sold_date_sk = d_date_sk
+   and   ss_store_sk = s_store_sk
+   and   ss_customer_sk= c_customer_sk
+   and   ca_address_sk = c_current_addr_sk
+   and   ss_item_sk = i_item_sk
+   and   ca_gmt_offset = -7
+   and   i_category = 'Electronics'
+   and   s_gmt_offset = -7
+   and   d_year = 1999
+   and   d_moy  = 11) all_sales
+order by promotions, total
+limit 100
+POSTHOOK: type: QUERY
+Plan optimized by CBO.
+
+Vertex dependency in root stage
+Reducer 12 <- Map 11 (SIMPLE_EDGE), Map 16 (SIMPLE_EDGE)
+Reducer 13 <- Map 20 (SIMPLE_EDGE), Reducer 12 (SIMPLE_EDGE)
+Reducer 14 <- Map 21 (SIMPLE_EDGE), Reducer 13 (SIMPLE_EDGE)
+Reducer 15 <- Map 22 (SIMPLE_EDGE), Reducer 14 (SIMPLE_EDGE)
+Reducer 17 <- Map 16 (SIMPLE_EDGE), Map 23 (SIMPLE_EDGE)
+Reducer 18 <- Map 20 (SIMPLE_EDGE), Reducer 17 (SIMPLE_EDGE)
+Reducer 19 <- Map 21 (SIMPLE_EDGE), Reducer 18 (SIMPLE_EDGE)
+Reducer 2 <- Map 1 (SIMPLE_EDGE), Map 10 (SIMPLE_EDGE)
+Reducer 3 <- Reducer 15 (SIMPLE_EDGE), Reducer 2 (SIMPLE_EDGE)
+Reducer 4 <- Reducer 3 (CUSTOM_SIMPLE_EDGE)
+Reducer 5 <- Reducer 4 (CUSTOM_SIMPLE_EDGE), Reducer 9 (CUSTOM_SIMPLE_EDGE)
+Reducer 6 <- Reducer 5 (SIMPLE_EDGE)
+Reducer 7 <- Map 1 (SIMPLE_EDGE), Map 10 (SIMPLE_EDGE)
+Reducer 8 <- Reducer 19 (SIMPLE_EDGE), Reducer 7 (SIMPLE_EDGE)
+Reducer 9 <- Reducer 8 (CUSTOM_SIMPLE_EDGE)
+
+Stage-0
+  Fetch Operator
+    limit:100
+    Stage-1
+      Reducer 6
+      File Output Operator [FS_91]
+        Limit [LIM_90] (rows=1 width=225)
+          Number of rows:100
+          Select Operator [SEL_89] (rows=1 width=225)
+            Output:["_col0","_col1","_col2"]
+          <-Reducer 5 [SIMPLE_EDGE]
+            SHUFFLE [RS_88]
+              Select Operator [SEL_87] (rows=1 width=225)
+                Output:["_col0","_col1","_col2"]
+                Merge Join Operator [MERGEJOIN_156] (rows=1 width=225)
+                  Conds:(Inner),Output:["_col0","_col1"]
+                <-Reducer 4 [CUSTOM_SIMPLE_EDGE]
+                  PARTITION_ONLY_SHUFFLE [RS_84]
+                    Group By Operator [GBY_43] (rows=1 width=112)
+                      Output:["_col0"],aggregations:["sum(VALUE._col0)"]
+                    <-Reducer 3 [CUSTOM_SIMPLE_EDGE]
+                      PARTITION_ONLY_SHUFFLE [RS_42]
+                        Group By Operator [GBY_41] (rows=1 width=112)
+                          Output:["_col0"],aggregations:["sum(_col9)"]
+                          Merge Join Operator [MERGEJOIN_154] (rows=927646829 width=88)
+                            Conds:RS_37._col0=RS_38._col2(Inner),Output:["_col9"]
+                          <-Reducer 15 [SIMPLE_EDGE]
+                            SHUFFLE [RS_38]
+                              PartitionCols:_col2
+                              Merge Join Operator [MERGEJOIN_149] (rows=843315281 width=88)
+                                Conds:RS_30._col4=RS_31._col0(Inner),Output:["_col2","_col5"]
+                              <-Map 22 [SIMPLE_EDGE]
+                                SHUFFLE [RS_31]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_20] (rows=2300 width=1179)
+                                    Output:["_col0"]
+                                    Filter Operator [FIL_138] (rows=2300 width=1179)
+                                      predicate:(((p_channel_dmail = 'Y') or (p_channel_email = 'Y') or (p_channel_tv = 'Y')) and p_promo_sk is not null)
+                                      TableScan [TS_18] (rows=2300 width=1179)
+                                        default@promotion,promotion,Tbl:COMPLETE,Col:NONE,Output:["p_promo_sk","p_channel_dmail","p_channel_email","p_channel_tv"]
+                              <-Reducer 14 [SIMPLE_EDGE]
+                                SHUFFLE [RS_30]
+                                  PartitionCols:_col4
+                                  Merge Join Operator [MERGEJOIN_148] (rows=766650239 width=88)
+                                    Conds:RS_27._col3=RS_28._col0(Inner),Output:["_col2","_col4","_col5"]
+                                  <-Map 21 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_28]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_17] (rows=852 width=1910)
+                                        Output:["_col0"]
+                                        Filter Operator [FIL_137] (rows=852 width=1910)
+                                          predicate:((s_gmt_offset = -7) and s_store_sk is not null)
+                                          TableScan [TS_15] (rows=1704 width=1910)
+                                            default@store,store,Tbl:COMPLETE,Col:NONE,Output:["s_store_sk","s_gmt_offset"]
+                                  <-Reducer 13 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_27]
+                                      PartitionCols:_col3
+                                      Merge Join Operator [MERGEJOIN_147] (rows=696954748 width=88)
+                                        Conds:RS_24._col1=RS_25._col0(Inner),Output:["_col2","_col3","_col4","_col5"]
+                                      <-Map 20 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_25]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_14] (rows=231000 width=1436)
+                                            Output:["_col0"]
+                                            Filter Operator [FIL_136] (rows=231000 width=1436)
+                                              predicate:((i_category = 'Electronics') and 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_category"]
+                                      <-Reducer 12 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_24]
+                                          PartitionCols:_col1
+                                          Merge Join Operator [MERGEJOIN_146] (rows=633595212 width=88)
+                                            Conds:RS_21._col0=RS_22._col0(Inner),Output:["_col1","_col2","_col3","_col4","_col5"]
+                                          <-Map 16 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_22]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_11] (rows=18262 width=1119)
+                                                Output:["_col0"]
+                                                Filter Operator [FIL_135] (rows=18262 width=1119)
+                                                  predicate:((d_year = 1999) and (d_moy = 11) and d_date_sk is not null)
+                                                  TableScan [TS_9] (rows=73049 width=1119)
+                                                    default@date_dim,date_dim,Tbl:COMPLETE,Col:NONE,Output:["d_date_sk","d_year","d_moy"]
+                                          <-Map 11 [SIMPLE_EDGE]
+                                            SHUFFLE [RS_21]
+                                              PartitionCols:_col0
+                                              Select Operator [SEL_8] (rows=575995635 width=88)
+                                                Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
+                                                Filter Operator [FIL_134] (rows=575995635 width=88)
+                                                  predicate:(ss_store_sk is not null and ss_promo_sk is not null and ss_sold_date_sk is not null and ss_customer_sk is not null and ss_item_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","ss_customer_sk","ss_store_sk","ss_promo_sk","ss_ext_sales_price"]
+                          <-Reducer 2 [SIMPLE_EDGE]
+                            SHUFFLE [RS_37]
+                              PartitionCols:_col0
+                              Merge Join Operator [MERGEJOIN_145] (rows=88000001 width=860)
+                                Conds:RS_34._col1=RS_35._col0(Inner),Output:["_col0"]
+                              <-Map 1 [SIMPLE_EDGE]
+                                SHUFFLE [RS_34]
+                                  PartitionCols:_col1
+                                  Select Operator [SEL_2] (rows=80000000 width=860)
+                                    Output:["_col0","_col1"]
+                                    Filter Operator [FIL_132] (rows=80000000 width=860)
+                                      predicate:(c_customer_sk is not null and c_current_addr_sk is not null)
+                                      TableScan [TS_0] (rows=80000000 width=860)
+                                        default@customer,customer,Tbl:COMPLETE,Col:NONE,Output:["c_customer_sk","c_current_addr_sk"]
+                              <-Map 10 [SIMPLE_EDGE]
+                                SHUFFLE [RS_35]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_5] (rows=20000000 width=1014)
+                                    Output:["_col0"]
+                                    Filter Operator [FIL_133] (rows=20000000 width=1014)
+                                      predicate:((ca_gmt_offset = -7) and ca_address_sk is not null)
+                                      TableScan [TS_3] (rows=40000000 width=1014)
+                                        default@customer_address,customer_address,Tbl:COMPLETE,Col:NONE,Output:["ca_address_sk","ca_gmt_offset"]
+                <-Reducer 9 [CUSTOM_SIMPLE_EDGE]
+                  PARTITION_ONLY_SHUFFLE [RS_85]
+                    Group By Operator [GBY_82] (rows=1 width=112)
+                      Output:["_col0"],aggregations:["sum(VALUE._col0)"]
+                    <-Reducer 8 [CUSTOM_SIMPLE_EDGE]
+                      PARTITION_ONLY_SHUFFLE [RS_81]
+                        Group By Operator [GBY_80] (rows=1 width=112)
+                          Output:["_col0"],aggregations:["sum(_col8)"]
+                          Merge Join Operator [MERGEJOIN_155] (rows=843315281 width=88)
+                            Conds:RS_76._col0=RS_77._col2(Inner),Output:["_col8"]
+                          <-Reducer 19 [SIMPLE_EDGE]
+                            SHUFFLE [RS_77]
+                              PartitionCols:_col2
+                              Merge Join Operator [MERGEJOIN_153] (rows=766650239 width=88)
+                                Conds:RS_69._col3=RS_70._col0(Inner),Output:["_col2","_col4"]
+                              <-Map 21 [SIMPLE_EDGE]
+                                SHUFFLE [RS_70]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_62] (rows=852 width=1910)
+                                    Output:["_col0"]
+                                    Filter Operator [FIL_144] (rows=852 width=1910)
+                                      predicate:((s_gmt_offset = -7) and s_store_sk is not null)
+                                       Please refer to the previous TableScan [TS_15]
+                              <-Reducer 18 [SIMPLE_EDGE]
+                                SHUFFLE [RS_69]
+                                  PartitionCols:_col3
+                                  Merge Join Operator [MERGEJOIN_152] (rows=696954748 width=88)
+                                    Conds:RS_66._col1=RS_67._col0(Inner),Output:["_col2","_col3","_col4"]
+                                  <-Map 20 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_67]
+                                      PartitionCols:_col0
+                                      Select Operator [SEL_59] (rows=231000 width=1436)
+                                        Output:["_col0"]
+                                        Filter Operator [FIL_143] (rows=231000 width=1436)
+                                          predicate:((i_category = 'Electronics') and i_item_sk is not null)
+                                           Please refer to the previous TableScan [TS_12]
+                                  <-Reducer 17 [SIMPLE_EDGE]
+                                    SHUFFLE [RS_66]
+                                      PartitionCols:_col1
+                                      Merge Join Operator [MERGEJOIN_151] (rows=633595212 width=88)
+                                        Conds:RS_63._col0=RS_64._col0(Inner),Output:["_col1","_col2","_col3","_col4"]
+                                      <-Map 16 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_64]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_56] (rows=18262 width=1119)
+                                            Output:["_col0"]
+                                            Filter Operator [FIL_142] (rows=18262 width=1119)
+                                              predicate:((d_year = 1999) and (d_moy = 11) and d_date_sk is not null)
+                                               Please refer to the previous TableScan [TS_9]
+                                      <-Map 23 [SIMPLE_EDGE]
+                                        SHUFFLE [RS_63]
+                                          PartitionCols:_col0
+                                          Select Operator [SEL_53] (rows=575995635 width=88)
+                                            Output:["_col0","_col1","_col2","_col3","_col4"]
+                                            Filter Operator [FIL_141] (rows=575995635 width=88)
+                                              predicate:(ss_store_sk is not null and ss_sold_date_sk is not null and ss_customer_sk is not null and ss_item_sk is not null)
+                                              TableScan [TS_51] (rows=575995635 width=88)
+                                                default@store_sales,store_sales,Tbl:COMPLETE,Col:NONE,Output:["ss_sold_date_sk","ss_item_sk","ss_customer_sk","ss_store_sk","ss_ext_sales_price"]
+                          <-Reducer 7 [SIMPLE_EDGE]
+                            SHUFFLE [RS_76]
+                              PartitionCols:_col0
+                              Merge Join Operator [MERGEJOIN_150] (rows=88000001 width=860)
+                                Conds:RS_73._col1=RS_74._col0(Inner),Output:["_col0"]
+                              <-Map 1 [SIMPLE_EDGE]
+                                SHUFFLE [RS_73]
+                                  PartitionCols:_col1
+                                  Select Operator [SEL_47] (rows=80000000 width=860)
+                                    Output:["_col0","_col1"]
+                                    Filter Operator [FIL_139] (rows=80000000 width=860)
+                                      predicate:(c_customer_sk is not null and c_current_addr_sk is not null)
+                                       Please refer to the previous TableScan [TS_0]
+                              <-Map 10 [SIMPLE_EDGE]
+                                SHUFFLE [RS_74]
+                                  PartitionCols:_col0
+                                  Select Operator [SEL_50] (rows=20000000 width=1014)
+                                    Output:["_col0"]
+                                    Filter Operator [FIL_140] (rows=20000000 width=1014)
+                                      predicate:((ca_gmt_offset = -7) and ca_address_sk is not null)
+                                       Please refer to the previous TableScan [TS_3]
+