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 2020/01/07 18:28:05 UTC

[hive] branch master updated: HIVE-22652: TopNKey push through Group by with Grouping sets (Krisztian Kasa, reviewed by Jesus Camacho Rodriguez)

This is an automated email from the ASF dual-hosted git repository.

jcamacho pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 8a4392f  HIVE-22652: TopNKey push through Group by with Grouping sets (Krisztian Kasa, reviewed by Jesus Camacho Rodriguez)
8a4392f is described below

commit 8a4392f2483afd5d488e6e65ad7866ce6816ffa4
Author: Krisztian Kasa <kk...@cloudera.com>
AuthorDate: Tue Jan 7 10:25:59 2020 -0800

    HIVE-22652: TopNKey push through Group by with Grouping sets (Krisztian Kasa, reviewed by Jesus Camacho Rodriguez)
---
 .../topnkey/TopNKeyPushdownProcessor.java          |    5 -
 .../queries/clientpositive/topnkey_grouping_sets.q |  109 ++
 .../topnkey_grouping_sets_functions.q              |   45 +
 .../clientpositive/topnkey_grouping_sets_order.q   |   53 +
 .../llap/topnkey_grouping_sets.q.out               | 1339 ++++++++++++++++++++
 .../llap/topnkey_grouping_sets_functions.q.out     |  440 +++++++
 .../llap/topnkey_grouping_sets_order.q.out         |  553 ++++++++
 .../llap/vector_groupby_grouping_sets_limit.q.out  |  360 +++---
 .../clientpositive/perf/tez/cbo_query14.q.out      |    6 +-
 .../clientpositive/perf/tez/cbo_query77.q.out      |    2 +-
 .../perf/tez/constraints/cbo_query14.q.out         |    6 +-
 .../perf/tez/constraints/cbo_query77.q.out         |    2 +-
 .../perf/tez/constraints/query14.q.out             |  662 +++++-----
 .../perf/tez/constraints/query27.q.out             |  164 +--
 .../perf/tez/constraints/query5.q.out              |  200 +--
 .../perf/tez/constraints/query77.q.out             |  206 +--
 .../perf/tez/constraints/query80.q.out             |  234 ++--
 .../results/clientpositive/perf/tez/query14.q.out  |  668 +++++-----
 .../results/clientpositive/perf/tez/query27.q.out  |  168 +--
 .../results/clientpositive/perf/tez/query5.q.out   |  206 +--
 .../results/clientpositive/perf/tez/query77.q.out  |  242 ++--
 .../results/clientpositive/perf/tez/query80.q.out  |  246 ++--
 .../clientpositive/topnkey_grouping_sets.q.out     | 1236 ++++++++++++++++++
 .../topnkey_grouping_sets_functions.q.out          |  419 ++++++
 .../topnkey_grouping_sets_order.q.out              |  513 ++++++++
 25 files changed, 6415 insertions(+), 1669 deletions(-)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/topnkey/TopNKeyPushdownProcessor.java b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/topnkey/TopNKeyPushdownProcessor.java
index c79c371..348fbb5 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/optimizer/topnkey/TopNKeyPushdownProcessor.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/optimizer/topnkey/TopNKeyPushdownProcessor.java
@@ -153,11 +153,6 @@ public class TopNKeyPushdownProcessor implements NodeProcessor {
     final GroupByDesc groupByDesc = groupBy.getConf();
     final TopNKeyDesc topNKeyDesc = topNKey.getConf();
 
-    // Check grouping sets
-    if (groupByDesc.isGroupingSetsPresent()) {
-      return;
-    }
-
     CommonKeyPrefix commonKeyPrefix = CommonKeyPrefix.map(topNKeyDesc, groupByDesc);
     if (commonKeyPrefix.isEmpty()) {
       return;
diff --git a/ql/src/test/queries/clientpositive/topnkey_grouping_sets.q b/ql/src/test/queries/clientpositive/topnkey_grouping_sets.q
new file mode 100644
index 0000000..e8c5401
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/topnkey_grouping_sets.q
@@ -0,0 +1,109 @@
+set hive.vectorized.execution.enabled=false;
+set hive.optimize.topnkey=true;
+
+CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+);
+
+INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL);
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3;
+SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3;
+
+set hive.optimize.topnkey=false;
+SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7;
+
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7;
+
+SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7;
+
+DROP TABLE IF EXISTS t_test_grouping_sets;
diff --git a/ql/src/test/queries/clientpositive/topnkey_grouping_sets_functions.q b/ql/src/test/queries/clientpositive/topnkey_grouping_sets_functions.q
new file mode 100644
index 0000000..60bd99a
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/topnkey_grouping_sets_functions.q
@@ -0,0 +1,45 @@
+set hive.vectorized.execution.enabled=false;
+set hive.optimize.topnkey=true;
+
+CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+);
+
+INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL);
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7;
+SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7;
+SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7;
+SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7;
+
+DROP TABLE IF EXISTS t_test_grouping_sets;
diff --git a/ql/src/test/queries/clientpositive/topnkey_grouping_sets_order.q b/ql/src/test/queries/clientpositive/topnkey_grouping_sets_order.q
new file mode 100644
index 0000000..9b0adba
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/topnkey_grouping_sets_order.q
@@ -0,0 +1,53 @@
+set hive.vectorized.execution.enabled=false;
+set hive.optimize.topnkey=true;
+
+CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+);
+
+INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL);
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7;
+
+set hive.optimize.topnkey=true;
+EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC NULLS FIRST, b ASC NULLS FIRST LIMIT 7;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC NULLS FIRST, b ASC NULLS FIRST LIMIT 7;
+
+set hive.optimize.topnkey=false;
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC NULLS FIRST, b ASC NULLS FIRST LIMIT 7;
+
+DROP TABLE IF EXISTS t_test_grouping_sets;
diff --git a/ql/src/test/results/clientpositive/llap/topnkey_grouping_sets.q.out b/ql/src/test/results/clientpositive/llap/topnkey_grouping_sets.q.out
new file mode 100644
index 0000000..b1ec8d8
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/topnkey_grouping_sets.q.out
@@ -0,0 +1,1339 @@
+PREHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@t_test_grouping_sets
+PREHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: Lineage: t_test_grouping_sets.a SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.b SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.c SCRIPT []
+PREHOOK: query: EXPLAIN
+SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Top N Key Operator
+                    sort order: +
+                    keys: a (type: int)
+                    null sort order: z
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 3
+                    Select Operator
+                      expressions: a (type: int), b (type: int)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Top N Key Operator
+                        sort order: +++
+                        keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint)
+                        null sort order: zaa
+                        Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        top n: 3
+                        Group By Operator
+                          keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint)
+                          minReductionHashAggr: 0.15384614
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2
+                          Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            null sort order: zaa
+                            sort order: +++
+                            Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), grouping(_col2, 1L) (type: bigint), grouping(_col2, 0L) (type: bigint), grouping(_col2, 1L, 0L) (type: bigint)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                  Statistics: Num rows: 26 Data size: 632 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int)
+                    null sort order: z
+                    sort order: +
+                    Statistics: Num rows: 26 Data size: 632 Basic stats: COMPLETE Column stats: COMPLETE
+                    TopN Hash Memory Usage: 0.1
+                    value expressions: _col1 (type: int), _col2 (type: bigint), _col3 (type: bigint), _col4 (type: bigint)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: int), VALUE._col1 (type: bigint), VALUE._col2 (type: bigint), VALUE._col3 (type: bigint)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4
+                Statistics: Num rows: 26 Data size: 632 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 3
+                  Statistics: Num rows: 3 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 3 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 3
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	2	0	0	0
+5	NULL	0	1	1
+5	1	0	0	0
+PREHOOK: query: SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	2	0	0	0
+5	NULL	0	1	1
+5	1	0	0	0
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Top N Key Operator
+                    sort order: +
+                    keys: a (type: int)
+                    null sort order: z
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 10
+                    Select Operator
+                      expressions: a (type: int), b (type: int)
+                      outputColumnNames: a, b
+                      Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Top N Key Operator
+                        sort order: +++
+                        keys: a (type: int), b (type: int), 0L (type: bigint)
+                        null sort order: zaa
+                        Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        top n: 10
+                        Group By Operator
+                          keys: a (type: int), b (type: int), 0L (type: bigint)
+                          minReductionHashAggr: 0.15384614
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2
+                          Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            null sort order: zaa
+                            sort order: +++
+                            Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Reduce Output Operator
+                  key expressions: _col0 (type: int)
+                  null sort order: z
+                  sort order: +
+                  Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+                  value expressions: _col1 (type: int)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 10
+                  Statistics: Num rows: 10 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 10
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	NULL
+5	1
+5	2
+6	NULL
+6	2
+7	NULL
+7	8
+10	11
+10	NULL
+NULL	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	NULL
+5	1
+5	2
+6	NULL
+6	2
+7	NULL
+7	8
+10	11
+10	NULL
+NULL	NULL
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: a (type: int), b (type: int)
+                    outputColumnNames: a, b
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      keys: a (type: int), b (type: int), 0L (type: bigint)
+                      minReductionHashAggr: 0.15384614
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        null sort order: aaa
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Top N Key Operator
+                  sort order: +
+                  keys: _col1 (type: int)
+                  null sort order: z
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                  top n: 3
+                  Reduce Output Operator
+                    key expressions: _col1 (type: int)
+                    null sort order: z
+                    sort order: +
+                    Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                    TopN Hash Memory Usage: 0.1
+                    value expressions: _col0 (type: int)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 3
+                  Statistics: Num rows: 3 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 3 Data size: 16 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 3
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+5	1
+5	2
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+5	1
+5	2
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: a (type: int), b (type: int)
+                    outputColumnNames: a, b
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      keys: a (type: int), b (type: int), 0L (type: bigint)
+                      minReductionHashAggr: 0.15384614
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        null sort order: aaa
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Top N Key Operator
+                  sort order: +
+                  keys: _col1 (type: int)
+                  null sort order: z
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                  top n: 1
+                  Reduce Output Operator
+                    key expressions: _col1 (type: int)
+                    null sort order: z
+                    sort order: +
+                    Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                    TopN Hash Memory Usage: 0.1
+                    value expressions: _col0 (type: int)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 1
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: a (type: int), b (type: int)
+                    outputColumnNames: a, b
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      keys: a (type: int), b (type: int), 0L (type: bigint)
+                      minReductionHashAggr: 0.15384614
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        null sort order: aaa
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Top N Key Operator
+                  sort order: +
+                  keys: _col1 (type: int)
+                  null sort order: z
+                  Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                  top n: 7
+                  Reduce Output Operator
+                    key expressions: _col1 (type: int)
+                    null sort order: z
+                    sort order: +
+                    Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                    TopN Hash Memory Usage: 0.1
+                    value expressions: _col0 (type: int)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+NULL	2
+NULL	8
+NULL	11
+NULL	NULL
+NULL	NULL
+5	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+NULL	2
+NULL	8
+NULL	11
+NULL	NULL
+NULL	NULL
+5	NULL
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Top N Key Operator
+                    sort order: -+
+                    keys: a (type: int), b (type: int)
+                    null sort order: zz
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 7
+                    Select Operator
+                      expressions: a (type: int), b (type: int)
+                      outputColumnNames: a, b
+                      Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Top N Key Operator
+                        sort order: -++
+                        keys: a (type: int), b (type: int), 0L (type: bigint)
+                        null sort order: zza
+                        Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        top n: 7
+                        Group By Operator
+                          keys: a (type: int), b (type: int), 0L (type: bigint)
+                          minReductionHashAggr: 0.15384614
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2
+                          Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            null sort order: zza
+                            sort order: -++
+                            Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int)
+                  null sort order: zz
+                  sort order: -+
+                  Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+10	NULL
+7	8
+7	NULL
+6	2
+6	NULL
+5	1
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+10	NULL
+7	8
+7	NULL
+6	2
+6	NULL
+5	1
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Top N Key Operator
+                    sort order: -+
+                    keys: a (type: int), b (type: int)
+                    null sort order: zz
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 7
+                    Select Operator
+                      expressions: a (type: int), b (type: int)
+                      outputColumnNames: a, b
+                      Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Top N Key Operator
+                        sort order: -++
+                        keys: a (type: int), b (type: int), 0L (type: bigint)
+                        null sort order: zza
+                        Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        top n: 7
+                        Group By Operator
+                          keys: a (type: int), b (type: int), 0L (type: bigint)
+                          minReductionHashAggr: 0.15384614
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2
+                          Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            null sort order: zza
+                            sort order: -++
+                            Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int)
+                  null sort order: zz
+                  sort order: -+
+                  Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	1
+NULL	2
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	1
+NULL	2
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Top N Key Operator
+                    sort order: -+
+                    keys: a (type: int), b (type: int)
+                    null sort order: zz
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 7
+                    Select Operator
+                      expressions: a (type: int), b (type: int)
+                      outputColumnNames: a, b
+                      Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Top N Key Operator
+                        sort order: -++
+                        keys: a (type: int), b (type: int), 0L (type: bigint)
+                        null sort order: zza
+                        Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        top n: 7
+                        Group By Operator
+                          keys: a (type: int), b (type: int), 0L (type: bigint)
+                          minReductionHashAggr: 0.15384614
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2
+                          Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            null sort order: zza
+                            sort order: -++
+                            Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int)
+                  null sort order: zz
+                  sort order: -+
+                  Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	NULL
+NULL	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	NULL
+NULL	NULL
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Top N Key Operator
+                    sort order: -+
+                    keys: a (type: int), b (type: int)
+                    null sort order: zz
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 7
+                    Select Operator
+                      expressions: a (type: int), b (type: int)
+                      outputColumnNames: a, b
+                      Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Top N Key Operator
+                        sort order: -++
+                        keys: a (type: int), b (type: int), 0L (type: bigint)
+                        null sort order: zza
+                        Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        top n: 7
+                        Group By Operator
+                          keys: a (type: int), b (type: int), 0L (type: bigint)
+                          minReductionHashAggr: 0.15384614
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2
+                          Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            null sort order: zza
+                            sort order: -++
+                            Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int)
+                  null sort order: zz
+                  sort order: -+
+                  Statistics: Num rows: 13 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 13 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	NULL
+NULL	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	NULL
+NULL	NULL
+PREHOOK: query: EXPLAIN
+SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: a (type: int), b (type: int), c (type: int)
+                    outputColumnNames: a, b, c
+                    Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      keys: a (type: int), b (type: int), c (type: int)
+                      minReductionHashAggr: 0.0
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 6 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int)
+                        null sort order: aaa
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: int)
+                        Statistics: Num rows: 6 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Top N Key Operator
+                sort order: -+
+                keys: KEY._col0 (type: int), KEY._col1 (type: int)
+                null sort order: zz
+                Statistics: Num rows: 6 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+                top n: 7
+                Group By Operator
+                  keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: int)
+                  mode: mergepartial
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 6 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
+                  Top N Key Operator
+                    sort order: -++
+                    keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint)
+                    null sort order: zza
+                    Statistics: Num rows: 6 Data size: 36 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 7
+                    Group By Operator
+                      aggregations: max(_col2)
+                      keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint)
+                      minReductionHashAggr: 0.0
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      Statistics: Num rows: 6 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        null sort order: zza
+                        sort order: -++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        Statistics: Num rows: 6 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        TopN Hash Memory Usage: 0.1
+                        value expressions: _col3 (type: int)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: max(VALUE._col0)
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col3
+                Statistics: Num rows: 6 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Select Operator
+                  expressions: _col0 (type: int), _col1 (type: int), _col3 (type: int)
+                  outputColumnNames: _col0, _col1, _col2
+                  Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: int), _col1 (type: int)
+                    null sort order: zz
+                    sort order: -+
+                    Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                    TopN Hash Memory Usage: 0.1
+                    value expressions: _col2 (type: int)
+        Reducer 4 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int), VALUE._col0 (type: int)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 6 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11	12
+7	8	4
+6	2	1
+5	1	2
+5	2	3
+NULL	NULL	NULL
+NULL	NULL	12
+PREHOOK: query: SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11	12
+7	8	4
+6	2	1
+5	1	2
+5	2	3
+NULL	NULL	NULL
+NULL	NULL	12
+PREHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@t_test_grouping_sets
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@t_test_grouping_sets
+POSTHOOK: Output: default@t_test_grouping_sets
diff --git a/ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_functions.q.out b/ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_functions.q.out
new file mode 100644
index 0000000..0ec6e6d
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_functions.q.out
@@ -0,0 +1,440 @@
+PREHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@t_test_grouping_sets
+PREHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: Lineage: t_test_grouping_sets.a SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.b SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.c SCRIPT []
+PREHOOK: query: EXPLAIN
+SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: a (type: int), b (type: int), c (type: int)
+                    outputColumnNames: a, b, c
+                    Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      aggregations: sum(c)
+                      keys: a (type: int), b (type: int), 0L (type: bigint)
+                      minReductionHashAggr: 0.15384614
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      Statistics: Num rows: 26 Data size: 568 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        null sort order: aaa
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        Statistics: Num rows: 26 Data size: 568 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col3 (type: bigint)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: sum(VALUE._col0)
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col3
+                Statistics: Num rows: 26 Data size: 568 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Top N Key Operator
+                  sort order: +
+                  keys: _col1 (type: int)
+                  null sort order: z
+                  Statistics: Num rows: 26 Data size: 568 Basic stats: COMPLETE Column stats: COMPLETE
+                  top n: 7
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), _col3 (type: bigint)
+                    outputColumnNames: _col0, _col1, _col2
+                    Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE
+                    Reduce Output Operator
+                      key expressions: _col1 (type: int)
+                      null sort order: z
+                      sort order: +
+                      Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE
+                      TopN Hash Memory Usage: 0.1
+                      value expressions: _col0 (type: int), _col2 (type: bigint)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int), VALUE._col1 (type: bigint)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 296 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1	6
+5	1	6
+5	2	3
+NULL	2	4
+6	2	1
+7	8	12
+NULL	8	12
+PREHOOK: query: SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1	6
+5	1	6
+5	2	3
+NULL	2	4
+6	2	1
+7	8	12
+NULL	8	12
+PREHOOK: query: EXPLAIN
+SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: a (type: int), b (type: int), c (type: int)
+                    outputColumnNames: a, b, c
+                    Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      aggregations: min(c)
+                      keys: a (type: int), b (type: int), 0L (type: bigint)
+                      minReductionHashAggr: 0.15384614
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        null sort order: aaa
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col3 (type: int)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: min(VALUE._col0)
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col3
+                Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Top N Key Operator
+                  sort order: +
+                  keys: _col1 (type: int)
+                  null sort order: z
+                  Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                  top n: 7
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), _col3 (type: int)
+                    outputColumnNames: _col0, _col1, _col2
+                    Statistics: Num rows: 26 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                    Reduce Output Operator
+                      key expressions: _col1 (type: int)
+                      null sort order: z
+                      sort order: +
+                      Statistics: Num rows: 26 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                      TopN Hash Memory Usage: 0.1
+                      value expressions: _col0 (type: int), _col2 (type: int)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int), VALUE._col1 (type: int)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1	2
+5	1	2
+5	2	3
+NULL	2	1
+6	2	1
+7	8	4
+NULL	8	4
+PREHOOK: query: SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1	2
+5	1	2
+5	2	3
+NULL	2	1
+6	2	1
+7	8	4
+NULL	8	4
+PREHOOK: query: EXPLAIN
+SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: a (type: int), b (type: int), c (type: int)
+                    outputColumnNames: a, b, c
+                    Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      aggregations: max(c)
+                      keys: a (type: int), b (type: int), 0L (type: bigint)
+                      minReductionHashAggr: 0.15384614
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2, _col3
+                      Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        null sort order: aaa
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                        value expressions: _col3 (type: int)
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: max(VALUE._col0)
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1, _col3
+                Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Top N Key Operator
+                  sort order: +
+                  keys: _col1 (type: int)
+                  null sort order: z
+                  Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                  top n: 7
+                  Select Operator
+                    expressions: _col0 (type: int), _col1 (type: int), _col3 (type: int)
+                    outputColumnNames: _col0, _col1, _col2
+                    Statistics: Num rows: 26 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                    Reduce Output Operator
+                      key expressions: _col1 (type: int)
+                      null sort order: z
+                      sort order: +
+                      Statistics: Num rows: 26 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                      TopN Hash Memory Usage: 0.1
+                      value expressions: _col0 (type: int), _col2 (type: int)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int), VALUE._col1 (type: int)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 192 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1	2
+5	1	2
+5	2	3
+NULL	2	3
+6	2	1
+NULL	8	4
+7	8	4
+PREHOOK: query: SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1	2
+5	1	2
+5	2	3
+NULL	2	3
+6	2	1
+7	8	4
+NULL	8	4
+PREHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@t_test_grouping_sets
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@t_test_grouping_sets
+POSTHOOK: Output: default@t_test_grouping_sets
diff --git a/ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_order.q.out b/ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_order.q.out
new file mode 100644
index 0000000..d3ff1a6
--- /dev/null
+++ b/ql/src/test/results/clientpositive/llap/topnkey_grouping_sets_order.q.out
@@ -0,0 +1,553 @@
+PREHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@t_test_grouping_sets
+PREHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: Lineage: t_test_grouping_sets.a SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.b SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.c SCRIPT []
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: a (type: int), b (type: int)
+                    outputColumnNames: a, b
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      keys: a (type: int), b (type: int), 0L (type: bigint)
+                      minReductionHashAggr: 0.15384614
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        null sort order: aaa
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Top N Key Operator
+                  sort order: +
+                  keys: _col1 (type: int)
+                  null sort order: a
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                  top n: 7
+                  Reduce Output Operator
+                    key expressions: _col1 (type: int)
+                    null sort order: a
+                    sort order: +
+                    Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                    TopN Hash Memory Usage: 0.1
+                    value expressions: _col0 (type: int)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	NULL
+5	NULL
+6	NULL
+10	NULL
+7	NULL
+NULL	NULL
+NULL	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	NULL
+5	NULL
+6	NULL
+10	NULL
+7	NULL
+NULL	NULL
+NULL	NULL
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Select Operator
+                    expressions: a (type: int), b (type: int)
+                    outputColumnNames: a, b
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    Group By Operator
+                      keys: a (type: int), b (type: int), 0L (type: bigint)
+                      minReductionHashAggr: 0.15384614
+                      mode: hash
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        null sort order: aaa
+                        sort order: +++
+                        Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                        Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Top N Key Operator
+                  sort order: +
+                  keys: _col1 (type: int)
+                  null sort order: z
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                  top n: 7
+                  Reduce Output Operator
+                    key expressions: _col1 (type: int)
+                    null sort order: z
+                    sort order: +
+                    Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                    TopN Hash Memory Usage: 0.1
+                    value expressions: _col0 (type: int)
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 88 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 32 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+5	1
+5	2
+NULL	2
+6	2
+NULL	8
+7	8
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+5	1
+5	2
+NULL	2
+6	2
+NULL	8
+7	8
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Top N Key Operator
+                    sort order: -+
+                    keys: a (type: int), b (type: int)
+                    null sort order: zz
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 7
+                    Select Operator
+                      expressions: a (type: int), b (type: int)
+                      outputColumnNames: a, b
+                      Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Top N Key Operator
+                        sort order: -++
+                        keys: a (type: int), b (type: int), 0L (type: bigint)
+                        null sort order: zza
+                        Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        top n: 7
+                        Group By Operator
+                          keys: a (type: int), b (type: int), 0L (type: bigint)
+                          minReductionHashAggr: 0.15384614
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2
+                          Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            null sort order: zza
+                            sort order: -++
+                            Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int)
+                  null sort order: zz
+                  sort order: -+
+                  Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+10	NULL
+7	8
+7	NULL
+6	2
+6	NULL
+5	1
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+10	NULL
+7	8
+7	NULL
+6	2
+6	NULL
+5	1
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC NULLS FIRST, b ASC NULLS FIRST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC NULLS FIRST, b ASC NULLS FIRST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+#### A masked pattern was here ####
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: t_test_grouping_sets
+                  Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                  Top N Key Operator
+                    sort order: -+
+                    keys: a (type: int), b (type: int)
+                    null sort order: aa
+                    Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 7
+                    Select Operator
+                      expressions: a (type: int), b (type: int)
+                      outputColumnNames: a, b
+                      Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                      Top N Key Operator
+                        sort order: -++
+                        keys: a (type: int), b (type: int), 0L (type: bigint)
+                        null sort order: aaa
+                        Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+                        top n: 7
+                        Group By Operator
+                          keys: a (type: int), b (type: int), 0L (type: bigint)
+                          minReductionHashAggr: 0.15384614
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2
+                          Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                          Reduce Output Operator
+                            key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            null sort order: aaa
+                            sort order: -++
+                            Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                            Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+            Execution mode: llap
+            LLAP IO: no inputs
+        Reducer 2 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Group By Operator
+                keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                pruneGroupingSetId: true
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int)
+                  null sort order: aa
+                  sort order: -+
+                  Statistics: Num rows: 26 Data size: 216 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+        Reducer 3 
+            Execution mode: llap
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 26 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                Limit
+                  Number of rows: 7
+                  Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 7 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+                    table:
+                        input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC NULLS FIRST, b ASC NULLS FIRST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC NULLS FIRST, b ASC NULLS FIRST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	NULL
+NULL	NULL
+NULL	NULL
+NULL	NULL
+NULL	1
+NULL	2
+NULL	8
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC NULLS FIRST, b ASC NULLS FIRST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC NULLS FIRST, b ASC NULLS FIRST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	NULL
+NULL	NULL
+NULL	NULL
+NULL	NULL
+NULL	1
+NULL	2
+NULL	8
+PREHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@t_test_grouping_sets
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@t_test_grouping_sets
+POSTHOOK: Output: default@t_test_grouping_sets
diff --git a/ql/src/test/results/clientpositive/llap/vector_groupby_grouping_sets_limit.q.out b/ql/src/test/results/clientpositive/llap/vector_groupby_grouping_sets_limit.q.out
index c7e8379..3addfb9 100644
--- a/ql/src/test/results/clientpositive/llap/vector_groupby_grouping_sets_limit.q.out
+++ b/ql/src/test/results/clientpositive/llap/vector_groupby_grouping_sets_limit.q.out
@@ -64,53 +64,63 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                       vectorizationSchemaColumns: [0:a:string, 1:b:string, 2:c:string, 3:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
-                  Select Operator
-                    expressions: a (type: string), b (type: string)
-                    outputColumnNames: a, b
-                    Select Vectorization:
-                        className: VectorSelectOperator
-                        native: true
-                        projectedOutputColumnNums: [0, 1]
+                  Top N Key Operator
+                    sort order: ++
+                    keys: a (type: string), b (type: string)
+                    null sort order: zz
                     Statistics: Num rows: 6 Data size: 1020 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: count()
-                      Group By Vectorization:
-                          aggregators: VectorUDAFCountStar(*) -> bigint
-                          className: VectorGroupByOperator
-                          groupByMode: HASH
-                          keyExpressions: col 0:string, col 1:string, ConstantVectorExpression(val 0) -> 4:bigint
-                          native: false
-                          vectorProcessingMode: HASH
-                          projectedOutputColumnNums: [0]
-                      keys: a (type: string), b (type: string), 0L (type: bigint)
-                      minReductionHashAggr: 0.0
-                      mode: hash
-                      outputColumnNames: _col0, _col1, _col2, _col3
-                      Statistics: Num rows: 12 Data size: 2232 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 10
+                    Top N Key Vectorization:
+                        className: VectorTopNKeyOperator
+                        keyExpressions: col 0:string, col 1:string
+                        native: true
+                    Select Operator
+                      expressions: a (type: string), b (type: string)
+                      outputColumnNames: a, b
+                      Select Vectorization:
+                          className: VectorSelectOperator
+                          native: true
+                          projectedOutputColumnNums: [0, 1]
+                      Statistics: Num rows: 6 Data size: 1020 Basic stats: COMPLETE Column stats: COMPLETE
                       Top N Key Operator
-                        sort order: ++
-                        keys: _col0 (type: string), _col1 (type: string)
-                        null sort order: zz
-                        Statistics: Num rows: 12 Data size: 2232 Basic stats: COMPLETE Column stats: COMPLETE
+                        sort order: +++
+                        keys: a (type: string), b (type: string), 0L (type: bigint)
+                        null sort order: zza
+                        Statistics: Num rows: 6 Data size: 1020 Basic stats: COMPLETE Column stats: COMPLETE
                         top n: 10
                         Top N Key Vectorization:
                             className: VectorTopNKeyOperator
-                            keyExpressions: col 0:string, col 1:string
+                            keyExpressions: col 0:string, col 1:string, ConstantVectorExpression(val 0) -> 4:bigint
                             native: true
-                        Reduce Output Operator
-                          key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
-                          null sort order: zza
-                          sort order: +++
-                          Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
-                          Reduce Sink Vectorization:
-                              className: VectorReduceSinkMultiKeyOperator
-                              keyColumns: 0:string, 1:string, 2:bigint
-                              native: true
-                              nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                              valueColumns: 3:bigint
+                        Group By Operator
+                          aggregations: count()
+                          Group By Vectorization:
+                              aggregators: VectorUDAFCountStar(*) -> bigint
+                              className: VectorGroupByOperator
+                              groupByMode: HASH
+                              keyExpressions: col 0:string, col 1:string, ConstantVectorExpression(val 0) -> 5:bigint
+                              native: false
+                              vectorProcessingMode: HASH
+                              projectedOutputColumnNums: [0]
+                          keys: a (type: string), b (type: string), 0L (type: bigint)
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2, _col3
                           Statistics: Num rows: 12 Data size: 2232 Basic stats: COMPLETE Column stats: COMPLETE
-                          TopN Hash Memory Usage: 0.1
-                          value expressions: _col3 (type: bigint)
+                          Reduce Output Operator
+                            key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
+                            null sort order: zza
+                            sort order: +++
+                            Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
+                            Reduce Sink Vectorization:
+                                className: VectorReduceSinkMultiKeyOperator
+                                keyColumns: 0:string, 1:string, 2:bigint
+                                native: true
+                                nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                                valueColumns: 3:bigint
+                            Statistics: Num rows: 12 Data size: 2232 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+                            value expressions: _col3 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -127,7 +137,7 @@ STAGE PLANS:
                     includeColumns: [0, 1]
                     dataColumns: a:string, b:string, c:string
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint]
+                    scratchColumnTypeNames: [bigint, bigint]
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
@@ -282,53 +292,63 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                       vectorizationSchemaColumns: [0:a:string, 1:b:string, 2:c:string, 3:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
-                  Select Operator
-                    expressions: a (type: string), b (type: string)
-                    outputColumnNames: a, b
-                    Select Vectorization:
-                        className: VectorSelectOperator
-                        native: true
-                        projectedOutputColumnNums: [0, 1]
+                  Top N Key Operator
+                    sort order: ++
+                    keys: a (type: string), b (type: string)
+                    null sort order: zz
                     Statistics: Num rows: 6 Data size: 1020 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: count()
-                      Group By Vectorization:
-                          aggregators: VectorUDAFCountStar(*) -> bigint
-                          className: VectorGroupByOperator
-                          groupByMode: HASH
-                          keyExpressions: col 0:string, col 1:string, ConstantVectorExpression(val 0) -> 4:bigint
-                          native: false
-                          vectorProcessingMode: HASH
-                          projectedOutputColumnNums: [0]
-                      keys: a (type: string), b (type: string), 0L (type: bigint)
-                      minReductionHashAggr: 0.0
-                      mode: hash
-                      outputColumnNames: _col0, _col1, _col2, _col3
-                      Statistics: Num rows: 12 Data size: 2232 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 10
+                    Top N Key Vectorization:
+                        className: VectorTopNKeyOperator
+                        keyExpressions: col 0:string, col 1:string
+                        native: true
+                    Select Operator
+                      expressions: a (type: string), b (type: string)
+                      outputColumnNames: a, b
+                      Select Vectorization:
+                          className: VectorSelectOperator
+                          native: true
+                          projectedOutputColumnNums: [0, 1]
+                      Statistics: Num rows: 6 Data size: 1020 Basic stats: COMPLETE Column stats: COMPLETE
                       Top N Key Operator
-                        sort order: ++
-                        keys: _col0 (type: string), _col1 (type: string)
-                        null sort order: zz
-                        Statistics: Num rows: 12 Data size: 2232 Basic stats: COMPLETE Column stats: COMPLETE
+                        sort order: +++
+                        keys: a (type: string), b (type: string), 0L (type: bigint)
+                        null sort order: zza
+                        Statistics: Num rows: 6 Data size: 1020 Basic stats: COMPLETE Column stats: COMPLETE
                         top n: 10
                         Top N Key Vectorization:
                             className: VectorTopNKeyOperator
-                            keyExpressions: col 0:string, col 1:string
+                            keyExpressions: col 0:string, col 1:string, ConstantVectorExpression(val 0) -> 4:bigint
                             native: true
-                        Reduce Output Operator
-                          key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
-                          null sort order: zza
-                          sort order: +++
-                          Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
-                          Reduce Sink Vectorization:
-                              className: VectorReduceSinkMultiKeyOperator
-                              keyColumns: 0:string, 1:string, 2:bigint
-                              native: true
-                              nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                              valueColumns: 3:bigint
+                        Group By Operator
+                          aggregations: count()
+                          Group By Vectorization:
+                              aggregators: VectorUDAFCountStar(*) -> bigint
+                              className: VectorGroupByOperator
+                              groupByMode: HASH
+                              keyExpressions: col 0:string, col 1:string, ConstantVectorExpression(val 0) -> 5:bigint
+                              native: false
+                              vectorProcessingMode: HASH
+                              projectedOutputColumnNums: [0]
+                          keys: a (type: string), b (type: string), 0L (type: bigint)
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2, _col3
                           Statistics: Num rows: 12 Data size: 2232 Basic stats: COMPLETE Column stats: COMPLETE
-                          TopN Hash Memory Usage: 0.1
-                          value expressions: _col3 (type: bigint)
+                          Reduce Output Operator
+                            key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
+                            null sort order: zza
+                            sort order: +++
+                            Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
+                            Reduce Sink Vectorization:
+                                className: VectorReduceSinkMultiKeyOperator
+                                keyColumns: 0:string, 1:string, 2:bigint
+                                native: true
+                                nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                                valueColumns: 3:bigint
+                            Statistics: Num rows: 12 Data size: 2232 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+                            value expressions: _col3 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -345,7 +365,7 @@ STAGE PLANS:
                     includeColumns: [0, 1]
                     dataColumns: a:string, b:string, c:string
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint]
+                    scratchColumnTypeNames: [bigint, bigint]
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
@@ -500,53 +520,63 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                       vectorizationSchemaColumns: [0:a:string, 1:b:string, 2:c:string, 3:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
-                  Select Operator
-                    expressions: a (type: string), b (type: string)
-                    outputColumnNames: a, b
-                    Select Vectorization:
-                        className: VectorSelectOperator
-                        native: true
-                        projectedOutputColumnNums: [0, 1]
+                  Top N Key Operator
+                    sort order: ++
+                    keys: a (type: string), b (type: string)
+                    null sort order: zz
                     Statistics: Num rows: 6 Data size: 1020 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      aggregations: count()
-                      Group By Vectorization:
-                          aggregators: VectorUDAFCountStar(*) -> bigint
-                          className: VectorGroupByOperator
-                          groupByMode: HASH
-                          keyExpressions: col 0:string, col 1:string, ConstantVectorExpression(val 0) -> 4:bigint
-                          native: false
-                          vectorProcessingMode: HASH
-                          projectedOutputColumnNums: [0]
-                      keys: a (type: string), b (type: string), 0L (type: bigint)
-                      minReductionHashAggr: 0.0
-                      mode: hash
-                      outputColumnNames: _col0, _col1, _col2, _col3
-                      Statistics: Num rows: 6 Data size: 1116 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 10
+                    Top N Key Vectorization:
+                        className: VectorTopNKeyOperator
+                        keyExpressions: col 0:string, col 1:string
+                        native: true
+                    Select Operator
+                      expressions: a (type: string), b (type: string)
+                      outputColumnNames: a, b
+                      Select Vectorization:
+                          className: VectorSelectOperator
+                          native: true
+                          projectedOutputColumnNums: [0, 1]
+                      Statistics: Num rows: 6 Data size: 1020 Basic stats: COMPLETE Column stats: COMPLETE
                       Top N Key Operator
-                        sort order: ++
-                        keys: _col0 (type: string), _col1 (type: string)
-                        null sort order: zz
-                        Statistics: Num rows: 6 Data size: 1116 Basic stats: COMPLETE Column stats: COMPLETE
+                        sort order: +++
+                        keys: a (type: string), b (type: string), 0L (type: bigint)
+                        null sort order: zza
+                        Statistics: Num rows: 6 Data size: 1020 Basic stats: COMPLETE Column stats: COMPLETE
                         top n: 10
                         Top N Key Vectorization:
                             className: VectorTopNKeyOperator
-                            keyExpressions: col 0:string, col 1:string
+                            keyExpressions: col 0:string, col 1:string, ConstantVectorExpression(val 0) -> 4:bigint
                             native: true
-                        Reduce Output Operator
-                          key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
-                          null sort order: zza
-                          sort order: +++
-                          Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
-                          Reduce Sink Vectorization:
-                              className: VectorReduceSinkMultiKeyOperator
-                              keyColumns: 0:string, 1:string, 2:bigint
-                              native: true
-                              nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
-                              valueColumns: 3:bigint
+                        Group By Operator
+                          aggregations: count()
+                          Group By Vectorization:
+                              aggregators: VectorUDAFCountStar(*) -> bigint
+                              className: VectorGroupByOperator
+                              groupByMode: HASH
+                              keyExpressions: col 0:string, col 1:string, ConstantVectorExpression(val 0) -> 5:bigint
+                              native: false
+                              vectorProcessingMode: HASH
+                              projectedOutputColumnNums: [0]
+                          keys: a (type: string), b (type: string), 0L (type: bigint)
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2, _col3
                           Statistics: Num rows: 6 Data size: 1116 Basic stats: COMPLETE Column stats: COMPLETE
-                          TopN Hash Memory Usage: 0.1
-                          value expressions: _col3 (type: bigint)
+                          Reduce Output Operator
+                            key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
+                            null sort order: zza
+                            sort order: +++
+                            Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: bigint)
+                            Reduce Sink Vectorization:
+                                className: VectorReduceSinkMultiKeyOperator
+                                keyColumns: 0:string, 1:string, 2:bigint
+                                native: true
+                                nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                                valueColumns: 3:bigint
+                            Statistics: Num rows: 6 Data size: 1116 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
+                            value expressions: _col3 (type: bigint)
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -563,7 +593,7 @@ STAGE PLANS:
                     includeColumns: [0, 1]
                     dataColumns: a:string, b:string, c:string
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint]
+                    scratchColumnTypeNames: [bigint, bigint]
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
@@ -718,49 +748,59 @@ STAGE PLANS:
                   TableScan Vectorization:
                       native: true
                       vectorizationSchemaColumns: [0:a:string, 1:b:string, 2:c:string, 3:ROW__ID:struct<writeid:bigint,bucketid:int,rowid:bigint>]
