hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From khorg...@apache.org
Subject [7/9] hive git commit: HIVE-10563 : MiniTezCliDriver tests ordering issues (Hari Subramaniyan via Sushanth Sowmyan)
Date Fri, 29 May 2015 20:51:04 GMT
http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/cross_product_check_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/cross_product_check_1.q.out b/ql/src/test/results/clientpositive/spark/cross_product_check_1.q.out
index bd4b5cb..ff58910 100644
--- a/ql/src/test/results/clientpositive/spark/cross_product_check_1.q.out
+++ b/ql/src/test/results/clientpositive/spark/cross_product_check_1.q.out
@@ -1,10 +1,14 @@
-PREHOOK: query: create table A as
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+create table A as
 select * from src
 PREHOOK: type: CREATETABLE_AS_SELECT
 PREHOOK: Input: default@src
 PREHOOK: Output: database:default
 PREHOOK: Output: default@A
-POSTHOOK: query: create table A as
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+create table A as
 select * from src
 POSTHOOK: type: CREATETABLE_AS_SELECT
 POSTHOOK: Input: default@src
@@ -185,12 +189,12 @@ STAGE PLANS:
 Warning: Shuffle Join JOIN[16][tables = [a, od1]] in Work 'Reducer 4' is a cross product
 PREHOOK: query: explain select * from A join 
          (select d1.key 
-          from B d1 join B d2 on d1.key = d2.key 
+          from B d1 join B d2 on d1.key = d2.key
           where 1 = 1 group by d1.key) od1
 PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from A join 
          (select d1.key 
-          from B d1 join B d2 on d1.key = d2.key 
+          from B d1 join B d2 on d1.key = d2.key
           where 1 = 1 group by d1.key) od1
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
@@ -302,9 +306,9 @@ STAGE PLANS:
 
 Warning: Shuffle Join JOIN[4][tables = [d1, d2]] in Work 'Reducer 2' is a cross product
 Warning: Shuffle Join JOIN[14][tables = [a, od1]] in Work 'Reducer 4' is a cross product
-PREHOOK: query: explain select * from A join (select d1.key from B d1 join B d2 where 1 = 1 group by d1.key) od1
+PREHOOK: query: explain select * from A join (select d1.key from B d1 join B d2 where 1 = 1  group by d1.key) od1
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select * from A join (select d1.key from B d1 join B d2 where 1 = 1 group by d1.key) od1
+POSTHOOK: query: explain select * from A join (select d1.key from B d1 join B d2 where 1 = 1  group by d1.key) od1
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -406,11 +410,11 @@ STAGE PLANS:
 
 Warning: Shuffle Join JOIN[21][tables = [ss, od1]] in Work 'Reducer 3' is a cross product
 PREHOOK: query: explain select * from 
-(select A.key from A group by key) ss join 
+(select A.key from A  group by key) ss join
 (select d1.key from B d1 join B d2 on d1.key = d2.key where 1 = 1 group by d1.key) od1
 PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from 
-(select A.key from A group by key) ss join 
+(select A.key from A  group by key) ss join
 (select d1.key from B d1 join B d2 on d1.key = d2.key where 1 = 1 group by d1.key) od1
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/cross_product_check_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/cross_product_check_2.q.out b/ql/src/test/results/clientpositive/spark/cross_product_check_2.q.out
index 7f3f130..6c4e659 100644
--- a/ql/src/test/results/clientpositive/spark/cross_product_check_2.q.out
+++ b/ql/src/test/results/clientpositive/spark/cross_product_check_2.q.out
@@ -1,24 +1,28 @@
-PREHOOK: query: create table A as
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+create table A as
 select * from src
 PREHOOK: type: CREATETABLE_AS_SELECT
 PREHOOK: Input: default@src
 PREHOOK: Output: database:default
 PREHOOK: Output: default@A
-POSTHOOK: query: create table A as
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+create table A as
 select * from src
 POSTHOOK: type: CREATETABLE_AS_SELECT
 POSTHOOK: Input: default@src
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@A
 PREHOOK: query: create table B as
-select * from src
+select * from src order by key
 limit 10
 PREHOOK: type: CREATETABLE_AS_SELECT
 PREHOOK: Input: default@src
 PREHOOK: Output: database:default
 PREHOOK: Output: default@B
 POSTHOOK: query: create table B as
-select * from src
+select * from src order by key
 limit 10
 POSTHOOK: type: CREATETABLE_AS_SELECT
 POSTHOOK: Input: default@src
@@ -43,7 +47,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: b
-                  Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                   Spark HashTable Sink Operator
                     keys:
                       0 
@@ -110,10 +114,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: d2
-                  Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
                     Spark HashTable Sink Operator
                       keys:
                         0 key (type: string)
@@ -129,10 +133,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: d1
-                  Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
@@ -142,7 +146,7 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1, _col5, _col6
                       input vertices:
                         1 Map 2
-                      Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
                       Spark HashTable Sink Operator
                         keys:
                           0 
@@ -215,10 +219,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: d2
-                  Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
                     Spark HashTable Sink Operator
                       keys:
                         0 key (type: string)
@@ -236,10 +240,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: d1
-                  Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
@@ -249,17 +253,17 @@ STAGE PLANS:
                       outputColumnNames: _col0
                       input vertices:
                         1 Map 3
-                      Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         keys: _col0 (type: string)
                         mode: hash
                         outputColumnNames: _col0
-                        Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
                         Reduce Output Operator
                           key expressions: _col0 (type: string)
                           sort order: +
                           Map-reduce partition columns: _col0 (type: string)
-                          Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
+                          Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
             Local Work:
               Map Reduce Local Work
         Reducer 2 
@@ -270,7 +274,7 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0
-                Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
                 Spark HashTable Sink Operator
                   keys:
                     0 
@@ -336,7 +340,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: d2
-                  Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: COMPLETE
+                  Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: COMPLETE
                   Spark HashTable Sink Operator
                     keys:
                       0 
@@ -354,7 +358,7 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: d1
-                  Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                   Map Join Operator
                     condition map:
                          Inner Join 0 to 1
@@ -364,17 +368,17 @@ STAGE PLANS:
                     outputColumnNames: _col0
                     input vertices:
                       1 Map 3
-                    Statistics: Num rows: 11 Data size: 114 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 11 Data size: 105 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
                       keys: _col0 (type: string)
                       mode: hash
                       outputColumnNames: _col0
-                      Statistics: Num rows: 11 Data size: 114 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 11 Data size: 105 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
                         key expressions: _col0 (type: string)
                         sort order: +
                         Map-reduce partition columns: _col0 (type: string)
-                        Statistics: Num rows: 11 Data size: 114 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 11 Data size: 105 Basic stats: COMPLETE Column stats: NONE
             Local Work:
               Map Reduce Local Work
         Reducer 2 
@@ -385,7 +389,7 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0
-                Statistics: Num rows: 5 Data size: 51 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 5 Data size: 47 Basic stats: COMPLETE Column stats: NONE
                 Spark HashTable Sink Operator
                   keys:
                     0 
@@ -454,10 +458,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: d2
-                  Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
                     Spark HashTable Sink Operator
                       keys:
                         0 key (type: string)
@@ -475,10 +479,10 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: d1
-                  Statistics: Num rows: 10 Data size: 104 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 10 Data size: 96 Basic stats: COMPLETE Column stats: NONE
                   Filter Operator
                     predicate: key is not null (type: boolean)
-                    Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 5 Data size: 48 Basic stats: COMPLETE Column stats: NONE
                     Map Join Operator
                       condition map:
                            Inner Join 0 to 1
@@ -488,17 +492,17 @@ STAGE PLANS:
                       outputColumnNames: _col0
                       input vertices:
                         1 Map 5
-                      Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
                       Group By Operator
                         keys: _col0 (type: string)
                         mode: hash
                         outputColumnNames: _col0
-                        Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
+                        Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
                         Reduce Output Operator
                           key expressions: _col0 (type: string)
                           sort order: +
                           Map-reduce partition columns: _col0 (type: string)
-                          Statistics: Num rows: 5 Data size: 57 Basic stats: COMPLETE Column stats: NONE
+                          Statistics: Num rows: 5 Data size: 52 Basic stats: COMPLETE Column stats: NONE
             Local Work:
               Map Reduce Local Work
         Reducer 4 
@@ -509,7 +513,7 @@ STAGE PLANS:
                 keys: KEY._col0 (type: string)
                 mode: mergepartial
                 outputColumnNames: _col0
-                Statistics: Num rows: 2 Data size: 22 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 2 Data size: 20 Basic stats: COMPLETE Column stats: NONE
                 Spark HashTable Sink Operator
                   keys:
                     0 

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/ctas.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/ctas.q.out b/ql/src/test/results/clientpositive/spark/ctas.q.out
index bcd663a..cebe3ab 100644
--- a/ql/src/test/results/clientpositive/spark/ctas.q.out
+++ b/ql/src/test/results/clientpositive/spark/ctas.q.out
@@ -1,10 +1,12 @@
 PREHOOK: query: -- EXCLUDE_HADOOP_MAJOR_VERSIONS( 0.20S)
+-- SORT_QUERY_RESULTS
 
 create table nzhang_Tmp(a int, b string)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@nzhang_Tmp
 POSTHOOK: query: -- EXCLUDE_HADOOP_MAJOR_VERSIONS( 0.20S)
+-- SORT_QUERY_RESULTS
 
 create table nzhang_Tmp(a int, b string)
 POSTHOOK: type: CREATETABLE

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/filter_join_breaktask2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/filter_join_breaktask2.q.out b/ql/src/test/results/clientpositive/spark/filter_join_breaktask2.q.out
index 6a2396e..af85af9 100644
--- a/ql/src/test/results/clientpositive/spark/filter_join_breaktask2.q.out
+++ b/ql/src/test/results/clientpositive/spark/filter_join_breaktask2.q.out
@@ -1,9 +1,13 @@
-PREHOOK: query: create table T1(c1 string, c2 string, c3 string, c4 string, c5 string, c6 string, c7 string) 
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+create table T1(c1 string, c2 string, c3 string, c4 string, c5 string, c6 string, c7 string) 
 partitioned by (ds string)
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@T1
-POSTHOOK: query: create table T1(c1 string, c2 string, c3 string, c4 string, c5 string, c6 string, c7 string) 
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+create table T1(c1 string, c2 string, c3 string, c4 string, c5 string, c6 string, c7 string) 
 partitioned by (ds string)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/insert_into1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/insert_into1.q.out b/ql/src/test/results/clientpositive/spark/insert_into1.q.out
index e7f7d8f..f407c8d 100644
--- a/ql/src/test/results/clientpositive/spark/insert_into1.q.out
+++ b/ql/src/test/results/clientpositive/spark/insert_into1.q.out
@@ -1,6 +1,10 @@
-PREHOOK: query: DROP TABLE insert_into1
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+DROP TABLE insert_into1
 PREHOOK: type: DROPTABLE
-POSTHOOK: query: DROP TABLE insert_into1
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+DROP TABLE insert_into1
 POSTHOOK: type: DROPTABLE
 PREHOOK: query: CREATE TABLE insert_into1 (key int, value string)
 PREHOOK: type: CREATETABLE
@@ -10,9 +14,9 @@ POSTHOOK: query: CREATE TABLE insert_into1 (key int, value string)
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@insert_into1
-PREHOOK: query: EXPLAIN INSERT INTO TABLE insert_into1 SELECT * from src LIMIT 100
+PREHOOK: query: EXPLAIN INSERT INTO TABLE insert_into1 SELECT * from src ORDER BY key LIMIT 100
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN INSERT INTO TABLE insert_into1 SELECT * from src LIMIT 100
+POSTHOOK: query: EXPLAIN INSERT INTO TABLE insert_into1 SELECT * from src ORDER BY key LIMIT 100
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -23,7 +27,7 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (GROUP, 1)
+        Reducer 2 <- Map 1 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -35,19 +39,17 @@ STAGE PLANS:
                     expressions: key (type: string), value (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                    Limit
-                      Number of rows: 100
-                      Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        sort order: 
-                        Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col1 (type: string)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col1 (type: string)
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: string), VALUE._col1 (type: string)
+                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 100
                   Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
@@ -77,11 +79,11 @@ STAGE PLANS:
   Stage: Stage-2
     Stats-Aggr Operator
 