-                  Select Operator
-                    expressions: a (type: string), b (type: string), c (type: string)
-                    outputColumnNames: a, b, c
-                    Select Vectorization:
-                        className: VectorSelectOperator
-                        native: true
-                        projectedOutputColumnNums: [0, 1, 2]
+                  Top N Key Operator
+                    sort order: +
+                    keys: a (type: string)
+                    null sort order: z
                     Statistics: Num rows: 6 Data size: 1530 Basic stats: COMPLETE Column stats: COMPLETE
-                    Group By Operator
-                      Group By Vectorization:
-                          className: VectorGroupByOperator
-                          groupByMode: HASH
-                          keyExpressions: col 0:string, col 1:string, col 2:string, ConstantVectorExpression(val 0) -> 4:bigint
-                          native: false
-                          vectorProcessingMode: HASH
-                          projectedOutputColumnNums: []
-                      keys: a (type: string), b (type: string), c (type: string), 0L (type: bigint)
-                      minReductionHashAggr: 0.0
-                      mode: hash
-                      outputColumnNames: _col0, _col1, _col2, _col3
-                      Statistics: Num rows: 9 Data size: 2367 Basic stats: COMPLETE Column stats: COMPLETE
+                    top n: 10
+                    Top N Key Vectorization:
+                        className: VectorTopNKeyOperator
+                        keyExpressions: col 0:string
+                        native: true
+                    Select Operator
+                      expressions: a (type: string), b (type: string), c (type: string)
+                      outputColumnNames: a, b, c
+                      Select Vectorization:
+                          className: VectorSelectOperator
+                          native: true
+                          projectedOutputColumnNums: [0, 1, 2]
+                      Statistics: Num rows: 6 Data size: 1530 Basic stats: COMPLETE Column stats: COMPLETE
                       Top N Key Operator
-                        sort order: +
-                        keys: _col0 (type: string)
-                        null sort order: z
-                        Statistics: Num rows: 9 Data size: 2367 Basic stats: COMPLETE Column stats: COMPLETE
+                        sort order: ++++
+                        keys: a (type: string), b (type: string), c (type: string), 0L (type: bigint)
+                        null sort order: zaaa
+                        Statistics: Num rows: 6 Data size: 1530 Basic stats: COMPLETE Column stats: COMPLETE
                         top n: 10
                         Top N Key Vectorization:
                             className: VectorTopNKeyOperator
-                            keyExpressions: col 0:string
+                            keyExpressions: col 0:string, col 1:string, col 2:string, ConstantVectorExpression(val 0) -> 4:bigint
                             native: true
-                        Reduce Output Operator
-                          key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: bigint)
-                          null sort order: zaaa
-                          sort order: ++++
-                          Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: bigint)
-                          Reduce Sink Vectorization:
-                              className: VectorReduceSinkMultiKeyOperator
-                              keyColumns: 0:string, 1:string, 2:string, 3:bigint
-                              native: true
-                              nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                        Group By Operator
+                          Group By Vectorization:
+                              className: VectorGroupByOperator
+                              groupByMode: HASH
+                              keyExpressions: col 0:string, col 1:string, col 2:string, ConstantVectorExpression(val 0) -> 5:bigint
+                              native: false
+                              vectorProcessingMode: HASH
+                              projectedOutputColumnNums: []
+                          keys: a (type: string), b (type: string), c (type: string), 0L (type: bigint)
+                          minReductionHashAggr: 0.0
+                          mode: hash
+                          outputColumnNames: _col0, _col1, _col2, _col3
                           Statistics: Num rows: 9 Data size: 2367 Basic stats: COMPLETE Column stats: COMPLETE
-                          TopN Hash Memory Usage: 0.1
+                          Reduce Output Operator
+                            key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: bigint)
+                            null sort order: zaaa
+                            sort order: ++++
+                            Map-reduce partition columns: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: bigint)
+                            Reduce Sink Vectorization:
+                                className: VectorReduceSinkMultiKeyOperator
+                                keyColumns: 0:string, 1:string, 2:string, 3:bigint
+                                native: true
+                                nativeConditionsMet: hive.vectorized.execution.reducesink.new.enabled IS true, hive.execution.engine tez IN [tez, spark] IS true, No PTF TopN IS true, No DISTINCT columns IS true, BinarySortableSerDe for keys IS true, LazyBinarySerDe for values IS true
+                            Statistics: Num rows: 9 Data size: 2367 Basic stats: COMPLETE Column stats: COMPLETE
+                            TopN Hash Memory Usage: 0.1
             Execution mode: vectorized, llap
             LLAP IO: all inputs
             Map Vectorization:
@@ -777,7 +817,7 @@ STAGE PLANS:
                     includeColumns: [0, 1, 2]
                     dataColumns: a:string, b:string, c:string
                     partitionColumnCount: 0
-                    scratchColumnTypeNames: [bigint]
+                    scratchColumnTypeNames: [bigint, bigint]
         Reducer 2 
             Execution mode: vectorized, llap
             Reduce Vectorization:
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query14.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query14.q.out
index d1e8c38..753b01f 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query14.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query14.q.out
@@ -1,6 +1,6 @@
-Warning: Shuffle Join MERGEJOIN[1175][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 6' is a cross product
-Warning: Shuffle Join MERGEJOIN[1182][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
-Warning: Shuffle Join MERGEJOIN[1189][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 22' is a cross product
+Warning: Shuffle Join MERGEJOIN[1178][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 6' is a cross product
+Warning: Shuffle Join MERGEJOIN[1185][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
+Warning: Shuffle Join MERGEJOIN[1192][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 22' is a cross product
 PREHOOK: query: explain cbo
 with  cross_items as
  (select i_item_sk ss_item_sk
diff --git a/ql/src/test/results/clientpositive/perf/tez/cbo_query77.q.out b/ql/src/test/results/clientpositive/perf/tez/cbo_query77.q.out
index aa08060..f3d4811 100644
--- a/ql/src/test/results/clientpositive/perf/tez/cbo_query77.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/cbo_query77.q.out
@@ -1,4 +1,4 @@
-Warning: Shuffle Join MERGEJOIN[319][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
+Warning: Shuffle Join MERGEJOIN[322][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
 PREHOOK: query: explain cbo
 with ss as
  (select s_store_sk,
diff --git a/ql/src/test/results/clientpositive/perf/tez/constraints/cbo_query14.q.out b/ql/src/test/results/clientpositive/perf/tez/constraints/cbo_query14.q.out
index 59fcf95..e751d07 100644
--- a/ql/src/test/results/clientpositive/perf/tez/constraints/cbo_query14.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/constraints/cbo_query14.q.out
@@ -1,6 +1,6 @@
-Warning: Shuffle Join MERGEJOIN[1193][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 6' is a cross product
-Warning: Shuffle Join MERGEJOIN[1200][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
-Warning: Shuffle Join MERGEJOIN[1207][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 22' is a cross product
+Warning: Shuffle Join MERGEJOIN[1196][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 6' is a cross product
+Warning: Shuffle Join MERGEJOIN[1203][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
+Warning: Shuffle Join MERGEJOIN[1210][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 22' is a cross product
 PREHOOK: query: explain cbo
 with  cross_items as
  (select i_item_sk ss_item_sk
diff --git a/ql/src/test/results/clientpositive/perf/tez/constraints/cbo_query77.q.out b/ql/src/test/results/clientpositive/perf/tez/constraints/cbo_query77.q.out
index 39da7ea..d953cd9 100644
--- a/ql/src/test/results/clientpositive/perf/tez/constraints/cbo_query77.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/constraints/cbo_query77.q.out
@@ -1,4 +1,4 @@
-Warning: Shuffle Join MERGEJOIN[227][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 14' is a cross product
+Warning: Shuffle Join MERGEJOIN[230][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 14' is a cross product
 PREHOOK: query: explain cbo
 with ss as
  (select s_store_sk,
diff --git a/ql/src/test/results/clientpositive/perf/tez/constraints/query14.q.out b/ql/src/test/results/clientpositive/perf/tez/constraints/query14.q.out
index 65d3faa..44da18a 100644
--- a/ql/src/test/results/clientpositive/perf/tez/constraints/query14.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/constraints/query14.q.out
@@ -1,6 +1,6 @@
-Warning: Shuffle Join MERGEJOIN[1193][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 6' is a cross product
-Warning: Shuffle Join MERGEJOIN[1200][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
-Warning: Shuffle Join MERGEJOIN[1207][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 22' is a cross product
+Warning: Shuffle Join MERGEJOIN[1196][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 6' is a cross product
+Warning: Shuffle Join MERGEJOIN[1203][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
+Warning: Shuffle Join MERGEJOIN[1210][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 22' is a cross product
 PREHOOK: query: explain
 with  cross_items as
  (select i_item_sk ss_item_sk
@@ -296,36 +296,36 @@ Stage-0
     limit:100
     Stage-1
       Reducer 9 vectorized
-      File Output Operator [FS_1363]
-        Limit [LIM_1362] (rows=100 width=223)
+      File Output Operator [FS_1366]
+        Limit [LIM_1365] (rows=100 width=223)
           Number of rows:100
-          Select Operator [SEL_1361] (rows=304320 width=223)
+          Select Operator [SEL_1364] (rows=304320 width=223)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
           <-Reducer 8 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_1360]
-              Select Operator [SEL_1359] (rows=304320 width=223)
+            SHUFFLE [RS_1363]
+              Select Operator [SEL_1362] (rows=304320 width=223)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                Group By Operator [GBY_1358] (rows=304320 width=231)
+                Group By Operator [GBY_1361] (rows=304320 width=231)
                   Output:["_col0","_col1","_col2","_col3","_col5","_col6"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
                 <-Union 7 [SIMPLE_EDGE]
                   <-Reducer 16 [CONTAINS]
-                    Reduce Output Operator [RS_1206]
+                    Reduce Output Operator [RS_1209]
                       PartitionCols:_col0, _col1, _col2, _col3, _col4
-                      Top N Key Operator [TNK_1205] (rows=304320 width=231)
-                        keys:_col0, _col1, _col2, _col3,top n:100
-                        Group By Operator [GBY_1204] (rows=304320 width=231)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
-                          Select Operator [SEL_1202] (rows=40576 width=223)
+                      Group By Operator [GBY_1208] (rows=304320 width=231)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
+                        Top N Key Operator [TNK_1207] (rows=121728 width=221)
+                          keys:_col0, _col1, _col2, _col3, 0L,top n:100
+                          Select Operator [SEL_1205] (rows=40576 width=223)
                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                            Filter Operator [FIL_1201] (rows=40576 width=244)
+                            Filter Operator [FIL_1204] (rows=40576 width=244)
                               predicate:(_col3 > _col5)
-                              Merge Join Operator [MERGEJOIN_1200] (rows=121728 width=244)
+                              Merge Join Operator [MERGEJOIN_1203] (rows=121728 width=244)
                                 Conds:(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                               <-Reducer 15 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1375]
-                                  Filter Operator [FIL_1374] (rows=121728 width=132)
+                                PARTITION_ONLY_SHUFFLE [RS_1378]
+                                  Filter Operator [FIL_1377] (rows=121728 width=132)
                                     predicate:_col3 is not null
-                                    Group By Operator [GBY_1373] (rows=121728 width=132)
+                                    Group By Operator [GBY_1376] (rows=121728 width=132)
                                       Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2
                                     <-Reducer 14 [SIMPLE_EDGE]
                                       SHUFFLE [RS_238]
@@ -334,374 +334,374 @@ Stage-0
                                           Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col3)","count()"],keys:_col0, _col1, _col2
                                           Select Operator [SEL_235] (rows=286549727 width=127)
                                             Output:["_col0","_col1","_col2","_col3"]
-                                            Merge Join Operator [MERGEJOIN_1173] (rows=286549727 width=127)
-                                              Conds:RS_232._col1=RS_1341._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9"]
+                                            Merge Join Operator [MERGEJOIN_1176] (rows=286549727 width=127)
+                                              Conds:RS_232._col1=RS_1344._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9"]
                                             <-Map 65 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_1341]
+                                              SHUFFLE [RS_1344]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_1332] (rows=462000 width=15)
+                                                Select Operator [SEL_1335] (rows=462000 width=15)
                                                   Output:["_col0","_col1","_col2","_col3"]
                                                   TableScan [TS_81] (rows=462000 width=15)
                                                     default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_brand_id","i_class_id","i_category_id"]
                                             <-Reducer 13 [SIMPLE_EDGE]
                                               SHUFFLE [RS_232]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_1172] (rows=286549727 width=119)
+                                                Merge Join Operator [MERGEJOIN_1175] (rows=286549727 width=119)
                                                   Conds:RS_229._col1=RS_230._col0(Inner),Output:["_col1","_col2","_col3"]
                                                 <-Reducer 12 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_229]
                                                     PartitionCols:_col1
-                                                    Merge Join Operator [MERGEJOIN_1164] (rows=286549727 width=119)
-                                                      Conds:RS_1368._col0=RS_1308._col0(Inner),Output:["_col1","_col2","_col3"]
+                                                    Merge Join Operator [MERGEJOIN_1167] (rows=286549727 width=119)
+                                                      Conds:RS_1371._col0=RS_1311._col0(Inner),Output:["_col1","_col2","_col3"]
                                                     <-Map 10 [SIMPLE_EDGE] vectorized
-                                                      PARTITION_ONLY_SHUFFLE [RS_1308]
+                                                      PARTITION_ONLY_SHUFFLE [RS_1311]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_1305] (rows=50 width=4)
+                                                        Select Operator [SEL_1308] (rows=50 width=4)
                                                           Output:["_col0"]
-                                                          Filter Operator [FIL_1304] (rows=50 width=12)
+                                                          Filter Operator [FIL_1307] (rows=50 width=12)
                                                             predicate:((d_year = 2000) and (d_moy = 11))
                                                             TableScan [TS_3] (rows=73049 width=12)
                                                               default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year","d_moy"]
                                                     <-Map 79 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1368]
+                                                      SHUFFLE [RS_1371]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_1367] (rows=286549727 width=123)
+                                                        Select Operator [SEL_1370] (rows=286549727 width=123)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_1366] (rows=286549727 width=123)
+                                                          Filter Operator [FIL_1369] (rows=286549727 width=123)
                                                             predicate:(cs_sold_date_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_227_date_dim_d_date_sk_min) AND DynamicValue(RS_227_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_227_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_143] (rows=287989836 width=123)
                                                               default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_item_sk","cs_quantity","cs_list_price"]
                                                             <-Reducer 17 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_1365]
-                                                                Group By Operator [GBY_1364] (rows=1 width=12)
+                                                              BROADCAST [RS_1368]
+                                                                Group By Operator [GBY_1367] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  PARTITION_ONLY_SHUFFLE [RS_1316]
-                                                                    Group By Operator [GBY_1313] (rows=1 width=12)
+                                                                  PARTITION_ONLY_SHUFFLE [RS_1319]
+                                                                    Group By Operator [GBY_1316] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_1309] (rows=50 width=4)
+                                                                      Select Operator [SEL_1312] (rows=50 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_1305]
+                                                                         Please refer to the previous Select Operator [SEL_1308]
                                                 <-Reducer 34 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_230]
                                                     PartitionCols:_col0
-                                                    Merge Join Operator [MERGEJOIN_1171] (rows=729 width=4)
-                                                      Conds:RS_1349._col1, _col2, _col3=RS_1372._col0, _col1, _col2(Inner),Output:["_col0"]
+                                                    Merge Join Operator [MERGEJOIN_1174] (rows=729 width=4)
+                                                      Conds:RS_1352._col1, _col2, _col3=RS_1375._col0, _col1, _col2(Inner),Output:["_col0"]
                                                     <-Map 65 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1349]
+                                                      SHUFFLE [RS_1352]
                                                         PartitionCols:_col1, _col2, _col3
-                                                        Select Operator [SEL_1342] (rows=458612 width=15)
+                                                        Select Operator [SEL_1345] (rows=458612 width=15)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_1333] (rows=458612 width=15)
+                                                          Filter Operator [FIL_1336] (rows=458612 width=15)
                                                             predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null)
                                                              Please refer to the previous TableScan [TS_81]
                                                     <-Reducer 33 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1372]
+                                                      SHUFFLE [RS_1375]
                                                         PartitionCols:_col0, _col1, _col2
-                                                        Select Operator [SEL_1371] (rows=1 width=12)
+                                                        Select Operator [SEL_1374] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"]
-                                                          Filter Operator [FIL_1370] (rows=1 width=20)
+                                                          Filter Operator [FIL_1373] (rows=1 width=20)
                                                             predicate:(_col3 = 3L)
-                                                            Group By Operator [GBY_1369] (rows=120960 width=20)
+                                                            Group By Operator [GBY_1372] (rows=120960 width=20)
                                                               Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                             <-Union 32 [SIMPLE_EDGE]
                                                               <-Reducer 31 [CONTAINS] vectorized
-                                                                Reduce Output Operator [RS_1426]
+                                                                Reduce Output Operator [RS_1429]
                                                                   PartitionCols:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1425] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1428] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                    Group By Operator [GBY_1424] (rows=120960 width=20)
+                                                                    Group By Operator [GBY_1427] (rows=120960 width=20)
                                                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                     <-Reducer 26 [SIMPLE_EDGE]
                                                                       SHUFFLE [RS_169]
                                                                         PartitionCols:_col0, _col1, _col2
                                                                         Group By Operator [GBY_25] (rows=3144960 width=19)
                                                                           Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col5, _col6
-                                                                          Merge Join Operator [MERGEJOIN_1153] (rows=546042657 width=11)
-                                                                            Conds:RS_21._col1=RS_1346._col0(Inner),Output:["_col4","_col5","_col6"]
+                                                                          Merge Join Operator [MERGEJOIN_1156] (rows=546042657 width=11)
+                                                                            Conds:RS_21._col1=RS_1349._col0(Inner),Output:["_col4","_col5","_col6"]
                                                                           <-Map 65 [SIMPLE_EDGE] vectorized
-                                                                            SHUFFLE [RS_1346]
+                                                                            SHUFFLE [RS_1349]
                                                                               PartitionCols:_col0
-                                                                              Select Operator [SEL_1338] (rows=458612 width=15)
+                                                                              Select Operator [SEL_1341] (rows=458612 width=15)
                                                                                 Output:["_col0","_col1","_col2","_col3"]
-                                                                                Filter Operator [FIL_1329] (rows=458612 width=15)
+                                                                                Filter Operator [FIL_1332] (rows=458612 width=15)
                                                                                   predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null)
                                                                                    Please refer to the previous TableScan [TS_81]
                                                                           <-Reducer 25 [SIMPLE_EDGE]
                                                                             SHUFFLE [RS_21]
                                                                               PartitionCols:_col1
-                                                                              Merge Join Operator [MERGEJOIN_1152] (rows=550076554 width=4)
-                                                                                Conds:RS_1420._col0=RS_1398._col0(Inner),Output:["_col1"]
+                                                                              Merge Join Operator [MERGEJOIN_1155] (rows=550076554 width=4)
+                                                                                Conds:RS_1423._col0=RS_1401._col0(Inner),Output:["_col1"]
                                                                               <-Map 39 [SIMPLE_EDGE] vectorized
-                                                                                SHUFFLE [RS_1398]
+                                                                                SHUFFLE [RS_1401]
                                                                                   PartitionCols:_col0
-                                                                                  Select Operator [SEL_1397] (rows=1957 width=4)
+                                                                                  Select Operator [SEL_1400] (rows=1957 width=4)
                                                                                     Output:["_col0"]
-                                                                                    Filter Operator [FIL_1396] (rows=1957 width=8)
+                                                                                    Filter Operator [FIL_1399] (rows=1957 width=8)
                                                                                       predicate:d_year BETWEEN 1999 AND 2001
                                                                                       TableScan [TS_12] (rows=73049 width=8)
                                                                                         default@date_dim,d1,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
                                                                               <-Map 24 [SIMPLE_EDGE] vectorized
-                                                                                SHUFFLE [RS_1420]
+                                                                                SHUFFLE [RS_1423]
                                                                                   PartitionCols:_col0
-                                                                                  Select Operator [SEL_1419] (rows=550076554 width=7)
+                                                                                  Select Operator [SEL_1422] (rows=550076554 width=7)
                                                                                     Output:["_col0","_col1"]
-                                                                                    Filter Operator [FIL_1418] (rows=550076554 width=7)
+                                                                                    Filter Operator [FIL_1421] (rows=550076554 width=7)
                                                                                       predicate:(ss_sold_date_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_19_d1_d_date_sk_min) AND DynamicValue(RS_19_d1_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_19_d1_d_date_sk_bloom_filter)))
                                                                                       TableScan [TS_9] (rows=575995635 width=7)
                                                                                         default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk"]
                                                                                       <-Reducer 40 [BROADCAST_EDGE] vectorized
-                                                                                        BROADCAST [RS_1417]
-                                                                                          Group By Operator [GBY_1416] (rows=1 width=12)
+                                                                                        BROADCAST [RS_1420]
+                                                                                          Group By Operator [GBY_1419] (rows=1 width=12)
                                                                                             Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                                           <-Map 39 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                            SHUFFLE [RS_1412]
-                                                                                              Group By Operator [GBY_1408] (rows=1 width=12)
+                                                                                            SHUFFLE [RS_1415]
+                                                                                              Group By Operator [GBY_1411] (rows=1 width=12)
                                                                                                 Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                                Select Operator [SEL_1399] (rows=1957 width=4)
+                                                                                                Select Operator [SEL_1402] (rows=1957 width=4)
                                                                                                   Output:["_col0"]
-                                                                                                   Please refer to the previous Select Operator [SEL_1397]
+                                                                                                   Please refer to the previous Select Operator [SEL_1400]
                                                               <-Reducer 44 [CONTAINS] vectorized
-                                                                Reduce Output Operator [RS_1440]
+                                                                Reduce Output Operator [RS_1443]
                                                                   PartitionCols:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1439] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1442] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                    Group By Operator [GBY_1438] (rows=120960 width=20)
+                                                                    Group By Operator [GBY_1441] (rows=120960 width=20)
                                                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                     <-Reducer 42 [SIMPLE_EDGE]
                                                                       SHUFFLE [RS_189]
                                                                         PartitionCols:_col0, _col1, _col2
                                                                         Group By Operator [GBY_45] (rows=1693440 width=19)
                                                                           Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col5, _col6
-                                                                          Merge Join Operator [MERGEJOIN_1155] (rows=284448361 width=11)
-                                                                            Conds:RS_41._col1=RS_1347._col0(Inner),Output:["_col4","_col5","_col6"]
+                                                                          Merge Join Operator [MERGEJOIN_1158] (rows=284448361 width=11)
+                                                                            Conds:RS_41._col1=RS_1350._col0(Inner),Output:["_col4","_col5","_col6"]
                                                                           <-Map 65 [SIMPLE_EDGE] vectorized
-                                                                            SHUFFLE [RS_1347]
+                                                                            SHUFFLE [RS_1350]
                                                                               PartitionCols:_col0
-                                                                              Select Operator [SEL_1339] (rows=458612 width=15)
+                                                                              Select Operator [SEL_1342] (rows=458612 width=15)
                                                                                 Output:["_col0","_col1","_col2","_col3"]
-                                                                                Filter Operator [FIL_1330] (rows=458612 width=15)
+                                                                                Filter Operator [FIL_1333] (rows=458612 width=15)
                                                                                   predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null)
                                                                                    Please refer to the previous TableScan [TS_81]
                                                                           <-Reducer 41 [SIMPLE_EDGE]
                                                                             SHUFFLE [RS_41]
                                                                               PartitionCols:_col1
-                                                                              Merge Join Operator [MERGEJOIN_1154] (rows=286549727 width=4)
-                                                                                Conds:RS_1434._col0=RS_1400._col0(Inner),Output:["_col1"]
+                                                                              Merge Join Operator [MERGEJOIN_1157] (rows=286549727 width=4)
+                                                                                Conds:RS_1437._col0=RS_1403._col0(Inner),Output:["_col1"]
                                                                               <-Map 39 [SIMPLE_EDGE] vectorized
-                                                                                SHUFFLE [RS_1400]
+                                                                                SHUFFLE [RS_1403]
                                                                                   PartitionCols:_col0
-                                                                                   Please refer to the previous Select Operator [SEL_1397]
+                                                                                   Please refer to the previous Select Operator [SEL_1400]
                                                                               <-Map 63 [SIMPLE_EDGE] vectorized
-                                                                                SHUFFLE [RS_1434]
+                                                                                SHUFFLE [RS_1437]
                                                                                   PartitionCols:_col0
-                                                                                  Select Operator [SEL_1433] (rows=286549727 width=7)
+                                                                                  Select Operator [SEL_1436] (rows=286549727 width=7)
                                                                                     Output:["_col0","_col1"]
-                                                                                    Filter Operator [FIL_1432] (rows=286549727 width=7)
+                                                                                    Filter Operator [FIL_1435] (rows=286549727 width=7)
                                                                                       predicate:(cs_sold_date_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_39_d2_d_date_sk_min) AND DynamicValue(RS_39_d2_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_39_d2_d_date_sk_bloom_filter)))
                                                                                       TableScan [TS_29] (rows=287989836 width=7)
                                                                                         default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_item_sk"]
                                                                                       <-Reducer 46 [BROADCAST_EDGE] vectorized
-                                                                                        BROADCAST [RS_1431]
-                                                                                          Group By Operator [GBY_1430] (rows=1 width=12)
+                                                                                        BROADCAST [RS_1434]
+                                                                                          Group By Operator [GBY_1433] (rows=1 width=12)
                                                                                             Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                                           <-Map 39 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                            SHUFFLE [RS_1413]
-                                                                                              Group By Operator [GBY_1409] (rows=1 width=12)
+                                                                                            SHUFFLE [RS_1416]
+                                                                                              Group By Operator [GBY_1412] (rows=1 width=12)
                                                                                                 Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                                Select Operator [SEL_1401] (rows=1957 width=4)
+                                                                                                Select Operator [SEL_1404] (rows=1957 width=4)
                                                                                                   Output:["_col0"]
-                                                                                                   Please refer to the previous Select Operator [SEL_1397]
+                                                                                                   Please refer to the previous Select Operator [SEL_1400]
                                                               <-Reducer 50 [CONTAINS] vectorized
-                                                                Reduce Output Operator [RS_1454]
+                                                                Reduce Output Operator [RS_1457]
                                                                   PartitionCols:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1453] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1456] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                    Group By Operator [GBY_1452] (rows=120960 width=20)
+                                                                    Group By Operator [GBY_1455] (rows=120960 width=20)
                                                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                     <-Reducer 48 [SIMPLE_EDGE]
                                                                       SHUFFLE [RS_210]
                                                                         PartitionCols:_col0, _col1, _col2
                                                                         Group By Operator [GBY_66] (rows=846720 width=19)
                                                                           Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col5, _col6
-                                                                          Merge Join Operator [MERGEJOIN_1157] (rows=142911107 width=11)
-                                                                            Conds:RS_62._col1=RS_1348._col0(Inner),Output:["_col4","_col5","_col6"]
+                                                                          Merge Join Operator [MERGEJOIN_1160] (rows=142911107 width=11)
+                                                                            Conds:RS_62._col1=RS_1351._col0(Inner),Output:["_col4","_col5","_col6"]
                                                                           <-Map 65 [SIMPLE_EDGE] vectorized
-                                                                            SHUFFLE [RS_1348]
+                                                                            SHUFFLE [RS_1351]
                                                                               PartitionCols:_col0
-                                                                              Select Operator [SEL_1340] (rows=458612 width=15)
+                                                                              Select Operator [SEL_1343] (rows=458612 width=15)
                                                                                 Output:["_col0","_col1","_col2","_col3"]
-                                                                                Filter Operator [FIL_1331] (rows=458612 width=15)
+                                                                                Filter Operator [FIL_1334] (rows=458612 width=15)
                                                                                   predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null)
                                                                                    Please refer to the previous TableScan [TS_81]
                                                                           <-Reducer 47 [SIMPLE_EDGE]
                                                                             SHUFFLE [RS_62]
                                                                               PartitionCols:_col1
-                                                                              Merge Join Operator [MERGEJOIN_1156] (rows=143966864 width=4)
-                                                                                Conds:RS_1448._col0=RS_1402._col0(Inner),Output:["_col1"]
+                                                                              Merge Join Operator [MERGEJOIN_1159] (rows=143966864 width=4)
+                                                                                Conds:RS_1451._col0=RS_1405._col0(Inner),Output:["_col1"]
                                                                               <-Map 39 [SIMPLE_EDGE] vectorized
-                                                                                SHUFFLE [RS_1402]
+                                                                                SHUFFLE [RS_1405]
                                                                                   PartitionCols:_col0
-                                                                                   Please refer to the previous Select Operator [SEL_1397]
+                                                                                   Please refer to the previous Select Operator [SEL_1400]
                                                                               <-Map 64 [SIMPLE_EDGE] vectorized
-                                                                                SHUFFLE [RS_1448]
+                                                                                SHUFFLE [RS_1451]
                                                                                   PartitionCols:_col0
-                                                                                  Select Operator [SEL_1447] (rows=143966864 width=7)
+                                                                                  Select Operator [SEL_1450] (rows=143966864 width=7)
                                                                                     Output:["_col0","_col1"]
-                                                                                    Filter Operator [FIL_1446] (rows=143966864 width=7)
+                                                                                    Filter Operator [FIL_1449] (rows=143966864 width=7)
                                                                                       predicate:(ws_sold_date_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_60_d3_d_date_sk_min) AND DynamicValue(RS_60_d3_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_60_d3_d_date_sk_bloom_filter)))
                                                                                       TableScan [TS_50] (rows=144002668 width=7)
                                                                                         default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk"]
                                                                                       <-Reducer 52 [BROADCAST_EDGE] vectorized
-                                                                                        BROADCAST [RS_1445]
-                                                                                          Group By Operator [GBY_1444] (rows=1 width=12)
+                                                                                        BROADCAST [RS_1448]
+                                                                                          Group By Operator [GBY_1447] (rows=1 width=12)
                                                                                             Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                                           <-Map 39 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                            SHUFFLE [RS_1414]
-                                                                                              Group By Operator [GBY_1410] (rows=1 width=12)
+                                                                                            SHUFFLE [RS_1417]
+                                                                                              Group By Operator [GBY_1413] (rows=1 width=12)
                                                                                                 Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                                Select Operator [SEL_1403] (rows=1957 width=4)
+                                                                                                Select Operator [SEL_1406] (rows=1957 width=4)
                                                                                                   Output:["_col0"]
-                                                                                                   Please refer to the previous Select Operator [SEL_1397]
+                                                                                                   Please refer to the previous Select Operator [SEL_1400]
                               <-Reducer 59 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1379]
-                                  Select Operator [SEL_1378] (rows=1 width=112)
+                                PARTITION_ONLY_SHUFFLE [RS_1382]
+                                  Select Operator [SEL_1381] (rows=1 width=112)
                                     Output:["_col0"]
-                                    Filter Operator [FIL_1377] (rows=1 width=120)
+                                    Filter Operator [FIL_1380] (rows=1 width=120)
                                       predicate:(_col0 is not null and _col1 is not null)
-                                      Group By Operator [GBY_1376] (rows=1 width=120)
+                                      Group By Operator [GBY_1379] (rows=1 width=120)
                                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                       <-Union 58 [CUSTOM_SIMPLE_EDGE]
                                         <-Reducer 57 [CONTAINS]
-                                          Reduce Output Operator [RS_1261]
-                                            Group By Operator [GBY_1260] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1264]
+                                            Group By Operator [GBY_1263] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1259] (rows=980593145 width=112)
+                                              Select Operator [SEL_1262] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1257] (rows=550076554 width=110)
+                                                Select Operator [SEL_1260] (rows=550076554 width=110)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1256] (rows=550076554 width=110)
-                                                    Conds:RS_1463._col0=RS_1406._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1259] (rows=550076554 width=110)
+                                                    Conds:RS_1466._col0=RS_1409._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 39 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1406]
+                                                    SHUFFLE [RS_1409]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1397]
+                                                       Please refer to the previous Select Operator [SEL_1400]
                                                   <-Map 66 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1463]
+                                                    SHUFFLE [RS_1466]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1461] (rows=550076554 width=114)
+                                                      Select Operator [SEL_1464] (rows=550076554 width=114)
                                                         Output:["_col0","_col1","_col2"]
-                                                        Filter Operator [FIL_1460] (rows=550076554 width=114)
+                                                        Filter Operator [FIL_1463] (rows=550076554 width=114)
                                                           predicate:(ss_sold_date_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_106_date_dim_d_date_sk_min) AND DynamicValue(RS_106_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_106_date_dim_d_date_sk_bloom_filter)))
                                                           TableScan [TS_99] (rows=575995635 width=114)
                                                             default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_quantity","ss_list_price"]
                                                           <-Reducer 56 [BROADCAST_EDGE] vectorized
-                                                            BROADCAST [RS_1459]
-                                                              Group By Operator [GBY_1458] (rows=1 width=12)
+                                                            BROADCAST [RS_1462]
+                                                              Group By Operator [GBY_1461] (rows=1 width=12)
                                                                 Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                               <-Map 39 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                SHUFFLE [RS_1415]
-                                                                  Group By Operator [GBY_1411] (rows=1 width=12)
+                                                                SHUFFLE [RS_1418]
+                                                                  Group By Operator [GBY_1414] (rows=1 width=12)
                                                                     Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                    Select Operator [SEL_1405] (rows=1957 width=4)
+                                                                    Select Operator [SEL_1408] (rows=1957 width=4)
                                                                       Output:["_col0"]
-                                                                       Please refer to the previous Select Operator [SEL_1397]
+                                                                       Please refer to the previous Select Operator [SEL_1400]
                                         <-Reducer 69 [CONTAINS]
-                                          Reduce Output Operator [RS_1279]
-                                            Group By Operator [GBY_1278] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1282]
+                                            Group By Operator [GBY_1281] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1277] (rows=980593145 width=112)
+                                              Select Operator [SEL_1280] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1275] (rows=286549727 width=115)
+                                                Select Operator [SEL_1278] (rows=286549727 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1274] (rows=286549727 width=115)
-                                                    Conds:RS_1478._col0=RS_1469._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1277] (rows=286549727 width=115)
+                                                    Conds:RS_1481._col0=RS_1472._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 71 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1469]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1472]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1466] (rows=1957 width=4)
+                                                      Select Operator [SEL_1469] (rows=1957 width=4)
                                                         Output:["_col0"]
-                                                        Filter Operator [FIL_1465] (rows=1957 width=8)
+                                                        Filter Operator [FIL_1468] (rows=1957 width=8)
                                                           predicate:d_year BETWEEN 1998 AND 2000
                                                           TableScan [TS_112] (rows=73049 width=8)
                                                             default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
                                                   <-Map 67 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1478]
+                                                    SHUFFLE [RS_1481]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1476] (rows=286549727 width=119)
+                                                      Select Operator [SEL_1479] (rows=286549727 width=119)
                                                         Output:["_col0","_col1","_col2"]
-                                                        Filter Operator [FIL_1475] (rows=286549727 width=119)
+                                                        Filter Operator [FIL_1478] (rows=286549727 width=119)
                                                           predicate:(cs_sold_date_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_116_date_dim_d_date_sk_min) AND DynamicValue(RS_116_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_116_date_dim_d_date_sk_bloom_filter)))
                                                           TableScan [TS_109] (rows=287989836 width=119)
                                                             default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_quantity","cs_list_price"]
                                                           <-Reducer 72 [BROADCAST_EDGE] vectorized
-                                                            BROADCAST [RS_1474]
-                                                              Group By Operator [GBY_1473] (rows=1 width=12)
+                                                            BROADCAST [RS_1477]
+                                                              Group By Operator [GBY_1476] (rows=1 width=12)
                                                                 Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                               <-Map 71 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                PARTITION_ONLY_SHUFFLE [RS_1472]
-                                                                  Group By Operator [GBY_1471] (rows=1 width=12)
+                                                                PARTITION_ONLY_SHUFFLE [RS_1475]
+                                                                  Group By Operator [GBY_1474] (rows=1 width=12)
                                                                     Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                    Select Operator [SEL_1468] (rows=1957 width=4)
+                                                                    Select Operator [SEL_1471] (rows=1957 width=4)
                                                                       Output:["_col0"]
-                                                                       Please refer to the previous Select Operator [SEL_1466]
+                                                                       Please refer to the previous Select Operator [SEL_1469]
                                         <-Reducer 75 [CONTAINS]
-                                          Reduce Output Operator [RS_1297]
-                                            Group By Operator [GBY_1296] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1300]
+                                            Group By Operator [GBY_1299] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1295] (rows=980593145 width=112)
+                                              Select Operator [SEL_1298] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1293] (rows=143966864 width=115)
+                                                Select Operator [SEL_1296] (rows=143966864 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1292] (rows=143966864 width=115)
-                                                    Conds:RS_1493._col0=RS_1484._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1295] (rows=143966864 width=115)
+                                                    Conds:RS_1496._col0=RS_1487._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 77 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1484]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1487]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1481] (rows=1957 width=4)
+                                                      Select Operator [SEL_1484] (rows=1957 width=4)
                                                         Output:["_col0"]
-                                                        Filter Operator [FIL_1480] (rows=1957 width=8)
+                                                        Filter Operator [FIL_1483] (rows=1957 width=8)
                                                           predicate:d_year BETWEEN 1998 AND 2000
                                                           TableScan [TS_123] (rows=73049 width=8)
                                                             default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
                                                   <-Map 73 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1493]
+                                                    SHUFFLE [RS_1496]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1491] (rows=143966864 width=119)
+                                                      Select Operator [SEL_1494] (rows=143966864 width=119)
                                                         Output:["_col0","_col1","_col2"]
-                                                        Filter Operator [FIL_1490] (rows=143966864 width=119)
+                                                        Filter Operator [FIL_1493] (rows=143966864 width=119)
                                                           predicate:(ws_sold_date_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_127_date_dim_d_date_sk_min) AND DynamicValue(RS_127_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_127_date_dim_d_date_sk_bloom_filter)))
                                                           TableScan [TS_120] (rows=144002668 width=119)
                                                             default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_quantity","ws_list_price"]
                                                           <-Reducer 78 [BROADCAST_EDGE] vectorized
-                                                            BROADCAST [RS_1489]
-                                                              Group By Operator [GBY_1488] (rows=1 width=12)
+                                                            BROADCAST [RS_1492]
+                                                              Group By Operator [GBY_1491] (rows=1 width=12)
                                                                 Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                               <-Map 77 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                PARTITION_ONLY_SHUFFLE [RS_1487]
-                                                                  Group By Operator [GBY_1486] (rows=1 width=12)
+                                                                PARTITION_ONLY_SHUFFLE [RS_1490]
+                                                                  Group By Operator [GBY_1489] (rows=1 width=12)
                                                                     Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                    Select Operator [SEL_1483] (rows=1957 width=4)
+                                                                    Select Operator [SEL_1486] (rows=1957 width=4)
                                                                       Output:["_col0"]
-                                                                       Please refer to the previous Select Operator [SEL_1481]
+                                                                       Please refer to the previous Select Operator [SEL_1484]
                   <-Reducer 22 [CONTAINS]