-PREHOOK: query: INSERT INTO TABLE insert_into1 SELECT * from src LIMIT 100
+PREHOOK: query: INSERT INTO TABLE insert_into1 SELECT * from src ORDER BY key LIMIT 100
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@insert_into1
-POSTHOOK: query: INSERT INTO TABLE insert_into1 SELECT * from src LIMIT 100
+POSTHOOK: query: INSERT INTO TABLE insert_into1 SELECT * from src ORDER BY key LIMIT 100
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@insert_into1
@@ -99,7 +101,7 @@ POSTHOOK: query: SELECT SUM(HASH(c)) FROM (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@insert_into1
 #### A masked pattern was here ####
-10226524244
+-1142373758
 PREHOOK: query: explain 
 select count(*) from insert_into1
 PREHOOK: type: QUERY
@@ -125,9 +127,9 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@insert_into1
 #### A masked pattern was here ####
 100
-PREHOOK: query: EXPLAIN INSERT INTO TABLE insert_into1 SELECT * FROM src LIMIT 100
+PREHOOK: query: EXPLAIN INSERT INTO TABLE insert_into1 SELECT * FROM src ORDER BY key LIMIT 100
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN INSERT INTO TABLE insert_into1 SELECT * FROM src LIMIT 100
+POSTHOOK: query: EXPLAIN INSERT INTO TABLE insert_into1 SELECT * FROM src ORDER BY key LIMIT 100
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -138,7 +140,7 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (GROUP, 1)
+        Reducer 2 <- Map 1 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -150,19 +152,17 @@ STAGE PLANS:
                     expressions: key (type: string), value (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                    Limit
-                      Number of rows: 100
-                      Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        sort order: 
-                        Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col1 (type: string)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col1 (type: string)
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: string), VALUE._col1 (type: string)
+                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 100
                   Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
@@ -192,11 +192,11 @@ STAGE PLANS:
   Stage: Stage-2
     Stats-Aggr Operator
 
-PREHOOK: query: INSERT INTO TABLE insert_into1 SELECT * FROM src LIMIT 100
+PREHOOK: query: INSERT INTO TABLE insert_into1 SELECT * FROM src ORDER BY key LIMIT 100
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@insert_into1
-POSTHOOK: query: INSERT INTO TABLE insert_into1 SELECT * FROM src LIMIT 100
+POSTHOOK: query: INSERT INTO TABLE insert_into1 SELECT * FROM src ORDER BY key LIMIT 100
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@insert_into1
@@ -214,7 +214,7 @@ POSTHOOK: query: SELECT SUM(HASH(c)) FROM (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@insert_into1
 #### A masked pattern was here ####
-20453048488
+-2284747516
 PREHOOK: query: explain
 SELECT COUNT(*) FROM insert_into1
 PREHOOK: type: QUERY
@@ -240,9 +240,9 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@insert_into1
 #### A masked pattern was here ####
 200
-PREHOOK: query: EXPLAIN INSERT OVERWRITE TABLE insert_into1 SELECT * FROM src LIMIT 10
+PREHOOK: query: EXPLAIN INSERT OVERWRITE TABLE insert_into1 SELECT * FROM src ORDER BY key LIMIT 10
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN INSERT OVERWRITE TABLE insert_into1 SELECT * FROM src LIMIT 10
+POSTHOOK: query: EXPLAIN INSERT OVERWRITE TABLE insert_into1 SELECT * FROM src ORDER BY key LIMIT 10
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -253,7 +253,7 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (GROUP, 1)
+        Reducer 2 <- Map 1 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -265,19 +265,17 @@ STAGE PLANS:
                     expressions: key (type: string), value (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                    Limit
-                      Number of rows: 10
-                      Statistics: Num rows: 10 Data size: 100 Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        sort order: 
-                        Statistics: Num rows: 10 Data size: 100 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col1 (type: string)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col1 (type: string)
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: string), VALUE._col1 (type: string)
+                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 10 Data size: 100 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 10
                   Statistics: Num rows: 10 Data size: 100 Basic stats: COMPLETE Column stats: NONE
@@ -307,11 +305,11 @@ STAGE PLANS:
   Stage: Stage-2
     Stats-Aggr Operator
 
-PREHOOK: query: INSERT OVERWRITE TABLE insert_into1 SELECT * FROM src LIMIT 10
+PREHOOK: query: INSERT OVERWRITE TABLE insert_into1 SELECT * FROM src ORDER BY key LIMIT 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@insert_into1
-POSTHOOK: query: INSERT OVERWRITE TABLE insert_into1 SELECT * FROM src LIMIT 10
+POSTHOOK: query: INSERT OVERWRITE TABLE insert_into1 SELECT * FROM src ORDER BY key LIMIT 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@insert_into1
@@ -329,7 +327,7 @@ POSTHOOK: query: SELECT SUM(HASH(c)) FROM (
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@insert_into1
 #### A masked pattern was here ####
--826625916
+-2693537120
 PREHOOK: query: explain
 SELECT COUNT(*) FROM insert_into1
 PREHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/insert_into2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/insert_into2.q.out b/ql/src/test/results/clientpositive/spark/insert_into2.q.out
index 8c5e1c3..578fae2 100644
--- a/ql/src/test/results/clientpositive/spark/insert_into2.q.out
+++ b/ql/src/test/results/clientpositive/spark/insert_into2.q.out
@@ -13,10 +13,10 @@ POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@insert_into2
 PREHOOK: query: EXPLAIN INSERT INTO TABLE insert_into2 PARTITION (ds='1') 
-  SELECT * FROM src LIMIT 100
+  SELECT * FROM src order by key LIMIT 100
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN INSERT INTO TABLE insert_into2 PARTITION (ds='1') 
-  SELECT * FROM src LIMIT 100
+  SELECT * FROM src order by key LIMIT 100
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -27,7 +27,7 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (GROUP, 1)
+        Reducer 2 <- Map 1 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -39,19 +39,17 @@ STAGE PLANS:
                     expressions: key (type: string), value (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                    Limit
-                      Number of rows: 100
-                      Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        sort order: 
-                        Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col1 (type: string)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col1 (type: string)
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: string), VALUE._col1 (type: string)
+                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 100
                   Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
@@ -83,11 +81,11 @@ STAGE PLANS:
   Stage: Stage-2
     Stats-Aggr Operator
 
-PREHOOK: query: INSERT INTO TABLE insert_into2 PARTITION (ds='1') SELECT * FROM src limit 100
+PREHOOK: query: INSERT INTO TABLE insert_into2 PARTITION (ds='1') SELECT * FROM src order by key limit 100
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@insert_into2@ds=1
-POSTHOOK: query: INSERT INTO TABLE insert_into2 PARTITION (ds='1') SELECT * FROM src limit 100
+POSTHOOK: query: INSERT INTO TABLE insert_into2 PARTITION (ds='1') SELECT * FROM src order by key limit 100
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@insert_into2@ds=1
@@ -118,11 +116,11 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@insert_into2
 #### A masked pattern was here ####
 100
-PREHOOK: query: INSERT INTO TABLE insert_into2 PARTITION (ds='1') SELECT * FROM src limit 100
+PREHOOK: query: INSERT INTO TABLE insert_into2 PARTITION (ds='1') SELECT * FROM src order by key limit 100
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@insert_into2@ds=1
-POSTHOOK: query: INSERT INTO TABLE insert_into2 PARTITION (ds='1') SELECT * FROM src limit 100
+POSTHOOK: query: INSERT INTO TABLE insert_into2 PARTITION (ds='1') SELECT * FROM src order by key limit 100
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@insert_into2@ds=1
@@ -167,12 +165,12 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@insert_into2
 POSTHOOK: Input: default@insert_into2@ds=1
 #### A masked pattern was here ####
--24159954504
+-39568181484
 PREHOOK: query: EXPLAIN INSERT OVERWRITE TABLE insert_into2 PARTITION (ds='2')
-  SELECT * FROM src LIMIT 100
+  SELECT * FROM src order by key LIMIT 100
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN INSERT OVERWRITE TABLE insert_into2 PARTITION (ds='2')
-  SELECT * FROM src LIMIT 100
+  SELECT * FROM src order by key LIMIT 100
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -183,7 +181,7 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (GROUP, 1)
+        Reducer 2 <- Map 1 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -195,19 +193,17 @@ STAGE PLANS:
                     expressions: key (type: string), value (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                    Limit
-                      Number of rows: 100
-                      Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        sort order: 
-                        Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col1 (type: string)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col1 (type: string)
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: string), VALUE._col1 (type: string)
+                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 100
                   Statistics: Num rows: 100 Data size: 1000 Basic stats: COMPLETE Column stats: NONE
@@ -240,12 +236,12 @@ STAGE PLANS:
     Stats-Aggr Operator
 
 PREHOOK: query: INSERT OVERWRITE TABLE insert_into2 PARTITION (ds='2')
-  SELECT * FROM src LIMIT 100
+  SELECT * FROM src order by key LIMIT 100
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@insert_into2@ds=2
 POSTHOOK: query: INSERT OVERWRITE TABLE insert_into2 PARTITION (ds='2')
-  SELECT * FROM src LIMIT 100
+  SELECT * FROM src order by key LIMIT 100
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@insert_into2@ds=2
@@ -267,7 +263,7 @@ POSTHOOK: Input: default@insert_into2
 POSTHOOK: Input: default@insert_into2@ds=1
 POSTHOOK: Input: default@insert_into2@ds=2
 #### A masked pattern was here ####
--36239931656
+-59352272126
 PREHOOK: query: explain
 SELECT COUNT(*) FROM insert_into2 WHERE ds='2'
 PREHOOK: type: QUERY
@@ -294,10 +290,10 @@ POSTHOOK: Input: default@insert_into2
 #### A masked pattern was here ####
 100
 PREHOOK: query: EXPLAIN INSERT OVERWRITE TABLE insert_into2 PARTITION (ds='2')
-  SELECT * FROM src LIMIT 50
+  SELECT * FROM src order by key LIMIT 50
 PREHOOK: type: QUERY
 POSTHOOK: query: EXPLAIN INSERT OVERWRITE TABLE insert_into2 PARTITION (ds='2')
-  SELECT * FROM src LIMIT 50
+  SELECT * FROM src order by key LIMIT 50
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -308,7 +304,7 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (GROUP, 1)
+        Reducer 2 <- Map 1 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -320,19 +316,17 @@ STAGE PLANS:
                     expressions: key (type: string), value (type: string)
                     outputColumnNames: _col0, _col1
                     Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
-                    Limit
-                      Number of rows: 50
-                      Statistics: Num rows: 50 Data size: 500 Basic stats: COMPLETE Column stats: NONE
-                      Reduce Output Operator
-                        sort order: 
-                        Statistics: Num rows: 50 Data size: 500 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col1 (type: string)
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col1 (type: string)
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: string), VALUE._col1 (type: string)
+                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: string)
                 outputColumnNames: _col0, _col1
-                Statistics: Num rows: 50 Data size: 500 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 500 Data size: 5312 Basic stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 50
                   Statistics: Num rows: 50 Data size: 500 Basic stats: COMPLETE Column stats: NONE
@@ -365,12 +359,12 @@ STAGE PLANS:
     Stats-Aggr Operator
 
 PREHOOK: query: INSERT OVERWRITE TABLE insert_into2 PARTITION (ds='2')
-  SELECT * FROM src LIMIT 50
+  SELECT * FROM src order by key LIMIT 50
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@insert_into2@ds=2
 POSTHOOK: query: INSERT OVERWRITE TABLE insert_into2 PARTITION (ds='2')
-  SELECT * FROM src LIMIT 50
+  SELECT * FROM src order by key LIMIT 50
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@insert_into2@ds=2
@@ -392,7 +386,7 @@ POSTHOOK: Input: default@insert_into2
 POSTHOOK: Input: default@insert_into2@ds=1
 POSTHOOK: Input: default@insert_into2@ds=2
 #### A masked pattern was here ####
--27100860056
+-33609711132
 PREHOOK: query: explain
 SELECT COUNT(*) FROM insert_into2 WHERE ds='2'
 PREHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/join_merge_multi_expressions.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join_merge_multi_expressions.q.out b/ql/src/test/results/clientpositive/spark/join_merge_multi_expressions.q.out
index 9eb15ec..a18d82e 100644
--- a/ql/src/test/results/clientpositive/spark/join_merge_multi_expressions.q.out
+++ b/ql/src/test/results/clientpositive/spark/join_merge_multi_expressions.q.out
@@ -1,7 +1,9 @@
-PREHOOK: query: explain
+PREHOOK: query: -- SORT_QUERY_RESULTS
+explain
 select count(*) from srcpart a join srcpart b on a.key = b.key and a.hr = b.hr join srcpart c on a.hr = c.hr and a.key = c.key
 PREHOOK: type: QUERY
-POSTHOOK: query: explain
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+explain
 select count(*) from srcpart a join srcpart b on a.key = b.key and a.hr = b.hr join srcpart c on a.hr = c.hr and a.key = c.key
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/join_nullsafe.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/join_nullsafe.q.out b/ql/src/test/results/clientpositive/spark/join_nullsafe.q.out
index 70459f7..c9e7a5c 100644
--- a/ql/src/test/results/clientpositive/spark/join_nullsafe.q.out
+++ b/ql/src/test/results/clientpositive/spark/join_nullsafe.q.out
@@ -86,11 +86,13 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-PREHOOK: query: select * from myinput1 a join myinput1 b on a.key<=>b.value
+PREHOOK: query: -- SORT_QUERY_RESULTS
+select * from myinput1 a join myinput1 b on a.key<=>b.value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@myinput1
 #### A masked pattern was here ####
-POSTHOOK: query: select * from myinput1 a join myinput1 b on a.key<=>b.value
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+select * from myinput1 a join myinput1 b on a.key<=>b.value
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@myinput1
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/mapjoin_decimal.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/mapjoin_decimal.q.out b/ql/src/test/results/clientpositive/spark/mapjoin_decimal.q.out
index 3fafe1f..20b188b 100644
--- a/ql/src/test/results/clientpositive/spark/mapjoin_decimal.q.out
+++ b/ql/src/test/results/clientpositive/spark/mapjoin_decimal.q.out
@@ -77,10 +77,10 @@ POSTHOOK: Input: default@over1k
 POSTHOOK: Output: default@t2
 POSTHOOK: Lineage: t2.dec EXPRESSION [(over1k)over1k.FieldSchema(name:dec, type:decimal(4,2), comment:null), ]
 PREHOOK: query: explain
-select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec)
+select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec) order by t1.dec
 PREHOOK: type: QUERY
 POSTHOOK: query: explain