-                    Reduce Output Operator [RS_1213]
+                    Reduce Output Operator [RS_1216]
                       PartitionCols:_col0, _col1, _col2, _col3, _col4
-                      Top N Key Operator [TNK_1212] (rows=304320 width=231)
-                        keys:_col0, _col1, _col2, _col3,top n:100
-                        Group By Operator [GBY_1211] (rows=304320 width=231)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
-                          Select Operator [SEL_1209] (rows=40576 width=219)
+                      Group By Operator [GBY_1215] (rows=304320 width=231)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
+                        Top N Key Operator [TNK_1214] (rows=121728 width=221)
+                          keys:_col0, _col1, _col2, _col3, 0L,top n:100
+                          Select Operator [SEL_1212] (rows=40576 width=219)
                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                            Filter Operator [FIL_1208] (rows=40576 width=244)
+                            Filter Operator [FIL_1211] (rows=40576 width=244)
                               predicate:(_col3 > _col5)
-                              Merge Join Operator [MERGEJOIN_1207] (rows=121728 width=244)
+                              Merge Join Operator [MERGEJOIN_1210] (rows=121728 width=244)
                                 Conds:(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                               <-Reducer 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1391]
-                                  Filter Operator [FIL_1390] (rows=121728 width=132)
+                                PARTITION_ONLY_SHUFFLE [RS_1394]
+                                  Filter Operator [FIL_1393] (rows=121728 width=132)
                                     predicate:_col3 is not null
-                                    Group By Operator [GBY_1389] (rows=121728 width=132)
+                                    Group By Operator [GBY_1392] (rows=121728 width=132)
                                       Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2
                                     <-Reducer 20 [SIMPLE_EDGE]
                                       SHUFFLE [RS_382]
@@ -710,185 +710,185 @@ Stage-0
                                           Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col3)","count()"],keys:_col0, _col1, _col2
                                           Select Operator [SEL_379] (rows=143966864 width=127)
                                             Output:["_col0","_col1","_col2","_col3"]
-                                            Merge Join Operator [MERGEJOIN_1186] (rows=143966864 width=127)
-                                              Conds:RS_376._col1=RS_1343._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9"]
+                                            Merge Join Operator [MERGEJOIN_1189] (rows=143966864 width=127)
+                                              Conds:RS_376._col1=RS_1346._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9"]
                                             <-Map 65 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_1343]
+                                              SHUFFLE [RS_1346]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_1334] (rows=462000 width=15)
+                                                Select Operator [SEL_1337] (rows=462000 width=15)
                                                   Output:["_col0","_col1","_col2","_col3"]
                                                    Please refer to the previous TableScan [TS_81]
                                             <-Reducer 19 [SIMPLE_EDGE]
                                               SHUFFLE [RS_376]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_1185] (rows=143966864 width=119)
+                                                Merge Join Operator [MERGEJOIN_1188] (rows=143966864 width=119)
                                                   Conds:RS_373._col1=RS_374._col0(Inner),Output:["_col1","_col2","_col3"]
                                                 <-Reducer 18 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_373]
                                                     PartitionCols:_col1
-                                                    Merge Join Operator [MERGEJOIN_1177] (rows=143966864 width=119)
-                                                      Conds:RS_1384._col0=RS_1310._col0(Inner),Output:["_col1","_col2","_col3"]
+                                                    Merge Join Operator [MERGEJOIN_1180] (rows=143966864 width=119)
+                                                      Conds:RS_1387._col0=RS_1313._col0(Inner),Output:["_col1","_col2","_col3"]
                                                     <-Map 10 [SIMPLE_EDGE] vectorized
-                                                      PARTITION_ONLY_SHUFFLE [RS_1310]
+                                                      PARTITION_ONLY_SHUFFLE [RS_1313]
                                                         PartitionCols:_col0
-                                                         Please refer to the previous Select Operator [SEL_1305]
+                                                         Please refer to the previous Select Operator [SEL_1308]
                                                     <-Map 80 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1384]
+                                                      SHUFFLE [RS_1387]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_1383] (rows=143966864 width=123)
+                                                        Select Operator [SEL_1386] (rows=143966864 width=123)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_1382] (rows=143966864 width=123)
+                                                          Filter Operator [FIL_1385] (rows=143966864 width=123)
                                                             predicate:(ws_sold_date_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_371_date_dim_d_date_sk_min) AND DynamicValue(RS_371_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_371_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_287] (rows=144002668 width=123)
                                                               default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_quantity","ws_list_price"]
                                                             <-Reducer 23 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_1381]
-                                                                Group By Operator [GBY_1380] (rows=1 width=12)
+                                                              BROADCAST [RS_1384]
+                                                                Group By Operator [GBY_1383] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  PARTITION_ONLY_SHUFFLE [RS_1317]
-                                                                    Group By Operator [GBY_1314] (rows=1 width=12)
+                                                                  PARTITION_ONLY_SHUFFLE [RS_1320]
+                                                                    Group By Operator [GBY_1317] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_1311] (rows=50 width=4)
+                                                                      Select Operator [SEL_1314] (rows=50 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_1305]
+                                                                         Please refer to the previous Select Operator [SEL_1308]
                                                 <-Reducer 38 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_374]
                                                     PartitionCols:_col0
-                                                    Merge Join Operator [MERGEJOIN_1184] (rows=729 width=4)
-                                                      Conds:RS_1350._col1, _col2, _col3=RS_1388._col0, _col1, _col2(Inner),Output:["_col0"]
+                                                    Merge Join Operator [MERGEJOIN_1187] (rows=729 width=4)
+                                                      Conds:RS_1353._col1, _col2, _col3=RS_1391._col0, _col1, _col2(Inner),Output:["_col0"]
                                                     <-Map 65 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1350]
+                                                      SHUFFLE [RS_1353]
                                                         PartitionCols:_col1, _col2, _col3
-                                                        Select Operator [SEL_1344] (rows=458612 width=15)
+                                                        Select Operator [SEL_1347] (rows=458612 width=15)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_1335] (rows=458612 width=15)
+                                                          Filter Operator [FIL_1338] (rows=458612 width=15)
                                                             predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null)
                                                              Please refer to the previous TableScan [TS_81]
                                                     <-Reducer 37 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1388]
+                                                      SHUFFLE [RS_1391]
                                                         PartitionCols:_col0, _col1, _col2
-                                                        Select Operator [SEL_1387] (rows=1 width=12)
+                                                        Select Operator [SEL_1390] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"]
-                                                          Filter Operator [FIL_1386] (rows=1 width=20)
+                                                          Filter Operator [FIL_1389] (rows=1 width=20)
                                                             predicate:(_col3 = 3L)
-                                                            Group By Operator [GBY_1385] (rows=120960 width=20)
+                                                            Group By Operator [GBY_1388] (rows=120960 width=20)
                                                               Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                             <-Union 36 [SIMPLE_EDGE]
                                                               <-Reducer 35 [CONTAINS] vectorized
-                                                                Reduce Output Operator [RS_1429]
+                                                                Reduce Output Operator [RS_1432]
                                                                   PartitionCols:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1428] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1431] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                    Group By Operator [GBY_1427] (rows=120960 width=20)
+                                                                    Group By Operator [GBY_1430] (rows=120960 width=20)
                                                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                     <-Reducer 26 [SIMPLE_EDGE]
                                                                       SHUFFLE [RS_313]
                                                                         PartitionCols:_col0, _col1, _col2
                                                                          Please refer to the previous Group By Operator [GBY_25]
                                                               <-Reducer 45 [CONTAINS] vectorized
-                                                                Reduce Output Operator [RS_1443]
+                                                                Reduce Output Operator [RS_1446]
                                                                   PartitionCols:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1442] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1445] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                    Group By Operator [GBY_1441] (rows=120960 width=20)
+                                                                    Group By Operator [GBY_1444] (rows=120960 width=20)
                                                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                     <-Reducer 42 [SIMPLE_EDGE]
                                                                       SHUFFLE [RS_333]
                                                                         PartitionCols:_col0, _col1, _col2
                                                                          Please refer to the previous Group By Operator [GBY_45]
                                                               <-Reducer 51 [CONTAINS] vectorized
-                                                                Reduce Output Operator [RS_1457]
+                                                                Reduce Output Operator [RS_1460]
                                                                   PartitionCols:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1456] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1459] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                    Group By Operator [GBY_1455] (rows=120960 width=20)
+                                                                    Group By Operator [GBY_1458] (rows=120960 width=20)
                                                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                     <-Reducer 48 [SIMPLE_EDGE]
                                                                       SHUFFLE [RS_354]
                                                                         PartitionCols:_col0, _col1, _col2
                                                                          Please refer to the previous Group By Operator [GBY_66]
                               <-Reducer 62 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1395]
-                                  Select Operator [SEL_1394] (rows=1 width=112)
+                                PARTITION_ONLY_SHUFFLE [RS_1398]
+                                  Select Operator [SEL_1397] (rows=1 width=112)
                                     Output:["_col0"]
-                                    Filter Operator [FIL_1393] (rows=1 width=120)
+                                    Filter Operator [FIL_1396] (rows=1 width=120)
                                       predicate:(_col0 is not null and _col1 is not null)
-                                      Group By Operator [GBY_1392] (rows=1 width=120)
+                                      Group By Operator [GBY_1395] (rows=1 width=120)
                                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                       <-Union 61 [CUSTOM_SIMPLE_EDGE]
                                         <-Reducer 60 [CONTAINS]
-                                          Reduce Output Operator [RS_1267]
-                                            Group By Operator [GBY_1266] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1270]
+                                            Group By Operator [GBY_1269] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1265] (rows=980593145 width=112)
+                                              Select Operator [SEL_1268] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1263] (rows=550076554 width=110)
+                                                Select Operator [SEL_1266] (rows=550076554 width=110)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1262] (rows=550076554 width=110)
-                                                    Conds:RS_1464._col0=RS_1407._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1265] (rows=550076554 width=110)
+                                                    Conds:RS_1467._col0=RS_1410._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 39 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1407]
+                                                    SHUFFLE [RS_1410]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1397]
+                                                       Please refer to the previous Select Operator [SEL_1400]
                                                   <-Map 66 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1464]
+                                                    SHUFFLE [RS_1467]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1461]
+                                                       Please refer to the previous Select Operator [SEL_1464]
                                         <-Reducer 70 [CONTAINS]
-                                          Reduce Output Operator [RS_1285]
-                                            Group By Operator [GBY_1284] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1288]
+                                            Group By Operator [GBY_1287] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1283] (rows=980593145 width=112)
+                                              Select Operator [SEL_1286] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1281] (rows=286549727 width=115)
+                                                Select Operator [SEL_1284] (rows=286549727 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1280] (rows=286549727 width=115)
-                                                    Conds:RS_1479._col0=RS_1470._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1283] (rows=286549727 width=115)
+                                                    Conds:RS_1482._col0=RS_1473._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 71 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1470]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1473]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1466]
+                                                       Please refer to the previous Select Operator [SEL_1469]
                                                   <-Map 67 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1479]
+                                                    SHUFFLE [RS_1482]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1476]
+                                                       Please refer to the previous Select Operator [SEL_1479]
                                         <-Reducer 76 [CONTAINS]
-                                          Reduce Output Operator [RS_1303]
-                                            Group By Operator [GBY_1302] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1306]
+                                            Group By Operator [GBY_1305] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1301] (rows=980593145 width=112)
+                                              Select Operator [SEL_1304] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1299] (rows=143966864 width=115)
+                                                Select Operator [SEL_1302] (rows=143966864 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1298] (rows=143966864 width=115)
-                                                    Conds:RS_1494._col0=RS_1485._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1301] (rows=143966864 width=115)
+                                                    Conds:RS_1497._col0=RS_1488._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 77 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1485]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1488]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1481]
+                                                       Please refer to the previous Select Operator [SEL_1484]
                                                   <-Map 73 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1494]
+                                                    SHUFFLE [RS_1497]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1491]
+                                                       Please refer to the previous Select Operator [SEL_1494]
                   <-Reducer 6 [CONTAINS]
-                    Reduce Output Operator [RS_1199]
+                    Reduce Output Operator [RS_1202]
                       PartitionCols:_col0, _col1, _col2, _col3, _col4
-                      Top N Key Operator [TNK_1198] (rows=304320 width=231)
-                        keys:_col0, _col1, _col2, _col3,top n:100
-                        Group By Operator [GBY_1197] (rows=304320 width=231)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
-                          Select Operator [SEL_1195] (rows=40576 width=221)
+                      Group By Operator [GBY_1201] (rows=304320 width=231)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
+                        Top N Key Operator [TNK_1200] (rows=121728 width=221)
+                          keys:_col0, _col1, _col2, _col3, 0L,top n:100
+                          Select Operator [SEL_1198] (rows=40576 width=221)
                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                            Filter Operator [FIL_1194] (rows=40576 width=244)
+                            Filter Operator [FIL_1197] (rows=40576 width=244)
                               predicate:(_col3 > _col5)
-                              Merge Join Operator [MERGEJOIN_1193] (rows=121728 width=244)
+                              Merge Join Operator [MERGEJOIN_1196] (rows=121728 width=244)
                                 Conds:(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                               <-Reducer 5 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1353]
-                                  Filter Operator [FIL_1352] (rows=121728 width=132)
+                                PARTITION_ONLY_SHUFFLE [RS_1356]
+                                  Filter Operator [FIL_1355] (rows=121728 width=132)
                                     predicate:_col3 is not null
-                                    Group By Operator [GBY_1351] (rows=121728 width=132)
+                                    Group By Operator [GBY_1354] (rows=121728 width=132)
                                       Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2
                                     <-Reducer 4 [SIMPLE_EDGE]
                                       SHUFFLE [RS_95]
@@ -897,165 +897,165 @@ Stage-0
                                           Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col3)","count()"],keys:_col0, _col1, _col2
                                           Select Operator [SEL_92] (rows=550076554 width=122)
                                             Output:["_col0","_col1","_col2","_col3"]
-                                            Merge Join Operator [MERGEJOIN_1160] (rows=550076554 width=122)
-                                              Conds:RS_89._col1=RS_1336._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9"]
+                                            Merge Join Operator [MERGEJOIN_1163] (rows=550076554 width=122)
+                                              Conds:RS_89._col1=RS_1339._col0(Inner),Output:["_col2","_col3","_col7","_col8","_col9"]
                                             <-Map 65 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_1336]
+                                              SHUFFLE [RS_1339]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_1327] (rows=462000 width=15)
+                                                Select Operator [SEL_1330] (rows=462000 width=15)
                                                   Output:["_col0","_col1","_col2","_col3"]
                                                    Please refer to the previous TableScan [TS_81]
                                             <-Reducer 3 [SIMPLE_EDGE]
                                               SHUFFLE [RS_89]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_1159] (rows=550076554 width=114)
+                                                Merge Join Operator [MERGEJOIN_1162] (rows=550076554 width=114)
                                                   Conds:RS_86._col1=RS_87._col0(Inner),Output:["_col1","_col2","_col3"]
                                                 <-Reducer 2 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_86]
                                                     PartitionCols:_col1
-                                                    Merge Join Operator [MERGEJOIN_1151] (rows=550076554 width=114)
-                                                      Conds:RS_1322._col0=RS_1306._col0(Inner),Output:["_col1","_col2","_col3"]
+                                                    Merge Join Operator [MERGEJOIN_1154] (rows=550076554 width=114)
+                                                      Conds:RS_1325._col0=RS_1309._col0(Inner),Output:["_col1","_col2","_col3"]
                                                     <-Map 10 [SIMPLE_EDGE] vectorized
-                                                      PARTITION_ONLY_SHUFFLE [RS_1306]
+                                                      PARTITION_ONLY_SHUFFLE [RS_1309]
                                                         PartitionCols:_col0
-                                                         Please refer to the previous Select Operator [SEL_1305]
+                                                         Please refer to the previous Select Operator [SEL_1308]
                                                     <-Map 1 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1322]
+                                                      SHUFFLE [RS_1325]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_1321] (rows=550076554 width=118)
+                                                        Select Operator [SEL_1324] (rows=550076554 width=118)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_1320] (rows=550076554 width=118)
+                                                          Filter Operator [FIL_1323] (rows=550076554 width=118)
                                                             predicate:(ss_sold_date_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_84_date_dim_d_date_sk_min) AND DynamicValue(RS_84_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_84_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_0] (rows=575995635 width=118)
                                                               default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_quantity","ss_list_price"]
                                                             <-Reducer 11 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_1319]
-                                                                Group By Operator [GBY_1318] (rows=1 width=12)
+                                                              BROADCAST [RS_1322]
+                                                                Group By Operator [GBY_1321] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  PARTITION_ONLY_SHUFFLE [RS_1315]
-                                                                    Group By Operator [GBY_1312] (rows=1 width=12)
+                                                                  PARTITION_ONLY_SHUFFLE [RS_1318]
+                                                                    Group By Operator [GBY_1315] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_1307] (rows=50 width=4)
+                                                                      Select Operator [SEL_1310] (rows=50 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_1305]
+                                                                         Please refer to the previous Select Operator [SEL_1308]
                                                 <-Reducer 30 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_87]
                                                     PartitionCols:_col0
-                                                    Merge Join Operator [MERGEJOIN_1158] (rows=729 width=4)
-                                                      Conds:RS_1345._col1, _col2, _col3=RS_1326._col0, _col1, _col2(Inner),Output:["_col0"]
+                                                    Merge Join Operator [MERGEJOIN_1161] (rows=729 width=4)
+                                                      Conds:RS_1348._col1, _col2, _col3=RS_1329._col0, _col1, _col2(Inner),Output:["_col0"]
                                                     <-Map 65 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1345]
+                                                      SHUFFLE [RS_1348]
                                                         PartitionCols:_col1, _col2, _col3
-                                                        Select Operator [SEL_1337] (rows=458612 width=15)
+                                                        Select Operator [SEL_1340] (rows=458612 width=15)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_1328] (rows=458612 width=15)
+                                                          Filter Operator [FIL_1331] (rows=458612 width=15)
                                                             predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null)
                                                              Please refer to the previous TableScan [TS_81]
                                                     <-Reducer 29 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1326]
+                                                      SHUFFLE [RS_1329]
                                                         PartitionCols:_col0, _col1, _col2
-                                                        Select Operator [SEL_1325] (rows=1 width=12)
+                                                        Select Operator [SEL_1328] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"]
-                                                          Filter Operator [FIL_1324] (rows=1 width=20)
+                                                          Filter Operator [FIL_1327] (rows=1 width=20)
                                                             predicate:(_col3 = 3L)
-                                                            Group By Operator [GBY_1323] (rows=120960 width=20)
+                                                            Group By Operator [GBY_1326] (rows=120960 width=20)
                                                               Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                             <-Union 28 [SIMPLE_EDGE]
                                                               <-Reducer 27 [CONTAINS] vectorized
-                                                                Reduce Output Operator [RS_1423]
+                                                                Reduce Output Operator [RS_1426]
                                                                   PartitionCols:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1422] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1425] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                    Group By Operator [GBY_1421] (rows=120960 width=20)
+                                                                    Group By Operator [GBY_1424] (rows=120960 width=20)
                                                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                     <-Reducer 26 [SIMPLE_EDGE]
                                                                       SHUFFLE [RS_26]
                                                                         PartitionCols:_col0, _col1, _col2
                                                                          Please refer to the previous Group By Operator [GBY_25]
                                                               <-Reducer 43 [CONTAINS] vectorized
-                                                                Reduce Output Operator [RS_1437]
+                                                                Reduce Output Operator [RS_1440]
                                                                   PartitionCols:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1436] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1439] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                    Group By Operator [GBY_1435] (rows=120960 width=20)
+                                                                    Group By Operator [GBY_1438] (rows=120960 width=20)
                                                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                     <-Reducer 42 [SIMPLE_EDGE]
                                                                       SHUFFLE [RS_46]
                                                                         PartitionCols:_col0, _col1, _col2
                                                                          Please refer to the previous Group By Operator [GBY_45]
                                                               <-Reducer 49 [CONTAINS] vectorized
-                                                                Reduce Output Operator [RS_1451]
+                                                                Reduce Output Operator [RS_1454]
                                                                   PartitionCols:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1450] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1453] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                    Group By Operator [GBY_1449] (rows=120960 width=20)
+                                                                    Group By Operator [GBY_1452] (rows=120960 width=20)
                                                                       Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                     <-Reducer 48 [SIMPLE_EDGE]
                                                                       SHUFFLE [RS_67]
                                                                         PartitionCols:_col0, _col1, _col2
                                                                          Please refer to the previous Group By Operator [GBY_66]
                               <-Reducer 55 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1357]
-                                  Select Operator [SEL_1356] (rows=1 width=112)
+                                PARTITION_ONLY_SHUFFLE [RS_1360]
+                                  Select Operator [SEL_1359] (rows=1 width=112)
                                     Output:["_col0"]
-                                    Filter Operator [FIL_1355] (rows=1 width=120)
+                                    Filter Operator [FIL_1358] (rows=1 width=120)
                                       predicate:(_col0 is not null and _col1 is not null)
-                                      Group By Operator [GBY_1354] (rows=1 width=120)
+                                      Group By Operator [GBY_1357] (rows=1 width=120)
                                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                       <-Union 54 [CUSTOM_SIMPLE_EDGE]
                                         <-Reducer 53 [CONTAINS]
-                                          Reduce Output Operator [RS_1255]
-                                            Group By Operator [GBY_1254] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1258]
+                                            Group By Operator [GBY_1257] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1253] (rows=980593145 width=112)
+                                              Select Operator [SEL_1256] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1251] (rows=550076554 width=110)
+                                                Select Operator [SEL_1254] (rows=550076554 width=110)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1250] (rows=550076554 width=110)
-                                                    Conds:RS_1462._col0=RS_1404._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1253] (rows=550076554 width=110)
+                                                    Conds:RS_1465._col0=RS_1407._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 39 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1404]
+                                                    SHUFFLE [RS_1407]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1397]
+                                                       Please refer to the previous Select Operator [SEL_1400]
                                                   <-Map 66 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1462]
+                                                    SHUFFLE [RS_1465]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1461]
+                                                       Please refer to the previous Select Operator [SEL_1464]
                                         <-Reducer 68 [CONTAINS]
-                                          Reduce Output Operator [RS_1273]
-                                            Group By Operator [GBY_1272] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1276]
+                                            Group By Operator [GBY_1275] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1271] (rows=980593145 width=112)
+                                              Select Operator [SEL_1274] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1269] (rows=286549727 width=115)
+                                                Select Operator [SEL_1272] (rows=286549727 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1268] (rows=286549727 width=115)
-                                                    Conds:RS_1477._col0=RS_1467._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1271] (rows=286549727 width=115)
+                                                    Conds:RS_1480._col0=RS_1470._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 71 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1467]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1470]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1466]
+                                                       Please refer to the previous Select Operator [SEL_1469]
                                                   <-Map 67 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1477]
+                                                    SHUFFLE [RS_1480]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1476]
+                                                       Please refer to the previous Select Operator [SEL_1479]
                                         <-Reducer 74 [CONTAINS]
-                                          Reduce Output Operator [RS_1291]
-                                            Group By Operator [GBY_1290] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1294]
+                                            Group By Operator [GBY_1293] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1289] (rows=980593145 width=112)
+                                              Select Operator [SEL_1292] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1287] (rows=143966864 width=115)
+                                                Select Operator [SEL_1290] (rows=143966864 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1286] (rows=143966864 width=115)
-                                                    Conds:RS_1492._col0=RS_1482._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1289] (rows=143966864 width=115)
+                                                    Conds:RS_1495._col0=RS_1485._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 77 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1482]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1485]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1481]
+                                                       Please refer to the previous Select Operator [SEL_1484]
                                                   <-Map 73 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1492]
+                                                    SHUFFLE [RS_1495]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1491]
+                                                       Please refer to the previous Select Operator [SEL_1494]
 
diff --git a/ql/src/test/results/clientpositive/perf/tez/constraints/query27.q.out b/ql/src/test/results/clientpositive/perf/tez/constraints/query27.q.out
index e1a48ea..4eb4116 100644
--- a/ql/src/test/results/clientpositive/perf/tez/constraints/query27.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/constraints/query27.q.out
@@ -71,95 +71,97 @@ Stage-0
     limit:100
     Stage-1
       Reducer 7 vectorized
-      File Output Operator [FS_126]
-        Limit [LIM_125] (rows=100 width=538)
+      File Output Operator [FS_129]
+        Limit [LIM_128] (rows=100 width=538)
           Number of rows:100
-          Select Operator [SEL_124] (rows=6526254 width=538)
+          Select Operator [SEL_127] (rows=6526254 width=538)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
           <-Reducer 6 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_123]
-              Select Operator [SEL_122] (rows=6526254 width=538)
+            SHUFFLE [RS_126]
+              Select Operator [SEL_125] (rows=6526254 width=538)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                Group By Operator [GBY_121] (rows=6526254 width=570)
+                Group By Operator [GBY_124] (rows=6526254 width=570)
                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)","sum(VALUE._col2)","count(VALUE._col3)","sum(VALUE._col4)","count(VALUE._col5)","sum(VALUE._col6)","count(VALUE._col7)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Reducer 5 [SIMPLE_EDGE]
                   SHUFFLE [RS_29]
                     PartitionCols:_col0, _col1, _col2
-                    Top N Key Operator [TNK_57] (rows=13907934 width=570)
-                      keys:_col0, _col1,top n:100
-                      Group By Operator [GBY_28] (rows=13907934 width=570)
-                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(_col2)","count(_col2)","sum(_col3)","count(_col3)","sum(_col4)","count(_col4)","sum(_col5)","count(_col5)"],keys:_col0, _col1, 0L
+                    Group By Operator [GBY_28] (rows=13907934 width=570)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(_col2)","count(_col2)","sum(_col3)","count(_col3)","sum(_col4)","count(_col4)","sum(_col5)","count(_col5)"],keys:_col0, _col1, 0L
+                      Top N Key Operator [TNK_60] (rows=4635978 width=186)
+                        keys:_col0, _col1, 0L,top n:100
                         Select Operator [SEL_26] (rows=4635978 width=186)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                          Merge Join Operator [MERGEJOIN_101] (rows=4635978 width=186)
-                            Conds:RS_23._col1=RS_120._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col11","_col13"]
-                          <-Map 12 [SIMPLE_EDGE] vectorized
-                            SHUFFLE [RS_120]
-                              PartitionCols:_col0
-                              Select Operator [SEL_119] (rows=462000 width=104)
-                                Output:["_col0","_col1"]
-                                TableScan [TS_12] (rows=462000 width=104)
-                                  default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
-                          <-Reducer 4 [SIMPLE_EDGE]
-                            SHUFFLE [RS_23]
-                              PartitionCols:_col1
-                              Merge Join Operator [MERGEJOIN_100] (rows=4635978 width=90)
-                                Conds:RS_20._col3=RS_118._col0(Inner),Output:["_col1","_col4","_col5","_col6","_col7","_col11"]
-                              <-Map 11 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_118]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_117] (rows=209 width=90)
-                                    Output:["_col0","_col1"]
-                                    Filter Operator [FIL_116] (rows=209 width=90)
-                                      predicate:(s_state) IN ('SD', 'FL', 'MI', 'LA', 'MO', 'SC')
-                                      TableScan [TS_9] (rows=1704 width=90)
-                                        default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_state"]
-                              <-Reducer 3 [SIMPLE_EDGE]
-                                SHUFFLE [RS_20]
-                                  PartitionCols:_col3
-                                  Merge Join Operator [MERGEJOIN_99] (rows=4635978 width=4)
-                                    Conds:RS_17._col0=RS_115._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7"]
-                                  <-Map 10 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_115]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_114] (rows=652 width=4)
-                                        Output:["_col0"]
-                                        Filter Operator [FIL_113] (rows=652 width=8)
-                                          predicate:(d_year = 2001)
-                                          TableScan [TS_6] (rows=73049 width=8)
-                                            default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                                  <-Reducer 2 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_17]
-                                      PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_98] (rows=4635978 width=4)
-                                        Conds:RS_112._col2=RS_104._col0(Inner),Output:["_col0","_col1","_col3","_col4","_col5","_col6","_col7"]
-                                      <-Map 8 [SIMPLE_EDGE] vectorized
-                                        PARTITION_ONLY_SHUFFLE [RS_104]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_103] (rows=14776 width=4)
-                                            Output:["_col0"]
-                                            Filter Operator [FIL_102] (rows=14776 width=268)
-                                              predicate:((cd_marital_status = 'U') and (cd_education_status = '2 yr Degree') and (cd_gender = 'M'))
-                                              TableScan [TS_3] (rows=1861800 width=268)
-                                                default@customer_demographics,customer_demographics,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_gender","cd_marital_status","cd_education_status"]
-                                      <-Map 1 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_112]
-                                          PartitionCols:_col2
-                                          Select Operator [SEL_111] (rows=501690006 width=340)
-                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                            Filter Operator [FIL_110] (rows=501690006 width=340)
-                                              predicate:(ss_cdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null and ss_cdemo_sk BETWEEN DynamicValue(RS_15_customer_demographics_cd_demo_sk_min) AND DynamicValue(RS_15_customer_demographics_cd_demo_sk_max) and in_bloom_filter(ss_cdemo_sk, DynamicValue(RS_15_customer_demographics_cd_demo_sk_bloom_filter)))
-                                              TableScan [TS_0] (rows=575995635 width=340)
-                                                default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_cdemo_sk","ss_store_sk","ss_quantity","ss_list_price","ss_sales_price","ss_coupon_amt"]
-                                              <-Reducer 9 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_109]
-                                                  Group By Operator [GBY_108] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                  <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_107]
-                                                      Group By Operator [GBY_106] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_105] (rows=14776 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_103]
+                          Top N Key Operator [TNK_58] (rows=4635978 width=186)
+                            keys:_col13, _col11,top n:100
+                            Merge Join Operator [MERGEJOIN_104] (rows=4635978 width=186)
+                              Conds:RS_23._col1=RS_123._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col11","_col13"]
+                            <-Map 12 [SIMPLE_EDGE] vectorized
+                              SHUFFLE [RS_123]
+                                PartitionCols:_col0
+                                Select Operator [SEL_122] (rows=462000 width=104)
+                                  Output:["_col0","_col1"]
+                                  TableScan [TS_12] (rows=462000 width=104)
+                                    default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
+                            <-Reducer 4 [SIMPLE_EDGE]
+                              SHUFFLE [RS_23]
+                                PartitionCols:_col1
+                                Merge Join Operator [MERGEJOIN_103] (rows=4635978 width=90)
+                                  Conds:RS_20._col3=RS_121._col0(Inner),Output:["_col1","_col4","_col5","_col6","_col7","_col11"]
+                                <-Map 11 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_121]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_120] (rows=209 width=90)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_119] (rows=209 width=90)
+                                        predicate:(s_state) IN ('SD', 'FL', 'MI', 'LA', 'MO', 'SC')
+                                        TableScan [TS_9] (rows=1704 width=90)
+                                          default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_state"]
+                                <-Reducer 3 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_20]
+                                    PartitionCols:_col3
+                                    Merge Join Operator [MERGEJOIN_102] (rows=4635978 width=4)
+                                      Conds:RS_17._col0=RS_118._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7"]
+                                    <-Map 10 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_118]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_117] (rows=652 width=4)
+                                          Output:["_col0"]
+                                          Filter Operator [FIL_116] (rows=652 width=8)
+                                            predicate:(d_year = 2001)
+                                            TableScan [TS_6] (rows=73049 width=8)
+                                              default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                    <-Reducer 2 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_17]
+                                        PartitionCols:_col0
+                                        Merge Join Operator [MERGEJOIN_101] (rows=4635978 width=4)
+                                          Conds:RS_115._col2=RS_107._col0(Inner),Output:["_col0","_col1","_col3","_col4","_col5","_col6","_col7"]
+                                        <-Map 8 [SIMPLE_EDGE] vectorized
+                                          PARTITION_ONLY_SHUFFLE [RS_107]
+                                            PartitionCols:_col0
+                                            Select Operator [SEL_106] (rows=14776 width=4)
+                                              Output:["_col0"]
+                                              Filter Operator [FIL_105] (rows=14776 width=268)
+                                                predicate:((cd_marital_status = 'U') and (cd_education_status = '2 yr Degree') and (cd_gender = 'M'))
+                                                TableScan [TS_3] (rows=1861800 width=268)
+                                                  default@customer_demographics,customer_demographics,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_gender","cd_marital_status","cd_education_status"]
+                                        <-Map 1 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_115]
+                                            PartitionCols:_col2
+                                            Select Operator [SEL_114] (rows=501690006 width=340)
+                                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                                              Filter Operator [FIL_113] (rows=501690006 width=340)
+                                                predicate:(ss_cdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null and ss_cdemo_sk BETWEEN DynamicValue(RS_15_customer_demographics_cd_demo_sk_min) AND DynamicValue(RS_15_customer_demographics_cd_demo_sk_max) and in_bloom_filter(ss_cdemo_sk, DynamicValue(RS_15_customer_demographics_cd_demo_sk_bloom_filter)))
+                                                TableScan [TS_0] (rows=575995635 width=340)
+                                                  default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_cdemo_sk","ss_store_sk","ss_quantity","ss_list_price","ss_sales_price","ss_coupon_amt"]
+                                                <-Reducer 9 [BROADCAST_EDGE] vectorized
+                                                  BROADCAST [RS_112]
+                                                    Group By Operator [GBY_111] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                    <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                      PARTITION_ONLY_SHUFFLE [RS_110]
+                                                        Group By Operator [GBY_109] (rows=1 width=12)
+                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                          Select Operator [SEL_108] (rows=14776 width=4)
+                                                            Output:["_col0"]
+                                                             Please refer to the previous Select Operator [SEL_106]
 
diff --git a/ql/src/test/results/clientpositive/perf/tez/constraints/query5.q.out b/ql/src/test/results/clientpositive/perf/tez/constraints/query5.q.out
index 13288d2..f78b2fa 100644
--- a/ql/src/test/results/clientpositive/perf/tez/constraints/query5.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/constraints/query5.q.out
@@ -303,229 +303,229 @@ Stage-0
     limit:100
     Stage-1
       Reducer 8 vectorized
-      File Output Operator [FS_302]
-        Limit [LIM_301] (rows=100 width=619)
+      File Output Operator [FS_305]
+        Limit [LIM_304] (rows=100 width=619)
           Number of rows:100
-          Select Operator [SEL_300] (rows=59581 width=619)
+          Select Operator [SEL_303] (rows=59581 width=619)
             Output:["_col0","_col1","_col2","_col3","_col4"]
           <-Reducer 7 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_299]
-              Select Operator [SEL_298] (rows=59581 width=619)
+            SHUFFLE [RS_302]
+              Select Operator [SEL_301] (rows=59581 width=619)
                 Output:["_col0","_col1","_col2","_col3","_col4"]
-                Group By Operator [GBY_297] (rows=59581 width=627)
+                Group By Operator [GBY_300] (rows=59581 width=627)
                   Output:["_col0","_col1","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Union 6 [SIMPLE_EDGE]
                   <-Reducer 14 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_312]
+                    Reduce Output Operator [RS_315]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_311] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_310] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_309] (rows=38846 width=619)
+                      Group By Operator [GBY_314] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_313] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_312] (rows=38846 width=619)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_308] (rows=38846 width=548)
+                            Group By Operator [GBY_311] (rows=38846 width=548)
                               Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
                             <-Reducer 13 [SIMPLE_EDGE]
                               SHUFFLE [RS_45]
                                 PartitionCols:_col0
                                 Group By Operator [GBY_44] (rows=26026820 width=548)
                                   Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col8
-                                  Merge Join Operator [MERGEJOIN_221] (rows=313339499 width=546)
-                                    Conds:RS_40._col0=RS_307._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
+                                  Merge Join Operator [MERGEJOIN_224] (rows=313339499 width=546)
+                                    Conds:RS_40._col0=RS_310._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
                                   <-Map 24 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_307]
+                                    SHUFFLE [RS_310]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_306] (rows=46000 width=104)
+                                      Select Operator [SEL_309] (rows=46000 width=104)
                                         Output:["_col0","_col1"]
                                         TableScan [TS_35] (rows=46000 width=104)
                                           default@catalog_page,catalog_page,Tbl:COMPLETE,Col:COMPLETE,Output:["cp_catalog_page_sk","cp_catalog_page_id"]
                                   <-Reducer 12 [SIMPLE_EDGE]
                                     SHUFFLE [RS_40]
                                       PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_220] (rows=313339499 width=450)
-                                        Conds:Union 22._col1=RS_275._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
+                                      Merge Join Operator [MERGEJOIN_223] (rows=313339499 width=450)
+                                        Conds:Union 22._col1=RS_278._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
                                       <-Map 10 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_275]
+                                        SHUFFLE [RS_278]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_272] (rows=8116 width=4)
+                                          Select Operator [SEL_275] (rows=8116 width=4)
                                             Output:["_col0"]
-                                            Filter Operator [FIL_271] (rows=8116 width=98)
+                                            Filter Operator [FIL_274] (rows=8116 width=98)
                                               predicate:CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-08-18 00:00:00'
                                               TableScan [TS_8] (rows=73049 width=98)
                                                 default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
                                       <-Union 22 [SIMPLE_EDGE]
                                         <-Map 21 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_324]
+                                          Reduce Output Operator [RS_327]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_323] (rows=285117694 width=455)
+                                            Select Operator [SEL_326] (rows=285117694 width=455)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_322] (rows=285117694 width=231)
+                                              Filter Operator [FIL_325] (rows=285117694 width=231)
                                                 predicate:(cs_sold_date_sk is not null and cs_catalog_page_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_38_date_dim_d_date_sk_min) AND DynamicValue(RS_38_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_38_date_dim_d_date_sk_bloom_filter)))
-                                                TableScan [TS_252] (rows=287989836 width=231)
+                                                TableScan [TS_255] (rows=287989836 width=231)
                                                   Output:["cs_sold_date_sk","cs_catalog_page_sk","cs_ext_sales_price","cs_net_profit"]
                                                 <-Reducer 15 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_321]
-                                                    Group By Operator [GBY_320] (rows=1 width=12)
+                                                  BROADCAST [RS_324]
+                                                    Group By Operator [GBY_323] (rows=1 width=12)
                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                     <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_283]
-                                                        Group By Operator [GBY_280] (rows=1 width=12)
+                                                      SHUFFLE [RS_286]
+                                                        Group By Operator [GBY_283] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_276] (rows=8116 width=4)
+                                                          Select Operator [SEL_279] (rows=8116 width=4)
                                                             Output:["_col0"]
-                                                             Please refer to the previous Select Operator [SEL_272]
+                                                             Please refer to the previous Select Operator [SEL_275]
                                         <-Map 23 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_327]
+                                          Reduce Output Operator [RS_330]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_326] (rows=28221805 width=451)
+                                            Select Operator [SEL_329] (rows=28221805 width=451)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_325] (rows=28221805 width=227)
+                                              Filter Operator [FIL_328] (rows=28221805 width=227)
                                                 predicate:(cr_catalog_page_sk is not null and cr_returned_date_sk is not null)
-                                                TableScan [TS_257] (rows=28798881 width=227)
+                                                TableScan [TS_260] (rows=28798881 width=227)
                                                   Output:["cr_returned_date_sk","cr_catalog_page_sk","cr_return_amount","cr_net_loss"]
                   <-Reducer 18 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_319]
+                    Reduce Output Operator [RS_322]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_318] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_317] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_316] (rows=53 width=615)
+                      Group By Operator [GBY_321] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_320] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_319] (rows=53 width=615)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_315] (rows=53 width=548)
+                            Group By Operator [GBY_318] (rows=53 width=548)
                               Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
                             <-Reducer 17 [SIMPLE_EDGE]
                               SHUFFLE [RS_77]
                                 PartitionCols:_col0
                                 Group By Operator [GBY_76] (rows=31641 width=548)
                                   Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col8
-                                  Merge Join Operator [MERGEJOIN_223] (rows=278713608 width=547)
-                                    Conds:RS_72._col0=RS_314._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
+                                  Merge Join Operator [MERGEJOIN_226] (rows=278713608 width=547)
+                                    Conds:RS_72._col0=RS_317._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
                                   <-Map 30 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_314]
+                                    SHUFFLE [RS_317]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_313] (rows=84 width=104)
+                                      Select Operator [SEL_316] (rows=84 width=104)
                                         Output:["_col0","_col1"]
                                         TableScan [TS_67] (rows=84 width=104)
                                           default@web_site,web_site,Tbl:COMPLETE,Col:COMPLETE,Output:["web_site_sk","web_site_id"]
                                   <-Reducer 16 [SIMPLE_EDGE]
                                     SHUFFLE [RS_72]
                                       PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_222] (rows=278713608 width=451)
-                                        Conds:Union 26._col1=RS_277._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
+                                      Merge Join Operator [MERGEJOIN_225] (rows=278713608 width=451)
+                                        Conds:Union 26._col1=RS_280._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
                                       <-Map 10 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_277]
+                                        SHUFFLE [RS_280]
                                           PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_272]
+                                           Please refer to the previous Select Operator [SEL_275]
                                       <-Union 26 [SIMPLE_EDGE]
                                         <-Map 25 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_332]
+                                          Reduce Output Operator [RS_335]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_331] (rows=143930874 width=455)
+                                            Select Operator [SEL_334] (rows=143930874 width=455)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_330] (rows=143930874 width=231)
+                                              Filter Operator [FIL_333] (rows=143930874 width=231)
                                                 predicate:(ws_web_site_sk is not null and ws_sold_date_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_70_date_dim_d_date_sk_min) AND DynamicValue(RS_70_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_70_date_dim_d_date_sk_bloom_filter)))
-                                                TableScan [TS_262] (rows=144002668 width=231)
+                                                TableScan [TS_265] (rows=144002668 width=231)
                                                   Output:["ws_sold_date_sk","ws_web_site_sk","ws_ext_sales_price","ws_net_profit"]
                                                 <-Reducer 19 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_329]
-                                                    Group By Operator [GBY_328] (rows=1 width=12)
+                                                  BROADCAST [RS_332]
+                                                    Group By Operator [GBY_331] (rows=1 width=12)
                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                     <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_284]
-                                                        Group By Operator [GBY_281] (rows=1 width=12)
+                                                      SHUFFLE [RS_287]
+                                                        Group By Operator [GBY_284] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_278] (rows=8116 width=4)
+                                                          Select Operator [SEL_281] (rows=8116 width=4)
                                                             Output:["_col0"]
-                                                             Please refer to the previous Select Operator [SEL_272]
+                                                             Please refer to the previous Select Operator [SEL_275]
                                         <-Reducer 28 [CONTAINS]
-                                          Reduce Output Operator [RS_270]
+                                          Reduce Output Operator [RS_273]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_268] (rows=134782734 width=454)
+                                            Select Operator [SEL_271] (rows=134782734 width=454)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Merge Join Operator [MERGEJOIN_267] (rows=134782734 width=230)
-                                                Conds:RS_335._col0, _col2=RS_338._col1, _col2(Inner),Output:["_col1","_col3","_col6","_col7"]
+                                              Merge Join Operator [MERGEJOIN_270] (rows=134782734 width=230)
+                                                Conds:RS_338._col0, _col2=RS_341._col1, _col2(Inner),Output:["_col1","_col3","_col6","_col7"]
                                               <-Map 27 [SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_335]
+                                                SHUFFLE [RS_338]
                                                   PartitionCols:_col0, _col2
-                                                  Select Operator [SEL_334] (rows=143966669 width=11)
+                                                  Select Operator [SEL_337] (rows=143966669 width=11)
                                                     Output:["_col0","_col1","_col2"]
-                                                    Filter Operator [FIL_333] (rows=143966669 width=11)
+                                                    Filter Operator [FIL_336] (rows=143966669 width=11)
                                                       predicate:ws_web_site_sk is not null
                                                       TableScan [TS_52] (rows=144002668 width=11)
                                                         default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_item_sk","ws_web_site_sk","ws_order_number"]
                                               <-Map 29 [SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_338]
+                                                SHUFFLE [RS_341]
                                                   PartitionCols:_col1, _col2
-                                                  Select Operator [SEL_337] (rows=13749816 width=225)
+                                                  Select Operator [SEL_340] (rows=13749816 width=225)
                                                     Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                    Filter Operator [FIL_336] (rows=13749816 width=225)
+                                                    Filter Operator [FIL_339] (rows=13749816 width=225)
                                                       predicate:wr_returned_date_sk is not null
                                                       TableScan [TS_55] (rows=14398467 width=225)
                                                         default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_returned_date_sk","wr_item_sk","wr_order_number","wr_return_amt","wr_net_loss"]
                   <-Reducer 5 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_296]
+                    Reduce Output Operator [RS_299]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_295] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_294] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_293] (rows=822 width=617)
+                      Group By Operator [GBY_298] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_297] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_296] (rows=822 width=617)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_292] (rows=822 width=548)
+                            Group By Operator [GBY_295] (rows=822 width=548)
                               Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
                             <-Reducer 4 [SIMPLE_EDGE]
                               SHUFFLE [RS_21]
                                 PartitionCols:_col0
                                 Group By Operator [GBY_20] (rows=983934 width=548)
                                   Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col8
-                                  Merge Join Operator [MERGEJOIN_219] (rows=578964757 width=528)
-                                    Conds:RS_16._col0=RS_291._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
+                                  Merge Join Operator [MERGEJOIN_222] (rows=578964757 width=528)
+                                    Conds:RS_16._col0=RS_294._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
                                   <-Map 20 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_291]
+                                    SHUFFLE [RS_294]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_290] (rows=1704 width=104)
+                                      Select Operator [SEL_293] (rows=1704 width=104)
                                         Output:["_col0","_col1"]
                                         TableScan [TS_11] (rows=1704 width=104)
                                           default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_id"]
                                   <-Reducer 3 [SIMPLE_EDGE]
                                     SHUFFLE [RS_16]
                                       PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_218] (rows=578964757 width=432)
-                                        Conds:Union 2._col1=RS_273._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
+                                      Merge Join Operator [MERGEJOIN_221] (rows=578964757 width=432)
+                                        Conds:Union 2._col1=RS_276._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
                                       <-Map 10 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_273]
+                                        SHUFFLE [RS_276]
                                           PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_272]
+                                           Please refer to the previous Select Operator [SEL_275]
                                       <-Union 2 [SIMPLE_EDGE]
                                         <-Map 1 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_289]
+                                          Reduce Output Operator [RS_292]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_288] (rows=525329897 width=445)
+                                            Select Operator [SEL_291] (rows=525329897 width=445)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_287] (rows=525329897 width=221)
+                                              Filter Operator [FIL_290] (rows=525329897 width=221)
                                                 predicate:(ss_sold_date_sk is not null and ss_store_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_14_date_dim_d_date_sk_min) AND DynamicValue(RS_14_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_14_date_dim_d_date_sk_bloom_filter)))
-                                                TableScan [TS_224] (rows=575995635 width=221)
+                                                TableScan [TS_227] (rows=575995635 width=221)
                                                   Output:["ss_sold_date_sk","ss_store_sk","ss_ext_sales_price","ss_net_profit"]
                                                 <-Reducer 11 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_286]
-                                                    Group By Operator [GBY_285] (rows=1 width=12)
+                                                  BROADCAST [RS_289]
+                                                    Group By Operator [GBY_288] (rows=1 width=12)
                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                     <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_282]
-                                                        Group By Operator [GBY_279] (rows=1 width=12)
+                                                      SHUFFLE [RS_285]
+                                                        Group By Operator [GBY_282] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_274] (rows=8116 width=4)
+                                                          Select Operator [SEL_277] (rows=8116 width=4)
                                                             Output:["_col0"]
-                                                             Please refer to the previous Select Operator [SEL_272]
+                                                             Please refer to the previous Select Operator [SEL_275]
                                         <-Map 9 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_305]
+                                          Reduce Output Operator [RS_308]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_304] (rows=53634860 width=447)
+                                            Select Operator [SEL_307] (rows=53634860 width=447)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_303] (rows=53634860 width=223)
+                                              Filter Operator [FIL_306] (rows=53634860 width=223)
                                                 predicate:(sr_store_sk is not null and sr_returned_date_sk is not null)
-                                                TableScan [TS_235] (rows=57591150 width=223)
+                                                TableScan [TS_238] (rows=57591150 width=223)
                                                   Output:["sr_returned_date_sk","sr_store_sk","sr_return_amt","sr_net_loss"]
 
diff --git a/ql/src/test/results/clientpositive/perf/tez/constraints/query77.q.out b/ql/src/test/results/clientpositive/perf/tez/constraints/query77.q.out
index c2758b7..40810d4 100644
--- a/ql/src/test/results/clientpositive/perf/tez/constraints/query77.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/constraints/query77.q.out
@@ -1,4 +1,4 @@
-Warning: Shuffle Join MERGEJOIN[227][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 14' is a cross product
+Warning: Shuffle Join MERGEJOIN[230][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 14' is a cross product
 PREHOOK: query: explain
 with ss as
  (select s_store_sk,
@@ -263,107 +263,107 @@ Stage-0
     limit:100
     Stage-1
       Reducer 7 vectorized
-      File Output Operator [FS_273]
-        Limit [LIM_272] (rows=100 width=438)
+      File Output Operator [FS_276]
+        Limit [LIM_275] (rows=100 width=438)
           Number of rows:100
-          Select Operator [SEL_271] (rows=564 width=438)
+          Select Operator [SEL_274] (rows=564 width=438)
             Output:["_col0","_col1","_col2","_col3","_col4"]
           <-Reducer 6 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_270]
-              Select Operator [SEL_269] (rows=564 width=438)
+            SHUFFLE [RS_273]
+              Select Operator [SEL_272] (rows=564 width=438)
                 Output:["_col0","_col1","_col2","_col3","_col4"]
-                Group By Operator [GBY_268] (rows=564 width=446)
+                Group By Operator [GBY_271] (rows=564 width=446)
                   Output:["_col0","_col1","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Union 5 [SIMPLE_EDGE]
                   <-Reducer 14 [CONTAINS]
-                    Reduce Output Operator [RS_232]
+                    Reduce Output Operator [RS_235]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_231] (rows=564 width=446)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_230] (rows=564 width=446)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_228] (rows=10 width=439)
+                      Group By Operator [GBY_234] (rows=564 width=446)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_233] (rows=531 width=435)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_231] (rows=10 width=439)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Merge Join Operator [MERGEJOIN_227] (rows=10 width=452)
+                            Merge Join Operator [MERGEJOIN_230] (rows=10 width=452)
                               Conds:(Inner),Output:["_col0","_col1","_col2","_col3","_col4"]
                             <-Reducer 13 [CUSTOM_SIMPLE_EDGE] vectorized
-                              PARTITION_ONLY_SHUFFLE [RS_280]
-                                Group By Operator [GBY_279] (rows=10 width=228)
+                              PARTITION_ONLY_SHUFFLE [RS_283]
+                                Group By Operator [GBY_282] (rows=10 width=228)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 12 [SIMPLE_EDGE]
                                   SHUFFLE [RS_45]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_44] (rows=2550 width=227)
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col1
-                                      Merge Join Operator [MERGEJOIN_214] (rows=286549727 width=227)
-                                        Conds:RS_278._col0=RS_244._col0(Inner),Output:["_col1","_col2","_col3"]
+                                      Merge Join Operator [MERGEJOIN_217] (rows=286549727 width=227)
+                                        Conds:RS_281._col0=RS_247._col0(Inner),Output:["_col1","_col2","_col3"]
                                       <-Map 8 [SIMPLE_EDGE] vectorized
-                                        PARTITION_ONLY_SHUFFLE [RS_244]
+                                        PARTITION_ONLY_SHUFFLE [RS_247]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_240] (rows=8116 width=4)
+                                          Select Operator [SEL_243] (rows=8116 width=4)
                                             Output:["_col0"]
-                                            Filter Operator [FIL_239] (rows=8116 width=98)
+                                            Filter Operator [FIL_242] (rows=8116 width=98)
                                               predicate:CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-09-03 00:00:00'
                                               TableScan [TS_3] (rows=73049 width=98)
                                                 default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
                                       <-Map 25 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_278]
+                                        SHUFFLE [RS_281]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_277] (rows=286549727 width=231)
+                                          Select Operator [SEL_280] (rows=286549727 width=231)
                                             Output:["_col0","_col1","_col2","_col3"]
-                                            Filter Operator [FIL_276] (rows=286549727 width=231)
+                                            Filter Operator [FIL_279] (rows=286549727 width=231)
                                               predicate:(cs_sold_date_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_41_date_dim_d_date_sk_min) AND DynamicValue(RS_41_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_41_date_dim_d_date_sk_bloom_filter)))
                                               TableScan [TS_34] (rows=287989836 width=231)
                                                 default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_call_center_sk","cs_ext_sales_price","cs_net_profit"]
                                               <-Reducer 15 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_275]
-                                                  Group By Operator [GBY_274] (rows=1 width=12)
+                                                BROADCAST [RS_278]
+                                                  Group By Operator [GBY_277] (rows=1 width=12)
                                                     Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                   <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_254]
-                                                      Group By Operator [GBY_251] (rows=1 width=12)
+                                                    PARTITION_ONLY_SHUFFLE [RS_257]
+                                                      Group By Operator [GBY_254] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_245] (rows=8116 width=4)
+                                                        Select Operator [SEL_248] (rows=8116 width=4)
                                                           Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_240]
+                                                           Please refer to the previous Select Operator [SEL_243]
                             <-Reducer 17 [CUSTOM_SIMPLE_EDGE] vectorized
-                              PARTITION_ONLY_SHUFFLE [RS_285]
-                                Group By Operator [GBY_284] (rows=1 width=224)
+                              PARTITION_ONLY_SHUFFLE [RS_288]
+                                Group By Operator [GBY_287] (rows=1 width=224)
                                   Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"]
                                 <-Reducer 16 [CUSTOM_SIMPLE_EDGE]
                                   PARTITION_ONLY_SHUFFLE [RS_59]
                                     Group By Operator [GBY_58] (rows=1 width=224)
                                       Output:["_col0","_col1"],aggregations:["sum(_col1)","sum(_col2)"]
-                                      Merge Join Operator [MERGEJOIN_215] (rows=3199657 width=183)
-                                        Conds:RS_283._col0=RS_246._col0(Inner),Output:["_col1","_col2"]
+                                      Merge Join Operator [MERGEJOIN_218] (rows=3199657 width=183)
+                                        Conds:RS_286._col0=RS_249._col0(Inner),Output:["_col1","_col2"]
                                       <-Map 8 [SIMPLE_EDGE] vectorized
-                                        PARTITION_ONLY_SHUFFLE [RS_246]
+                                        PARTITION_ONLY_SHUFFLE [RS_249]
                                           PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_240]
+                                           Please refer to the previous Select Operator [SEL_243]
                                       <-Map 26 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_283]
+                                        SHUFFLE [RS_286]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_282] (rows=28798881 width=223)
+                                          Select Operator [SEL_285] (rows=28798881 width=223)
                                             Output:["_col0","_col1","_col2"]
-                                            Filter Operator [FIL_281] (rows=28798881 width=223)
+                                            Filter Operator [FIL_284] (rows=28798881 width=223)
                                               predicate:cr_returned_date_sk is not null
                                               TableScan [TS_48] (rows=28798881 width=223)
                                                 default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_returned_date_sk","cr_return_amount","cr_net_loss"]
                   <-Reducer 20 [CONTAINS]
-                    Reduce Output Operator [RS_238]
+                    Reduce Output Operator [RS_241]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_237] (rows=564 width=446)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_236] (rows=564 width=446)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_234] (rows=394 width=435)
+                      Group By Operator [GBY_240] (rows=564 width=446)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_239] (rows=531 width=435)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_237] (rows=394 width=435)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Merge Join Operator [MERGEJOIN_233] (rows=394 width=335)
-                              Conds:RS_292._col0=RS_297._col0(Left Outer),Output:["_col0","_col1","_col2","_col4","_col5"]
+                            Merge Join Operator [MERGEJOIN_236] (rows=394 width=335)
+                              Conds:RS_295._col0=RS_300._col0(Left Outer),Output:["_col0","_col1","_col2","_col4","_col5"]
                             <-Reducer 19 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_292]
+                              SHUFFLE [RS_295]
                                 PartitionCols:_col0
-                                Group By Operator [GBY_291] (rows=206 width=228)
+                                Group By Operator [GBY_294] (rows=206 width=228)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 18 [SIMPLE_EDGE]
                                   SHUFFLE [RS_79]
@@ -372,36 +372,36 @@ Stage-0
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col1)","sum(_col2)"],keys:_col0
                                       Select Operator [SEL_76] (rows=143931136 width=227)
                                         Output:["_col0","_col1","_col2"]
-                                        Merge Join Operator [MERGEJOIN_216] (rows=143931136 width=227)
-                                          Conds:RS_290._col0=RS_247._col0(Inner),Output:["_col1","_col2","_col3"]
+                                        Merge Join Operator [MERGEJOIN_219] (rows=143931136 width=227)
+                                          Conds:RS_293._col0=RS_250._col0(Inner),Output:["_col1","_col2","_col3"]
                                         <-Map 8 [SIMPLE_EDGE] vectorized
-                                          PARTITION_ONLY_SHUFFLE [RS_247]
+                                          PARTITION_ONLY_SHUFFLE [RS_250]
                                             PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_240]
+                                             Please refer to the previous Select Operator [SEL_243]
                                         <-Map 27 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_290]
+                                          SHUFFLE [RS_293]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_289] (rows=143931136 width=231)
+                                            Select Operator [SEL_292] (rows=143931136 width=231)
                                               Output:["_col0","_col1","_col2","_col3"]
-                                              Filter Operator [FIL_288] (rows=143931136 width=231)
+                                              Filter Operator [FIL_291] (rows=143931136 width=231)
                                                 predicate:(ws_sold_date_sk is not null and ws_web_page_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_74_date_dim_d_date_sk_min) AND DynamicValue(RS_74_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_74_date_dim_d_date_sk_bloom_filter)))
                                                 TableScan [TS_67] (rows=144002668 width=231)
                                                   default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_web_page_sk","ws_ext_sales_price","ws_net_profit"]
                                                 <-Reducer 21 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_287]
-                                                    Group By Operator [GBY_286] (rows=1 width=12)
+                                                  BROADCAST [RS_290]
+                                                    Group By Operator [GBY_289] (rows=1 width=12)
                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                     <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                      PARTITION_ONLY_SHUFFLE [RS_255]
-                                                        Group By Operator [GBY_252] (rows=1 width=12)
+                                                      PARTITION_ONLY_SHUFFLE [RS_258]
+                                                        Group By Operator [GBY_255] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_248] (rows=8116 width=4)
+                                                          Select Operator [SEL_251] (rows=8116 width=4)
                                                             Output:["_col0"]
-                                                             Please refer to the previous Select Operator [SEL_240]
+                                                             Please refer to the previous Select Operator [SEL_243]
                             <-Reducer 23 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_297]
+                              SHUFFLE [RS_300]
                                 PartitionCols:_col0
-                                Group By Operator [GBY_296] (rows=188 width=227)
+                                Group By Operator [GBY_299] (rows=188 width=227)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 22 [SIMPLE_EDGE]
                                   SHUFFLE [RS_94]
@@ -410,36 +410,36 @@ Stage-0
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col1)","sum(_col2)"],keys:_col0
                                       Select Operator [SEL_91] (rows=13129719 width=217)
                                         Output:["_col0","_col1","_col2"]
-                                        Merge Join Operator [MERGEJOIN_217] (rows=13129719 width=217)
-                                          Conds:RS_295._col0=RS_249._col0(Inner),Output:["_col1","_col2","_col3"]
+                                        Merge Join Operator [MERGEJOIN_220] (rows=13129719 width=217)
+                                          Conds:RS_298._col0=RS_252._col0(Inner),Output:["_col1","_col2","_col3"]
                                         <-Map 8 [SIMPLE_EDGE] vectorized
-                                          PARTITION_ONLY_SHUFFLE [RS_249]
+                                          PARTITION_ONLY_SHUFFLE [RS_252]
                                             PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_240]
+                                             Please refer to the previous Select Operator [SEL_243]
                                         <-Map 28 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_295]
+                                          SHUFFLE [RS_298]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_294] (rows=13129719 width=221)
+                                            Select Operator [SEL_297] (rows=13129719 width=221)
                                               Output:["_col0","_col1","_col2","_col3"]
-                                              Filter Operator [FIL_293] (rows=13129719 width=221)
+                                              Filter Operator [FIL_296] (rows=13129719 width=221)
                                                 predicate:(wr_web_page_sk is not null and wr_returned_date_sk is not null)
                                                 TableScan [TS_82] (rows=14398467 width=221)
                                                   default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_returned_date_sk","wr_web_page_sk","wr_return_amt","wr_net_loss"]
                   <-Reducer 4 [CONTAINS]
-                    Reduce Output Operator [RS_226]
+                    Reduce Output Operator [RS_229]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_225] (rows=564 width=446)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_224] (rows=564 width=446)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_222] (rows=127 width=436)
+                      Group By Operator [GBY_228] (rows=564 width=446)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_227] (rows=531 width=435)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_225] (rows=127 width=436)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Merge Join Operator [MERGEJOIN_221] (rows=127 width=379)
-                              Conds:RS_262._col0=RS_267._col0(Left Outer),Output:["_col0","_col1","_col2","_col4","_col5"]
+                            Merge Join Operator [MERGEJOIN_224] (rows=127 width=379)
+                              Conds:RS_265._col0=RS_270._col0(Left Outer),Output:["_col0","_col1","_col2","_col4","_col5"]
                             <-Reducer 11 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_267]
+                              SHUFFLE [RS_270]
                                 PartitionCols:_col0
-                                Group By Operator [GBY_266] (rows=85 width=227)
+                                Group By Operator [GBY_269] (rows=85 width=227)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 10 [SIMPLE_EDGE]
                                   SHUFFLE [RS_27]
@@ -448,25 +448,25 @@ Stage-0
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col1)","sum(_col2)"],keys:_col0
                                       Select Operator [SEL_24] (rows=53634860 width=220)
                                         Output:["_col0","_col1","_col2"]
-                                        Merge Join Operator [MERGEJOIN_213] (rows=53634860 width=220)
-                                          Conds:RS_265._col0=RS_243._col0(Inner),Output:["_col1","_col2","_col3"]
+                                        Merge Join Operator [MERGEJOIN_216] (rows=53634860 width=220)
+                                          Conds:RS_268._col0=RS_246._col0(Inner),Output:["_col1","_col2","_col3"]
                                         <-Map 8 [SIMPLE_EDGE] vectorized
-                                          PARTITION_ONLY_SHUFFLE [RS_243]
+                                          PARTITION_ONLY_SHUFFLE [RS_246]
                                             PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_240]
+                                             Please refer to the previous Select Operator [SEL_243]
                                         <-Map 24 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_265]
+                                          SHUFFLE [RS_268]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_264] (rows=53634860 width=223)
+                                            Select Operator [SEL_267] (rows=53634860 width=223)
                                               Output:["_col0","_col1","_col2","_col3"]
-                                              Filter Operator [FIL_263] (rows=53634860 width=223)
+                                              Filter Operator [FIL_266] (rows=53634860 width=223)
                                                 predicate:(sr_store_sk is not null and sr_returned_date_sk is not null)
                                                 TableScan [TS_15] (rows=57591150 width=223)
                                                   default@store_returns,store_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_returned_date_sk","sr_store_sk","sr_return_amt","sr_net_loss"]
                             <-Reducer 3 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_262]
+                              SHUFFLE [RS_265]
                                 PartitionCols:_col0
-                                Group By Operator [GBY_261] (rows=84 width=227)
+                                Group By Operator [GBY_264] (rows=84 width=227)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 2 [SIMPLE_EDGE]
                                   SHUFFLE [RS_12]
@@ -475,30 +475,30 @@ Stage-0
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col1)","sum(_col2)"],keys:_col0
                                       Select Operator [SEL_9] (rows=525329897 width=217)
                                         Output:["_col0","_col1","_col2"]
-                                        Merge Join Operator [MERGEJOIN_212] (rows=525329897 width=217)
-                                          Conds:RS_260._col0=RS_241._col0(Inner),Output:["_col1","_col2","_col3"]
+                                        Merge Join Operator [MERGEJOIN_215] (rows=525329897 width=217)
+                                          Conds:RS_263._col0=RS_244._col0(Inner),Output:["_col1","_col2","_col3"]
                                         <-Map 8 [SIMPLE_EDGE] vectorized
-                                          PARTITION_ONLY_SHUFFLE [RS_241]
+                                          PARTITION_ONLY_SHUFFLE [RS_244]
                                             PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_240]
+                                             Please refer to the previous Select Operator [SEL_243]
                                         <-Map 1 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_260]
+                                          SHUFFLE [RS_263]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_259] (rows=525329897 width=221)
+                                            Select Operator [SEL_262] (rows=525329897 width=221)
                                               Output:["_col0","_col1","_col2","_col3"]
-                                              Filter Operator [FIL_258] (rows=525329897 width=221)
+                                              Filter Operator [FIL_261] (rows=525329897 width=221)
                                                 predicate:(ss_sold_date_sk is not null and ss_store_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_7_date_dim_d_date_sk_min) AND DynamicValue(RS_7_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_7_date_dim_d_date_sk_bloom_filter)))
                                                 TableScan [TS_0] (rows=575995635 width=221)
                                                   default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_store_sk","ss_ext_sales_price","ss_net_profit"]
                                                 <-Reducer 9 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_257]
-                                                    Group By Operator [GBY_256] (rows=1 width=12)
+                                                  BROADCAST [RS_260]
+                                                    Group By Operator [GBY_259] (rows=1 width=12)
                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                     <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                      PARTITION_ONLY_SHUFFLE [RS_253]
-                                                        Group By Operator [GBY_250] (rows=1 width=12)
+                                                      PARTITION_ONLY_SHUFFLE [RS_256]
+                                                        Group By Operator [GBY_253] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_242] (rows=8116 width=4)
+                                                          Select Operator [SEL_245] (rows=8116 width=4)
                                                             Output:["_col0"]
-                                                             Please refer to the previous Select Operator [SEL_240]
+                                                             Please refer to the previous Select Operator [SEL_243]
 
diff --git a/ql/src/test/results/clientpositive/perf/tez/constraints/query80.q.out b/ql/src/test/results/clientpositive/perf/tez/constraints/query80.q.out
index 72a5492..462eed8 100644
--- a/ql/src/test/results/clientpositive/perf/tez/constraints/query80.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/constraints/query80.q.out
@@ -249,28 +249,28 @@ Stage-0
     limit:100
     Stage-1
       Reducer 10 vectorized
-      File Output Operator [FS_432]
-        Limit [LIM_431] (rows=100 width=619)
+      File Output Operator [FS_435]
+        Limit [LIM_434] (rows=100 width=619)
           Number of rows:100
-          Select Operator [SEL_430] (rows=59581 width=619)
+          Select Operator [SEL_433] (rows=59581 width=619)
             Output:["_col0","_col1","_col2","_col3","_col4"]
           <-Reducer 9 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_429]
-              Select Operator [SEL_428] (rows=59581 width=619)
+            SHUFFLE [RS_432]
+              Select Operator [SEL_431] (rows=59581 width=619)
                 Output:["_col0","_col1","_col2","_col3","_col4"]
-                Group By Operator [GBY_427] (rows=59581 width=627)
+                Group By Operator [GBY_430] (rows=59581 width=627)
                   Output:["_col0","_col1","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Union 8 [SIMPLE_EDGE]
                   <-Reducer 18 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_446]
+                    Reduce Output Operator [RS_449]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_445] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_444] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_443] (rows=38846 width=619)
+                      Group By Operator [GBY_448] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_447] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_446] (rows=38846 width=619)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_442] (rows=38846 width=436)
+                            Group By Operator [GBY_445] (rows=38846 width=436)
                               Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
                             <-Reducer 17 [SIMPLE_EDGE]
                               SHUFFLE [RS_71]
@@ -279,99 +279,99 @@ Stage-0
                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
                                   Select Operator [SEL_68] (rows=154681759 width=322)
                                     Output:["_col0","_col1","_col2","_col3"]
-                                    Merge Join Operator [MERGEJOIN_365] (rows=154681759 width=322)
-                                      Conds:RS_65._col1=RS_441._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
+                                    Merge Join Operator [MERGEJOIN_368] (rows=154681759 width=322)
+                                      Conds:RS_65._col1=RS_444._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
                                     <-Map 32 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_441]
+                                      SHUFFLE [RS_444]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_440] (rows=46000 width=104)
+                                        Select Operator [SEL_443] (rows=46000 width=104)
                                           Output:["_col0","_col1"]
                                           TableScan [TS_51] (rows=46000 width=104)
                                             default@catalog_page,catalog_page,Tbl:COMPLETE,Col:COMPLETE,Output:["cp_catalog_page_sk","cp_catalog_page_id"]
                                     <-Reducer 16 [SIMPLE_EDGE]
                                       SHUFFLE [RS_65]
                                         PartitionCols:_col1
-                                        Merge Join Operator [MERGEJOIN_364] (rows=154681759 width=226)
-                                          Conds:RS_62._col3=RS_418._col0(Inner),Output:["_col1","_col5","_col6","_col9","_col10"]
+                                        Merge Join Operator [MERGEJOIN_367] (rows=154681759 width=226)
+                                          Conds:RS_62._col3=RS_421._col0(Inner),Output:["_col1","_col5","_col6","_col9","_col10"]
                                         <-Map 27 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_418]
+                                          SHUFFLE [RS_421]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_416] (rows=1150 width=4)
+                                            Select Operator [SEL_419] (rows=1150 width=4)
                                               Output:["_col0"]
-                                              Filter Operator [FIL_415] (rows=1150 width=89)
+                                              Filter Operator [FIL_418] (rows=1150 width=89)
                                                 predicate:(p_channel_tv = 'N')
                                                 TableScan [TS_11] (rows=2300 width=89)
                                                   default@promotion,promotion,Tbl:COMPLETE,Col:COMPLETE,Output:["p_promo_sk","p_channel_tv"]
                                         <-Reducer 15 [SIMPLE_EDGE]
                                           SHUFFLE [RS_62]
                                             PartitionCols:_col3
-                                            Merge Join Operator [MERGEJOIN_363] (rows=154681759 width=230)
-                                              Conds:RS_59._col2=RS_413._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col9","_col10"]
+                                            Merge Join Operator [MERGEJOIN_366] (rows=154681759 width=230)
+                                              Conds:RS_59._col2=RS_416._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col9","_col10"]
                                             <-Map 26 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_413]
+                                              SHUFFLE [RS_416]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_411] (rows=154000 width=4)
+                                                Select Operator [SEL_414] (rows=154000 width=4)
                                                   Output:["_col0"]
-                                                  Filter Operator [FIL_410] (rows=154000 width=115)
+                                                  Filter Operator [FIL_413] (rows=154000 width=115)
                                                     predicate:(i_current_price > 50)
                                                     TableScan [TS_8] (rows=462000 width=115)
                                                       default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_current_price"]
                                             <-Reducer 14 [SIMPLE_EDGE]
                                               SHUFFLE [RS_59]
                                                 PartitionCols:_col2
-                                                Merge Join Operator [MERGEJOIN_362] (rows=464045263 width=322)
-                                                  Conds:RS_56._col0=RS_393._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                Merge Join Operator [MERGEJOIN_365] (rows=464045263 width=322)
+                                                  Conds:RS_56._col0=RS_396._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                 <-Map 12 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_393]
+                                                  SHUFFLE [RS_396]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_390] (rows=8116 width=4)
+                                                    Select Operator [SEL_393] (rows=8116 width=4)
                                                       Output:["_col0"]
-                                                      Filter Operator [FIL_389] (rows=8116 width=98)
+                                                      Filter Operator [FIL_392] (rows=8116 width=98)
                                                         predicate:CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-09-03 00:00:00'
                                                         TableScan [TS_5] (rows=73049 width=98)
                                                           default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
                                                 <-Reducer 30 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_56]
                                                     PartitionCols:_col0
-                                                    Merge Join Operator [MERGEJOIN_361] (rows=464045263 width=326)
-                                                      Conds:RS_437._col2, _col4=RS_439._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                    Merge Join Operator [MERGEJOIN_364] (rows=464045263 width=326)
+                                                      Conds:RS_440._col2, _col4=RS_442._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                     <-Map 29 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_437]
+                                                      SHUFFLE [RS_440]
                                                         PartitionCols:_col2, _col4
-                                                        Select Operator [SEL_436] (rows=283691906 width=243)
+                                                        Select Operator [SEL_439] (rows=283691906 width=243)
                                                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                          Filter Operator [FIL_435] (rows=283691906 width=243)
+                                                          Filter Operator [FIL_438] (rows=283691906 width=243)
                                                             predicate:(cs_promo_sk is not null and cs_sold_date_sk is not null and cs_catalog_page_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_57_date_dim_d_date_sk_min) AND DynamicValue(RS_57_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_57_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_37] (rows=287989836 width=243)
                                                               default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_catalog_page_sk","cs_item_sk","cs_promo_sk","cs_order_number","cs_ext_sales_price","cs_net_profit"]
                                                             <-Reducer 19 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_434]
-                                                                Group By Operator [GBY_433] (rows=1 width=12)
+                                                              BROADCAST [RS_437]
+                                                                Group By Operator [GBY_436] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  SHUFFLE [RS_401]
-                                                                    Group By Operator [GBY_398] (rows=1 width=12)
+                                                                  SHUFFLE [RS_404]
+                                                                    Group By Operator [GBY_401] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_394] (rows=8116 width=4)
+                                                                      Select Operator [SEL_397] (rows=8116 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_390]
+                                                                         Please refer to the previous Select Operator [SEL_393]
                                                     <-Map 31 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_439]
+                                                      SHUFFLE [RS_442]
                                                         PartitionCols:_col0, _col1
-                                                        Select Operator [SEL_438] (rows=28798881 width=227)
+                                                        Select Operator [SEL_441] (rows=28798881 width=227)
                                                           Output:["_col0","_col1","_col2","_col3"]
                                                           TableScan [TS_40] (rows=28798881 width=227)
                                                             default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_item_sk","cr_order_number","cr_return_amount","cr_net_loss"]
                   <-Reducer 24 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_460]
+                    Reduce Output Operator [RS_463]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_459] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_458] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_457] (rows=53 width=615)
+                      Group By Operator [GBY_462] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_461] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_460] (rows=53 width=615)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_456] (rows=53 width=436)
+                            Group By Operator [GBY_459] (rows=53 width=436)
                               Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
                             <-Reducer 23 [SIMPLE_EDGE]
                               SHUFFLE [RS_109]
@@ -380,84 +380,84 @@ Stage-0
                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
                                   Select Operator [SEL_106] (rows=84869669 width=323)
                                     Output:["_col0","_col1","_col2","_col3"]
-                                    Merge Join Operator [MERGEJOIN_370] (rows=84869669 width=323)
-                                      Conds:RS_103._col2=RS_455._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
+                                    Merge Join Operator [MERGEJOIN_373] (rows=84869669 width=323)
+                                      Conds:RS_103._col2=RS_458._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
                                     <-Map 36 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_455]
+                                      SHUFFLE [RS_458]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_454] (rows=84 width=104)
+                                        Select Operator [SEL_457] (rows=84 width=104)
                                           Output:["_col0","_col1"]
                                           TableScan [TS_89] (rows=84 width=104)
                                             default@web_site,web_site,Tbl:COMPLETE,Col:COMPLETE,Output:["web_site_sk","web_site_id"]
                                     <-Reducer 22 [SIMPLE_EDGE]
                                       SHUFFLE [RS_103]
                                         PartitionCols:_col2
-                                        Merge Join Operator [MERGEJOIN_369] (rows=84869669 width=227)
-                                          Conds:RS_100._col3=RS_419._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
+                                        Merge Join Operator [MERGEJOIN_372] (rows=84869669 width=227)
+                                          Conds:RS_100._col3=RS_422._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
                                         <-Map 27 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_419]
+                                          SHUFFLE [RS_422]
                                             PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_416]
+                                             Please refer to the previous Select Operator [SEL_419]
                                         <-Reducer 21 [SIMPLE_EDGE]
                                           SHUFFLE [RS_100]
                                             PartitionCols:_col3
-                                            Merge Join Operator [MERGEJOIN_368] (rows=84869669 width=231)
-                                              Conds:RS_97._col1=RS_414._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
+                                            Merge Join Operator [MERGEJOIN_371] (rows=84869669 width=231)
+                                              Conds:RS_97._col1=RS_417._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
                                             <-Map 26 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_414]
+                                              SHUFFLE [RS_417]
                                                 PartitionCols:_col0
-                                                 Please refer to the previous Select Operator [SEL_411]
+                                                 Please refer to the previous Select Operator [SEL_414]
                                             <-Reducer 20 [SIMPLE_EDGE]
                                               SHUFFLE [RS_97]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_367] (rows=254608997 width=359)
-                                                  Conds:RS_94._col0=RS_395._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                Merge Join Operator [MERGEJOIN_370] (rows=254608997 width=359)
+                                                  Conds:RS_94._col0=RS_398._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                 <-Map 12 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_395]
+                                                  SHUFFLE [RS_398]
                                                     PartitionCols:_col0
-                                                     Please refer to the previous Select Operator [SEL_390]
+                                                     Please refer to the previous Select Operator [SEL_393]
                                                 <-Reducer 34 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_94]
                                                     PartitionCols:_col0
-                                                    Merge Join Operator [MERGEJOIN_366] (rows=254608997 width=363)
-                                                      Conds:RS_451._col1, _col4=RS_453._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                    Merge Join Operator [MERGEJOIN_369] (rows=254608997 width=363)
+                                                      Conds:RS_454._col1, _col4=RS_456._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                     <-Map 33 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_451]
+                                                      SHUFFLE [RS_454]
                                                         PartitionCols:_col1, _col4