-select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec)
+select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec) order by t1.dec
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-2 is a root stage
@@ -92,7 +92,7 @@ STAGE PLANS:
     Spark
 #### A masked pattern was here ####
       Vertices:
-        Map 2 
+        Map 3 
             Map Operator Tree:
                 TableScan
                   alias: t2
@@ -109,6 +109,8 @@ STAGE PLANS:
 
   Stage: Stage-1
     Spark
+      Edges:
+        Reducer 2 <- Map 1 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -127,21 +129,32 @@ STAGE PLANS:
                         1 dec (type: decimal(6,2))
                       outputColumnNames: _col0, _col4
                       input vertices:
-                        1 Map 2
+                        1 Map 3
                       Statistics: Num rows: 577 Data size: 64680 Basic stats: COMPLETE Column stats: NONE
                       Select Operator
                         expressions: _col0 (type: decimal(4,2)), _col4 (type: decimal(4,0))
                         outputColumnNames: _col0, _col1
                         Statistics: Num rows: 577 Data size: 64680 Basic stats: COMPLETE Column stats: NONE
-                        File Output Operator
-                          compressed: false
+                        Reduce Output Operator
+                          key expressions: _col0 (type: decimal(4,2))
+                          sort order: +
                           Statistics: Num rows: 577 Data size: 64680 Basic stats: COMPLETE Column stats: NONE
-                          table:
-                              input format: org.apache.hadoop.mapred.TextInputFormat
-                              output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-                              serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+                          value expressions: _col1 (type: decimal(4,0))
             Local Work:
               Map Reduce Local Work
+        Reducer 2 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: decimal(4,2)), VALUE._col0 (type: decimal(4,0))
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 577 Data size: 64680 Basic stats: COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 577 Data size: 64680 Basic stats: COMPLETE Column stats: NONE
+                  table:
+                      input format: org.apache.hadoop.mapred.TextInputFormat
+                      output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                      serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
 
   Stage: Stage-0
     Fetch Operator
@@ -149,12 +162,12 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-PREHOOK: query: select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec)
+PREHOOK: query: select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec) order by t1.dec
 PREHOOK: type: QUERY
 PREHOOK: Input: default@t1
 PREHOOK: Input: default@t2
 #### A masked pattern was here ####
-POSTHOOK: query: select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec)
+POSTHOOK: query: select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec) order by t1.dec
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@t1
 POSTHOOK: Input: default@t2
@@ -265,12 +278,12 @@ POSTHOOK: Input: default@t2
 9	9
 9	9
 9	9
-PREHOOK: query: select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec)
+PREHOOK: query: select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec) order by t1.dec
 PREHOOK: type: QUERY
 PREHOOK: Input: default@t1
 PREHOOK: Input: default@t2
 #### A masked pattern was here ####
-POSTHOOK: query: select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec)
+POSTHOOK: query: select t1.dec, t2.dec from t1 join t2 on (t1.dec=t2.dec) order by t1.dec
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@t1
 POSTHOOK: Input: default@t2

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/script_env_var1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/script_env_var1.q.out b/ql/src/test/results/clientpositive/spark/script_env_var1.q.out
index 5ab1c20..cd39eb8 100644
--- a/ql/src/test/results/clientpositive/spark/script_env_var1.q.out
+++ b/ql/src/test/results/clientpositive/spark/script_env_var1.q.out
@@ -1,16 +1,16 @@
 PREHOOK: query: -- Verifies that script operator ID environment variables have unique values
 -- in each instance of the script operator.
 SELECT count(1) FROM
-( SELECT * FROM (SELECT TRANSFORM('echo $HIVE_SCRIPT_OPERATOR_ID') USING 'sh' AS key FROM src LIMIT 1)x UNION ALL
-  SELECT * FROM (SELECT TRANSFORM('echo $HIVE_SCRIPT_OPERATOR_ID') USING 'sh' AS key FROM src LIMIT 1)y ) a GROUP BY key
+( SELECT * FROM (SELECT TRANSFORM('echo $HIVE_SCRIPT_OPERATOR_ID') USING 'sh' AS key FROM src order by key LIMIT 1)x UNION ALL
+  SELECT * FROM (SELECT TRANSFORM('echo $HIVE_SCRIPT_OPERATOR_ID') USING 'sh' AS key FROM src order by key LIMIT 1)y ) a GROUP BY key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 #### A masked pattern was here ####
 POSTHOOK: query: -- Verifies that script operator ID environment variables have unique values
 -- in each instance of the script operator.
 SELECT count(1) FROM
-( SELECT * FROM (SELECT TRANSFORM('echo $HIVE_SCRIPT_OPERATOR_ID') USING 'sh' AS key FROM src LIMIT 1)x UNION ALL
-  SELECT * FROM (SELECT TRANSFORM('echo $HIVE_SCRIPT_OPERATOR_ID') USING 'sh' AS key FROM src LIMIT 1)y ) a GROUP BY key
+( SELECT * FROM (SELECT TRANSFORM('echo $HIVE_SCRIPT_OPERATOR_ID') USING 'sh' AS key FROM src order by key LIMIT 1)x UNION ALL
+  SELECT * FROM (SELECT TRANSFORM('echo $HIVE_SCRIPT_OPERATOR_ID') USING 'sh' AS key FROM src order by key LIMIT 1)y ) a GROUP BY key
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/skewjoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/skewjoin.q.out b/ql/src/test/results/clientpositive/spark/skewjoin.q.out
index 32bbc95..5fb2ecb 100644
--- a/ql/src/test/results/clientpositive/spark/skewjoin.q.out
+++ b/ql/src/test/results/clientpositive/spark/skewjoin.q.out
@@ -1,8 +1,12 @@
-PREHOOK: query: CREATE TABLE T1(key STRING, val STRING) STORED AS TEXTFILE
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+CREATE TABLE T1(key STRING, val STRING) STORED AS TEXTFILE
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@T1
-POSTHOOK: query: CREATE TABLE T1(key STRING, val STRING) STORED AS TEXTFILE
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+CREATE TABLE T1(key STRING, val STRING) STORED AS TEXTFILE
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@T1

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/subquery_exists.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/subquery_exists.q.out b/ql/src/test/results/clientpositive/spark/subquery_exists.q.out
index 0b88715..854ca14 100644
--- a/ql/src/test/results/clientpositive/spark/subquery_exists.q.out
+++ b/ql/src/test/results/clientpositive/spark/subquery_exists.q.out
@@ -1,6 +1,7 @@
 PREHOOK: query: -- SORT_QUERY_RESULTS
 
 -- no agg, corr
+-- SORT_QUERY_RESULTS
 explain
 select * 
 from src b 
@@ -13,6 +14,7 @@ PREHOOK: type: QUERY
 POSTHOOK: query: -- SORT_QUERY_RESULTS
 
 -- no agg, corr
+-- SORT_QUERY_RESULTS
 explain
 select * 
 from src b 

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/temp_table.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/temp_table.q.out b/ql/src/test/results/clientpositive/spark/temp_table.q.out
index 73d33ee..30563b2 100644
--- a/ql/src/test/results/clientpositive/spark/temp_table.q.out
+++ b/ql/src/test/results/clientpositive/spark/temp_table.q.out
@@ -146,48 +146,76 @@ POSTHOOK: type: DESCTABLE
 POSTHOOK: Input: default@bar
 key                 	string              	                    
 value               	string              	                    