-                                                        Select Operator [SEL_450] (rows=143894769 width=243)
+                                                        Select Operator [SEL_453] (rows=143894769 width=243)
                                                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                          Filter Operator [FIL_449] (rows=143894769 width=243)
+                                                          Filter Operator [FIL_452] (rows=143894769 width=243)
                                                             predicate:(ws_promo_sk is not null and ws_web_site_sk is not null and ws_sold_date_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_95_date_dim_d_date_sk_min) AND DynamicValue(RS_95_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_95_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_75] (rows=144002668 width=243)
                                                               default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_web_site_sk","ws_promo_sk","ws_order_number","ws_ext_sales_price","ws_net_profit"]
                                                             <-Reducer 25 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_448]
-                                                                Group By Operator [GBY_447] (rows=1 width=12)
+                                                              BROADCAST [RS_451]
+                                                                Group By Operator [GBY_450] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  SHUFFLE [RS_402]
-                                                                    Group By Operator [GBY_399] (rows=1 width=12)
+                                                                  SHUFFLE [RS_405]
+                                                                    Group By Operator [GBY_402] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_396] (rows=8116 width=4)
+                                                                      Select Operator [SEL_399] (rows=8116 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_390]
+                                                                         Please refer to the previous Select Operator [SEL_393]
                                                     <-Map 35 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_453]
+                                                      SHUFFLE [RS_456]
                                                         PartitionCols:_col0, _col1
-                                                        Select Operator [SEL_452] (rows=14398467 width=221)
+                                                        Select Operator [SEL_455] (rows=14398467 width=221)
                                                           Output:["_col0","_col1","_col2","_col3"]
                                                           TableScan [TS_78] (rows=14398467 width=221)
                                                             default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_item_sk","wr_order_number","wr_return_amt","wr_net_loss"]
                   <-Reducer 7 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_426]
+                    Reduce Output Operator [RS_429]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_425] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_424] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_423] (rows=822 width=617)
+                      Group By Operator [GBY_428] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_427] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_426] (rows=822 width=617)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_422] (rows=822 width=436)
+                            Group By Operator [GBY_425] (rows=822 width=436)
                               Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
                             <-Reducer 6 [SIMPLE_EDGE]
                               SHUFFLE [RS_34]
@@ -466,71 +466,71 @@ Stage-0
                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
                                   Select Operator [SEL_31] (rows=270716624 width=305)
                                     Output:["_col0","_col1","_col2","_col3"]
-                                    Merge Join Operator [MERGEJOIN_360] (rows=270716624 width=305)
-                                      Conds:RS_28._col2=RS_421._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
+                                    Merge Join Operator [MERGEJOIN_363] (rows=270716624 width=305)
+                                      Conds:RS_28._col2=RS_424._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
                                     <-Map 28 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_421]
+                                      SHUFFLE [RS_424]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_420] (rows=1704 width=104)
+                                        Select Operator [SEL_423] (rows=1704 width=104)
                                           Output:["_col0","_col1"]
                                           TableScan [TS_14] (rows=1704 width=104)
                                             default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_id"]
                                     <-Reducer 5 [SIMPLE_EDGE]
                                       SHUFFLE [RS_28]
                                         PartitionCols:_col2
-                                        Merge Join Operator [MERGEJOIN_359] (rows=270716624 width=208)
-                                          Conds:RS_25._col3=RS_417._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
+                                        Merge Join Operator [MERGEJOIN_362] (rows=270716624 width=208)
+                                          Conds:RS_25._col3=RS_420._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
                                         <-Map 27 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_417]
+                                          SHUFFLE [RS_420]
                                             PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_416]
+                                             Please refer to the previous Select Operator [SEL_419]
                                         <-Reducer 4 [SIMPLE_EDGE]
                                           SHUFFLE [RS_25]
                                             PartitionCols:_col3
-                                            Merge Join Operator [MERGEJOIN_358] (rows=270716624 width=212)
-                                              Conds:RS_22._col1=RS_412._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
+                                            Merge Join Operator [MERGEJOIN_361] (rows=270716624 width=212)
+                                              Conds:RS_22._col1=RS_415._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
                                             <-Map 26 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_412]
+                                              SHUFFLE [RS_415]
                                                 PartitionCols:_col0
-                                                 Please refer to the previous Select Operator [SEL_411]
+                                                 Please refer to the previous Select Operator [SEL_414]
                                             <-Reducer 3 [SIMPLE_EDGE]
                                               SHUFFLE [RS_22]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_357] (rows=812149846 width=370)
-                                                  Conds:RS_19._col0=RS_391._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                Merge Join Operator [MERGEJOIN_360] (rows=812149846 width=370)
+                                                  Conds:RS_19._col0=RS_394._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                 <-Map 12 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_391]
+                                                  SHUFFLE [RS_394]
                                                     PartitionCols:_col0
-                                                     Please refer to the previous Select Operator [SEL_390]
+                                                     Please refer to the previous Select Operator [SEL_393]
                                                 <-Reducer 2 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_19]
                                                     PartitionCols:_col0
-                                                    Merge Join Operator [MERGEJOIN_356] (rows=812149846 width=374)
-                                                      Conds:RS_407._col1, _col4=RS_409._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                    Merge Join Operator [MERGEJOIN_359] (rows=812149846 width=374)
+                                                      Conds:RS_410._col1, _col4=RS_412._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                     <-Map 1 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_407]
+                                                      SHUFFLE [RS_410]
                                                         PartitionCols:_col1, _col4
-                                                        Select Operator [SEL_406] (rows=501693263 width=233)
+                                                        Select Operator [SEL_409] (rows=501693263 width=233)
                                                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                          Filter Operator [FIL_405] (rows=501693263 width=233)
+                                                          Filter Operator [FIL_408] (rows=501693263 width=233)
                                                             predicate:(ss_sold_date_sk is not null and ss_promo_sk is not null and ss_store_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_20_date_dim_d_date_sk_min) AND DynamicValue(RS_20_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_20_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_0] (rows=575995635 width=233)
                                                               default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_store_sk","ss_promo_sk","ss_ticket_number","ss_ext_sales_price","ss_net_profit"]
                                                             <-Reducer 13 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_404]
-                                                                Group By Operator [GBY_403] (rows=1 width=12)
+                                                              BROADCAST [RS_407]
+                                                                Group By Operator [GBY_406] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  SHUFFLE [RS_400]
-                                                                    Group By Operator [GBY_397] (rows=1 width=12)
+                                                                  SHUFFLE [RS_403]
+                                                                    Group By Operator [GBY_400] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_392] (rows=8116 width=4)
+                                                                      Select Operator [SEL_395] (rows=8116 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_390]
+                                                                         Please refer to the previous Select Operator [SEL_393]
                                                     <-Map 11 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_409]
+                                                      SHUFFLE [RS_412]
                                                         PartitionCols:_col0, _col1
-                                                        Select Operator [SEL_408] (rows=57591150 width=224)
+                                                        Select Operator [SEL_411] (rows=57591150 width=224)
                                                           Output:["_col0","_col1","_col2","_col3"]
                                                           TableScan [TS_3] (rows=57591150 width=224)
                                                             default@store_returns,store_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_item_sk","sr_ticket_number","sr_return_amt","sr_net_loss"]
diff --git a/ql/src/test/results/clientpositive/perf/tez/query14.q.out b/ql/src/test/results/clientpositive/perf/tez/query14.q.out
index 00bc4cb..da6b74d 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query14.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query14.q.out
@@ -1,6 +1,6 @@
-Warning: Shuffle Join MERGEJOIN[1175][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 6' is a cross product
-Warning: Shuffle Join MERGEJOIN[1182][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
-Warning: Shuffle Join MERGEJOIN[1189][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 22' is a cross product
+Warning: Shuffle Join MERGEJOIN[1178][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 6' is a cross product
+Warning: Shuffle Join MERGEJOIN[1185][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
+Warning: Shuffle Join MERGEJOIN[1192][tables = [$hdt$_1, $hdt$_2]] in Stage 'Reducer 22' is a cross product
 PREHOOK: query: explain
 with  cross_items as
  (select i_item_sk ss_item_sk
@@ -296,36 +296,36 @@ Stage-0
     limit:100
     Stage-1
       Reducer 9 vectorized
-      File Output Operator [FS_1348]
-        Limit [LIM_1347] (rows=100 width=223)
+      File Output Operator [FS_1351]
+        Limit [LIM_1350] (rows=100 width=223)
           Number of rows:100
-          Select Operator [SEL_1346] (rows=304320 width=223)
+          Select Operator [SEL_1349] (rows=304320 width=223)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
           <-Reducer 8 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_1345]
-              Select Operator [SEL_1344] (rows=304320 width=223)
+            SHUFFLE [RS_1348]
+              Select Operator [SEL_1347] (rows=304320 width=223)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                Group By Operator [GBY_1343] (rows=304320 width=231)
+                Group By Operator [GBY_1346] (rows=304320 width=231)
                   Output:["_col0","_col1","_col2","_col3","_col5","_col6"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2, KEY._col3, KEY._col4
                 <-Union 7 [SIMPLE_EDGE]
                   <-Reducer 16 [CONTAINS]
-                    Reduce Output Operator [RS_1188]
+                    Reduce Output Operator [RS_1191]
                       PartitionCols:_col0, _col1, _col2, _col3, _col4
-                      Top N Key Operator [TNK_1187] (rows=304320 width=231)
-                        keys:_col0, _col1, _col2, _col3,top n:100
-                        Group By Operator [GBY_1186] (rows=304320 width=231)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
-                          Select Operator [SEL_1184] (rows=40576 width=223)
+                      Group By Operator [GBY_1190] (rows=304320 width=231)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
+                        Top N Key Operator [TNK_1189] (rows=121728 width=221)
+                          keys:_col0, _col1, _col2, _col3, 0L,top n:100
+                          Select Operator [SEL_1187] (rows=40576 width=223)
                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                            Filter Operator [FIL_1183] (rows=40576 width=244)
+                            Filter Operator [FIL_1186] (rows=40576 width=244)
                               predicate:(_col3 > _col5)
-                              Merge Join Operator [MERGEJOIN_1182] (rows=121728 width=244)
+                              Merge Join Operator [MERGEJOIN_1185] (rows=121728 width=244)
                                 Conds:(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                               <-Reducer 15 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1360]
-                                  Filter Operator [FIL_1359] (rows=121728 width=132)
+                                PARTITION_ONLY_SHUFFLE [RS_1363]
+                                  Filter Operator [FIL_1362] (rows=121728 width=132)
                                     predicate:_col3 is not null
-                                    Group By Operator [GBY_1358] (rows=121728 width=132)
+                                    Group By Operator [GBY_1361] (rows=121728 width=132)
                                       Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2
                                     <-Reducer 14 [SIMPLE_EDGE]
                                       SHUFFLE [RS_244]
@@ -334,378 +334,378 @@ Stage-0
                                           Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col3)","count()"],keys:_col0, _col1, _col2
                                           Select Operator [SEL_241] (rows=286549727 width=127)
                                             Output:["_col0","_col1","_col2","_col3"]
-                                            Merge Join Operator [MERGEJOIN_1170] (rows=286549727 width=127)
+                                            Merge Join Operator [MERGEJOIN_1173] (rows=286549727 width=127)
                                               Conds:RS_238._col1=RS_239._col0(Left Semi),Output:["_col2","_col3","_col6","_col7","_col8"]
                                             <-Reducer 13 [SIMPLE_EDGE]
                                               SHUFFLE [RS_238]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_1146] (rows=286549727 width=131)
-                                                  Conds:RS_233._col1=RS_1328._col0(Inner),Output:["_col1","_col2","_col3","_col6","_col7","_col8"]
+                                                Merge Join Operator [MERGEJOIN_1149] (rows=286549727 width=131)
+                                                  Conds:RS_233._col1=RS_1331._col0(Inner),Output:["_col1","_col2","_col3","_col6","_col7","_col8"]
                                                 <-Map 24 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_1328]
+                                                  SHUFFLE [RS_1331]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_1319] (rows=462000 width=15)
+                                                    Select Operator [SEL_1322] (rows=462000 width=15)
                                                       Output:["_col0","_col1","_col2","_col3"]
-                                                      Filter Operator [FIL_1310] (rows=462000 width=15)
+                                                      Filter Operator [FIL_1313] (rows=462000 width=15)
                                                         predicate:i_item_sk is not null
                                                         TableScan [TS_6] (rows=462000 width=15)
                                                           default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_brand_id","i_class_id","i_category_id"]
                                                 <-Reducer 12 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_233]
                                                     PartitionCols:_col1
-                                                    Merge Join Operator [MERGEJOIN_1145] (rows=286549727 width=119)
-                                                      Conds:RS_1353._col0=RS_1290._col0(Inner),Output:["_col1","_col2","_col3"]
+                                                    Merge Join Operator [MERGEJOIN_1148] (rows=286549727 width=119)
+                                                      Conds:RS_1356._col0=RS_1293._col0(Inner),Output:["_col1","_col2","_col3"]
                                                     <-Map 10 [SIMPLE_EDGE] vectorized
-                                                      PARTITION_ONLY_SHUFFLE [RS_1290]
+                                                      PARTITION_ONLY_SHUFFLE [RS_1293]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_1287] (rows=50 width=4)
+                                                        Select Operator [SEL_1290] (rows=50 width=4)
                                                           Output:["_col0"]
-                                                          Filter Operator [FIL_1286] (rows=50 width=12)
+                                                          Filter Operator [FIL_1289] (rows=50 width=12)
                                                             predicate:((d_year = 2000) and (d_moy = 11) and d_date_sk is not null)
                                                             TableScan [TS_3] (rows=73049 width=12)
                                                               default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year","d_moy"]
                                                     <-Map 79 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1353]
+                                                      SHUFFLE [RS_1356]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_1352] (rows=286549727 width=123)
+                                                        Select Operator [SEL_1355] (rows=286549727 width=123)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_1351] (rows=286549727 width=123)
+                                                          Filter Operator [FIL_1354] (rows=286549727 width=123)
                                                             predicate:(cs_sold_date_sk is not null and cs_item_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_231_date_dim_d_date_sk_min) AND DynamicValue(RS_231_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_231_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_146] (rows=287989836 width=123)
                                                               default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_item_sk","cs_quantity","cs_list_price"]
                                                             <-Reducer 17 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_1350]
-                                                                Group By Operator [GBY_1349] (rows=1 width=12)
+                                                              BROADCAST [RS_1353]
+                                                                Group By Operator [GBY_1352] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  PARTITION_ONLY_SHUFFLE [RS_1298]
-                                                                    Group By Operator [GBY_1295] (rows=1 width=12)
+                                                                  PARTITION_ONLY_SHUFFLE [RS_1301]
+                                                                    Group By Operator [GBY_1298] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_1291] (rows=50 width=4)
+                                                                      Select Operator [SEL_1294] (rows=50 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_1287]
+                                                                         Please refer to the previous Select Operator [SEL_1290]
                                             <-Reducer 33 [SIMPLE_EDGE]
                                               SHUFFLE [RS_239]
                                                 PartitionCols:_col0
                                                 Group By Operator [GBY_237] (rows=364 width=4)
                                                   Output:["_col0"],keys:_col0
-                                                  Merge Join Operator [MERGEJOIN_1153] (rows=729 width=4)
-                                                    Conds:RS_1329._col1, _col2, _col3=RS_1357._col0, _col1, _col2(Inner),Output:["_col0"]
+                                                  Merge Join Operator [MERGEJOIN_1156] (rows=729 width=4)
+                                                    Conds:RS_1332._col1, _col2, _col3=RS_1360._col0, _col1, _col2(Inner),Output:["_col0"]
                                                   <-Map 24 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1329]
+                                                    SHUFFLE [RS_1332]
                                                       PartitionCols:_col1, _col2, _col3
-                                                      Select Operator [SEL_1320] (rows=458612 width=15)
+                                                      Select Operator [SEL_1323] (rows=458612 width=15)
                                                         Output:["_col0","_col1","_col2","_col3"]
-                                                        Filter Operator [FIL_1311] (rows=458612 width=15)
+                                                        Filter Operator [FIL_1314] (rows=458612 width=15)
                                                           predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null and i_item_sk is not null)
                                                            Please refer to the previous TableScan [TS_6]
                                                   <-Reducer 32 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1357]
+                                                    SHUFFLE [RS_1360]
                                                       PartitionCols:_col0, _col1, _col2
-                                                      Select Operator [SEL_1356] (rows=1 width=12)
+                                                      Select Operator [SEL_1359] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"]
-                                                        Filter Operator [FIL_1355] (rows=1 width=20)
+                                                        Filter Operator [FIL_1358] (rows=1 width=20)
                                                           predicate:(_col3 = 3L)
-                                                          Group By Operator [GBY_1354] (rows=120960 width=20)
+                                                          Group By Operator [GBY_1357] (rows=120960 width=20)
                                                             Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                           <-Union 31 [SIMPLE_EDGE]
                                                             <-Reducer 30 [CONTAINS] vectorized
-                                                              Reduce Output Operator [RS_1411]
+                                                              Reduce Output Operator [RS_1414]
                                                                 PartitionCols:_col0, _col1, _col2
-                                                                Group By Operator [GBY_1410] (rows=120960 width=20)
+                                                                Group By Operator [GBY_1413] (rows=120960 width=20)
                                                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1409] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1412] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                   <-Reducer 26 [SIMPLE_EDGE]
                                                                     SHUFFLE [RS_175]
                                                                       PartitionCols:_col0, _col1, _col2
                                                                       Group By Operator [GBY_28] (rows=3144960 width=19)
                                                                         Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col5, _col6
-                                                                        Merge Join Operator [MERGEJOIN_1136] (rows=546042657 width=11)
-                                                                          Conds:RS_24._col1=RS_1325._col0(Inner),Output:["_col4","_col5","_col6"]
+                                                                        Merge Join Operator [MERGEJOIN_1139] (rows=546042657 width=11)
+                                                                          Conds:RS_24._col1=RS_1328._col0(Inner),Output:["_col4","_col5","_col6"]
                                                                         <-Map 24 [SIMPLE_EDGE] vectorized
-                                                                          SHUFFLE [RS_1325]
+                                                                          SHUFFLE [RS_1328]
                                                                             PartitionCols:_col0
-                                                                            Select Operator [SEL_1316] (rows=458612 width=15)
+                                                                            Select Operator [SEL_1319] (rows=458612 width=15)
                                                                               Output:["_col0","_col1","_col2","_col3"]
-                                                                              Filter Operator [FIL_1307] (rows=458612 width=15)
+                                                                              Filter Operator [FIL_1310] (rows=458612 width=15)
                                                                                 predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null and i_item_sk is not null)
                                                                                  Please refer to the previous TableScan [TS_6]
                                                                         <-Reducer 47 [SIMPLE_EDGE]
                                                                           SHUFFLE [RS_24]
                                                                             PartitionCols:_col1
-                                                                            Merge Join Operator [MERGEJOIN_1135] (rows=550076554 width=4)
-                                                                              Conds:RS_1405._col0=RS_1383._col0(Inner),Output:["_col1"]
+                                                                            Merge Join Operator [MERGEJOIN_1138] (rows=550076554 width=4)
+                                                                              Conds:RS_1408._col0=RS_1386._col0(Inner),Output:["_col1"]
                                                                             <-Map 48 [SIMPLE_EDGE] vectorized
-                                                                              SHUFFLE [RS_1383]
+                                                                              SHUFFLE [RS_1386]
                                                                                 PartitionCols:_col0
-                                                                                Select Operator [SEL_1382] (rows=1957 width=4)
+                                                                                Select Operator [SEL_1385] (rows=1957 width=4)
                                                                                   Output:["_col0"]
-                                                                                  Filter Operator [FIL_1381] (rows=1957 width=8)
+                                                                                  Filter Operator [FIL_1384] (rows=1957 width=8)
                                                                                     predicate:(d_year BETWEEN 1999 AND 2001 and d_date_sk is not null)
                                                                                     TableScan [TS_15] (rows=73049 width=8)
                                                                                       default@date_dim,d1,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
                                                                             <-Map 46 [SIMPLE_EDGE] vectorized
-                                                                              SHUFFLE [RS_1405]
+                                                                              SHUFFLE [RS_1408]
                                                                                 PartitionCols:_col0
-                                                                                Select Operator [SEL_1404] (rows=550076554 width=7)
+                                                                                Select Operator [SEL_1407] (rows=550076554 width=7)
                                                                                   Output:["_col0","_col1"]
-                                                                                  Filter Operator [FIL_1403] (rows=550076554 width=7)
+                                                                                  Filter Operator [FIL_1406] (rows=550076554 width=7)
                                                                                     predicate:(ss_sold_date_sk is not null and ss_item_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_22_d1_d_date_sk_min) AND DynamicValue(RS_22_d1_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_22_d1_d_date_sk_bloom_filter)))
                                                                                     TableScan [TS_12] (rows=575995635 width=7)
                                                                                       default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk"]
                                                                                     <-Reducer 49 [BROADCAST_EDGE] vectorized
-                                                                                      BROADCAST [RS_1402]
-                                                                                        Group By Operator [GBY_1401] (rows=1 width=12)
+                                                                                      BROADCAST [RS_1405]
+                                                                                        Group By Operator [GBY_1404] (rows=1 width=12)
                                                                                           Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                                         <-Map 48 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                          SHUFFLE [RS_1397]
-                                                                                            Group By Operator [GBY_1393] (rows=1 width=12)
+                                                                                          SHUFFLE [RS_1400]
+                                                                                            Group By Operator [GBY_1396] (rows=1 width=12)
                                                                                               Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                              Select Operator [SEL_1384] (rows=1957 width=4)
+                                                                                              Select Operator [SEL_1387] (rows=1957 width=4)
                                                                                                 Output:["_col0"]
-                                                                                                 Please refer to the previous Select Operator [SEL_1382]
+                                                                                                 Please refer to the previous Select Operator [SEL_1385]
                                                             <-Reducer 40 [CONTAINS] vectorized
-                                                              Reduce Output Operator [RS_1425]
+                                                              Reduce Output Operator [RS_1428]
                                                                 PartitionCols:_col0, _col1, _col2
-                                                                Group By Operator [GBY_1424] (rows=120960 width=20)
+                                                                Group By Operator [GBY_1427] (rows=120960 width=20)
                                                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1423] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1426] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                   <-Reducer 38 [SIMPLE_EDGE]
                                                                     SHUFFLE [RS_195]
                                                                       PartitionCols:_col0, _col1, _col2
                                                                       Group By Operator [GBY_48] (rows=1693440 width=19)
                                                                         Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col5, _col6
-                                                                        Merge Join Operator [MERGEJOIN_1138] (rows=284448361 width=11)
-                                                                          Conds:RS_44._col1=RS_1326._col0(Inner),Output:["_col4","_col5","_col6"]
+                                                                        Merge Join Operator [MERGEJOIN_1141] (rows=284448361 width=11)
+                                                                          Conds:RS_44._col1=RS_1329._col0(Inner),Output:["_col4","_col5","_col6"]
                                                                         <-Map 24 [SIMPLE_EDGE] vectorized
-                                                                          SHUFFLE [RS_1326]
+                                                                          SHUFFLE [RS_1329]
                                                                             PartitionCols:_col0
-                                                                            Select Operator [SEL_1317] (rows=458612 width=15)
+                                                                            Select Operator [SEL_1320] (rows=458612 width=15)
                                                                               Output:["_col0","_col1","_col2","_col3"]
-                                                                              Filter Operator [FIL_1308] (rows=458612 width=15)
+                                                                              Filter Operator [FIL_1311] (rows=458612 width=15)
                                                                                 predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null and i_item_sk is not null)
                                                                                  Please refer to the previous TableScan [TS_6]
                                                                         <-Reducer 50 [SIMPLE_EDGE]
                                                                           SHUFFLE [RS_44]
                                                                             PartitionCols:_col1
-                                                                            Merge Join Operator [MERGEJOIN_1137] (rows=286549727 width=4)
-                                                                              Conds:RS_1419._col0=RS_1385._col0(Inner),Output:["_col1"]
+                                                                            Merge Join Operator [MERGEJOIN_1140] (rows=286549727 width=4)
+                                                                              Conds:RS_1422._col0=RS_1388._col0(Inner),Output:["_col1"]
                                                                             <-Map 48 [SIMPLE_EDGE] vectorized
-                                                                              SHUFFLE [RS_1385]
+                                                                              SHUFFLE [RS_1388]
                                                                                 PartitionCols:_col0
-                                                                                 Please refer to the previous Select Operator [SEL_1382]
+                                                                                 Please refer to the previous Select Operator [SEL_1385]
                                                                             <-Map 64 [SIMPLE_EDGE] vectorized
-                                                                              SHUFFLE [RS_1419]
+                                                                              SHUFFLE [RS_1422]
                                                                                 PartitionCols:_col0
-                                                                                Select Operator [SEL_1418] (rows=286549727 width=7)
+                                                                                Select Operator [SEL_1421] (rows=286549727 width=7)
                                                                                   Output:["_col0","_col1"]
-                                                                                  Filter Operator [FIL_1417] (rows=286549727 width=7)
+                                                                                  Filter Operator [FIL_1420] (rows=286549727 width=7)
                                                                                     predicate:(cs_sold_date_sk is not null and cs_item_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_42_d2_d_date_sk_min) AND DynamicValue(RS_42_d2_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_42_d2_d_date_sk_bloom_filter)))
                                                                                     TableScan [TS_32] (rows=287989836 width=7)
                                                                                       default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_item_sk"]
                                                                                     <-Reducer 51 [BROADCAST_EDGE] vectorized
-                                                                                      BROADCAST [RS_1416]
-                                                                                        Group By Operator [GBY_1415] (rows=1 width=12)
+                                                                                      BROADCAST [RS_1419]
+                                                                                        Group By Operator [GBY_1418] (rows=1 width=12)
                                                                                           Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                                         <-Map 48 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                          SHUFFLE [RS_1398]
-                                                                                            Group By Operator [GBY_1394] (rows=1 width=12)
+                                                                                          SHUFFLE [RS_1401]
+                                                                                            Group By Operator [GBY_1397] (rows=1 width=12)
                                                                                               Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                              Select Operator [SEL_1386] (rows=1957 width=4)
+                                                                                              Select Operator [SEL_1389] (rows=1957 width=4)
                                                                                                 Output:["_col0"]
-                                                                                                 Please refer to the previous Select Operator [SEL_1382]
+                                                                                                 Please refer to the previous Select Operator [SEL_1385]
                                                             <-Reducer 44 [CONTAINS] vectorized
-                                                              Reduce Output Operator [RS_1439]
+                                                              Reduce Output Operator [RS_1442]
                                                                 PartitionCols:_col0, _col1, _col2
-                                                                Group By Operator [GBY_1438] (rows=120960 width=20)
+                                                                Group By Operator [GBY_1441] (rows=120960 width=20)
                                                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1437] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1440] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                   <-Reducer 42 [SIMPLE_EDGE]
                                                                     SHUFFLE [RS_216]
                                                                       PartitionCols:_col0, _col1, _col2
                                                                       Group By Operator [GBY_69] (rows=846720 width=19)
                                                                         Output:["_col0","_col1","_col2","_col3"],aggregations:["count()"],keys:_col4, _col5, _col6
-                                                                        Merge Join Operator [MERGEJOIN_1140] (rows=142911107 width=11)
-                                                                          Conds:RS_65._col1=RS_1327._col0(Inner),Output:["_col4","_col5","_col6"]
+                                                                        Merge Join Operator [MERGEJOIN_1143] (rows=142911107 width=11)
+                                                                          Conds:RS_65._col1=RS_1330._col0(Inner),Output:["_col4","_col5","_col6"]
                                                                         <-Map 24 [SIMPLE_EDGE] vectorized
-                                                                          SHUFFLE [RS_1327]
+                                                                          SHUFFLE [RS_1330]
                                                                             PartitionCols:_col0
-                                                                            Select Operator [SEL_1318] (rows=458612 width=15)
+                                                                            Select Operator [SEL_1321] (rows=458612 width=15)
                                                                               Output:["_col0","_col1","_col2","_col3"]
-                                                                              Filter Operator [FIL_1309] (rows=458612 width=15)
+                                                                              Filter Operator [FIL_1312] (rows=458612 width=15)
                                                                                 predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null and i_item_sk is not null)
                                                                                  Please refer to the previous TableScan [TS_6]
                                                                         <-Reducer 52 [SIMPLE_EDGE]
                                                                           SHUFFLE [RS_65]
                                                                             PartitionCols:_col1
-                                                                            Merge Join Operator [MERGEJOIN_1139] (rows=143966864 width=4)
-                                                                              Conds:RS_1433._col0=RS_1387._col0(Inner),Output:["_col1"]
+                                                                            Merge Join Operator [MERGEJOIN_1142] (rows=143966864 width=4)
+                                                                              Conds:RS_1436._col0=RS_1390._col0(Inner),Output:["_col1"]
                                                                             <-Map 48 [SIMPLE_EDGE] vectorized
-                                                                              SHUFFLE [RS_1387]
+                                                                              SHUFFLE [RS_1390]
                                                                                 PartitionCols:_col0
-                                                                                 Please refer to the previous Select Operator [SEL_1382]
+                                                                                 Please refer to the previous Select Operator [SEL_1385]
                                                                             <-Map 65 [SIMPLE_EDGE] vectorized
-                                                                              SHUFFLE [RS_1433]
+                                                                              SHUFFLE [RS_1436]
                                                                                 PartitionCols:_col0
-                                                                                Select Operator [SEL_1432] (rows=143966864 width=7)
+                                                                                Select Operator [SEL_1435] (rows=143966864 width=7)
                                                                                   Output:["_col0","_col1"]
-                                                                                  Filter Operator [FIL_1431] (rows=143966864 width=7)
+                                                                                  Filter Operator [FIL_1434] (rows=143966864 width=7)
                                                                                     predicate:(ws_sold_date_sk is not null and ws_item_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_63_d3_d_date_sk_min) AND DynamicValue(RS_63_d3_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_63_d3_d_date_sk_bloom_filter)))
                                                                                     TableScan [TS_53] (rows=144002668 width=7)
                                                                                       default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk"]
                                                                                     <-Reducer 53 [BROADCAST_EDGE] vectorized
-                                                                                      BROADCAST [RS_1430]
-                                                                                        Group By Operator [GBY_1429] (rows=1 width=12)
+                                                                                      BROADCAST [RS_1433]
+                                                                                        Group By Operator [GBY_1432] (rows=1 width=12)
                                                                                           Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                                         <-Map 48 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                                          SHUFFLE [RS_1399]
-                                                                                            Group By Operator [GBY_1395] (rows=1 width=12)
+                                                                                          SHUFFLE [RS_1402]
+                                                                                            Group By Operator [GBY_1398] (rows=1 width=12)
                                                                                               Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                                              Select Operator [SEL_1388] (rows=1957 width=4)
+                                                                                              Select Operator [SEL_1391] (rows=1957 width=4)
                                                                                                 Output:["_col0"]
-                                                                                                 Please refer to the previous Select Operator [SEL_1382]
+                                                                                                 Please refer to the previous Select Operator [SEL_1385]
                               <-Reducer 60 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1364]
-                                  Select Operator [SEL_1363] (rows=1 width=112)
+                                PARTITION_ONLY_SHUFFLE [RS_1367]
+                                  Select Operator [SEL_1366] (rows=1 width=112)
                                     Output:["_col0"]
-                                    Filter Operator [FIL_1362] (rows=1 width=120)
+                                    Filter Operator [FIL_1365] (rows=1 width=120)
                                       predicate:(_col0 is not null and _col1 is not null)
-                                      Group By Operator [GBY_1361] (rows=1 width=120)
+                                      Group By Operator [GBY_1364] (rows=1 width=120)
                                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                       <-Union 59 [CUSTOM_SIMPLE_EDGE]
                                         <-Reducer 58 [CONTAINS]
-                                          Reduce Output Operator [RS_1243]
-                                            Group By Operator [GBY_1242] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1246]
+                                            Group By Operator [GBY_1245] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1241] (rows=980593145 width=112)
+                                              Select Operator [SEL_1244] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1239] (rows=550076554 width=110)
+                                                Select Operator [SEL_1242] (rows=550076554 width=110)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1238] (rows=550076554 width=110)
-                                                    Conds:RS_1448._col0=RS_1391._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1241] (rows=550076554 width=110)
+                                                    Conds:RS_1451._col0=RS_1394._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 48 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1391]
+                                                    SHUFFLE [RS_1394]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1382]
+                                                       Please refer to the previous Select Operator [SEL_1385]
                                                   <-Map 66 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1448]
+                                                    SHUFFLE [RS_1451]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1446] (rows=550076554 width=114)
+                                                      Select Operator [SEL_1449] (rows=550076554 width=114)
                                                         Output:["_col0","_col1","_col2"]
-                                                        Filter Operator [FIL_1445] (rows=550076554 width=114)
+                                                        Filter Operator [FIL_1448] (rows=550076554 width=114)
                                                           predicate:(ss_sold_date_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_109_date_dim_d_date_sk_min) AND DynamicValue(RS_109_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_109_date_dim_d_date_sk_bloom_filter)))
                                                           TableScan [TS_102] (rows=575995635 width=114)
                                                             default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_quantity","ss_list_price"]
                                                           <-Reducer 57 [BROADCAST_EDGE] vectorized
-                                                            BROADCAST [RS_1444]
-                                                              Group By Operator [GBY_1443] (rows=1 width=12)
+                                                            BROADCAST [RS_1447]
+                                                              Group By Operator [GBY_1446] (rows=1 width=12)
                                                                 Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                               <-Map 48 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                SHUFFLE [RS_1400]
-                                                                  Group By Operator [GBY_1396] (rows=1 width=12)
+                                                                SHUFFLE [RS_1403]
+                                                                  Group By Operator [GBY_1399] (rows=1 width=12)
                                                                     Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                    Select Operator [SEL_1390] (rows=1957 width=4)
+                                                                    Select Operator [SEL_1393] (rows=1957 width=4)
                                                                       Output:["_col0"]
-                                                                       Please refer to the previous Select Operator [SEL_1382]
+                                                                       Please refer to the previous Select Operator [SEL_1385]
                                         <-Reducer 69 [CONTAINS]
-                                          Reduce Output Operator [RS_1261]
-                                            Group By Operator [GBY_1260] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1264]
+                                            Group By Operator [GBY_1263] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1259] (rows=980593145 width=112)
+                                              Select Operator [SEL_1262] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1257] (rows=286549727 width=115)
+                                                Select Operator [SEL_1260] (rows=286549727 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1256] (rows=286549727 width=115)
-                                                    Conds:RS_1463._col0=RS_1454._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1259] (rows=286549727 width=115)
+                                                    Conds:RS_1466._col0=RS_1457._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 71 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1454]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1457]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1451] (rows=1957 width=4)
+                                                      Select Operator [SEL_1454] (rows=1957 width=4)
                                                         Output:["_col0"]
-                                                        Filter Operator [FIL_1450] (rows=1957 width=8)
+                                                        Filter Operator [FIL_1453] (rows=1957 width=8)
                                                           predicate:(d_year BETWEEN 1998 AND 2000 and d_date_sk is not null)
                                                           TableScan [TS_115] (rows=73049 width=8)
                                                             default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
                                                   <-Map 67 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1463]
+                                                    SHUFFLE [RS_1466]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1461] (rows=286549727 width=119)
+                                                      Select Operator [SEL_1464] (rows=286549727 width=119)
                                                         Output:["_col0","_col1","_col2"]
-                                                        Filter Operator [FIL_1460] (rows=286549727 width=119)
+                                                        Filter Operator [FIL_1463] (rows=286549727 width=119)
                                                           predicate:(cs_sold_date_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_119_date_dim_d_date_sk_min) AND DynamicValue(RS_119_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_119_date_dim_d_date_sk_bloom_filter)))
                                                           TableScan [TS_112] (rows=287989836 width=119)
                                                             default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_quantity","cs_list_price"]
                                                           <-Reducer 72 [BROADCAST_EDGE] vectorized
-                                                            BROADCAST [RS_1459]
-                                                              Group By Operator [GBY_1458] (rows=1 width=12)
+                                                            BROADCAST [RS_1462]
+                                                              Group By Operator [GBY_1461] (rows=1 width=12)
                                                                 Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                               <-Map 71 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                PARTITION_ONLY_SHUFFLE [RS_1457]
-                                                                  Group By Operator [GBY_1456] (rows=1 width=12)
+                                                                PARTITION_ONLY_SHUFFLE [RS_1460]
+                                                                  Group By Operator [GBY_1459] (rows=1 width=12)
                                                                     Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                    Select Operator [SEL_1453] (rows=1957 width=4)
+                                                                    Select Operator [SEL_1456] (rows=1957 width=4)
                                                                       Output:["_col0"]
-                                                                       Please refer to the previous Select Operator [SEL_1451]
+                                                                       Please refer to the previous Select Operator [SEL_1454]
                                         <-Reducer 75 [CONTAINS]
-                                          Reduce Output Operator [RS_1279]
-                                            Group By Operator [GBY_1278] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1282]
+                                            Group By Operator [GBY_1281] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1277] (rows=980593145 width=112)
+                                              Select Operator [SEL_1280] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1275] (rows=143966864 width=115)
+                                                Select Operator [SEL_1278] (rows=143966864 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1274] (rows=143966864 width=115)
-                                                    Conds:RS_1478._col0=RS_1469._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1277] (rows=143966864 width=115)
+                                                    Conds:RS_1481._col0=RS_1472._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 77 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1469]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1472]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1466] (rows=1957 width=4)
+                                                      Select Operator [SEL_1469] (rows=1957 width=4)
                                                         Output:["_col0"]
-                                                        Filter Operator [FIL_1465] (rows=1957 width=8)
+                                                        Filter Operator [FIL_1468] (rows=1957 width=8)
                                                           predicate:(d_year BETWEEN 1998 AND 2000 and d_date_sk is not null)
                                                           TableScan [TS_126] (rows=73049 width=8)
                                                             default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
                                                   <-Map 73 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1478]
+                                                    SHUFFLE [RS_1481]
                                                       PartitionCols:_col0
-                                                      Select Operator [SEL_1476] (rows=143966864 width=119)
+                                                      Select Operator [SEL_1479] (rows=143966864 width=119)
                                                         Output:["_col0","_col1","_col2"]
-                                                        Filter Operator [FIL_1475] (rows=143966864 width=119)
+                                                        Filter Operator [FIL_1478] (rows=143966864 width=119)
                                                           predicate:(ws_sold_date_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_130_date_dim_d_date_sk_min) AND DynamicValue(RS_130_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_130_date_dim_d_date_sk_bloom_filter)))
                                                           TableScan [TS_123] (rows=144002668 width=119)
                                                             default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_quantity","ws_list_price"]
                                                           <-Reducer 78 [BROADCAST_EDGE] vectorized
-                                                            BROADCAST [RS_1474]
-                                                              Group By Operator [GBY_1473] (rows=1 width=12)
+                                                            BROADCAST [RS_1477]
+                                                              Group By Operator [GBY_1476] (rows=1 width=12)
                                                                 Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                               <-Map 77 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                PARTITION_ONLY_SHUFFLE [RS_1472]