-PREHOOK: query: explain select * from foo limit 10
+PREHOOK: query: explain select * from foo order by key limit 10
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select * from foo limit 10
+POSTHOOK: query: explain select * from foo order by key limit 10
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
-  Stage-0 is a root stage
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
 
 STAGE PLANS:
+  Stage: Stage-1
+    Spark
+      Edges:
+        Reducer 2 <- Map 1 (SORT, 1)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: foo
+                  Statistics: Num rows: 247 Data size: 2609 Basic stats: COMPLETE Column stats: NONE
+                  Select Operator
+                    expressions: key (type: string), value (type: string)
+                    outputColumnNames: _col0, _col1
+                    Statistics: Num rows: 247 Data size: 2609 Basic stats: COMPLETE Column stats: NONE
+                    Reduce Output Operator
+                      key expressions: _col0 (type: string)
+                      sort order: +
+                      Statistics: Num rows: 247 Data size: 2609 Basic stats: COMPLETE Column stats: NONE
+                      value expressions: _col1 (type: string)
+        Reducer 2 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: string), VALUE._col0 (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 247 Data size: 2609 Basic stats: COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 10
+                  Statistics: Num rows: 10 Data size: 100 Basic stats: COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 100 Basic stats: COMPLETE Column stats: NONE
+                    table:
+                        input format: org.apache.hadoop.mapred.TextInputFormat
+                        output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+                        serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+
   Stage: Stage-0
     Fetch Operator
       limit: 10
       Processor Tree:
-        TableScan
-          alias: foo
-          Statistics: Num rows: 247 Data size: 2609 Basic stats: COMPLETE Column stats: NONE
-          Select Operator
-            expressions: key (type: string), value (type: string)
-            outputColumnNames: _col0, _col1
-            Statistics: Num rows: 247 Data size: 2609 Basic stats: COMPLETE Column stats: NONE
-            Limit
-              Number of rows: 10
-              Statistics: Num rows: 10 Data size: 100 Basic stats: COMPLETE Column stats: NONE
-              ListSink
+        ListSink
 
-PREHOOK: query: select * from foo limit 10
+PREHOOK: query: select * from foo order by key limit 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@foo
 #### A masked pattern was here ####
-POSTHOOK: query: select * from foo limit 10
+POSTHOOK: query: select * from foo order by key limit 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@foo
 #### A masked pattern was here ####
-238	val_238
-86	val_86
-278	val_278
-98	val_98
-484	val_484
-150	val_150
-224	val_224
-66	val_66
-128	val_128
-146	val_146
+0	val_0
+0	val_0
+0	val_0
+10	val_10
+100	val_100
+100	val_100
+104	val_104
+104	val_104
+114	val_114
+116	val_116
 PREHOOK: query: explain select * from (select * from foo union all select * from bar) u order by key limit 10
 PREHOOK: type: QUERY
 POSTHOOK: query: explain select * from (select * from foo union all select * from bar) u order by key limit 10
@@ -318,11 +346,11 @@ POSTHOOK: Input: default@src
 POSTHOOK: Output: default@bay
 POSTHOOK: Lineage: bay.key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ]
 POSTHOOK: Lineage: bay.value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
-PREHOOK: query: select * from bay limit 10
+PREHOOK: query: select * from bay order by key limit 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@bay
 #### A masked pattern was here ####
-POSTHOOK: query: select * from bay limit 10
+POSTHOOK: query: select * from bay order by key limit 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@bay
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/tez_joins_explain.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/tez_joins_explain.q.out b/ql/src/test/results/clientpositive/spark/tez_joins_explain.q.out
index ad3048b..7bd894b 100644
--- a/ql/src/test/results/clientpositive/spark/tez_joins_explain.q.out
+++ b/ql/src/test/results/clientpositive/spark/tez_joins_explain.q.out
@@ -1,10 +1,8 @@
 PREHOOK: query: -- SORT_QUERY_RESULTS
-
 explain
 select * from (select b.key, b.value from src1 a left outer join src b on (a.key = b.key) order by b.key) x right outer join src c on (x.value = c.value) order by x.key
 PREHOOK: type: QUERY
 POSTHOOK: query: -- SORT_QUERY_RESULTS
-
 explain
 select * from (select b.key, b.value from src1 a left outer join src b on (a.key = b.key) order by b.key) x right outer join src c on (x.value = c.value) order by x.key
 POSTHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/vector_data_types.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/vector_data_types.q.out b/ql/src/test/results/clientpositive/spark/vector_data_types.q.out
index 98cfb7d..a959964 100644
--- a/ql/src/test/results/clientpositive/spark/vector_data_types.q.out
+++ b/ql/src/test/results/clientpositive/spark/vector_data_types.q.out
@@ -97,9 +97,9 @@ POSTHOOK: Lineage: over1korc.s SIMPLE [(over1k)over1k.FieldSchema(name:s, type:s
 POSTHOOK: Lineage: over1korc.si SIMPLE [(over1k)over1k.FieldSchema(name:si, type:smallint, comment:null), ]
 POSTHOOK: Lineage: over1korc.t SIMPLE [(over1k)over1k.FieldSchema(name:t, type:tinyint, comment:null), ]
 POSTHOOK: Lineage: over1korc.ts SIMPLE [(over1k)over1k.FieldSchema(name:ts, type:timestamp, comment:null), ]
-PREHOOK: query: EXPLAIN SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i LIMIT 20
+PREHOOK: query: EXPLAIN SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i LIMIT 20
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i LIMIT 20
+POSTHOOK: query: EXPLAIN SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i LIMIT 20
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -122,14 +122,14 @@ STAGE PLANS:
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                     Statistics: Num rows: 1049 Data size: 311170 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col2 (type: int)
-                      sort order: +
+                      key expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int)
+                      sort order: +++
                       Statistics: Num rows: 1049 Data size: 311170 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: boolean), _col7 (type: string), _col8 (type: timestamp), _col9 (type: decimal(4,2)), _col10 (type: binary)
+                      value expressions: _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: boolean), _col7 (type: string), _col8 (type: timestamp), _col9 (type: decimal(4,2)), _col10 (type: binary)
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: tinyint), VALUE._col1 (type: smallint), KEY.reducesinkkey0 (type: int), VALUE._col2 (type: bigint), VALUE._col3 (type: float), VALUE._col4 (type: double), VALUE._col5 (type: boolean), VALUE._col6 (type: string), VALUE._col7 (type: timestamp), VALUE._col8 (type: decimal(4,2)), VALUE._col9 (type: binary)
+                expressions: KEY.reducesinkkey0 (type: tinyint), KEY.reducesinkkey1 (type: smallint), KEY.reducesinkkey2 (type: int), VALUE._col0 (type: bigint), VALUE._col1 (type: float), VALUE._col2 (type: double), VALUE._col3 (type: boolean), VALUE._col4 (type: string), VALUE._col5 (type: timestamp), VALUE._col6 (type: decimal(4,2)), VALUE._col7 (type: binary)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 1049 Data size: 311170 Basic stats: COMPLETE Column stats: NONE
                 Limit
@@ -149,48 +149,48 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-PREHOOK: query: SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i LIMIT 20
+PREHOOK: query: SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i LIMIT 20
 PREHOOK: type: QUERY
 PREHOOK: Input: default@over1korc
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i LIMIT 20
+POSTHOOK: query: SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i LIMIT 20
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@over1korc
 #### A masked pattern was here ####
+NULL	374	65560	4294967516	65.43	22.48	true	oscar quirinius	2013-03-01 09:11:58.703316	16.86	mathematics
 NULL	409	65536	4294967490	46.97	25.92	false	fred miller	2013-03-01 09:11:58.703116	33.45	history
-18	280	65536	4294967320	32.92	45.94	false	holly white	2013-03-01 09:11:58.703086	58.86	topology
-69	489	65536	4294967404	33.52	17.99	false	oscar ichabod	2013-03-01 09:11:58.703247	32.68	topology
-108	301	65536	4294967357	90.05	17.59	true	ethan johnson	2013-03-01 09:11:58.703271	75.7	undecided
-27	405	65536	4294967508	82.24	29.41	true	oscar ovid	2013-03-01 09:11:58.703166	16.85	biology
-42	495	65536	4294967431	43.57	46.81	false	tom johnson	2013-03-01 09:11:58.703245	62.25	american history
-118	497	65536	4294967381	50.32	12.72	false	david nixon	2013-03-01 09:11:58.703285	83.48	values clariffication
-72	267	65537	4294967460	55.2	42.89	false	oscar carson	2013-03-01 09:11:58.703153	51.91	topology
-22	264	65537	4294967419	8.07	10.71	false	david xylophone	2013-03-01 09:11:58.703136	11.87	undecided
-63	458	65537	4294967463	21.94	49.71	true	fred van buren	2013-03-01 09:11:58.703278	99.34	wind surfing
-121	355	65537	4294967437	85.9	10.99	true	calvin brown	2013-03-01 09:11:58.703254	4.49	yard duty
-59	431	65537	4294967326	11.34	2.9	true	oscar robinson	2013-03-01 09:11:58.703161	81.04	zync studies
-83	353	65538	4294967339	0.08	23.91	true	holly thompson	2013-03-01 09:11:58.703157	30.27	quiet hour
-109	376	65538	4294967453	59.61	35.62	true	priscilla xylophone	2013-03-01 09:11:58.703286	9.53	study skills
-101	283	65538	4294967527	84.03	27.29	true	yuri brown	2013-03-01 09:11:58.703306	44.24	biology
-120	331	65539	4294967324	88.02	40.94	true	holly nixon	2013-03-01 09:11:58.703262	96.64	yard duty
-70	430	65539	4294967534	18.89	43.84	true	tom carson	2013-03-01 09:11:58.703182	21.93	joggying
-29	331	65539	4294967420	73.18	28.96	true	ethan brown	2013-03-01 09:11:58.703094	58.85	zync studies
-71	298	65540	4294967510	91.63	9.6	false	gabriella zipper	2013-03-01 09:11:58.70314	68.14	geology
-89	466	65541	4294967468	85.51	19.79	true	calvin davidson	2013-03-01 09:11:58.703113	35.38	philosophy
+NULL	473	65720	4294967324	80.74	40.6	false	holly falkner	2013-03-01 09:11:58.703111	18.8	mathematics
+-3	275	65622	4294967302	71.78	8.49	false	wendy robinson	2013-03-01 09:11:58.703294	95.39	undecided
+-3	344	65733	4294967363	0.56	11.96	true	rachel thompson	2013-03-01 09:11:58.703276	88.46	wind surfing
+-3	376	65548	4294967431	96.78	43.23	false	fred ellison	2013-03-01 09:11:58.703233	75.39	education
+-3	438	65618	4294967398	62.39	4.62	false	victor xylophone	2013-03-01 09:11:58.703135	88.38	values clariffication
+-3	458	65696	4294967418	45.24	8.49	false	irene ellison	2013-03-01 09:11:58.703092	54.02	american history
+-3	467	65575	4294967437	81.64	23.53	true	tom hernandez	2013-03-01 09:11:58.703188	32.85	study skills
+-2	261	65603	4294967332	39.18	28.98	false	fred polk	2013-03-01 09:11:58.70331	69.26	opthamology
+-2	269	65681	4294967544	99.24	28.19	false	rachel falkner	2013-03-01 09:11:58.703089	41.57	quiet hour
+-2	288	65658	4294967383	53.78	19.92	false	holly nixon	2013-03-01 09:11:58.703224	42.93	industrial engineering
+-2	304	65629	4294967386	84.38	33.49	false	zach garcia	2013-03-01 09:11:58.703264	56.99	chemistry
+-2	340	65627	4294967533	76.52	21.91	true	quinn laertes	2013-03-01 09:11:58.703178	93.29	xylophone band
+-2	427	65666	4294967465	19.69	33.24	true	bob xylophone	2013-03-01 09:11:58.703219	32.73	joggying
+-2	429	65664	4294967441	45.19	40.43	false	wendy king	2013-03-01 09:11:58.703265	11.46	industrial engineering
+-2	461	65648	4294967425	58.52	24.85	false	rachel thompson	2013-03-01 09:11:58.703318	85.62	zync studies
+-1	268	65778	4294967418	56.33	44.73	true	calvin falkner	2013-03-01 09:11:58.70322	7.37	history
+-1	281	65643	4294967323	15.1	45.0	false	irene nixon	2013-03-01 09:11:58.703223	80.96	undecided
+-1	300	65663	4294967343	71.26	34.62	true	calvin ovid	2013-03-01 09:11:58.703262	78.56	study skills
 PREHOOK: query: SELECT SUM(HASH(*))
-FROM (SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i) as q
+FROM (SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i) as q
 PREHOOK: type: QUERY
 PREHOOK: Input: default@over1korc
 #### A masked pattern was here ####
 POSTHOOK: query: SELECT SUM(HASH(*))
-FROM (SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i) as q
+FROM (SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i) as q
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@over1korc
 #### A masked pattern was here ####
 -17045922556
-PREHOOK: query: EXPLAIN select t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i LIMIT 20
+PREHOOK: query: EXPLAIN select t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i LIMIT 20
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN select t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i LIMIT 20
+POSTHOOK: query: EXPLAIN select t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i LIMIT 20
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -213,15 +213,15 @@ STAGE PLANS:
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                     Statistics: Num rows: 1049 Data size: 311170 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
-                      key expressions: _col2 (type: int)
-                      sort order: +
+                      key expressions: _col0 (type: tinyint), _col1 (type: smallint), _col2 (type: int)
+                      sort order: +++
                       Statistics: Num rows: 1049 Data size: 311170 Basic stats: COMPLETE Column stats: NONE
-                      value expressions: _col0 (type: tinyint), _col1 (type: smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: boolean), _col7 (type: string), _col8 (type: timestamp), _col9 (type: decimal(4,2)), _col10 (type: binary)
+                      value expressions: _col3 (type: bigint), _col4 (type: float), _col5 (type: double), _col6 (type: boolean), _col7 (type: string), _col8 (type: timestamp), _col9 (type: decimal(4,2)), _col10 (type: binary)
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
-                expressions: VALUE._col0 (type: tinyint), VALUE._col1 (type: smallint), KEY.reducesinkkey0 (type: int), VALUE._col2 (type: bigint), VALUE._col3 (type: float), VALUE._col4 (type: double), VALUE._col5 (type: boolean), VALUE._col6 (type: string), VALUE._col7 (type: timestamp), VALUE._col8 (type: decimal(4,2)), VALUE._col9 (type: binary)
+                expressions: KEY.reducesinkkey0 (type: tinyint), KEY.reducesinkkey1 (type: smallint), KEY.reducesinkkey2 (type: int), VALUE._col0 (type: bigint), VALUE._col1 (type: float), VALUE._col2 (type: double), VALUE._col3 (type: boolean), VALUE._col4 (type: string), VALUE._col5 (type: timestamp), VALUE._col6 (type: decimal(4,2)), VALUE._col7 (type: binary)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10
                 Statistics: Num rows: 1049 Data size: 311170 Basic stats: COMPLETE Column stats: NONE
                 Limit
@@ -242,41 +242,41 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-PREHOOK: query: SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i LIMIT 20
+PREHOOK: query: SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i LIMIT 20
 PREHOOK: type: QUERY
 PREHOOK: Input: default@over1korc
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i LIMIT 20
+POSTHOOK: query: SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i LIMIT 20
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@over1korc
 #### A masked pattern was here ####
+NULL	374	65560	4294967516	65.43	22.48	true	oscar quirinius	2013-03-01 09:11:58.703316	16.86	mathematics
 NULL	409	65536	4294967490	46.97	25.92	false	fred miller	2013-03-01 09:11:58.703116	33.45	history