-                                                                  Group By Operator [GBY_1471] (rows=1 width=12)
+                                                                PARTITION_ONLY_SHUFFLE [RS_1475]
+                                                                  Group By Operator [GBY_1474] (rows=1 width=12)
                                                                     Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                    Select Operator [SEL_1468] (rows=1957 width=4)
+                                                                    Select Operator [SEL_1471] (rows=1957 width=4)
                                                                       Output:["_col0"]
-                                                                       Please refer to the previous Select Operator [SEL_1466]
+                                                                       Please refer to the previous Select Operator [SEL_1469]
                   <-Reducer 22 [CONTAINS]
-                    Reduce Output Operator [RS_1195]
+                    Reduce Output Operator [RS_1198]
                       PartitionCols:_col0, _col1, _col2, _col3, _col4
-                      Top N Key Operator [TNK_1194] (rows=304320 width=231)
-                        keys:_col0, _col1, _col2, _col3,top n:100
-                        Group By Operator [GBY_1193] (rows=304320 width=231)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
-                          Select Operator [SEL_1191] (rows=40576 width=219)
+                      Group By Operator [GBY_1197] (rows=304320 width=231)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
+                        Top N Key Operator [TNK_1196] (rows=121728 width=221)
+                          keys:_col0, _col1, _col2, _col3, 0L,top n:100
+                          Select Operator [SEL_1194] (rows=40576 width=219)
                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                            Filter Operator [FIL_1190] (rows=40576 width=244)
+                            Filter Operator [FIL_1193] (rows=40576 width=244)
                               predicate:(_col3 > _col5)
-                              Merge Join Operator [MERGEJOIN_1189] (rows=121728 width=244)
+                              Merge Join Operator [MERGEJOIN_1192] (rows=121728 width=244)
                                 Conds:(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                               <-Reducer 21 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1376]
-                                  Filter Operator [FIL_1375] (rows=121728 width=132)
+                                PARTITION_ONLY_SHUFFLE [RS_1379]
+                                  Filter Operator [FIL_1378] (rows=121728 width=132)
                                     predicate:_col3 is not null
-                                    Group By Operator [GBY_1374] (rows=121728 width=132)
+                                    Group By Operator [GBY_1377] (rows=121728 width=132)
                                       Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2
                                     <-Reducer 20 [SIMPLE_EDGE]
                                       SHUFFLE [RS_391]
@@ -714,189 +714,189 @@ Stage-0
                                           Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col3)","count()"],keys:_col0, _col1, _col2
                                           Select Operator [SEL_388] (rows=143966864 width=127)
                                             Output:["_col0","_col1","_col2","_col3"]
-                                            Merge Join Operator [MERGEJOIN_1171] (rows=143966864 width=127)
+                                            Merge Join Operator [MERGEJOIN_1174] (rows=143966864 width=127)
                                               Conds:RS_385._col1=RS_386._col0(Left Semi),Output:["_col2","_col3","_col6","_col7","_col8"]
                                             <-Reducer 19 [SIMPLE_EDGE]
                                               SHUFFLE [RS_385]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_1158] (rows=143966864 width=131)
-                                                  Conds:RS_380._col1=RS_1330._col0(Inner),Output:["_col1","_col2","_col3","_col6","_col7","_col8"]
+                                                Merge Join Operator [MERGEJOIN_1161] (rows=143966864 width=131)
+                                                  Conds:RS_380._col1=RS_1333._col0(Inner),Output:["_col1","_col2","_col3","_col6","_col7","_col8"]
                                                 <-Map 24 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_1330]
+                                                  SHUFFLE [RS_1333]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_1321] (rows=462000 width=15)
+                                                    Select Operator [SEL_1324] (rows=462000 width=15)
                                                       Output:["_col0","_col1","_col2","_col3"]
-                                                      Filter Operator [FIL_1312] (rows=462000 width=15)
+                                                      Filter Operator [FIL_1315] (rows=462000 width=15)
                                                         predicate:i_item_sk is not null
                                                          Please refer to the previous TableScan [TS_6]
                                                 <-Reducer 18 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_380]
                                                     PartitionCols:_col1
-                                                    Merge Join Operator [MERGEJOIN_1157] (rows=143966864 width=119)
-                                                      Conds:RS_1369._col0=RS_1292._col0(Inner),Output:["_col1","_col2","_col3"]
+                                                    Merge Join Operator [MERGEJOIN_1160] (rows=143966864 width=119)
+                                                      Conds:RS_1372._col0=RS_1295._col0(Inner),Output:["_col1","_col2","_col3"]
                                                     <-Map 10 [SIMPLE_EDGE] vectorized
-                                                      PARTITION_ONLY_SHUFFLE [RS_1292]
+                                                      PARTITION_ONLY_SHUFFLE [RS_1295]
                                                         PartitionCols:_col0
-                                                         Please refer to the previous Select Operator [SEL_1287]
+                                                         Please refer to the previous Select Operator [SEL_1290]
                                                     <-Map 80 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1369]
+                                                      SHUFFLE [RS_1372]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_1368] (rows=143966864 width=123)
+                                                        Select Operator [SEL_1371] (rows=143966864 width=123)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_1367] (rows=143966864 width=123)
+                                                          Filter Operator [FIL_1370] (rows=143966864 width=123)
                                                             predicate:(ws_sold_date_sk is not null and ws_item_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_378_date_dim_d_date_sk_min) AND DynamicValue(RS_378_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_378_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_293] (rows=144002668 width=123)
                                                               default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_quantity","ws_list_price"]
                                                             <-Reducer 23 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_1366]
-                                                                Group By Operator [GBY_1365] (rows=1 width=12)
+                                                              BROADCAST [RS_1369]
+                                                                Group By Operator [GBY_1368] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  PARTITION_ONLY_SHUFFLE [RS_1299]
-                                                                    Group By Operator [GBY_1296] (rows=1 width=12)
+                                                                  PARTITION_ONLY_SHUFFLE [RS_1302]
+                                                                    Group By Operator [GBY_1299] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_1293] (rows=50 width=4)
+                                                                      Select Operator [SEL_1296] (rows=50 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_1287]
+                                                                         Please refer to the previous Select Operator [SEL_1290]
                                             <-Reducer 37 [SIMPLE_EDGE]
                                               SHUFFLE [RS_386]
                                                 PartitionCols:_col0
                                                 Group By Operator [GBY_384] (rows=364 width=4)
                                                   Output:["_col0"],keys:_col0
-                                                  Merge Join Operator [MERGEJOIN_1165] (rows=729 width=4)
-                                                    Conds:RS_1331._col1, _col2, _col3=RS_1373._col0, _col1, _col2(Inner),Output:["_col0"]
+                                                  Merge Join Operator [MERGEJOIN_1168] (rows=729 width=4)
+                                                    Conds:RS_1334._col1, _col2, _col3=RS_1376._col0, _col1, _col2(Inner),Output:["_col0"]
                                                   <-Map 24 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1331]
+                                                    SHUFFLE [RS_1334]
                                                       PartitionCols:_col1, _col2, _col3
-                                                      Select Operator [SEL_1322] (rows=458612 width=15)
+                                                      Select Operator [SEL_1325] (rows=458612 width=15)
                                                         Output:["_col0","_col1","_col2","_col3"]
-                                                        Filter Operator [FIL_1313] (rows=458612 width=15)
+                                                        Filter Operator [FIL_1316] (rows=458612 width=15)
                                                           predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null and i_item_sk is not null)
                                                            Please refer to the previous TableScan [TS_6]
                                                   <-Reducer 36 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1373]
+                                                    SHUFFLE [RS_1376]
                                                       PartitionCols:_col0, _col1, _col2
-                                                      Select Operator [SEL_1372] (rows=1 width=12)
+                                                      Select Operator [SEL_1375] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"]
-                                                        Filter Operator [FIL_1371] (rows=1 width=20)
+                                                        Filter Operator [FIL_1374] (rows=1 width=20)
                                                           predicate:(_col3 = 3L)
-                                                          Group By Operator [GBY_1370] (rows=120960 width=20)
+                                                          Group By Operator [GBY_1373] (rows=120960 width=20)
                                                             Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                           <-Union 35 [SIMPLE_EDGE]
                                                             <-Reducer 34 [CONTAINS] vectorized
-                                                              Reduce Output Operator [RS_1414]
+                                                              Reduce Output Operator [RS_1417]
                                                                 PartitionCols:_col0, _col1, _col2
-                                                                Group By Operator [GBY_1413] (rows=120960 width=20)
+                                                                Group By Operator [GBY_1416] (rows=120960 width=20)
                                                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1412] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1415] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                   <-Reducer 26 [SIMPLE_EDGE]
                                                                     SHUFFLE [RS_322]
                                                                       PartitionCols:_col0, _col1, _col2
                                                                        Please refer to the previous Group By Operator [GBY_28]
                                                             <-Reducer 41 [CONTAINS] vectorized
-                                                              Reduce Output Operator [RS_1428]
+                                                              Reduce Output Operator [RS_1431]
                                                                 PartitionCols:_col0, _col1, _col2
-                                                                Group By Operator [GBY_1427] (rows=120960 width=20)
+                                                                Group By Operator [GBY_1430] (rows=120960 width=20)
                                                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1426] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1429] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                   <-Reducer 38 [SIMPLE_EDGE]
                                                                     SHUFFLE [RS_342]
                                                                       PartitionCols:_col0, _col1, _col2
                                                                        Please refer to the previous Group By Operator [GBY_48]
                                                             <-Reducer 45 [CONTAINS] vectorized
-                                                              Reduce Output Operator [RS_1442]
+                                                              Reduce Output Operator [RS_1445]
                                                                 PartitionCols:_col0, _col1, _col2
-                                                                Group By Operator [GBY_1441] (rows=120960 width=20)
+                                                                Group By Operator [GBY_1444] (rows=120960 width=20)
                                                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1440] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1443] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                   <-Reducer 42 [SIMPLE_EDGE]
                                                                     SHUFFLE [RS_363]
                                                                       PartitionCols:_col0, _col1, _col2
                                                                        Please refer to the previous Group By Operator [GBY_69]
                               <-Reducer 63 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1380]
-                                  Select Operator [SEL_1379] (rows=1 width=112)
+                                PARTITION_ONLY_SHUFFLE [RS_1383]
+                                  Select Operator [SEL_1382] (rows=1 width=112)
                                     Output:["_col0"]
-                                    Filter Operator [FIL_1378] (rows=1 width=120)
+                                    Filter Operator [FIL_1381] (rows=1 width=120)
                                       predicate:(_col0 is not null and _col1 is not null)
-                                      Group By Operator [GBY_1377] (rows=1 width=120)
+                                      Group By Operator [GBY_1380] (rows=1 width=120)
                                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                       <-Union 62 [CUSTOM_SIMPLE_EDGE]
                                         <-Reducer 61 [CONTAINS]
-                                          Reduce Output Operator [RS_1249]
-                                            Group By Operator [GBY_1248] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1252]
+                                            Group By Operator [GBY_1251] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1247] (rows=980593145 width=112)
+                                              Select Operator [SEL_1250] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1245] (rows=550076554 width=110)
+                                                Select Operator [SEL_1248] (rows=550076554 width=110)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1244] (rows=550076554 width=110)
-                                                    Conds:RS_1449._col0=RS_1392._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1247] (rows=550076554 width=110)
+                                                    Conds:RS_1452._col0=RS_1395._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 48 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1392]
+                                                    SHUFFLE [RS_1395]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1382]
+                                                       Please refer to the previous Select Operator [SEL_1385]
                                                   <-Map 66 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1449]
+                                                    SHUFFLE [RS_1452]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1446]
+                                                       Please refer to the previous Select Operator [SEL_1449]
                                         <-Reducer 70 [CONTAINS]
-                                          Reduce Output Operator [RS_1267]
-                                            Group By Operator [GBY_1266] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1270]
+                                            Group By Operator [GBY_1269] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1265] (rows=980593145 width=112)
+                                              Select Operator [SEL_1268] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1263] (rows=286549727 width=115)
+                                                Select Operator [SEL_1266] (rows=286549727 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1262] (rows=286549727 width=115)
-                                                    Conds:RS_1464._col0=RS_1455._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1265] (rows=286549727 width=115)
+                                                    Conds:RS_1467._col0=RS_1458._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 71 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1455]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1458]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1451]
+                                                       Please refer to the previous Select Operator [SEL_1454]
                                                   <-Map 67 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1464]
+                                                    SHUFFLE [RS_1467]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1461]
+                                                       Please refer to the previous Select Operator [SEL_1464]
                                         <-Reducer 76 [CONTAINS]
-                                          Reduce Output Operator [RS_1285]
-                                            Group By Operator [GBY_1284] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1288]
+                                            Group By Operator [GBY_1287] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1283] (rows=980593145 width=112)
+                                              Select Operator [SEL_1286] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1281] (rows=143966864 width=115)
+                                                Select Operator [SEL_1284] (rows=143966864 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1280] (rows=143966864 width=115)
-                                                    Conds:RS_1479._col0=RS_1470._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1283] (rows=143966864 width=115)
+                                                    Conds:RS_1482._col0=RS_1473._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 77 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1470]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1473]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1466]
+                                                       Please refer to the previous Select Operator [SEL_1469]
                                                   <-Map 73 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1479]
+                                                    SHUFFLE [RS_1482]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1476]
+                                                       Please refer to the previous Select Operator [SEL_1479]
                   <-Reducer 6 [CONTAINS]
-                    Reduce Output Operator [RS_1181]
+                    Reduce Output Operator [RS_1184]
                       PartitionCols:_col0, _col1, _col2, _col3, _col4
-                      Top N Key Operator [TNK_1180] (rows=304320 width=231)
-                        keys:_col0, _col1, _col2, _col3,top n:100
-                        Group By Operator [GBY_1179] (rows=304320 width=231)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
-                          Select Operator [SEL_1177] (rows=40576 width=221)
+                      Group By Operator [GBY_1183] (rows=304320 width=231)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"],aggregations:["sum(_col4)","sum(_col5)"],keys:_col0, _col1, _col2, _col3, 0L
+                        Top N Key Operator [TNK_1182] (rows=121728 width=221)
+                          keys:_col0, _col1, _col2, _col3, 0L,top n:100
+                          Select Operator [SEL_1180] (rows=40576 width=221)
                             Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                            Filter Operator [FIL_1176] (rows=40576 width=244)
+                            Filter Operator [FIL_1179] (rows=40576 width=244)
                               predicate:(_col3 > _col5)
-                              Merge Join Operator [MERGEJOIN_1175] (rows=121728 width=244)
+                              Merge Join Operator [MERGEJOIN_1178] (rows=121728 width=244)
                                 Conds:(Inner),Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
                               <-Reducer 5 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1338]
-                                  Filter Operator [FIL_1337] (rows=121728 width=132)
+                                PARTITION_ONLY_SHUFFLE [RS_1341]
+                                  Filter Operator [FIL_1340] (rows=121728 width=132)
                                     predicate:_col3 is not null
-                                    Group By Operator [GBY_1336] (rows=121728 width=132)
+                                    Group By Operator [GBY_1339] (rows=121728 width=132)
                                       Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"],keys:KEY._col0, KEY._col1, KEY._col2
                                     <-Reducer 4 [SIMPLE_EDGE]
                                       SHUFFLE [RS_98]
@@ -905,61 +905,61 @@ Stage-0
                                           Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col3)","count()"],keys:_col0, _col1, _col2
                                           Select Operator [SEL_95] (rows=550076554 width=122)
                                             Output:["_col0","_col1","_col2","_col3"]
-                                            Merge Join Operator [MERGEJOIN_1169] (rows=550076554 width=122)
+                                            Merge Join Operator [MERGEJOIN_1172] (rows=550076554 width=122)
                                               Conds:RS_92._col1=RS_93._col0(Left Semi),Output:["_col2","_col3","_col6","_col7","_col8"]
                                             <-Reducer 25 [SIMPLE_EDGE]
                                               SHUFFLE [RS_93]
                                                 PartitionCols:_col0
                                                 Group By Operator [GBY_91] (rows=364 width=4)
                                                   Output:["_col0"],keys:_col0
-                                                  Merge Join Operator [MERGEJOIN_1141] (rows=729 width=4)
-                                                    Conds:RS_1324._col1, _col2, _col3=RS_1335._col0, _col1, _col2(Inner),Output:["_col0"]
+                                                  Merge Join Operator [MERGEJOIN_1144] (rows=729 width=4)
+                                                    Conds:RS_1327._col1, _col2, _col3=RS_1338._col0, _col1, _col2(Inner),Output:["_col0"]
                                                   <-Map 24 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1324]
+                                                    SHUFFLE [RS_1327]
                                                       PartitionCols:_col1, _col2, _col3
-                                                      Select Operator [SEL_1315] (rows=458612 width=15)
+                                                      Select Operator [SEL_1318] (rows=458612 width=15)
                                                         Output:["_col0","_col1","_col2","_col3"]
-                                                        Filter Operator [FIL_1306] (rows=458612 width=15)
+                                                        Filter Operator [FIL_1309] (rows=458612 width=15)
                                                           predicate:(i_category_id is not null and i_brand_id is not null and i_class_id is not null and i_item_sk is not null)
                                                            Please refer to the previous TableScan [TS_6]
                                                   <-Reducer 29 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1335]
+                                                    SHUFFLE [RS_1338]
                                                       PartitionCols:_col0, _col1, _col2
-                                                      Select Operator [SEL_1334] (rows=1 width=12)
+                                                      Select Operator [SEL_1337] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"]
-                                                        Filter Operator [FIL_1333] (rows=1 width=20)
+                                                        Filter Operator [FIL_1336] (rows=1 width=20)
                                                           predicate:(_col3 = 3L)
-                                                          Group By Operator [GBY_1332] (rows=120960 width=20)
+                                                          Group By Operator [GBY_1335] (rows=120960 width=20)
                                                             Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                           <-Union 28 [SIMPLE_EDGE]
                                                             <-Reducer 27 [CONTAINS] vectorized
-                                                              Reduce Output Operator [RS_1408]
+                                                              Reduce Output Operator [RS_1411]
                                                                 PartitionCols:_col0, _col1, _col2
-                                                                Group By Operator [GBY_1407] (rows=120960 width=20)
+                                                                Group By Operator [GBY_1410] (rows=120960 width=20)
                                                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1406] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1409] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                   <-Reducer 26 [SIMPLE_EDGE]
                                                                     SHUFFLE [RS_29]
                                                                       PartitionCols:_col0, _col1, _col2
                                                                        Please refer to the previous Group By Operator [GBY_28]
                                                             <-Reducer 39 [CONTAINS] vectorized
-                                                              Reduce Output Operator [RS_1422]
+                                                              Reduce Output Operator [RS_1425]
                                                                 PartitionCols:_col0, _col1, _col2
-                                                                Group By Operator [GBY_1421] (rows=120960 width=20)
+                                                                Group By Operator [GBY_1424] (rows=120960 width=20)
                                                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1420] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1423] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                   <-Reducer 38 [SIMPLE_EDGE]
                                                                     SHUFFLE [RS_49]
                                                                       PartitionCols:_col0, _col1, _col2
                                                                        Please refer to the previous Group By Operator [GBY_48]
                                                             <-Reducer 43 [CONTAINS] vectorized
-                                                              Reduce Output Operator [RS_1436]
+                                                              Reduce Output Operator [RS_1439]
                                                                 PartitionCols:_col0, _col1, _col2
-                                                                Group By Operator [GBY_1435] (rows=120960 width=20)
+                                                                Group By Operator [GBY_1438] (rows=120960 width=20)
                                                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["count(_col3)"],keys:_col0, _col1, _col2
-                                                                  Group By Operator [GBY_1434] (rows=120960 width=20)
+                                                                  Group By Operator [GBY_1437] (rows=120960 width=20)
                                                                     Output:["_col0","_col1","_col2","_col3"],aggregations:["count(VALUE._col0)"],keys:KEY._col0, KEY._col1, KEY._col2
                                                                   <-Reducer 42 [SIMPLE_EDGE]
                                                                     SHUFFLE [RS_70]
@@ -968,106 +968,106 @@ Stage-0
                                             <-Reducer 3 [SIMPLE_EDGE]
                                               SHUFFLE [RS_92]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_1134] (rows=550076554 width=126)
-                                                  Conds:RS_87._col1=RS_1323._col0(Inner),Output:["_col1","_col2","_col3","_col6","_col7","_col8"]
+                                                Merge Join Operator [MERGEJOIN_1137] (rows=550076554 width=126)
+                                                  Conds:RS_87._col1=RS_1326._col0(Inner),Output:["_col1","_col2","_col3","_col6","_col7","_col8"]
                                                 <-Map 24 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_1323]
+                                                  SHUFFLE [RS_1326]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_1314] (rows=462000 width=15)
+                                                    Select Operator [SEL_1317] (rows=462000 width=15)
                                                       Output:["_col0","_col1","_col2","_col3"]
-                                                      Filter Operator [FIL_1305] (rows=462000 width=15)
+                                                      Filter Operator [FIL_1308] (rows=462000 width=15)
                                                         predicate:i_item_sk is not null
                                                          Please refer to the previous TableScan [TS_6]
                                                 <-Reducer 2 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_87]
                                                     PartitionCols:_col1
-                                                    Merge Join Operator [MERGEJOIN_1133] (rows=550076554 width=114)
-                                                      Conds:RS_1304._col0=RS_1288._col0(Inner),Output:["_col1","_col2","_col3"]
+                                                    Merge Join Operator [MERGEJOIN_1136] (rows=550076554 width=114)
+                                                      Conds:RS_1307._col0=RS_1291._col0(Inner),Output:["_col1","_col2","_col3"]
                                                     <-Map 10 [SIMPLE_EDGE] vectorized
-                                                      PARTITION_ONLY_SHUFFLE [RS_1288]
+                                                      PARTITION_ONLY_SHUFFLE [RS_1291]
                                                         PartitionCols:_col0
-                                                         Please refer to the previous Select Operator [SEL_1287]
+                                                         Please refer to the previous Select Operator [SEL_1290]
                                                     <-Map 1 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_1304]
+                                                      SHUFFLE [RS_1307]
                                                         PartitionCols:_col0
-                                                        Select Operator [SEL_1303] (rows=550076554 width=118)
+                                                        Select Operator [SEL_1306] (rows=550076554 width=118)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_1302] (rows=550076554 width=118)
+                                                          Filter Operator [FIL_1305] (rows=550076554 width=118)
                                                             predicate:(ss_sold_date_sk is not null and ss_item_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_85_date_dim_d_date_sk_min) AND DynamicValue(RS_85_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_85_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_0] (rows=575995635 width=118)
                                                               default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_quantity","ss_list_price"]
                                                             <-Reducer 11 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_1301]
-                                                                Group By Operator [GBY_1300] (rows=1 width=12)
+                                                              BROADCAST [RS_1304]
+                                                                Group By Operator [GBY_1303] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  PARTITION_ONLY_SHUFFLE [RS_1297]
-                                                                    Group By Operator [GBY_1294] (rows=1 width=12)
+                                                                  PARTITION_ONLY_SHUFFLE [RS_1300]
+                                                                    Group By Operator [GBY_1297] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_1289] (rows=50 width=4)
+                                                                      Select Operator [SEL_1292] (rows=50 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_1287]
+                                                                         Please refer to the previous Select Operator [SEL_1290]
                               <-Reducer 56 [CUSTOM_SIMPLE_EDGE] vectorized
-                                PARTITION_ONLY_SHUFFLE [RS_1342]
-                                  Select Operator [SEL_1341] (rows=1 width=112)
+                                PARTITION_ONLY_SHUFFLE [RS_1345]
+                                  Select Operator [SEL_1344] (rows=1 width=112)
                                     Output:["_col0"]
-                                    Filter Operator [FIL_1340] (rows=1 width=120)
+                                    Filter Operator [FIL_1343] (rows=1 width=120)
                                       predicate:(_col0 is not null and _col1 is not null)
-                                      Group By Operator [GBY_1339] (rows=1 width=120)
+                                      Group By Operator [GBY_1342] (rows=1 width=120)
                                         Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)"]
                                       <-Union 55 [CUSTOM_SIMPLE_EDGE]
                                         <-Reducer 54 [CONTAINS]
-                                          Reduce Output Operator [RS_1237]
-                                            Group By Operator [GBY_1236] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1240]
+                                            Group By Operator [GBY_1239] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1235] (rows=980593145 width=112)
+                                              Select Operator [SEL_1238] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1233] (rows=550076554 width=110)
+                                                Select Operator [SEL_1236] (rows=550076554 width=110)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1232] (rows=550076554 width=110)
-                                                    Conds:RS_1447._col0=RS_1389._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1235] (rows=550076554 width=110)
+                                                    Conds:RS_1450._col0=RS_1392._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 48 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1389]
+                                                    SHUFFLE [RS_1392]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1382]
+                                                       Please refer to the previous Select Operator [SEL_1385]
                                                   <-Map 66 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1447]
+                                                    SHUFFLE [RS_1450]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1446]
+                                                       Please refer to the previous Select Operator [SEL_1449]
                                         <-Reducer 68 [CONTAINS]
-                                          Reduce Output Operator [RS_1255]
-                                            Group By Operator [GBY_1254] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1258]
+                                            Group By Operator [GBY_1257] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1253] (rows=980593145 width=112)
+                                              Select Operator [SEL_1256] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1251] (rows=286549727 width=115)
+                                                Select Operator [SEL_1254] (rows=286549727 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1250] (rows=286549727 width=115)
-                                                    Conds:RS_1462._col0=RS_1452._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1253] (rows=286549727 width=115)
+                                                    Conds:RS_1465._col0=RS_1455._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 71 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1452]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1455]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1451]
+                                                       Please refer to the previous Select Operator [SEL_1454]
                                                   <-Map 67 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1462]
+                                                    SHUFFLE [RS_1465]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1461]
+                                                       Please refer to the previous Select Operator [SEL_1464]
                                         <-Reducer 74 [CONTAINS]
-                                          Reduce Output Operator [RS_1273]
-                                            Group By Operator [GBY_1272] (rows=1 width=120)
+                                          Reduce Output Operator [RS_1276]
+                                            Group By Operator [GBY_1275] (rows=1 width=120)
                                               Output:["_col0","_col1"],aggregations:["sum(_col0)","count(_col0)"]
-                                              Select Operator [SEL_1271] (rows=980593145 width=112)
+                                              Select Operator [SEL_1274] (rows=980593145 width=112)
                                                 Output:["_col0"]
-                                                Select Operator [SEL_1269] (rows=143966864 width=115)
+                                                Select Operator [SEL_1272] (rows=143966864 width=115)
                                                   Output:["_col0","_col1"]
-                                                  Merge Join Operator [MERGEJOIN_1268] (rows=143966864 width=115)
-                                                    Conds:RS_1477._col0=RS_1467._col0(Inner),Output:["_col1","_col2"]
+                                                  Merge Join Operator [MERGEJOIN_1271] (rows=143966864 width=115)
+                                                    Conds:RS_1480._col0=RS_1470._col0(Inner),Output:["_col1","_col2"]
                                                   <-Map 77 [SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_1467]
+                                                    PARTITION_ONLY_SHUFFLE [RS_1470]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1466]
+                                                       Please refer to the previous Select Operator [SEL_1469]
                                                   <-Map 73 [SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_1477]
+                                                    SHUFFLE [RS_1480]
                                                       PartitionCols:_col0
-                                                       Please refer to the previous Select Operator [SEL_1476]
+                                                       Please refer to the previous Select Operator [SEL_1479]
 
diff --git a/ql/src/test/results/clientpositive/perf/tez/query27.q.out b/ql/src/test/results/clientpositive/perf/tez/query27.q.out
index 774c0fd..62fbeda 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query27.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query27.q.out
@@ -71,97 +71,99 @@ Stage-0
     limit:100
     Stage-1
       Reducer 7 vectorized
-      File Output Operator [FS_128]
-        Limit [LIM_127] (rows=100 width=538)
+      File Output Operator [FS_131]
+        Limit [LIM_130] (rows=100 width=538)
           Number of rows:100
-          Select Operator [SEL_126] (rows=6526254 width=538)
+          Select Operator [SEL_129] (rows=6526254 width=538)
             Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
           <-Reducer 6 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_125]
-              Select Operator [SEL_124] (rows=6526254 width=538)
+            SHUFFLE [RS_128]
+              Select Operator [SEL_127] (rows=6526254 width=538)
                 Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                Group By Operator [GBY_123] (rows=6526254 width=570)
+                Group By Operator [GBY_126] (rows=6526254 width=570)
                   Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(VALUE._col0)","count(VALUE._col1)","sum(VALUE._col2)","count(VALUE._col3)","sum(VALUE._col4)","count(VALUE._col5)","sum(VALUE._col6)","count(VALUE._col7)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Reducer 5 [SIMPLE_EDGE]
                   SHUFFLE [RS_30]
                     PartitionCols:_col0, _col1, _col2
-                    Top N Key Operator [TNK_58] (rows=13907934 width=570)
-                      keys:_col0, _col1,top n:100
-                      Group By Operator [GBY_29] (rows=13907934 width=570)
-                        Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(_col2)","count(_col2)","sum(_col3)","count(_col3)","sum(_col4)","count(_col4)","sum(_col5)","count(_col5)"],keys:_col0, _col1, 0L
+                    Group By Operator [GBY_29] (rows=13907934 width=570)
+                      Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7","_col8","_col9","_col10"],aggregations:["sum(_col2)","count(_col2)","sum(_col3)","count(_col3)","sum(_col4)","count(_col4)","sum(_col5)","count(_col5)"],keys:_col0, _col1, 0L
+                      Top N Key Operator [TNK_61] (rows=4635978 width=186)
+                        keys:_col0, _col1, 0L,top n:100
                         Select Operator [SEL_27] (rows=4635978 width=186)
                           Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                          Merge Join Operator [MERGEJOIN_102] (rows=4635978 width=186)
-                            Conds:RS_24._col1=RS_122._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col11","_col13"]
-                          <-Map 12 [SIMPLE_EDGE] vectorized
-                            SHUFFLE [RS_122]
-                              PartitionCols:_col0
-                              Select Operator [SEL_121] (rows=462000 width=104)
-                                Output:["_col0","_col1"]
-                                Filter Operator [FIL_120] (rows=462000 width=104)
-                                  predicate:i_item_sk is not null
-                                  TableScan [TS_12] (rows=462000 width=104)
-                                    default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
-                          <-Reducer 4 [SIMPLE_EDGE]
-                            SHUFFLE [RS_24]
-                              PartitionCols:_col1
-                              Merge Join Operator [MERGEJOIN_101] (rows=4635978 width=90)
-                                Conds:RS_21._col3=RS_119._col0(Inner),Output:["_col1","_col4","_col5","_col6","_col7","_col11"]
-                              <-Map 11 [SIMPLE_EDGE] vectorized
-                                SHUFFLE [RS_119]
-                                  PartitionCols:_col0
-                                  Select Operator [SEL_118] (rows=209 width=90)
-                                    Output:["_col0","_col1"]
-                                    Filter Operator [FIL_117] (rows=209 width=90)
-                                      predicate:((s_state) IN ('SD', 'FL', 'MI', 'LA', 'MO', 'SC') and s_store_sk is not null)
-                                      TableScan [TS_9] (rows=1704 width=90)
-                                        default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_state"]
-                              <-Reducer 3 [SIMPLE_EDGE]
-                                SHUFFLE [RS_21]
-                                  PartitionCols:_col3
-                                  Merge Join Operator [MERGEJOIN_100] (rows=4635978 width=4)
-                                    Conds:RS_18._col0=RS_116._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7"]
-                                  <-Map 10 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_116]
-                                      PartitionCols:_col0
-                                      Select Operator [SEL_115] (rows=652 width=4)
-                                        Output:["_col0"]
-                                        Filter Operator [FIL_114] (rows=652 width=8)
-                                          predicate:((d_year = 2001) and d_date_sk is not null)
-                                          TableScan [TS_6] (rows=73049 width=8)
-                                            default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
-                                  <-Reducer 2 [SIMPLE_EDGE]
-                                    SHUFFLE [RS_18]
-                                      PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_99] (rows=4635978 width=4)
-                                        Conds:RS_113._col2=RS_105._col0(Inner),Output:["_col0","_col1","_col3","_col4","_col5","_col6","_col7"]
-                                      <-Map 8 [SIMPLE_EDGE] vectorized
-                                        PARTITION_ONLY_SHUFFLE [RS_105]
-                                          PartitionCols:_col0
-                                          Select Operator [SEL_104] (rows=14776 width=4)
-                                            Output:["_col0"]
-                                            Filter Operator [FIL_103] (rows=14776 width=268)
-                                              predicate:((cd_marital_status = 'U') and (cd_education_status = '2 yr Degree') and (cd_gender = 'M') and cd_demo_sk is not null)
-                                              TableScan [TS_3] (rows=1861800 width=268)
-                                                default@customer_demographics,customer_demographics,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_gender","cd_marital_status","cd_education_status"]
-                                      <-Map 1 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_113]
-                                          PartitionCols:_col2
-                                          Select Operator [SEL_112] (rows=501690006 width=340)
-                                            Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
-                                            Filter Operator [FIL_111] (rows=501690006 width=340)
-                                              predicate:(ss_cdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null and ss_item_sk is not null and ss_cdemo_sk BETWEEN DynamicValue(RS_16_customer_demographics_cd_demo_sk_min) AND DynamicValue(RS_16_customer_demographics_cd_demo_sk_max) and in_bloom_filter(ss_cdemo_sk, DynamicValue(RS_16_customer_demographics_cd_demo_sk_bloom_filter)))
-                                              TableScan [TS_0] (rows=575995635 width=340)
-                                                default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_cdemo_sk","ss_store_sk","ss_quantity","ss_list_price","ss_sales_price","ss_coupon_amt"]
-                                              <-Reducer 9 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_110]
-                                                  Group By Operator [GBY_109] (rows=1 width=12)
-                                                    Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
-                                                  <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    PARTITION_ONLY_SHUFFLE [RS_108]
-                                                      Group By Operator [GBY_107] (rows=1 width=12)
-                                                        Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_106] (rows=14776 width=4)
-                                                          Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_104]
+                          Top N Key Operator [TNK_59] (rows=4635978 width=186)
+                            keys:_col13, _col11,top n:100
+                            Merge Join Operator [MERGEJOIN_105] (rows=4635978 width=186)
+                              Conds:RS_24._col1=RS_125._col0(Inner),Output:["_col4","_col5","_col6","_col7","_col11","_col13"]
+                            <-Map 12 [SIMPLE_EDGE] vectorized
+                              SHUFFLE [RS_125]
+                                PartitionCols:_col0
+                                Select Operator [SEL_124] (rows=462000 width=104)
+                                  Output:["_col0","_col1"]
+                                  Filter Operator [FIL_123] (rows=462000 width=104)
+                                    predicate:i_item_sk is not null
+                                    TableScan [TS_12] (rows=462000 width=104)
+                                      default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_item_id"]
+                            <-Reducer 4 [SIMPLE_EDGE]
+                              SHUFFLE [RS_24]
+                                PartitionCols:_col1
+                                Merge Join Operator [MERGEJOIN_104] (rows=4635978 width=90)
+                                  Conds:RS_21._col3=RS_122._col0(Inner),Output:["_col1","_col4","_col5","_col6","_col7","_col11"]
+                                <-Map 11 [SIMPLE_EDGE] vectorized
+                                  SHUFFLE [RS_122]
+                                    PartitionCols:_col0
+                                    Select Operator [SEL_121] (rows=209 width=90)
+                                      Output:["_col0","_col1"]
+                                      Filter Operator [FIL_120] (rows=209 width=90)
+                                        predicate:((s_state) IN ('SD', 'FL', 'MI', 'LA', 'MO', 'SC') and s_store_sk is not null)
+                                        TableScan [TS_9] (rows=1704 width=90)
+                                          default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_state"]
+                                <-Reducer 3 [SIMPLE_EDGE]
+                                  SHUFFLE [RS_21]
+                                    PartitionCols:_col3
+                                    Merge Join Operator [MERGEJOIN_103] (rows=4635978 width=4)
+                                      Conds:RS_18._col0=RS_119._col0(Inner),Output:["_col1","_col3","_col4","_col5","_col6","_col7"]
+                                    <-Map 10 [SIMPLE_EDGE] vectorized
+                                      SHUFFLE [RS_119]
+                                        PartitionCols:_col0
+                                        Select Operator [SEL_118] (rows=652 width=4)
+                                          Output:["_col0"]
+                                          Filter Operator [FIL_117] (rows=652 width=8)
+                                            predicate:((d_year = 2001) and d_date_sk is not null)
+                                            TableScan [TS_6] (rows=73049 width=8)
+                                              default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_year"]
+                                    <-Reducer 2 [SIMPLE_EDGE]
+                                      SHUFFLE [RS_18]
+                                        PartitionCols:_col0
+                                        Merge Join Operator [MERGEJOIN_102] (rows=4635978 width=4)
+                                          Conds:RS_116._col2=RS_108._col0(Inner),Output:["_col0","_col1","_col3","_col4","_col5","_col6","_col7"]
+                                        <-Map 8 [SIMPLE_EDGE] vectorized
+                                          PARTITION_ONLY_SHUFFLE [RS_108]
+                                            PartitionCols:_col0
+                                            Select Operator [SEL_107] (rows=14776 width=4)
+                                              Output:["_col0"]
+                                              Filter Operator [FIL_106] (rows=14776 width=268)
+                                                predicate:((cd_marital_status = 'U') and (cd_education_status = '2 yr Degree') and (cd_gender = 'M') and cd_demo_sk is not null)
+                                                TableScan [TS_3] (rows=1861800 width=268)
+                                                  default@customer_demographics,customer_demographics,Tbl:COMPLETE,Col:COMPLETE,Output:["cd_demo_sk","cd_gender","cd_marital_status","cd_education_status"]
+                                        <-Map 1 [SIMPLE_EDGE] vectorized
+                                          SHUFFLE [RS_116]
+                                            PartitionCols:_col2
+                                            Select Operator [SEL_115] (rows=501690006 width=340)
+                                              Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
+                                              Filter Operator [FIL_114] (rows=501690006 width=340)
+                                                predicate:(ss_cdemo_sk is not null and ss_sold_date_sk is not null and ss_store_sk is not null and ss_item_sk is not null and ss_cdemo_sk BETWEEN DynamicValue(RS_16_customer_demographics_cd_demo_sk_min) AND DynamicValue(RS_16_customer_demographics_cd_demo_sk_max) and in_bloom_filter(ss_cdemo_sk, DynamicValue(RS_16_customer_demographics_cd_demo_sk_bloom_filter)))
+                                                TableScan [TS_0] (rows=575995635 width=340)
+                                                  default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_cdemo_sk","ss_store_sk","ss_quantity","ss_list_price","ss_sales_price","ss_coupon_amt"]
+                                                <-Reducer 9 [BROADCAST_EDGE] vectorized
+                                                  BROADCAST [RS_113]
+                                                    Group By Operator [GBY_112] (rows=1 width=12)
+                                                      Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
+                                                    <-Map 8 [CUSTOM_SIMPLE_EDGE] vectorized
+                                                      PARTITION_ONLY_SHUFFLE [RS_111]
+                                                        Group By Operator [GBY_110] (rows=1 width=12)
+                                                          Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
+                                                          Select Operator [SEL_109] (rows=14776 width=4)
+                                                            Output:["_col0"]
+                                                             Please refer to the previous Select Operator [SEL_107]
 