-18	280	65536	4294967320	32.92	45.94	false	holly white	2013-03-01 09:11:58.703086	58.86	topology
-69	489	65536	4294967404	33.52	17.99	false	oscar ichabod	2013-03-01 09:11:58.703247	32.68	topology
-108	301	65536	4294967357	90.05	17.59	true	ethan johnson	2013-03-01 09:11:58.703271	75.7	undecided
-27	405	65536	4294967508	82.24	29.41	true	oscar ovid	2013-03-01 09:11:58.703166	16.85	biology
-42	495	65536	4294967431	43.57	46.81	false	tom johnson	2013-03-01 09:11:58.703245	62.25	american history
-118	497	65536	4294967381	50.32	12.72	false	david nixon	2013-03-01 09:11:58.703285	83.48	values clariffication
-72	267	65537	4294967460	55.2	42.89	false	oscar carson	2013-03-01 09:11:58.703153	51.91	topology
-22	264	65537	4294967419	8.07	10.71	false	david xylophone	2013-03-01 09:11:58.703136	11.87	undecided
-63	458	65537	4294967463	21.94	49.71	true	fred van buren	2013-03-01 09:11:58.703278	99.34	wind surfing
-121	355	65537	4294967437	85.9	10.99	true	calvin brown	2013-03-01 09:11:58.703254	4.49	yard duty
-59	431	65537	4294967326	11.34	2.9	true	oscar robinson	2013-03-01 09:11:58.703161	81.04	zync studies
-83	353	65538	4294967339	0.08	23.91	true	holly thompson	2013-03-01 09:11:58.703157	30.27	quiet hour
-109	376	65538	4294967453	59.61	35.62	true	priscilla xylophone	2013-03-01 09:11:58.703286	9.53	study skills
-101	283	65538	4294967527	84.03	27.29	true	yuri brown	2013-03-01 09:11:58.703306	44.24	biology
-120	331	65539	4294967324	88.02	40.94	true	holly nixon	2013-03-01 09:11:58.703262	96.64	yard duty
-70	430	65539	4294967534	18.89	43.84	true	tom carson	2013-03-01 09:11:58.703182	21.93	joggying
-29	331	65539	4294967420	73.18	28.96	true	ethan brown	2013-03-01 09:11:58.703094	58.85	zync studies
-71	298	65540	4294967510	91.63	9.6	false	gabriella zipper	2013-03-01 09:11:58.70314	68.14	geology
-89	466	65541	4294967468	85.51	19.79	true	calvin davidson	2013-03-01 09:11:58.703113	35.38	philosophy
+NULL	473	65720	4294967324	80.74	40.6	false	holly falkner	2013-03-01 09:11:58.703111	18.8	mathematics
+-3	275	65622	4294967302	71.78	8.49	false	wendy robinson	2013-03-01 09:11:58.703294	95.39	undecided
+-3	344	65733	4294967363	0.56	11.96	true	rachel thompson	2013-03-01 09:11:58.703276	88.46	wind surfing
+-3	376	65548	4294967431	96.78	43.23	false	fred ellison	2013-03-01 09:11:58.703233	75.39	education
+-3	438	65618	4294967398	62.39	4.62	false	victor xylophone	2013-03-01 09:11:58.703135	88.38	values clariffication
+-3	458	65696	4294967418	45.24	8.49	false	irene ellison	2013-03-01 09:11:58.703092	54.02	american history
+-3	467	65575	4294967437	81.64	23.53	true	tom hernandez	2013-03-01 09:11:58.703188	32.85	study skills
+-2	261	65603	4294967332	39.18	28.98	false	fred polk	2013-03-01 09:11:58.70331	69.26	opthamology
+-2	269	65681	4294967544	99.24	28.19	false	rachel falkner	2013-03-01 09:11:58.703089	41.57	quiet hour
+-2	288	65658	4294967383	53.78	19.92	false	holly nixon	2013-03-01 09:11:58.703224	42.93	industrial engineering
+-2	304	65629	4294967386	84.38	33.49	false	zach garcia	2013-03-01 09:11:58.703264	56.99	chemistry
+-2	340	65627	4294967533	76.52	21.91	true	quinn laertes	2013-03-01 09:11:58.703178	93.29	xylophone band
+-2	427	65666	4294967465	19.69	33.24	true	bob xylophone	2013-03-01 09:11:58.703219	32.73	joggying
+-2	429	65664	4294967441	45.19	40.43	false	wendy king	2013-03-01 09:11:58.703265	11.46	industrial engineering
+-2	461	65648	4294967425	58.52	24.85	false	rachel thompson	2013-03-01 09:11:58.703318	85.62	zync studies
+-1	268	65778	4294967418	56.33	44.73	true	calvin falkner	2013-03-01 09:11:58.70322	7.37	history
+-1	281	65643	4294967323	15.1	45.0	false	irene nixon	2013-03-01 09:11:58.703223	80.96	undecided
+-1	300	65663	4294967343	71.26	34.62	true	calvin ovid	2013-03-01 09:11:58.703262	78.56	study skills
 PREHOOK: query: SELECT SUM(HASH(*))
-FROM (SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i) as q
+FROM (SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i) as q
 PREHOOK: type: QUERY
 PREHOOK: Input: default@over1korc
 #### A masked pattern was here ####
 POSTHOOK: query: SELECT SUM(HASH(*))