diff --git a/ql/src/test/results/clientpositive/perf/tez/query5.q.out b/ql/src/test/results/clientpositive/perf/tez/query5.q.out
index 03980ac..34bbb51 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query5.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query5.q.out
@@ -303,235 +303,235 @@ Stage-0
     limit:100
     Stage-1
       Reducer 8 vectorized
-      File Output Operator [FS_306]
-        Limit [LIM_305] (rows=100 width=619)
+      File Output Operator [FS_309]
+        Limit [LIM_308] (rows=100 width=619)
           Number of rows:100
-          Select Operator [SEL_304] (rows=59581 width=619)
+          Select Operator [SEL_307] (rows=59581 width=619)
             Output:["_col0","_col1","_col2","_col3","_col4"]
           <-Reducer 7 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_303]
-              Select Operator [SEL_302] (rows=59581 width=619)
+            SHUFFLE [RS_306]
+              Select Operator [SEL_305] (rows=59581 width=619)
                 Output:["_col0","_col1","_col2","_col3","_col4"]
-                Group By Operator [GBY_301] (rows=59581 width=627)
+                Group By Operator [GBY_304] (rows=59581 width=627)
                   Output:["_col0","_col1","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Union 6 [SIMPLE_EDGE]
                   <-Reducer 14 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_317]
+                    Reduce Output Operator [RS_320]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_316] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_315] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_314] (rows=38846 width=619)
+                      Group By Operator [GBY_319] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_318] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_317] (rows=38846 width=619)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_313] (rows=38846 width=548)
+                            Group By Operator [GBY_316] (rows=38846 width=548)
                               Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
                             <-Reducer 13 [SIMPLE_EDGE]
                               SHUFFLE [RS_47]
                                 PartitionCols:_col0
                                 Group By Operator [GBY_46] (rows=26026820 width=548)
                                   Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col8
-                                  Merge Join Operator [MERGEJOIN_224] (rows=313339499 width=546)
-                                    Conds:RS_42._col0=RS_312._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
+                                  Merge Join Operator [MERGEJOIN_227] (rows=313339499 width=546)
+                                    Conds:RS_42._col0=RS_315._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
                                   <-Map 24 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_312]
+                                    SHUFFLE [RS_315]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_311] (rows=46000 width=104)
+                                      Select Operator [SEL_314] (rows=46000 width=104)
                                         Output:["_col0","_col1"]
-                                        Filter Operator [FIL_310] (rows=46000 width=104)
+                                        Filter Operator [FIL_313] (rows=46000 width=104)
                                           predicate:cp_catalog_page_sk is not null
                                           TableScan [TS_36] (rows=46000 width=104)
                                             default@catalog_page,catalog_page,Tbl:COMPLETE,Col:COMPLETE,Output:["cp_catalog_page_sk","cp_catalog_page_id"]
                                   <-Reducer 12 [SIMPLE_EDGE]
                                     SHUFFLE [RS_42]
                                       PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_223] (rows=313339499 width=450)
-                                        Conds:Union 22._col1=RS_278._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
+                                      Merge Join Operator [MERGEJOIN_226] (rows=313339499 width=450)
+                                        Conds:Union 22._col1=RS_281._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
                                       <-Map 10 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_278]
+                                        SHUFFLE [RS_281]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_275] (rows=8116 width=4)
+                                          Select Operator [SEL_278] (rows=8116 width=4)
                                             Output:["_col0"]
-                                            Filter Operator [FIL_274] (rows=8116 width=98)
+                                            Filter Operator [FIL_277] (rows=8116 width=98)
                                               predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-08-18 00:00:00' and d_date_sk is not null)
                                               TableScan [TS_8] (rows=73049 width=98)
                                                 default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
                                       <-Union 22 [SIMPLE_EDGE]
                                         <-Map 21 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_330]
+                                          Reduce Output Operator [RS_333]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_329] (rows=285117694 width=455)
+                                            Select Operator [SEL_332] (rows=285117694 width=455)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_328] (rows=285117694 width=231)
+                                              Filter Operator [FIL_331] (rows=285117694 width=231)
                                                 predicate:(cs_sold_date_sk is not null and cs_catalog_page_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_40_date_dim_d_date_sk_min) AND DynamicValue(RS_40_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_40_date_dim_d_date_sk_bloom_filter)))
-                                                TableScan [TS_255] (rows=287989836 width=231)
+                                                TableScan [TS_258] (rows=287989836 width=231)
                                                   Output:["cs_sold_date_sk","cs_catalog_page_sk","cs_ext_sales_price","cs_net_profit"]
                                                 <-Reducer 15 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_327]
-                                                    Group By Operator [GBY_326] (rows=1 width=12)
+                                                  BROADCAST [RS_330]
+                                                    Group By Operator [GBY_329] (rows=1 width=12)
                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                     <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_286]
-                                                        Group By Operator [GBY_283] (rows=1 width=12)
+                                                      SHUFFLE [RS_289]
+                                                        Group By Operator [GBY_286] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_279] (rows=8116 width=4)
+                                                          Select Operator [SEL_282] (rows=8116 width=4)
                                                             Output:["_col0"]
-                                                             Please refer to the previous Select Operator [SEL_275]
+                                                             Please refer to the previous Select Operator [SEL_278]
                                         <-Map 23 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_333]
+                                          Reduce Output Operator [RS_336]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_332] (rows=28221805 width=451)
+                                            Select Operator [SEL_335] (rows=28221805 width=451)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_331] (rows=28221805 width=227)
+                                              Filter Operator [FIL_334] (rows=28221805 width=227)
                                                 predicate:(cr_catalog_page_sk is not null and cr_returned_date_sk is not null)
-                                                TableScan [TS_260] (rows=28798881 width=227)
+                                                TableScan [TS_263] (rows=28798881 width=227)
                                                   Output:["cr_returned_date_sk","cr_catalog_page_sk","cr_return_amount","cr_net_loss"]
                   <-Reducer 18 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_325]
+                    Reduce Output Operator [RS_328]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_324] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_323] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_322] (rows=53 width=615)
+                      Group By Operator [GBY_327] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_326] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_325] (rows=53 width=615)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_321] (rows=53 width=548)
+                            Group By Operator [GBY_324] (rows=53 width=548)
                               Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
                             <-Reducer 17 [SIMPLE_EDGE]
                               SHUFFLE [RS_80]
                                 PartitionCols:_col0
                                 Group By Operator [GBY_79] (rows=31641 width=548)
                                   Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col8
-                                  Merge Join Operator [MERGEJOIN_226] (rows=278713608 width=547)
-                                    Conds:RS_75._col0=RS_320._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
+                                  Merge Join Operator [MERGEJOIN_229] (rows=278713608 width=547)
+                                    Conds:RS_75._col0=RS_323._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
                                   <-Map 30 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_320]
+                                    SHUFFLE [RS_323]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_319] (rows=84 width=104)
+                                      Select Operator [SEL_322] (rows=84 width=104)
                                         Output:["_col0","_col1"]
-                                        Filter Operator [FIL_318] (rows=84 width=104)
+                                        Filter Operator [FIL_321] (rows=84 width=104)
                                           predicate:web_site_sk is not null
                                           TableScan [TS_69] (rows=84 width=104)
                                             default@web_site,web_site,Tbl:COMPLETE,Col:COMPLETE,Output:["web_site_sk","web_site_id"]
                                   <-Reducer 16 [SIMPLE_EDGE]
                                     SHUFFLE [RS_75]
                                       PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_225] (rows=278713608 width=451)
-                                        Conds:Union 26._col1=RS_280._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
+                                      Merge Join Operator [MERGEJOIN_228] (rows=278713608 width=451)
+                                        Conds:Union 26._col1=RS_283._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
                                       <-Map 10 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_280]
+                                        SHUFFLE [RS_283]
                                           PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_275]
+                                           Please refer to the previous Select Operator [SEL_278]
                                       <-Union 26 [SIMPLE_EDGE]
                                         <-Map 25 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_338]
+                                          Reduce Output Operator [RS_341]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_337] (rows=143930874 width=455)
+                                            Select Operator [SEL_340] (rows=143930874 width=455)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_336] (rows=143930874 width=231)
+                                              Filter Operator [FIL_339] (rows=143930874 width=231)
                                                 predicate:(ws_web_site_sk is not null and ws_sold_date_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_73_date_dim_d_date_sk_min) AND DynamicValue(RS_73_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_73_date_dim_d_date_sk_bloom_filter)))
-                                                TableScan [TS_265] (rows=144002668 width=231)
+                                                TableScan [TS_268] (rows=144002668 width=231)
                                                   Output:["ws_sold_date_sk","ws_web_site_sk","ws_ext_sales_price","ws_net_profit"]
                                                 <-Reducer 19 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_335]
-                                                    Group By Operator [GBY_334] (rows=1 width=12)
+                                                  BROADCAST [RS_338]
+                                                    Group By Operator [GBY_337] (rows=1 width=12)
                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                     <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_287]
-                                                        Group By Operator [GBY_284] (rows=1 width=12)
+                                                      SHUFFLE [RS_290]
+                                                        Group By Operator [GBY_287] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_281] (rows=8116 width=4)
+                                                          Select Operator [SEL_284] (rows=8116 width=4)
                                                             Output:["_col0"]
-                                                             Please refer to the previous Select Operator [SEL_275]
+                                                             Please refer to the previous Select Operator [SEL_278]
                                         <-Reducer 28 [CONTAINS]
-                                          Reduce Output Operator [RS_273]
+                                          Reduce Output Operator [RS_276]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_271] (rows=134782734 width=454)
+                                            Select Operator [SEL_274] (rows=134782734 width=454)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Merge Join Operator [MERGEJOIN_270] (rows=134782734 width=230)
-                                                Conds:RS_341._col0, _col2=RS_344._col1, _col2(Inner),Output:["_col1","_col3","_col6","_col7"]
+                                              Merge Join Operator [MERGEJOIN_273] (rows=134782734 width=230)
+                                                Conds:RS_344._col0, _col2=RS_347._col1, _col2(Inner),Output:["_col1","_col3","_col6","_col7"]
                                               <-Map 27 [SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_341]
+                                                SHUFFLE [RS_344]
                                                   PartitionCols:_col0, _col2
-                                                  Select Operator [SEL_340] (rows=143966669 width=11)
+                                                  Select Operator [SEL_343] (rows=143966669 width=11)
                                                     Output:["_col0","_col1","_col2"]
-                                                    Filter Operator [FIL_339] (rows=143966669 width=11)
+                                                    Filter Operator [FIL_342] (rows=143966669 width=11)
                                                       predicate:(ws_web_site_sk is not null and ws_item_sk is not null and ws_order_number is not null)
                                                       TableScan [TS_54] (rows=144002668 width=11)
                                                         default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_item_sk","ws_web_site_sk","ws_order_number"]
                                               <-Map 29 [SIMPLE_EDGE] vectorized
-                                                SHUFFLE [RS_344]
+                                                SHUFFLE [RS_347]
                                                   PartitionCols:_col1, _col2
-                                                  Select Operator [SEL_343] (rows=13749816 width=225)
+                                                  Select Operator [SEL_346] (rows=13749816 width=225)
                                                     Output:["_col0","_col1","_col2","_col3","_col4"]
-                                                    Filter Operator [FIL_342] (rows=13749816 width=225)
+                                                    Filter Operator [FIL_345] (rows=13749816 width=225)
                                                       predicate:(wr_returned_date_sk is not null and wr_item_sk is not null and wr_order_number is not null)
                                                       TableScan [TS_57] (rows=14398467 width=225)
                                                         default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_returned_date_sk","wr_item_sk","wr_order_number","wr_return_amt","wr_net_loss"]
                   <-Reducer 5 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_300]
+                    Reduce Output Operator [RS_303]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_299] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_298] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_297] (rows=822 width=617)
+                      Group By Operator [GBY_302] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_301] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_300] (rows=822 width=617)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_296] (rows=822 width=548)
+                            Group By Operator [GBY_299] (rows=822 width=548)
                               Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)","sum(VALUE._col3)"],keys:KEY._col0
                             <-Reducer 4 [SIMPLE_EDGE]
                               SHUFFLE [RS_22]
                                 PartitionCols:_col0
                                 Group By Operator [GBY_21] (rows=983934 width=548)
                                   Output:["_col0","_col1","_col2","_col3","_col4"],aggregations:["sum(_col2)","sum(_col4)","sum(_col3)","sum(_col5)"],keys:_col8
-                                  Merge Join Operator [MERGEJOIN_222] (rows=578964757 width=528)
-                                    Conds:RS_17._col0=RS_295._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
+                                  Merge Join Operator [MERGEJOIN_225] (rows=578964757 width=528)
+                                    Conds:RS_17._col0=RS_298._col0(Inner),Output:["_col2","_col3","_col4","_col5","_col8"]
                                   <-Map 20 [SIMPLE_EDGE] vectorized
-                                    SHUFFLE [RS_295]
+                                    SHUFFLE [RS_298]
                                       PartitionCols:_col0
-                                      Select Operator [SEL_294] (rows=1704 width=104)
+                                      Select Operator [SEL_297] (rows=1704 width=104)
                                         Output:["_col0","_col1"]
-                                        Filter Operator [FIL_293] (rows=1704 width=104)
+                                        Filter Operator [FIL_296] (rows=1704 width=104)
                                           predicate:s_store_sk is not null
                                           TableScan [TS_11] (rows=1704 width=104)
                                             default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_id"]
                                   <-Reducer 3 [SIMPLE_EDGE]
                                     SHUFFLE [RS_17]
                                       PartitionCols:_col0
-                                      Merge Join Operator [MERGEJOIN_221] (rows=578964757 width=432)
-                                        Conds:Union 2._col1=RS_276._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
+                                      Merge Join Operator [MERGEJOIN_224] (rows=578964757 width=432)
+                                        Conds:Union 2._col1=RS_279._col0(Inner),Output:["_col0","_col2","_col3","_col4","_col5"]
                                       <-Map 10 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_276]
+                                        SHUFFLE [RS_279]
                                           PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_275]
+                                           Please refer to the previous Select Operator [SEL_278]
                                       <-Union 2 [SIMPLE_EDGE]
                                         <-Map 1 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_292]
+                                          Reduce Output Operator [RS_295]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_291] (rows=525329897 width=445)
+                                            Select Operator [SEL_294] (rows=525329897 width=445)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_290] (rows=525329897 width=221)
+                                              Filter Operator [FIL_293] (rows=525329897 width=221)
                                                 predicate:(ss_sold_date_sk is not null and ss_store_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_15_date_dim_d_date_sk_min) AND DynamicValue(RS_15_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_15_date_dim_d_date_sk_bloom_filter)))
-                                                TableScan [TS_227] (rows=575995635 width=221)
+                                                TableScan [TS_230] (rows=575995635 width=221)
                                                   Output:["ss_sold_date_sk","ss_store_sk","ss_ext_sales_price","ss_net_profit"]
                                                 <-Reducer 11 [BROADCAST_EDGE] vectorized
-                                                  BROADCAST [RS_289]
-                                                    Group By Operator [GBY_288] (rows=1 width=12)
+                                                  BROADCAST [RS_292]
+                                                    Group By Operator [GBY_291] (rows=1 width=12)
                                                       Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                     <-Map 10 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_285]
-                                                        Group By Operator [GBY_282] (rows=1 width=12)
+                                                      SHUFFLE [RS_288]
+                                                        Group By Operator [GBY_285] (rows=1 width=12)
                                                           Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                          Select Operator [SEL_277] (rows=8116 width=4)
+                                                          Select Operator [SEL_280] (rows=8116 width=4)
                                                             Output:["_col0"]
-                                                             Please refer to the previous Select Operator [SEL_275]
+                                                             Please refer to the previous Select Operator [SEL_278]
                                         <-Map 9 [CONTAINS] vectorized
-                                          Reduce Output Operator [RS_309]
+                                          Reduce Output Operator [RS_312]
                                             PartitionCols:_col1
-                                            Select Operator [SEL_308] (rows=53634860 width=447)
+                                            Select Operator [SEL_311] (rows=53634860 width=447)
                                               Output:["_col0","_col1","_col2","_col3","_col4","_col5"]
-                                              Filter Operator [FIL_307] (rows=53634860 width=223)
+                                              Filter Operator [FIL_310] (rows=53634860 width=223)
                                                 predicate:(sr_store_sk is not null and sr_returned_date_sk is not null)
-                                                TableScan [TS_238] (rows=57591150 width=223)
+                                                TableScan [TS_241] (rows=57591150 width=223)
                                                   Output:["sr_returned_date_sk","sr_store_sk","sr_return_amt","sr_net_loss"]
 
diff --git a/ql/src/test/results/clientpositive/perf/tez/query77.q.out b/ql/src/test/results/clientpositive/perf/tez/query77.q.out
index fcfc5a3..6b9c5b4 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query77.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query77.q.out
@@ -1,4 +1,4 @@
-Warning: Shuffle Join MERGEJOIN[319][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
+Warning: Shuffle Join MERGEJOIN[322][tables = [$hdt$_0, $hdt$_1]] in Stage 'Reducer 16' is a cross product
 PREHOOK: query: explain
 with ss as
  (select s_store_sk,
@@ -267,280 +267,280 @@ Stage-0
     limit:100
     Stage-1
       Reducer 8 vectorized
-      File Output Operator [FS_369]
-        Limit [LIM_368] (rows=100 width=439)
+      File Output Operator [FS_372]
+        Limit [LIM_371] (rows=100 width=439)
           Number of rows:100
-          Select Operator [SEL_367] (rows=561 width=439)
+          Select Operator [SEL_370] (rows=561 width=439)
             Output:["_col0","_col1","_col2","_col3","_col4"]
           <-Reducer 7 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_366]
-              Select Operator [SEL_365] (rows=561 width=439)
+            SHUFFLE [RS_369]
+              Select Operator [SEL_368] (rows=561 width=439)
                 Output:["_col0","_col1","_col2","_col3","_col4"]
-                Group By Operator [GBY_364] (rows=561 width=447)
+                Group By Operator [GBY_367] (rows=561 width=447)
                   Output:["_col0","_col1","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Union 6 [SIMPLE_EDGE]
                   <-Reducer 16 [CONTAINS]
-                    Reduce Output Operator [RS_324]
+                    Reduce Output Operator [RS_327]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_323] (rows=561 width=447)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_322] (rows=561 width=447)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_320] (rows=10 width=439)
+                      Group By Operator [GBY_326] (rows=561 width=447)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_325] (rows=526 width=435)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_323] (rows=10 width=439)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Merge Join Operator [MERGEJOIN_319] (rows=10 width=452)
+                            Merge Join Operator [MERGEJOIN_322] (rows=10 width=452)
                               Conds:(Inner),Output:["_col0","_col1","_col2","_col3","_col4"]
                             <-Reducer 15 [CUSTOM_SIMPLE_EDGE] vectorized
-                              PARTITION_ONLY_SHUFFLE [RS_376]
-                                Group By Operator [GBY_375] (rows=10 width=228)
+                              PARTITION_ONLY_SHUFFLE [RS_379]
+                                Group By Operator [GBY_378] (rows=10 width=228)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 14 [SIMPLE_EDGE]
                                   SHUFFLE [RS_55]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_54] (rows=2550 width=227)
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col1
-                                      Merge Join Operator [MERGEJOIN_304] (rows=286549727 width=227)
-                                        Conds:RS_374._col0=RS_336._col0(Inner),Output:["_col1","_col2","_col3"]
+                                      Merge Join Operator [MERGEJOIN_307] (rows=286549727 width=227)
+                                        Conds:RS_377._col0=RS_339._col0(Inner),Output:["_col1","_col2","_col3"]
                                       <-Map 9 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_336]
+                                        SHUFFLE [RS_339]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_332] (rows=8116 width=4)
+                                          Select Operator [SEL_335] (rows=8116 width=4)
                                             Output:["_col0"]
-                                            Filter Operator [FIL_331] (rows=8116 width=98)
+                                            Filter Operator [FIL_334] (rows=8116 width=98)
                                               predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-09-03 00:00:00' and d_date_sk is not null)
                                               TableScan [TS_3] (rows=73049 width=98)
                                                 default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
                                       <-Map 30 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_374]
+                                        SHUFFLE [RS_377]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_373] (rows=286549727 width=231)
+                                          Select Operator [SEL_376] (rows=286549727 width=231)
                                             Output:["_col0","_col1","_col2","_col3"]
-                                            Filter Operator [FIL_372] (rows=286549727 width=231)
+                                            Filter Operator [FIL_375] (rows=286549727 width=231)
                                               predicate:(cs_sold_date_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_51_date_dim_d_date_sk_min) AND DynamicValue(RS_51_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_51_date_dim_d_date_sk_bloom_filter)))
                                               TableScan [TS_44] (rows=287989836 width=231)
                                                 default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_call_center_sk","cs_ext_sales_price","cs_net_profit"]
                                               <-Reducer 17 [BROADCAST_EDGE] vectorized
-                                                BROADCAST [RS_371]
-                                                  Group By Operator [GBY_370] (rows=1 width=12)
+                                                BROADCAST [RS_374]
+                                                  Group By Operator [GBY_373] (rows=1 width=12)
                                                     Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                   <-Map 9 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                    SHUFFLE [RS_346]
-                                                      Group By Operator [GBY_343] (rows=1 width=12)
+                                                    SHUFFLE [RS_349]
+                                                      Group By Operator [GBY_346] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                        Select Operator [SEL_337] (rows=8116 width=4)
+                                                        Select Operator [SEL_340] (rows=8116 width=4)
                                                           Output:["_col0"]
-                                                           Please refer to the previous Select Operator [SEL_332]
+                                                           Please refer to the previous Select Operator [SEL_335]
                             <-Reducer 19 [CUSTOM_SIMPLE_EDGE] vectorized
-                              PARTITION_ONLY_SHUFFLE [RS_381]
-                                Group By Operator [GBY_380] (rows=1 width=224)
+                              PARTITION_ONLY_SHUFFLE [RS_384]
+                                Group By Operator [GBY_383] (rows=1 width=224)
                                   Output:["_col0","_col1"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"]
                                 <-Reducer 18 [CUSTOM_SIMPLE_EDGE]
                                   PARTITION_ONLY_SHUFFLE [RS_69]
                                     Group By Operator [GBY_68] (rows=1 width=224)
                                       Output:["_col0","_col1"],aggregations:["sum(_col1)","sum(_col2)"]
-                                      Merge Join Operator [MERGEJOIN_305] (rows=3199657 width=183)
-                                        Conds:RS_379._col0=RS_338._col0(Inner),Output:["_col1","_col2"]
+                                      Merge Join Operator [MERGEJOIN_308] (rows=3199657 width=183)
+                                        Conds:RS_382._col0=RS_341._col0(Inner),Output:["_col1","_col2"]
                                       <-Map 9 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_338]
+                                        SHUFFLE [RS_341]
                                           PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_332]
+                                           Please refer to the previous Select Operator [SEL_335]
                                       <-Map 31 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_379]
+                                        SHUFFLE [RS_382]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_378] (rows=28798881 width=223)
+                                          Select Operator [SEL_381] (rows=28798881 width=223)
                                             Output:["_col0","_col1","_col2"]
-                                            Filter Operator [FIL_377] (rows=28798881 width=223)
+                                            Filter Operator [FIL_380] (rows=28798881 width=223)
                                               predicate:cr_returned_date_sk is not null
                                               TableScan [TS_58] (rows=28798881 width=223)
                                                 default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_returned_date_sk","cr_return_amount","cr_net_loss"]
                   <-Reducer 23 [CONTAINS]
-                    Reduce Output Operator [RS_330]
+                    Reduce Output Operator [RS_333]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_329] (rows=561 width=447)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_328] (rows=561 width=447)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_326] (rows=392 width=435)
+                      Group By Operator [GBY_332] (rows=561 width=447)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_331] (rows=526 width=435)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_329] (rows=392 width=435)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Merge Join Operator [MERGEJOIN_325] (rows=392 width=335)
-                              Conds:RS_392._col0=RS_397._col0(Left Outer),Output:["_col0","_col1","_col2","_col4","_col5"]
+                            Merge Join Operator [MERGEJOIN_328] (rows=392 width=335)
+                              Conds:RS_395._col0=RS_400._col0(Left Outer),Output:["_col0","_col1","_col2","_col4","_col5"]
                             <-Reducer 22 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_392]
+                              SHUFFLE [RS_395]
                                 PartitionCols:_col0
-                                Group By Operator [GBY_391] (rows=205 width=228)
+                                Group By Operator [GBY_394] (rows=205 width=228)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 21 [SIMPLE_EDGE]
                                   SHUFFLE [RS_94]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_93] (rows=26445 width=228)
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col5
-                                      Merge Join Operator [MERGEJOIN_307] (rows=143931136 width=227)
-                                        Conds:RS_89._col1=RS_389._col0(Inner),Output:["_col2","_col3","_col5"]
+                                      Merge Join Operator [MERGEJOIN_310] (rows=143931136 width=227)
+                                        Conds:RS_89._col1=RS_392._col0(Inner),Output:["_col2","_col3","_col5"]
                                       <-Map 33 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_389]
+                                        SHUFFLE [RS_392]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_388] (rows=4602 width=4)
+                                          Select Operator [SEL_391] (rows=4602 width=4)
                                             Output:["_col0"]
-                                            Filter Operator [FIL_387] (rows=4602 width=4)
+                                            Filter Operator [FIL_390] (rows=4602 width=4)
                                               predicate:wp_web_page_sk is not null
                                               TableScan [TS_83] (rows=4602 width=4)
                                                 default@web_page,web_page,Tbl:COMPLETE,Col:COMPLETE,Output:["wp_web_page_sk"]
                                       <-Reducer 20 [SIMPLE_EDGE]
                                         SHUFFLE [RS_89]
                                           PartitionCols:_col1
-                                          Merge Join Operator [MERGEJOIN_306] (rows=143931136 width=227)
-                                            Conds:RS_386._col0=RS_339._col0(Inner),Output:["_col1","_col2","_col3"]
+                                          Merge Join Operator [MERGEJOIN_309] (rows=143931136 width=227)
+                                            Conds:RS_389._col0=RS_342._col0(Inner),Output:["_col1","_col2","_col3"]
                                           <-Map 9 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_339]
+                                            SHUFFLE [RS_342]
                                               PartitionCols:_col0
-                                               Please refer to the previous Select Operator [SEL_332]
+                                               Please refer to the previous Select Operator [SEL_335]
                                           <-Map 32 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_386]
+                                            SHUFFLE [RS_389]
                                               PartitionCols:_col0
-                                              Select Operator [SEL_385] (rows=143931136 width=231)
+                                              Select Operator [SEL_388] (rows=143931136 width=231)
                                                 Output:["_col0","_col1","_col2","_col3"]
-                                                Filter Operator [FIL_384] (rows=143931136 width=231)
+                                                Filter Operator [FIL_387] (rows=143931136 width=231)
                                                   predicate:(ws_sold_date_sk is not null and ws_web_page_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_87_date_dim_d_date_sk_min) AND DynamicValue(RS_87_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_87_date_dim_d_date_sk_bloom_filter)))
                                                   TableScan [TS_77] (rows=144002668 width=231)
                                                     default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_web_page_sk","ws_ext_sales_price","ws_net_profit"]
                                                   <-Reducer 24 [BROADCAST_EDGE] vectorized
-                                                    BROADCAST [RS_383]
-                                                      Group By Operator [GBY_382] (rows=1 width=12)
+                                                    BROADCAST [RS_386]
+                                                      Group By Operator [GBY_385] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                       <-Map 9 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                        SHUFFLE [RS_347]
-                                                          Group By Operator [GBY_344] (rows=1 width=12)
+                                                        SHUFFLE [RS_350]
+                                                          Group By Operator [GBY_347] (rows=1 width=12)
                                                             Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                            Select Operator [SEL_340] (rows=8116 width=4)
+                                                            Select Operator [SEL_343] (rows=8116 width=4)
                                                               Output:["_col0"]
-                                                               Please refer to the previous Select Operator [SEL_332]
+                                                               Please refer to the previous Select Operator [SEL_335]
                             <-Reducer 27 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_397]
+                              SHUFFLE [RS_400]
                                 PartitionCols:_col0
-                                Group By Operator [GBY_396] (rows=187 width=228)
+                                Group By Operator [GBY_399] (rows=187 width=228)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 26 [SIMPLE_EDGE]
                                   SHUFFLE [RS_114]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_113] (rows=2244 width=228)
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col5
-                                      Merge Join Operator [MERGEJOIN_309] (rows=13129719 width=217)
-                                        Conds:RS_109._col1=RS_390._col0(Inner),Output:["_col2","_col3","_col5"]
+                                      Merge Join Operator [MERGEJOIN_312] (rows=13129719 width=217)
+                                        Conds:RS_109._col1=RS_393._col0(Inner),Output:["_col2","_col3","_col5"]
                                       <-Map 33 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_390]
+                                        SHUFFLE [RS_393]
                                           PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_388]
+                                           Please refer to the previous Select Operator [SEL_391]
                                       <-Reducer 25 [SIMPLE_EDGE]
                                         SHUFFLE [RS_109]
                                           PartitionCols:_col1
-                                          Merge Join Operator [MERGEJOIN_308] (rows=13129719 width=217)
-                                            Conds:RS_395._col0=RS_341._col0(Inner),Output:["_col1","_col2","_col3"]
+                                          Merge Join Operator [MERGEJOIN_311] (rows=13129719 width=217)
+                                            Conds:RS_398._col0=RS_344._col0(Inner),Output:["_col1","_col2","_col3"]
                                           <-Map 9 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_341]
+                                            SHUFFLE [RS_344]
                                               PartitionCols:_col0
-                                               Please refer to the previous Select Operator [SEL_332]
+                                               Please refer to the previous Select Operator [SEL_335]
                                           <-Map 34 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_395]
+                                            SHUFFLE [RS_398]
                                               PartitionCols:_col0
-                                              Select Operator [SEL_394] (rows=13129719 width=221)
+                                              Select Operator [SEL_397] (rows=13129719 width=221)
                                                 Output:["_col0","_col1","_col2","_col3"]
-                                                Filter Operator [FIL_393] (rows=13129719 width=221)
+                                                Filter Operator [FIL_396] (rows=13129719 width=221)
                                                   predicate:(wr_web_page_sk is not null and wr_returned_date_sk is not null)
                                                   TableScan [TS_97] (rows=14398467 width=221)
                                                     default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_returned_date_sk","wr_web_page_sk","wr_return_amt","wr_net_loss"]
                   <-Reducer 5 [CONTAINS]
-                    Reduce Output Operator [RS_318]
+                    Reduce Output Operator [RS_321]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_317] (rows=561 width=447)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_316] (rows=561 width=447)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_314] (rows=124 width=437)
+                      Group By Operator [GBY_320] (rows=561 width=447)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_319] (rows=526 width=435)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_317] (rows=124 width=437)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Merge Join Operator [MERGEJOIN_313] (rows=124 width=379)
-                              Conds:RS_358._col0=RS_363._col0(Left Outer),Output:["_col0","_col1","_col2","_col4","_col5"]
+                            Merge Join Operator [MERGEJOIN_316] (rows=124 width=379)
+                              Conds:RS_361._col0=RS_366._col0(Left Outer),Output:["_col0","_col1","_col2","_col4","_col5"]
                             <-Reducer 13 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_363]
+                              SHUFFLE [RS_366]
                                 PartitionCols:_col0
-                                Group By Operator [GBY_362] (rows=84 width=228)
+                                Group By Operator [GBY_365] (rows=84 width=228)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 12 [SIMPLE_EDGE]
                                   SHUFFLE [RS_37]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_36] (rows=3948 width=228)
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col5
-                                      Merge Join Operator [MERGEJOIN_303] (rows=53634860 width=220)
-                                        Conds:RS_32._col1=RS_356._col0(Inner),Output:["_col2","_col3","_col5"]
+                                      Merge Join Operator [MERGEJOIN_306] (rows=53634860 width=220)
+                                        Conds:RS_32._col1=RS_359._col0(Inner),Output:["_col2","_col3","_col5"]
                                       <-Map 28 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_356]
+                                        SHUFFLE [RS_359]
                                           PartitionCols:_col0
-                                          Select Operator [SEL_354] (rows=1704 width=4)
+                                          Select Operator [SEL_357] (rows=1704 width=4)
                                             Output:["_col0"]
-                                            Filter Operator [FIL_353] (rows=1704 width=4)
+                                            Filter Operator [FIL_356] (rows=1704 width=4)
                                               predicate:s_store_sk is not null
                                               TableScan [TS_6] (rows=1704 width=4)
                                                 default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk"]
                                       <-Reducer 11 [SIMPLE_EDGE]
                                         SHUFFLE [RS_32]
                                           PartitionCols:_col1
-                                          Merge Join Operator [MERGEJOIN_302] (rows=53634860 width=220)
-                                            Conds:RS_361._col0=RS_335._col0(Inner),Output:["_col1","_col2","_col3"]
+                                          Merge Join Operator [MERGEJOIN_305] (rows=53634860 width=220)
+                                            Conds:RS_364._col0=RS_338._col0(Inner),Output:["_col1","_col2","_col3"]
                                           <-Map 9 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_335]
+                                            SHUFFLE [RS_338]
                                               PartitionCols:_col0
-                                               Please refer to the previous Select Operator [SEL_332]
+                                               Please refer to the previous Select Operator [SEL_335]
                                           <-Map 29 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_361]
+                                            SHUFFLE [RS_364]
                                               PartitionCols:_col0
-                                              Select Operator [SEL_360] (rows=53634860 width=223)
+                                              Select Operator [SEL_363] (rows=53634860 width=223)
                                                 Output:["_col0","_col1","_col2","_col3"]
-                                                Filter Operator [FIL_359] (rows=53634860 width=223)
+                                                Filter Operator [FIL_362] (rows=53634860 width=223)
                                                   predicate:(sr_store_sk is not null and sr_returned_date_sk is not null)
                                                   TableScan [TS_20] (rows=57591150 width=223)
                                                     default@store_returns,store_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_returned_date_sk","sr_store_sk","sr_return_amt","sr_net_loss"]
                             <-Reducer 4 [SIMPLE_EDGE] vectorized
-                              SHUFFLE [RS_358]
+                              SHUFFLE [RS_361]
                                 PartitionCols:_col0
-                                Group By Operator [GBY_357] (rows=83 width=228)
+                                Group By Operator [GBY_360] (rows=83 width=228)
                                   Output:["_col0","_col1","_col2"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)"],keys:KEY._col0
                                 <-Reducer 3 [SIMPLE_EDGE]
                                   SHUFFLE [RS_17]
                                     PartitionCols:_col0
                                     Group By Operator [GBY_16] (rows=37184 width=228)
                                       Output:["_col0","_col1","_col2"],aggregations:["sum(_col2)","sum(_col3)"],keys:_col5
-                                      Merge Join Operator [MERGEJOIN_301] (rows=525329897 width=217)
-                                        Conds:RS_12._col1=RS_355._col0(Inner),Output:["_col2","_col3","_col5"]
+                                      Merge Join Operator [MERGEJOIN_304] (rows=525329897 width=217)
+                                        Conds:RS_12._col1=RS_358._col0(Inner),Output:["_col2","_col3","_col5"]
                                       <-Map 28 [SIMPLE_EDGE] vectorized
-                                        SHUFFLE [RS_355]
+                                        SHUFFLE [RS_358]
                                           PartitionCols:_col0
-                                           Please refer to the previous Select Operator [SEL_354]
+                                           Please refer to the previous Select Operator [SEL_357]
                                       <-Reducer 2 [SIMPLE_EDGE]
                                         SHUFFLE [RS_12]
                                           PartitionCols:_col1
-                                          Merge Join Operator [MERGEJOIN_300] (rows=525329897 width=217)
-                                            Conds:RS_352._col0=RS_333._col0(Inner),Output:["_col1","_col2","_col3"]
+                                          Merge Join Operator [MERGEJOIN_303] (rows=525329897 width=217)
+                                            Conds:RS_355._col0=RS_336._col0(Inner),Output:["_col1","_col2","_col3"]
                                           <-Map 9 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_333]
+                                            SHUFFLE [RS_336]
                                               PartitionCols:_col0
-                                               Please refer to the previous Select Operator [SEL_332]
+                                               Please refer to the previous Select Operator [SEL_335]
                                           <-Map 1 [SIMPLE_EDGE] vectorized
-                                            SHUFFLE [RS_352]
+                                            SHUFFLE [RS_355]
                                               PartitionCols:_col0
-                                              Select Operator [SEL_351] (rows=525329897 width=221)
+                                              Select Operator [SEL_354] (rows=525329897 width=221)
                                                 Output:["_col0","_col1","_col2","_col3"]
-                                                Filter Operator [FIL_350] (rows=525329897 width=221)
+                                                Filter Operator [FIL_353] (rows=525329897 width=221)
                                                   predicate:(ss_sold_date_sk is not null and ss_store_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_10_date_dim_d_date_sk_min) AND DynamicValue(RS_10_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_10_date_dim_d_date_sk_bloom_filter)))
                                                   TableScan [TS_0] (rows=575995635 width=221)
                                                     default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_store_sk","ss_ext_sales_price","ss_net_profit"]
                                                   <-Reducer 10 [BROADCAST_EDGE] vectorized
-                                                    BROADCAST [RS_349]
-                                                      Group By Operator [GBY_348] (rows=1 width=12)
+                                                    BROADCAST [RS_352]
+                                                      Group By Operator [GBY_351] (rows=1 width=12)
                                                         Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                       <-Map 9 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                        SHUFFLE [RS_345]
-                                                          Group By Operator [GBY_342] (rows=1 width=12)
+                                                        SHUFFLE [RS_348]
+                                                          Group By Operator [GBY_345] (rows=1 width=12)
                                                             Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                            Select Operator [SEL_334] (rows=8116 width=4)
+                                                            Select Operator [SEL_337] (rows=8116 width=4)
                                                               Output:["_col0"]
-                                                               Please refer to the previous Select Operator [SEL_332]
+                                                               Please refer to the previous Select Operator [SEL_335]
 
diff --git a/ql/src/test/results/clientpositive/perf/tez/query80.q.out b/ql/src/test/results/clientpositive/perf/tez/query80.q.out
index 3020b58..30f77de 100644
--- a/ql/src/test/results/clientpositive/perf/tez/query80.q.out
+++ b/ql/src/test/results/clientpositive/perf/tez/query80.q.out
@@ -249,28 +249,28 @@ Stage-0
     limit:100
     Stage-1
       Reducer 10 vectorized
-      File Output Operator [FS_440]
-        Limit [LIM_439] (rows=100 width=619)
+      File Output Operator [FS_443]
+        Limit [LIM_442] (rows=100 width=619)
           Number of rows:100