-FROM (SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY i) as q
+FROM (SELECT t, si, i, b, f, d, bo, s, ts, dec, bin FROM over1korc ORDER BY t, si, i) as q
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@over1korc
 #### A masked pattern was here ####

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/vectorization_part_project.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/vectorization_part_project.q.out b/ql/src/test/results/clientpositive/spark/vectorization_part_project.q.out
index 0f10727..f92e823 100644
--- a/ql/src/test/results/clientpositive/spark/vectorization_part_project.q.out
+++ b/ql/src/test/results/clientpositive/spark/vectorization_part_project.q.out
@@ -6,11 +6,11 @@ POSTHOOK: query: CREATE TABLE alltypesorc_part(ctinyint tinyint, csmallint small
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@alltypesorc_part
-PREHOOK: query: insert overwrite table alltypesorc_part partition (ds='2011') select * from alltypesorc limit 100
+PREHOOK: query: insert overwrite table alltypesorc_part partition (ds='2011') select * from alltypesorc order by ctinyint, cint, cbigint limit 100
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Output: default@alltypesorc_part@ds=2011
-POSTHOOK: query: insert overwrite table alltypesorc_part partition (ds='2011') select * from alltypesorc limit 100
+POSTHOOK: query: insert overwrite table alltypesorc_part partition (ds='2011') select * from alltypesorc order by ctinyint, cint, cbigint limit 100
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 POSTHOOK: Output: default@alltypesorc_part@ds=2011
@@ -26,11 +26,11 @@ POSTHOOK: Lineage: alltypesorc_part PARTITION(ds=2011).cstring2 SIMPLE [(alltype
 POSTHOOK: Lineage: alltypesorc_part PARTITION(ds=2011).ctimestamp1 SIMPLE [(alltypesorc)alltypesorc.FieldSchema(name:ctimestamp1, type:timestamp, comment:null), ]
 POSTHOOK: Lineage: alltypesorc_part PARTITION(ds=2011).ctimestamp2 SIMPLE [(alltypesorc)alltypesorc.FieldSchema(name:ctimestamp2, type:timestamp, comment:null), ]
 POSTHOOK: Lineage: alltypesorc_part PARTITION(ds=2011).ctinyint SIMPLE [(alltypesorc)alltypesorc.FieldSchema(name:ctinyint, type:tinyint, comment:null), ]
-PREHOOK: query: insert overwrite table alltypesorc_part partition (ds='2012') select * from alltypesorc limit 100
+PREHOOK: query: insert overwrite table alltypesorc_part partition (ds='2012') select * from alltypesorc order by ctinyint, cint, cbigint limit 100
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Output: default@alltypesorc_part@ds=2012
-POSTHOOK: query: insert overwrite table alltypesorc_part partition (ds='2012') select * from alltypesorc limit 100
+POSTHOOK: query: insert overwrite table alltypesorc_part partition (ds='2012') select * from alltypesorc order by ctinyint, cint, cbigint limit 100
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 POSTHOOK: Output: default@alltypesorc_part@ds=2012
@@ -65,28 +65,28 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc_part
-                  Statistics: Num rows: 200 Data size: 41576 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 200 Data size: 54496 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: (cdouble + 2) (type: double)
                     outputColumnNames: _col0
-                    Statistics: Num rows: 200 Data size: 41576 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 200 Data size: 54496 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: double)
                       sort order: +
-                      Statistics: Num rows: 200 Data size: 41576 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 200 Data size: 54496 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
                 expressions: KEY.reducesinkkey0 (type: double)
                 outputColumnNames: _col0
-                Statistics: Num rows: 200 Data size: 41576 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 200 Data size: 54496 Basic stats: COMPLETE Column stats: NONE
                 Limit
                   Number of rows: 10
-                  Statistics: Num rows: 10 Data size: 2070 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 10 Data size: 2720 Basic stats: COMPLETE Column stats: NONE
                   File Output Operator
                     compressed: false
-                    Statistics: Num rows: 10 Data size: 2070 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 10 Data size: 2720 Basic stats: COMPLETE Column stats: NONE
                     table:
                         input format: org.apache.hadoop.mapred.TextInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
@@ -111,13 +111,13 @@ POSTHOOK: Input: default@alltypesorc_part
 POSTHOOK: Input: default@alltypesorc_part@ds=2011
 POSTHOOK: Input: default@alltypesorc_part@ds=2012
 #### A masked pattern was here ####
--15910.0
--15910.0
--15811.0
--15811.0
--15788.0
--15788.0
--15547.0
--15547.0
--15429.0
--15429.0
+NULL
+NULL
+-15863.0
+-15863.0
+-14988.0
+-14988.0
+-14646.0
+-14646.0
+-14236.0
+-14236.0

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/vectorized_mapjoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/vectorized_mapjoin.q.out b/ql/src/test/results/clientpositive/spark/vectorized_mapjoin.q.out
index 29c6c56..78b0b37 100644
--- a/ql/src/test/results/clientpositive/spark/vectorized_mapjoin.q.out
+++ b/ql/src/test/results/clientpositive/spark/vectorized_mapjoin.q.out
@@ -1,8 +1,12 @@
-PREHOOK: query: EXPLAIN SELECT COUNT(t1.cint), MAX(t2.cint), MIN(t1.cint), AVG(t1.cint+t2.cint)
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+EXPLAIN SELECT COUNT(t1.cint), MAX(t2.cint), MIN(t1.cint), AVG(t1.cint+t2.cint)
   FROM alltypesorc t1
   JOIN alltypesorc t2 ON t1.cint = t2.cint
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN SELECT COUNT(t1.cint), MAX(t2.cint), MIN(t1.cint), AVG(t1.cint+t2.cint)
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+EXPLAIN SELECT COUNT(t1.cint), MAX(t2.cint), MIN(t1.cint), AVG(t1.cint+t2.cint)
   FROM alltypesorc t1
   JOIN alltypesorc t2 ON t1.cint = t2.cint
 POSTHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/vectorized_nested_mapjoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/vectorized_nested_mapjoin.q.out b/ql/src/test/results/clientpositive/spark/vectorized_nested_mapjoin.q.out
index c50f6cf..a25d540 100644
--- a/ql/src/test/results/clientpositive/spark/vectorized_nested_mapjoin.q.out
+++ b/ql/src/test/results/clientpositive/spark/vectorized_nested_mapjoin.q.out
@@ -1,6 +1,10 @@
-PREHOOK: query: explain select sum(t1.td) from (select  v1.csmallint as tsi, v1.cdouble as td from alltypesorc v1, alltypesorc v2 where v1.ctinyint=v2.ctinyint) t1 join alltypesorc v3 on t1.tsi=v3.csmallint
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+explain select sum(t1.td) from (select  v1.csmallint as tsi, v1.cdouble as td from alltypesorc v1, alltypesorc v2 where v1.ctinyint=v2.ctinyint) t1 join alltypesorc v3 on t1.tsi=v3.csmallint
 PREHOOK: type: QUERY
-POSTHOOK: query: explain select sum(t1.td) from (select  v1.csmallint as tsi, v1.cdouble as td from alltypesorc v1, alltypesorc v2 where v1.ctinyint=v2.ctinyint) t1 join alltypesorc v3 on t1.tsi=v3.csmallint
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+explain select sum(t1.td) from (select  v1.csmallint as tsi, v1.cdouble as td from alltypesorc v1, alltypesorc v2 where v1.ctinyint=v2.ctinyint) t1 join alltypesorc v3 on t1.tsi=v3.csmallint
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-2 is a root stage

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/vectorized_rcfile_columnar.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/vectorized_rcfile_columnar.q.out b/ql/src/test/results/clientpositive/spark/vectorized_rcfile_columnar.q.out
index ee8959b..c35173e 100644
--- a/ql/src/test/results/clientpositive/spark/vectorized_rcfile_columnar.q.out
+++ b/ql/src/test/results/clientpositive/spark/vectorized_rcfile_columnar.q.out
@@ -23,12 +23,12 @@ POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@columnTable
 PREHOOK: query: FROM src
-INSERT OVERWRITE TABLE columnTable SELECT src.key, src.value LIMIT 10
+INSERT OVERWRITE TABLE columnTable SELECT src.key, src.value ORDER BY src.key, src.value LIMIT 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@columntable
 POSTHOOK: query: FROM src
-INSERT OVERWRITE TABLE columnTable SELECT src.key, src.value LIMIT 10
+INSERT OVERWRITE TABLE columnTable SELECT src.key, src.value ORDER BY src.key, src.value LIMIT 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@columntable
@@ -50,13 +50,13 @@ POSTHOOK: query: SELECT key, value FROM columnTable ORDER BY key
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@columntable
 #### A masked pattern was here ####
-165	val_165
-238	val_238
-255	val_255
-27	val_27
-278	val_278
-311	val_311
-409	val_409
-484	val_484
-86	val_86
-98	val_98
+0	val_0
+0	val_0
+0	val_0
+10	val_10
+100	val_100
+100	val_100
+103	val_103
+103	val_103
+104	val_104
+104	val_104

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/vectorized_shufflejoin.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/vectorized_shufflejoin.q.out b/ql/src/test/results/clientpositive/spark/vectorized_shufflejoin.q.out
index 720a1a6..b84a4c3 100644
--- a/ql/src/test/results/clientpositive/spark/vectorized_shufflejoin.q.out
+++ b/ql/src/test/results/clientpositive/spark/vectorized_shufflejoin.q.out
@@ -1,10 +1,14 @@
-PREHOOK: query: EXPLAIN SELECT COUNT(t1.cint), MAX(t2.cint), MIN(t1.cint), AVG(t1.cint+t2.cint)
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+EXPLAIN SELECT COUNT(t1.cint) AS CNT, MAX(t2.cint) , MIN(t1.cint), AVG(t1.cint+t2.cint)
   FROM alltypesorc t1
-  JOIN alltypesorc t2 ON t1.cint = t2.cint
+  JOIN alltypesorc t2 ON t1.cint = t2.cint order by CNT
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN SELECT COUNT(t1.cint), MAX(t2.cint), MIN(t1.cint), AVG(t1.cint+t2.cint)
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+EXPLAIN SELECT COUNT(t1.cint) AS CNT, MAX(t2.cint) , MIN(t1.cint), AVG(t1.cint+t2.cint)
   FROM alltypesorc t1
-  JOIN alltypesorc t2 ON t1.cint = t2.cint
+  JOIN alltypesorc t2 ON t1.cint = t2.cint order by CNT
 POSTHOOK: type: QUERY
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -14,8 +18,9 @@ STAGE PLANS:
   Stage: Stage-1
     Spark
       Edges:
-        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 2), Map 4 (PARTITION-LEVEL SORT, 2)
+        Reducer 2 <- Map 1 (PARTITION-LEVEL SORT, 2), Map 5 (PARTITION-LEVEL SORT, 2)
         Reducer 3 <- Reducer 2 (GROUP, 1)
+        Reducer 4 <- Reducer 3 (SORT, 1)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -32,7 +37,7 @@ STAGE PLANS:
                       Map-reduce partition columns: cint (type: int)
                       Statistics: Num rows: 6144 Data size: 188618 Basic stats: COMPLETE Column stats: NONE
             Execution mode: vectorized
-        Map 4 
+        Map 5 
             Map Operator Tree:
                 TableScan
                   alias: t2
@@ -72,6 +77,17 @@ STAGE PLANS:
                 mode: mergepartial
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 1 Data size: 24 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col0 (type: bigint)
+                  sort order: +
+                  Statistics: Num rows: 1 Data size: 24 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: double)
+        Reducer 4 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: bigint), VALUE._col0 (type: int), VALUE._col1 (type: int), VALUE._col2 (type: double)
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 1 Data size: 24 Basic stats: COMPLETE Column stats: NONE
                 File Output Operator
                   compressed: false
                   Statistics: Num rows: 1 Data size: 24 Basic stats: COMPLETE Column stats: NONE
@@ -79,6 +95,7 @@ STAGE PLANS:
                       input format: org.apache.hadoop.mapred.TextInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
                       serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+            Execution mode: vectorized
 
   Stage: Stage-0
     Fetch Operator
@@ -86,15 +103,15 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-PREHOOK: query: SELECT COUNT(t1.cint), MAX(t2.cint), MIN(t1.cint), AVG(t1.cint+t2.cint)
+PREHOOK: query: SELECT COUNT(t1.cint), MAX(t2.cint) AS CNT, MIN(t1.cint), AVG(t1.cint+t2.cint)
   FROM alltypesorc t1
-  JOIN alltypesorc t2 ON t1.cint = t2.cint
+  JOIN alltypesorc t2 ON t1.cint = t2.cint order by CNT
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT COUNT(t1.cint), MAX(t2.cint), MIN(t1.cint), AVG(t1.cint+t2.cint)
+POSTHOOK: query: SELECT COUNT(t1.cint), MAX(t2.cint) AS CNT, MIN(t1.cint), AVG(t1.cint+t2.cint)
   FROM alltypesorc t1
-  JOIN alltypesorc t2 ON t1.cint = t2.cint
+  JOIN alltypesorc t2 ON t1.cint = t2.cint order by CNT
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####


Mime
View raw message