-          Select Operator [SEL_438] (rows=59581 width=619)
+          Select Operator [SEL_441] (rows=59581 width=619)
             Output:["_col0","_col1","_col2","_col3","_col4"]
           <-Reducer 9 [SIMPLE_EDGE] vectorized
-            SHUFFLE [RS_437]
-              Select Operator [SEL_436] (rows=59581 width=619)
+            SHUFFLE [RS_440]
+              Select Operator [SEL_439] (rows=59581 width=619)
                 Output:["_col0","_col1","_col2","_col3","_col4"]
-                Group By Operator [GBY_435] (rows=59581 width=627)
+                Group By Operator [GBY_438] (rows=59581 width=627)
                   Output:["_col0","_col1","_col3","_col4","_col5"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0, KEY._col1, KEY._col2
                 <-Union 8 [SIMPLE_EDGE]
                   <-Reducer 18 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_456]
+                    Reduce Output Operator [RS_459]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_455] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_454] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_453] (rows=38846 width=619)
+                      Group By Operator [GBY_458] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_457] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_456] (rows=38846 width=619)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_452] (rows=38846 width=436)
+                            Group By Operator [GBY_455] (rows=38846 width=436)
                               Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
                             <-Reducer 17 [SIMPLE_EDGE]
                               SHUFFLE [RS_75]
@@ -279,103 +279,103 @@ Stage-0
                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
                                   Select Operator [SEL_72] (rows=154681759 width=322)
                                     Output:["_col0","_col1","_col2","_col3"]
-                                    Merge Join Operator [MERGEJOIN_371] (rows=154681759 width=322)
-                                      Conds:RS_69._col1=RS_451._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
+                                    Merge Join Operator [MERGEJOIN_374] (rows=154681759 width=322)
+                                      Conds:RS_69._col1=RS_454._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
                                     <-Map 32 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_451]
+                                      SHUFFLE [RS_454]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_450] (rows=46000 width=104)
+                                        Select Operator [SEL_453] (rows=46000 width=104)
                                           Output:["_col0","_col1"]
-                                          Filter Operator [FIL_449] (rows=46000 width=104)
+                                          Filter Operator [FIL_452] (rows=46000 width=104)
                                             predicate:cp_catalog_page_sk is not null
                                             TableScan [TS_54] (rows=46000 width=104)
                                               default@catalog_page,catalog_page,Tbl:COMPLETE,Col:COMPLETE,Output:["cp_catalog_page_sk","cp_catalog_page_id"]
                                     <-Reducer 16 [SIMPLE_EDGE]
                                       SHUFFLE [RS_69]
                                         PartitionCols:_col1
-                                        Merge Join Operator [MERGEJOIN_370] (rows=154681759 width=226)
-                                          Conds:RS_66._col3=RS_425._col0(Inner),Output:["_col1","_col5","_col6","_col9","_col10"]
+                                        Merge Join Operator [MERGEJOIN_373] (rows=154681759 width=226)
+                                          Conds:RS_66._col3=RS_428._col0(Inner),Output:["_col1","_col5","_col6","_col9","_col10"]
                                         <-Map 27 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_425]
+                                          SHUFFLE [RS_428]
                                             PartitionCols:_col0
-                                            Select Operator [SEL_423] (rows=1150 width=4)
+                                            Select Operator [SEL_426] (rows=1150 width=4)
                                               Output:["_col0"]
-                                              Filter Operator [FIL_422] (rows=1150 width=89)
+                                              Filter Operator [FIL_425] (rows=1150 width=89)
                                                 predicate:((p_channel_tv = 'N') and p_promo_sk is not null)
                                                 TableScan [TS_12] (rows=2300 width=89)
                                                   default@promotion,promotion,Tbl:COMPLETE,Col:COMPLETE,Output:["p_promo_sk","p_channel_tv"]
                                         <-Reducer 15 [SIMPLE_EDGE]
                                           SHUFFLE [RS_66]
                                             PartitionCols:_col3
-                                            Merge Join Operator [MERGEJOIN_369] (rows=154681759 width=230)
-                                              Conds:RS_63._col2=RS_420._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col9","_col10"]
+                                            Merge Join Operator [MERGEJOIN_372] (rows=154681759 width=230)
+                                              Conds:RS_63._col2=RS_423._col0(Inner),Output:["_col1","_col3","_col5","_col6","_col9","_col10"]
                                             <-Map 26 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_420]
+                                              SHUFFLE [RS_423]
                                                 PartitionCols:_col0
-                                                Select Operator [SEL_418] (rows=154000 width=4)
+                                                Select Operator [SEL_421] (rows=154000 width=4)
                                                   Output:["_col0"]
-                                                  Filter Operator [FIL_417] (rows=154000 width=115)
+                                                  Filter Operator [FIL_420] (rows=154000 width=115)
                                                     predicate:((i_current_price > 50) and i_item_sk is not null)
                                                     TableScan [TS_9] (rows=462000 width=115)
                                                       default@item,item,Tbl:COMPLETE,Col:COMPLETE,Output:["i_item_sk","i_current_price"]
                                             <-Reducer 14 [SIMPLE_EDGE]
                                               SHUFFLE [RS_63]
                                                 PartitionCols:_col2
-                                                Merge Join Operator [MERGEJOIN_368] (rows=464045263 width=322)
-                                                  Conds:RS_60._col0=RS_399._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                Merge Join Operator [MERGEJOIN_371] (rows=464045263 width=322)
+                                                  Conds:RS_60._col0=RS_402._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                 <-Map 12 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_399]
+                                                  SHUFFLE [RS_402]
                                                     PartitionCols:_col0
-                                                    Select Operator [SEL_396] (rows=8116 width=4)
+                                                    Select Operator [SEL_399] (rows=8116 width=4)
                                                       Output:["_col0"]
-                                                      Filter Operator [FIL_395] (rows=8116 width=98)
+                                                      Filter Operator [FIL_398] (rows=8116 width=98)
                                                         predicate:(CAST( d_date AS TIMESTAMP) BETWEEN TIMESTAMP'1998-08-04 00:00:00' AND TIMESTAMP'1998-09-03 00:00:00' and d_date_sk is not null)
                                                         TableScan [TS_6] (rows=73049 width=98)
                                                           default@date_dim,date_dim,Tbl:COMPLETE,Col:COMPLETE,Output:["d_date_sk","d_date"]
                                                 <-Reducer 30 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_60]
                                                     PartitionCols:_col0
-                                                    Merge Join Operator [MERGEJOIN_367] (rows=464045263 width=326)
-                                                      Conds:RS_445._col2, _col4=RS_448._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                    Merge Join Operator [MERGEJOIN_370] (rows=464045263 width=326)
+                                                      Conds:RS_448._col2, _col4=RS_451._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                     <-Map 29 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_445]
+                                                      SHUFFLE [RS_448]
                                                         PartitionCols:_col2, _col4
-                                                        Select Operator [SEL_444] (rows=283691906 width=243)
+                                                        Select Operator [SEL_447] (rows=283691906 width=243)
                                                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                          Filter Operator [FIL_443] (rows=283691906 width=243)
+                                                          Filter Operator [FIL_446] (rows=283691906 width=243)
                                                             predicate:(cs_promo_sk is not null and cs_sold_date_sk is not null and cs_catalog_page_sk is not null and cs_item_sk is not null and cs_sold_date_sk BETWEEN DynamicValue(RS_61_date_dim_d_date_sk_min) AND DynamicValue(RS_61_date_dim_d_date_sk_max) and in_bloom_filter(cs_sold_date_sk, DynamicValue(RS_61_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_39] (rows=287989836 width=243)
                                                               default@catalog_sales,catalog_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["cs_sold_date_sk","cs_catalog_page_sk","cs_item_sk","cs_promo_sk","cs_order_number","cs_ext_sales_price","cs_net_profit"]
                                                             <-Reducer 19 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_442]
-                                                                Group By Operator [GBY_441] (rows=1 width=12)
+                                                              BROADCAST [RS_445]
+                                                                Group By Operator [GBY_444] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  SHUFFLE [RS_407]
-                                                                    Group By Operator [GBY_404] (rows=1 width=12)
+                                                                  SHUFFLE [RS_410]
+                                                                    Group By Operator [GBY_407] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_400] (rows=8116 width=4)
+                                                                      Select Operator [SEL_403] (rows=8116 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_396]
+                                                                         Please refer to the previous Select Operator [SEL_399]
                                                     <-Map 31 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_448]
+                                                      SHUFFLE [RS_451]
                                                         PartitionCols:_col0, _col1
-                                                        Select Operator [SEL_447] (rows=28798881 width=227)
+                                                        Select Operator [SEL_450] (rows=28798881 width=227)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_446] (rows=28798881 width=227)
+                                                          Filter Operator [FIL_449] (rows=28798881 width=227)
                                                             predicate:(cr_item_sk is not null and cr_order_number is not null)
                                                             TableScan [TS_42] (rows=28798881 width=227)
                                                               default@catalog_returns,catalog_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["cr_item_sk","cr_order_number","cr_return_amount","cr_net_loss"]
                   <-Reducer 24 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_472]
+                    Reduce Output Operator [RS_475]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_471] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_470] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_469] (rows=53 width=615)
+                      Group By Operator [GBY_474] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_473] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_472] (rows=53 width=615)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_468] (rows=53 width=436)
+                            Group By Operator [GBY_471] (rows=53 width=436)
                               Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
                             <-Reducer 23 [SIMPLE_EDGE]
                               SHUFFLE [RS_115]
@@ -384,88 +384,88 @@ Stage-0
                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
                                   Select Operator [SEL_112] (rows=84869669 width=323)
                                     Output:["_col0","_col1","_col2","_col3"]
-                                    Merge Join Operator [MERGEJOIN_376] (rows=84869669 width=323)
-                                      Conds:RS_109._col2=RS_467._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
+                                    Merge Join Operator [MERGEJOIN_379] (rows=84869669 width=323)
+                                      Conds:RS_109._col2=RS_470._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
                                     <-Map 36 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_467]
+                                      SHUFFLE [RS_470]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_466] (rows=84 width=104)
+                                        Select Operator [SEL_469] (rows=84 width=104)
                                           Output:["_col0","_col1"]
-                                          Filter Operator [FIL_465] (rows=84 width=104)
+                                          Filter Operator [FIL_468] (rows=84 width=104)
                                             predicate:web_site_sk is not null
                                             TableScan [TS_94] (rows=84 width=104)
                                               default@web_site,web_site,Tbl:COMPLETE,Col:COMPLETE,Output:["web_site_sk","web_site_id"]
                                     <-Reducer 22 [SIMPLE_EDGE]
                                       SHUFFLE [RS_109]
                                         PartitionCols:_col2
-                                        Merge Join Operator [MERGEJOIN_375] (rows=84869669 width=227)
-                                          Conds:RS_106._col3=RS_426._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
+                                        Merge Join Operator [MERGEJOIN_378] (rows=84869669 width=227)
+                                          Conds:RS_106._col3=RS_429._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
                                         <-Map 27 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_426]
+                                          SHUFFLE [RS_429]
                                             PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_423]
+                                             Please refer to the previous Select Operator [SEL_426]
                                         <-Reducer 21 [SIMPLE_EDGE]
                                           SHUFFLE [RS_106]
                                             PartitionCols:_col3
-                                            Merge Join Operator [MERGEJOIN_374] (rows=84869669 width=231)
-                                              Conds:RS_103._col1=RS_421._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
+                                            Merge Join Operator [MERGEJOIN_377] (rows=84869669 width=231)
+                                              Conds:RS_103._col1=RS_424._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
                                             <-Map 26 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_421]
+                                              SHUFFLE [RS_424]
                                                 PartitionCols:_col0
-                                                 Please refer to the previous Select Operator [SEL_418]
+                                                 Please refer to the previous Select Operator [SEL_421]
                                             <-Reducer 20 [SIMPLE_EDGE]
                                               SHUFFLE [RS_103]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_373] (rows=254608997 width=359)
-                                                  Conds:RS_100._col0=RS_401._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                Merge Join Operator [MERGEJOIN_376] (rows=254608997 width=359)
+                                                  Conds:RS_100._col0=RS_404._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                 <-Map 12 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_401]
+                                                  SHUFFLE [RS_404]
                                                     PartitionCols:_col0
-                                                     Please refer to the previous Select Operator [SEL_396]
+                                                     Please refer to the previous Select Operator [SEL_399]
                                                 <-Reducer 34 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_100]
                                                     PartitionCols:_col0
-                                                    Merge Join Operator [MERGEJOIN_372] (rows=254608997 width=363)
-                                                      Conds:RS_461._col1, _col4=RS_464._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                    Merge Join Operator [MERGEJOIN_375] (rows=254608997 width=363)
+                                                      Conds:RS_464._col1, _col4=RS_467._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                     <-Map 33 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_461]
+                                                      SHUFFLE [RS_464]
                                                         PartitionCols:_col1, _col4
-                                                        Select Operator [SEL_460] (rows=143894769 width=243)
+                                                        Select Operator [SEL_463] (rows=143894769 width=243)
                                                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                          Filter Operator [FIL_459] (rows=143894769 width=243)
+                                                          Filter Operator [FIL_462] (rows=143894769 width=243)
                                                             predicate:(ws_promo_sk is not null and ws_web_site_sk is not null and ws_sold_date_sk is not null and ws_item_sk is not null and ws_sold_date_sk BETWEEN DynamicValue(RS_101_date_dim_d_date_sk_min) AND DynamicValue(RS_101_date_dim_d_date_sk_max) and in_bloom_filter(ws_sold_date_sk, DynamicValue(RS_101_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_79] (rows=144002668 width=243)
                                                               default@web_sales,web_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ws_sold_date_sk","ws_item_sk","ws_web_site_sk","ws_promo_sk","ws_order_number","ws_ext_sales_price","ws_net_profit"]
                                                             <-Reducer 25 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_458]
-                                                                Group By Operator [GBY_457] (rows=1 width=12)
+                                                              BROADCAST [RS_461]
+                                                                Group By Operator [GBY_460] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  SHUFFLE [RS_408]
-                                                                    Group By Operator [GBY_405] (rows=1 width=12)
+                                                                  SHUFFLE [RS_411]
+                                                                    Group By Operator [GBY_408] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_402] (rows=8116 width=4)
+                                                                      Select Operator [SEL_405] (rows=8116 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_396]
+                                                                         Please refer to the previous Select Operator [SEL_399]
                                                     <-Map 35 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_464]
+                                                      SHUFFLE [RS_467]
                                                         PartitionCols:_col0, _col1
-                                                        Select Operator [SEL_463] (rows=14398467 width=221)
+                                                        Select Operator [SEL_466] (rows=14398467 width=221)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_462] (rows=14398467 width=221)
+                                                          Filter Operator [FIL_465] (rows=14398467 width=221)
                                                             predicate:(wr_item_sk is not null and wr_order_number is not null)
                                                             TableScan [TS_82] (rows=14398467 width=221)
                                                               default@web_returns,web_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["wr_item_sk","wr_order_number","wr_return_amt","wr_net_loss"]
                   <-Reducer 7 [CONTAINS] vectorized
-                    Reduce Output Operator [RS_434]
+                    Reduce Output Operator [RS_437]
                       PartitionCols:_col0, _col1, _col2
-                      Top N Key Operator [TNK_433] (rows=59581 width=627)
-                        keys:_col0, _col1,top n:100
-                        Group By Operator [GBY_432] (rows=59581 width=627)
-                          Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
-                          Select Operator [SEL_431] (rows=822 width=617)
+                      Group By Operator [GBY_436] (rows=59581 width=627)
+                        Output:["_col0","_col1","_col2","_col3","_col4","_col5"],aggregations:["sum(_col2)","sum(_col3)","sum(_col4)"],keys:_col0, _col1, 0L
+                        Top N Key Operator [TNK_435] (rows=39721 width=618)
+                          keys:_col0, _col1, 0L,top n:100
+                          Select Operator [SEL_434] (rows=822 width=617)
                             Output:["_col0","_col1","_col2","_col3","_col4"]
-                            Group By Operator [GBY_430] (rows=822 width=436)
+                            Group By Operator [GBY_433] (rows=822 width=436)
                               Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(VALUE._col0)","sum(VALUE._col1)","sum(VALUE._col2)"],keys:KEY._col0
                             <-Reducer 6 [SIMPLE_EDGE]
                               SHUFFLE [RS_36]
@@ -474,75 +474,75 @@ Stage-0
                                   Output:["_col0","_col1","_col2","_col3"],aggregations:["sum(_col1)","sum(_col2)","sum(_col3)"],keys:_col0
                                   Select Operator [SEL_33] (rows=270716624 width=305)
                                     Output:["_col0","_col1","_col2","_col3"]
-                                    Merge Join Operator [MERGEJOIN_366] (rows=270716624 width=305)
-                                      Conds:RS_30._col2=RS_429._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
+                                    Merge Join Operator [MERGEJOIN_369] (rows=270716624 width=305)
+                                      Conds:RS_30._col2=RS_432._col0(Inner),Output:["_col5","_col6","_col9","_col10","_col15"]
                                     <-Map 28 [SIMPLE_EDGE] vectorized
-                                      SHUFFLE [RS_429]
+                                      SHUFFLE [RS_432]
                                         PartitionCols:_col0
-                                        Select Operator [SEL_428] (rows=1704 width=104)
+                                        Select Operator [SEL_431] (rows=1704 width=104)
                                           Output:["_col0","_col1"]
-                                          Filter Operator [FIL_427] (rows=1704 width=104)
+                                          Filter Operator [FIL_430] (rows=1704 width=104)
                                             predicate:s_store_sk is not null
                                             TableScan [TS_15] (rows=1704 width=104)
                                               default@store,store,Tbl:COMPLETE,Col:COMPLETE,Output:["s_store_sk","s_store_id"]
                                     <-Reducer 5 [SIMPLE_EDGE]
                                       SHUFFLE [RS_30]
                                         PartitionCols:_col2
-                                        Merge Join Operator [MERGEJOIN_365] (rows=270716624 width=208)
-                                          Conds:RS_27._col3=RS_424._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
+                                        Merge Join Operator [MERGEJOIN_368] (rows=270716624 width=208)
+                                          Conds:RS_27._col3=RS_427._col0(Inner),Output:["_col2","_col5","_col6","_col9","_col10"]
                                         <-Map 27 [SIMPLE_EDGE] vectorized
-                                          SHUFFLE [RS_424]
+                                          SHUFFLE [RS_427]
                                             PartitionCols:_col0
-                                             Please refer to the previous Select Operator [SEL_423]
+                                             Please refer to the previous Select Operator [SEL_426]
                                         <-Reducer 4 [SIMPLE_EDGE]
                                           SHUFFLE [RS_27]
                                             PartitionCols:_col3
-                                            Merge Join Operator [MERGEJOIN_364] (rows=270716624 width=212)
-                                              Conds:RS_24._col1=RS_419._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
+                                            Merge Join Operator [MERGEJOIN_367] (rows=270716624 width=212)
+                                              Conds:RS_24._col1=RS_422._col0(Inner),Output:["_col2","_col3","_col5","_col6","_col9","_col10"]
                                             <-Map 26 [SIMPLE_EDGE] vectorized
-                                              SHUFFLE [RS_419]
+                                              SHUFFLE [RS_422]
                                                 PartitionCols:_col0
-                                                 Please refer to the previous Select Operator [SEL_418]
+                                                 Please refer to the previous Select Operator [SEL_421]
                                             <-Reducer 3 [SIMPLE_EDGE]
                                               SHUFFLE [RS_24]
                                                 PartitionCols:_col1
-                                                Merge Join Operator [MERGEJOIN_363] (rows=812149846 width=370)
-                                                  Conds:RS_21._col0=RS_397._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                Merge Join Operator [MERGEJOIN_366] (rows=812149846 width=370)
+                                                  Conds:RS_21._col0=RS_400._col0(Inner),Output:["_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                 <-Map 12 [SIMPLE_EDGE] vectorized
-                                                  SHUFFLE [RS_397]
+                                                  SHUFFLE [RS_400]
                                                     PartitionCols:_col0
-                                                     Please refer to the previous Select Operator [SEL_396]
+                                                     Please refer to the previous Select Operator [SEL_399]
                                                 <-Reducer 2 [SIMPLE_EDGE]
                                                   SHUFFLE [RS_21]
                                                     PartitionCols:_col0
-                                                    Merge Join Operator [MERGEJOIN_362] (rows=812149846 width=374)
-                                                      Conds:RS_413._col1, _col4=RS_416._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
+                                                    Merge Join Operator [MERGEJOIN_365] (rows=812149846 width=374)
+                                                      Conds:RS_416._col1, _col4=RS_419._col0, _col1(Left Outer),Output:["_col0","_col1","_col2","_col3","_col5","_col6","_col9","_col10"]
                                                     <-Map 1 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_413]
+                                                      SHUFFLE [RS_416]
                                                         PartitionCols:_col1, _col4
-                                                        Select Operator [SEL_412] (rows=501693263 width=233)
+                                                        Select Operator [SEL_415] (rows=501693263 width=233)
                                                           Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6"]
-                                                          Filter Operator [FIL_411] (rows=501693263 width=233)
+                                                          Filter Operator [FIL_414] (rows=501693263 width=233)
                                                             predicate:(ss_sold_date_sk is not null and ss_promo_sk is not null and ss_store_sk is not null and ss_item_sk is not null and ss_sold_date_sk BETWEEN DynamicValue(RS_22_date_dim_d_date_sk_min) AND DynamicValue(RS_22_date_dim_d_date_sk_max) and in_bloom_filter(ss_sold_date_sk, DynamicValue(RS_22_date_dim_d_date_sk_bloom_filter)))
                                                             TableScan [TS_0] (rows=575995635 width=233)
                                                               default@store_sales,store_sales,Tbl:COMPLETE,Col:COMPLETE,Output:["ss_sold_date_sk","ss_item_sk","ss_store_sk","ss_promo_sk","ss_ticket_number","ss_ext_sales_price","ss_net_profit"]
                                                             <-Reducer 13 [BROADCAST_EDGE] vectorized
-                                                              BROADCAST [RS_410]
-                                                                Group By Operator [GBY_409] (rows=1 width=12)
+                                                              BROADCAST [RS_413]
+                                                                Group By Operator [GBY_412] (rows=1 width=12)
                                                                   Output:["_col0","_col1","_col2"],aggregations:["min(VALUE._col0)","max(VALUE._col1)","bloom_filter(VALUE._col2, expectedEntries=1000000)"]
                                                                 <-Map 12 [CUSTOM_SIMPLE_EDGE] vectorized
-                                                                  SHUFFLE [RS_406]
-                                                                    Group By Operator [GBY_403] (rows=1 width=12)
+                                                                  SHUFFLE [RS_409]
+                                                                    Group By Operator [GBY_406] (rows=1 width=12)
                                                                       Output:["_col0","_col1","_col2"],aggregations:["min(_col0)","max(_col0)","bloom_filter(_col0, expectedEntries=1000000)"]
-                                                                      Select Operator [SEL_398] (rows=8116 width=4)
+                                                                      Select Operator [SEL_401] (rows=8116 width=4)
                                                                         Output:["_col0"]
-                                                                         Please refer to the previous Select Operator [SEL_396]
+                                                                         Please refer to the previous Select Operator [SEL_399]
                                                     <-Map 11 [SIMPLE_EDGE] vectorized
-                                                      SHUFFLE [RS_416]
+                                                      SHUFFLE [RS_419]
                                                         PartitionCols:_col0, _col1
-                                                        Select Operator [SEL_415] (rows=57591150 width=224)
+                                                        Select Operator [SEL_418] (rows=57591150 width=224)
                                                           Output:["_col0","_col1","_col2","_col3"]
-                                                          Filter Operator [FIL_414] (rows=57591150 width=224)
+                                                          Filter Operator [FIL_417] (rows=57591150 width=224)
                                                             predicate:(sr_item_sk is not null and sr_ticket_number is not null)
                                                             TableScan [TS_3] (rows=57591150 width=224)
                                                               default@store_returns,store_returns,Tbl:COMPLETE,Col:COMPLETE,Output:["sr_item_sk","sr_ticket_number","sr_return_amt","sr_net_loss"]
diff --git a/ql/src/test/results/clientpositive/topnkey_grouping_sets.q.out b/ql/src/test/results/clientpositive/topnkey_grouping_sets.q.out
new file mode 100644
index 0000000..afca23a
--- /dev/null
+++ b/ql/src/test/results/clientpositive/topnkey_grouping_sets.q.out
@@ -0,0 +1,1236 @@
+PREHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@t_test_grouping_sets
+PREHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: Lineage: t_test_grouping_sets.a SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.b SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.c SCRIPT []
+PREHOOK: query: EXPLAIN
+SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: _col0, _col1
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: zaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1, _col2
+          Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), grouping(_col2, 1L) (type: bigint), grouping(_col2, 0L) (type: bigint), grouping(_col2, 1L, 0L) (type: bigint)
+            outputColumnNames: _col0, _col1, _col2, _col3, _col4
+            Statistics: Num rows: 26 Data size: 776 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col0 (type: int)
+              null sort order: z
+              sort order: +
+              Statistics: Num rows: 26 Data size: 776 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col1 (type: int), _col2 (type: bigint), _col3 (type: bigint), _col4 (type: bigint)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: int), VALUE._col1 (type: bigint), VALUE._col2 (type: bigint), VALUE._col3 (type: bigint)
+          outputColumnNames: _col0, _col1, _col2, _col3, _col4
+          Statistics: Num rows: 26 Data size: 776 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 3
+            Statistics: Num rows: 3 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 3 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 3
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	2	0	0	0
+5	1	0	0	0
+5	NULL	0	1	1
+PREHOOK: query: SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, grouping(a), grouping(b), grouping(a, b) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	2	0	0	0
+5	1	0	0	0
+5	NULL	0	1	1
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: zaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col0 (type: int)
+              null sort order: z
+              sort order: +
+              Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col1 (type: int)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: KEY.reducesinkkey0 (type: int), VALUE._col0 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 10
+            Statistics: Num rows: 10 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 10 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 10
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	2
+5	1
+5	NULL
+6	NULL
+6	2
+7	8
+7	NULL
+10	NULL
+10	11
+NULL	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a LIMIT 10
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	2
+5	1
+5	NULL
+6	NULL
+6	2
+7	8
+7	NULL
+10	NULL
+10	11
+NULL	NULL
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: aaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              null sort order: z
+              sort order: +
+              Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col0 (type: int)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 3
+            Statistics: Num rows: 3 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 3 Data size: 24 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 3
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1
+NULL	1
+NULL	2
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 3
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1
+NULL	1
+NULL	2
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: aaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              null sort order: z
+              sort order: +
+              Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col0 (type: int)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 1
+            Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: aaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              null sort order: z
+              sort order: +
+              Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col0 (type: int)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+NULL	2
+NULL	8
+NULL	11
+5	NULL
+NULL	NULL
+10	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a), (b)) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+NULL	1
+NULL	2
+NULL	8
+NULL	11
+5	NULL
+NULL	NULL
+10	NULL
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: zza
+                  sort order: -++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col0 (type: int), _col1 (type: int)
+              null sort order: zz
+              sort order: -+
+              Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Select Operator
+          expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+10	NULL
+7	8
+7	NULL
+6	2
+6	NULL
+5	1
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+10	NULL
+7	8
+7	NULL
+6	2
+6	NULL
+5	1
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: zza
+                  sort order: -++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col0 (type: int), _col1 (type: int)
+              null sort order: zz
+              sort order: -+
+              Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Select Operator
+          expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	1
+NULL	2
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	1
+NULL	2
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: zza
+                  sort order: -++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col0 (type: int), _col1 (type: int)
+              null sort order: zz
+              sort order: -+
+              Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Select Operator
+          expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	NULL
+NULL	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	NULL
+NULL	NULL
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: zza
+                  sort order: -++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col0 (type: int), _col1 (type: int)
+              null sort order: zz
+              sort order: -+
+              Statistics: Num rows: 13 Data size: 184 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Select Operator
+          expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	NULL
+NULL	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((), (a,b)) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11
+7	8
+6	2
+5	1
+5	2
+NULL	NULL
+NULL	NULL
+PREHOOK: query: EXPLAIN
+SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-3 depends on stages: Stage-2
+  Stage-0 depends on stages: Stage-3
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int), c (type: int)
+              outputColumnNames: a, b, c
+              Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), c (type: int)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 6 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: int)
+                  null sort order: aaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: int)
+                  Statistics: Num rows: 6 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: int)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1, _col2
+          Statistics: Num rows: 6 Data size: 60 Basic stats: COMPLETE Column stats: COMPLETE
+          Group By Operator
+            aggregations: max(_col2)
+            keys: _col0 (type: int), _col1 (type: int), 0L (type: bigint)
+            minReductionHashAggr: 0.99
+            mode: hash
+            outputColumnNames: _col0, _col1, _col2, _col3
+            Statistics: Num rows: 6 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+              null sort order: zza
+              sort order: -++
+              Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+              Statistics: Num rows: 6 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col3 (type: int)
+      Reduce Operator Tree:
+        Group By Operator
+          aggregations: max(VALUE._col0)
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1, _col3
+          Statistics: Num rows: 6 Data size: 112 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col3 (type: int)
+            outputColumnNames: _col0, _col1, _col2
+            Statistics: Num rows: 6 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-3
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col0 (type: int), _col1 (type: int)
+              null sort order: zz
+              sort order: -+
+              Statistics: Num rows: 6 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col2 (type: int)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: KEY.reducesinkkey0 (type: int), KEY.reducesinkkey1 (type: int), VALUE._col0 (type: int)
+          outputColumnNames: _col0, _col1, _col2
+          Statistics: Num rows: 6 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 6 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 6 Data size: 64 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11	12
+7	8	4
+6	2	1
+5	1	2
+5	2	3
+NULL	NULL	12
+NULL	NULL	NULL
+PREHOOK: query: SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT tmp.a, tmp.b, max(tmp.c) FROM
+  (SELECT a, b, c FROM t_test_grouping_sets GROUP BY a, b, c) tmp
+GROUP BY tmp.a, tmp.b GROUPING SETS ((), (tmp.a,tmp.b)) ORDER BY tmp.a DESC, tmp.b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+10	11	12
+7	8	4
+6	2	1
+5	1	2
+5	2	3
+NULL	NULL	12
+NULL	NULL	NULL
+PREHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@t_test_grouping_sets
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@t_test_grouping_sets
+POSTHOOK: Output: default@t_test_grouping_sets
diff --git a/ql/src/test/results/clientpositive/topnkey_grouping_sets_functions.q.out b/ql/src/test/results/clientpositive/topnkey_grouping_sets_functions.q.out
new file mode 100644
index 0000000..221ef31
--- /dev/null
+++ b/ql/src/test/results/clientpositive/topnkey_grouping_sets_functions.q.out
@@ -0,0 +1,419 @@
+PREHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@t_test_grouping_sets
+PREHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: Lineage: t_test_grouping_sets.a SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.b SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.c SCRIPT []
+PREHOOK: query: EXPLAIN
+SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int), c (type: int)
+              outputColumnNames: a, b, c
+              Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                aggregations: sum(c)
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 26 Data size: 568 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: aaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 568 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col3 (type: bigint)
+      Reduce Operator Tree:
+        Group By Operator
+          aggregations: sum(VALUE._col0)
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1, _col3
+          Statistics: Num rows: 26 Data size: 568 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col3 (type: bigint)
+            outputColumnNames: _col0, _col1, _col2
+            Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              null sort order: z
+              sort order: +
+              Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col0 (type: int), _col2 (type: bigint)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int), VALUE._col1 (type: bigint)
+          outputColumnNames: _col0, _col1, _col2
+          Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1	6
+NULL	1	6
+6	2	1
+NULL	2	4
+5	2	3
+NULL	8	12
+7	8	12
+PREHOOK: query: SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, sum(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1	6
+NULL	1	6
+6	2	1
+NULL	2	4
+5	2	3
+NULL	8	12
+7	8	12
+PREHOOK: query: EXPLAIN
+SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int), c (type: int)
+              outputColumnNames: a, b, c
+              Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                aggregations: min(c)
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: aaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col3 (type: int)
+      Reduce Operator Tree:
+        Group By Operator
+          aggregations: min(VALUE._col0)
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1, _col3
+          Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col3 (type: int)
+            outputColumnNames: _col0, _col1, _col2
+            Statistics: Num rows: 26 Data size: 256 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              null sort order: z
+              sort order: +
+              Statistics: Num rows: 26 Data size: 256 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col0 (type: int), _col2 (type: int)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int), VALUE._col1 (type: int)
+          outputColumnNames: _col0, _col1, _col2
+          Statistics: Num rows: 26 Data size: 256 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 76 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 76 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1	2
+NULL	1	2
+6	2	1
+NULL	2	1
+5	2	3
+NULL	8	4
+7	8	4
+PREHOOK: query: SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, min(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((b,a), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1	2
+NULL	1	2
+6	2	1
+NULL	2	1
+5	2	3
+NULL	8	4
+7	8	4
+PREHOOK: query: EXPLAIN
+SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int), c (type: int)
+              outputColumnNames: a, b, c
+              Statistics: Num rows: 13 Data size: 120 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                aggregations: max(c)
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: aaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+                  value expressions: _col3 (type: int)
+      Reduce Operator Tree:
+        Group By Operator
+          aggregations: max(VALUE._col0)
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1, _col3
+          Statistics: Num rows: 26 Data size: 464 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          Select Operator
+            expressions: _col0 (type: int), _col1 (type: int), _col3 (type: int)
+            outputColumnNames: _col0, _col1, _col2
+            Statistics: Num rows: 26 Data size: 256 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              null sort order: z
+              sort order: +
+              Statistics: Num rows: 26 Data size: 256 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col0 (type: int), _col2 (type: int)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int), VALUE._col1 (type: int)
+          outputColumnNames: _col0, _col1, _col2
+          Statistics: Num rows: 26 Data size: 256 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 76 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 76 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1	2
+NULL	1	2
+6	2	1
+NULL	2	3
+5	2	3
+NULL	8	4
+7	8	4
+PREHOOK: query: SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b, max(c) FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1	2
+NULL	1	2
+6	2	1
+NULL	2	3
+5	2	3
+NULL	8	4
+7	8	4
+PREHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+PREHOOK: type: DROPTABLE
+PREHOOK: Input: default@t_test_grouping_sets
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: DROP TABLE IF EXISTS t_test_grouping_sets
+POSTHOOK: type: DROPTABLE
+POSTHOOK: Input: default@t_test_grouping_sets
+POSTHOOK: Output: default@t_test_grouping_sets
diff --git a/ql/src/test/results/clientpositive/topnkey_grouping_sets_order.q.out b/ql/src/test/results/clientpositive/topnkey_grouping_sets_order.q.out
new file mode 100644
index 0000000..73d7cca
--- /dev/null
+++ b/ql/src/test/results/clientpositive/topnkey_grouping_sets_order.q.out
@@ -0,0 +1,513 @@
+PREHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+PREHOOK: type: CREATETABLE
+PREHOOK: Output: database:default
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: CREATE TABLE t_test_grouping_sets(
+  a int,
+  b int,
+  c int
+)
+POSTHOOK: type: CREATETABLE
+POSTHOOK: Output: database:default
+POSTHOOK: Output: default@t_test_grouping_sets
+PREHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+PREHOOK: type: QUERY
+PREHOOK: Input: _dummy_database@_dummy_table
+PREHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: query: INSERT INTO t_test_grouping_sets VALUES
+(NULL, NULL, NULL),
+(5, 2, 3),
+(10, 11, 12),
+(NULL, NULL, NULL),
+(NULL, NULL, NULL),
+(6, 2, 1),
+(7, 8, 4), (7, 8, 4), (7, 8, 4),
+(5, 1, 2), (5, 1, 2), (5, 1, 2),
+(NULL, NULL, NULL)
+POSTHOOK: type: QUERY
+POSTHOOK: Input: _dummy_database@_dummy_table
+POSTHOOK: Output: default@t_test_grouping_sets
+POSTHOOK: Lineage: t_test_grouping_sets.a SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.b SCRIPT []
+POSTHOOK: Lineage: t_test_grouping_sets.c SCRIPT []
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: aaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              null sort order: a
+              sort order: +
+              Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col0 (type: int)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	NULL
+NULL	NULL
+NULL	NULL
+NULL	NULL
+7	NULL
+10	NULL
+NULL	NULL
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS FIRST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	NULL
+NULL	NULL
+NULL	NULL
+NULL	NULL
+7	NULL
+10	NULL
+NULL	NULL
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: aaa
+                  sort order: +++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col1 (type: int)
+              null sort order: z
+              sort order: +
+              Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+              TopN Hash Memory Usage: 0.1
+              value expressions: _col0 (type: int)
+      Reduce Operator Tree:
+        Select Operator
+          expressions: VALUE._col0 (type: int), KEY.reducesinkkey0 (type: int)
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 152 Basic stats: COMPLETE Column stats: COMPLETE
+          Limit
+            Number of rows: 7
+            Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+            File Output Operator
+              compressed: false
+              Statistics: Num rows: 7 Data size: 48 Basic stats: COMPLETE Column stats: COMPLETE
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: 7
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1
+NULL	1
+6	2
+NULL	2
+5	2
+NULL	8
+7	8
+PREHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY b NULLS LAST LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+5	1
+NULL	1
+6	2
+NULL	2
+5	2
+NULL	8
+7	8
+PREHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+POSTHOOK: query: EXPLAIN
+SELECT a, b FROM t_test_grouping_sets GROUP BY a,b GROUPING SETS ((a,b), (a), (b), ()) ORDER BY a DESC, b ASC LIMIT 7
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t_test_grouping_sets
+#### A masked pattern was here ####
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-2 depends on stages: Stage-1
+  Stage-0 depends on stages: Stage-2
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            alias: t_test_grouping_sets
+            Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+            Select Operator
+              expressions: a (type: int), b (type: int)
+              outputColumnNames: a, b
+              Statistics: Num rows: 13 Data size: 80 Basic stats: COMPLETE Column stats: COMPLETE
+              Group By Operator
+                keys: a (type: int), b (type: int), 0L (type: bigint)
+                minReductionHashAggr: 0.99
+                mode: hash
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                Reduce Output Operator
+                  key expressions: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  null sort order: zza
+                  sort order: -++
+                  Map-reduce partition columns: _col0 (type: int), _col1 (type: int), _col2 (type: bigint)
+                  Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+                  TopN Hash Memory Usage: 0.1
+      Reduce Operator Tree:
+        Group By Operator
+          keys: KEY._col0 (type: int), KEY._col1 (type: int), KEY._col2 (type: bigint)
+          mode: mergepartial
+          outputColumnNames: _col0, _col1
+          Statistics: Num rows: 26 Data size: 360 Basic stats: COMPLETE Column stats: COMPLETE
+          pruneGroupingSetId: true
+          File Output Operator
+            compressed: false
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe
+
+  Stage: Stage-2
+    Map Reduce
+      Map Operator Tree:
+          TableScan
+            Reduce Output Operator
+              key expressions: _col0 (type: int), _col1 (type: int)
+              null sort order: zz
+              sort order: -+
... 177 lines suppressed ...