hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject [06/50] [abbrv] hive git commit: HIVE-10563 : MiniTezCliDriver tests ordering issues (Hari Subramaniyan via Sushanth Sowmyan)
Date Tue, 02 Jun 2015 23:23:11 GMT
http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/spark/vectorized_timestamp_funcs.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/spark/vectorized_timestamp_funcs.q.out b/ql/src/test/results/clientpositive/spark/vectorized_timestamp_funcs.q.out
index e9bef38..ed1ba4b 100644
--- a/ql/src/test/results/clientpositive/spark/vectorized_timestamp_funcs.q.out
+++ b/ql/src/test/results/clientpositive/spark/vectorized_timestamp_funcs.q.out
@@ -18,18 +18,20 @@ POSTHOOK: Output: database:default
 POSTHOOK: Output: default@alltypesorc_string
 PREHOOK: query: INSERT OVERWRITE TABLE alltypesorc_string
 SELECT
-  to_utc_timestamp(ctimestamp1, 'America/Los_Angeles'),
-  CAST(to_utc_timestamp(ctimestamp1, 'America/Los_Angeles') AS STRING)
+  to_utc_timestamp(ctimestamp1, 'America/Los_Angeles') AS toutc,
+  CAST(to_utc_timestamp(ctimestamp1, 'America/Los_Angeles') AS STRING) as cst
 FROM alltypesorc
+ORDER BY toutc, cst
 LIMIT 40
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Output: default@alltypesorc_string
 POSTHOOK: query: INSERT OVERWRITE TABLE alltypesorc_string
 SELECT
-  to_utc_timestamp(ctimestamp1, 'America/Los_Angeles'),
-  CAST(to_utc_timestamp(ctimestamp1, 'America/Los_Angeles') AS STRING)
+  to_utc_timestamp(ctimestamp1, 'America/Los_Angeles') AS toutc,
+  CAST(to_utc_timestamp(ctimestamp1, 'America/Los_Angeles') AS STRING) as cst
 FROM alltypesorc
+ORDER BY toutc, cst
 LIMIT 40
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
@@ -112,15 +114,15 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc_string
-                  Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: to_unix_timestamp(ctimestamp1) (type: bigint), year(ctimestamp1) (type: int), month(ctimestamp1) (type: int), day(ctimestamp1) (type: int), dayofmonth(ctimestamp1) (type: int), weekofyear(ctimestamp1) (type: int), hour(ctimestamp1) (type: int), minute(ctimestamp1) (type: int), second(ctimestamp1) (type: int)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: bigint)
                       sort order: +
-                      Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: int), _col8 (type: int)
             Execution mode: vectorized
         Reducer 2 
@@ -128,10 +130,10 @@ STAGE PLANS:
               Select Operator
                 expressions: KEY.reducesinkkey0 (type: bigint), VALUE._col0 (type: int), VALUE._col1 (type: int), VALUE._col2 (type: int), VALUE._col3 (type: int), VALUE._col4 (type: int), VALUE._col5 (type: int), VALUE._col6 (type: int), VALUE._col7 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                   table:
                       input format: org.apache.hadoop.mapred.TextInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
@@ -175,45 +177,45 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc_string
 #### A masked pattern was here ####
 NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
-28784	1969	12	31	31	1	23	59	44
-28784	1969	12	31	31	1	23	59	44
-28784	1969	12	31	31	1	23	59	44
-28784	1969	12	31	31	1	23	59	44
-28785	1969	12	31	31	1	23	59	45
-28786	1969	12	31	31	1	23	59	46
-28787	1969	12	31	31	1	23	59	47
-28788	1969	12	31	31	1	23	59	48
-28789	1969	12	31	31	1	23	59	49
-28789	1969	12	31	31	1	23	59	49
-28790	1969	12	31	31	1	23	59	50
-28792	1969	12	31	31	1	23	59	52
-28792	1969	12	31	31	1	23	59	52
-28792	1969	12	31	31	1	23	59	52
-28792	1969	12	31	31	1	23	59	52
-28795	1969	12	31	31	1	23	59	55
-28795	1969	12	31	31	1	23	59	55
-28795	1969	12	31	31	1	23	59	55
-28798	1969	12	31	31	1	23	59	58
-28798	1969	12	31	31	1	23	59	58
-28800	1970	1	1	1	1	0	0	0
-28800	1970	1	1	1	1	0	0	0
-28802	1970	1	1	1	1	0	0	2
-28803	1970	1	1	1	1	0	0	3
-28804	1970	1	1	1	1	0	0	4
-28804	1970	1	1	1	1	0	0	4
-28805	1970	1	1	1	1	0	0	5
-28805	1970	1	1	1	1	0	0	5
-28806	1970	1	1	1	1	0	0	6
-28807	1970	1	1	1	1	0	0	7
-28807	1970	1	1	1	1	0	0	7
-28807	1970	1	1	1	1	0	0	7
-28808	1970	1	1	1	1	0	0	8
-28808	1970	1	1	1	1	0	0	8
-28809	1970	1	1	1	1	0	0	9
-28811	1970	1	1	1	1	0	0	11
-28813	1970	1	1	1	1	0	0	13
-28814	1970	1	1	1	1	0	0	14
-28815	1970	1	1	1	1	0	0	15
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 PREHOOK: query: EXPLAIN SELECT
   to_unix_timestamp(stimestamp1) AS c1,
   year(stimestamp1),
@@ -255,15 +257,15 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc_string
-                  Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: to_unix_timestamp(stimestamp1) (type: bigint), year(stimestamp1) (type: int), month(stimestamp1) (type: int), day(stimestamp1) (type: int), dayofmonth(stimestamp1) (type: int), weekofyear(stimestamp1) (type: int), hour(stimestamp1) (type: int), minute(stimestamp1) (type: int), second(stimestamp1) (type: int)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: bigint)
                       sort order: +
-                      Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col1 (type: int), _col2 (type: int), _col3 (type: int), _col4 (type: int), _col5 (type: int), _col6 (type: int), _col7 (type: int), _col8 (type: int)
             Execution mode: vectorized
         Reducer 2 
@@ -271,10 +273,10 @@ STAGE PLANS:
               Select Operator
                 expressions: KEY.reducesinkkey0 (type: bigint), VALUE._col0 (type: int), VALUE._col1 (type: int), VALUE._col2 (type: int), VALUE._col3 (type: int), VALUE._col4 (type: int), VALUE._col5 (type: int), VALUE._col6 (type: int), VALUE._col7 (type: int)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                   table:
                       input format: org.apache.hadoop.mapred.TextInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
@@ -318,45 +320,45 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc_string
 #### A masked pattern was here ####
 NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
-28784	1969	12	31	31	1	23	59	44
-28784	1969	12	31	31	1	23	59	44
-28784	1969	12	31	31	1	23	59	44
-28784	1969	12	31	31	1	23	59	44
-28785	1969	12	31	31	1	23	59	45
-28786	1969	12	31	31	1	23	59	46
-28787	1969	12	31	31	1	23	59	47
-28788	1969	12	31	31	1	23	59	48
-28789	1969	12	31	31	1	23	59	49
-28789	1969	12	31	31	1	23	59	49
-28790	1969	12	31	31	1	23	59	50
-28792	1969	12	31	31	1	23	59	52
-28792	1969	12	31	31	1	23	59	52
-28792	1969	12	31	31	1	23	59	52
-28792	1969	12	31	31	1	23	59	52
-28795	1969	12	31	31	1	23	59	55
-28795	1969	12	31	31	1	23	59	55
-28795	1969	12	31	31	1	23	59	55
-28798	1969	12	31	31	1	23	59	58
-28798	1969	12	31	31	1	23	59	58
-28800	1970	1	1	1	1	0	0	0
-28800	1970	1	1	1	1	0	0	0
-28802	1970	1	1	1	1	0	0	2
-28803	1970	1	1	1	1	0	0	3
-28804	1970	1	1	1	1	0	0	4
-28804	1970	1	1	1	1	0	0	4
-28805	1970	1	1	1	1	0	0	5
-28805	1970	1	1	1	1	0	0	5
-28806	1970	1	1	1	1	0	0	6
-28807	1970	1	1	1	1	0	0	7
-28807	1970	1	1	1	1	0	0	7
-28807	1970	1	1	1	1	0	0	7
-28808	1970	1	1	1	1	0	0	8
-28808	1970	1	1	1	1	0	0	8
-28809	1970	1	1	1	1	0	0	9
-28811	1970	1	1	1	1	0	0	11
-28813	1970	1	1	1	1	0	0	13
-28814	1970	1	1	1	1	0	0	14
-28815	1970	1	1	1	1	0	0	15
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 PREHOOK: query: EXPLAIN SELECT
   to_unix_timestamp(ctimestamp1) = to_unix_timestamp(stimestamp1) AS c1,
   year(ctimestamp1) = year(stimestamp1),
@@ -398,15 +400,15 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc_string
-                  Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: (to_unix_timestamp(ctimestamp1) = to_unix_timestamp(stimestamp1)) (type: boolean), (year(ctimestamp1) = year(stimestamp1)) (type: boolean), (month(ctimestamp1) = month(stimestamp1)) (type: boolean), (day(ctimestamp1) = day(stimestamp1)) (type: boolean), (dayofmonth(ctimestamp1) = dayofmonth(stimestamp1)) (type: boolean), (weekofyear(ctimestamp1) = weekofyear(stimestamp1)) (type: boolean), (hour(ctimestamp1) = hour(stimestamp1)) (type: boolean), (minute(ctimestamp1) = minute(stimestamp1)) (type: boolean), (second(ctimestamp1) = second(stimestamp1)) (type: boolean)
                     outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                    Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                     Reduce Output Operator
                       key expressions: _col0 (type: boolean)
                       sort order: +
-                      Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                      Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                       value expressions: _col1 (type: boolean), _col2 (type: boolean), _col3 (type: boolean), _col4 (type: boolean), _col5 (type: boolean), _col6 (type: boolean), _col7 (type: boolean), _col8 (type: boolean)
             Execution mode: vectorized
         Reducer 2 
@@ -414,10 +416,10 @@ STAGE PLANS:
               Select Operator
                 expressions: KEY.reducesinkkey0 (type: boolean), VALUE._col0 (type: boolean), VALUE._col1 (type: boolean), VALUE._col2 (type: boolean), VALUE._col3 (type: boolean), VALUE._col4 (type: boolean), VALUE._col5 (type: boolean), VALUE._col6 (type: boolean), VALUE._col7 (type: boolean)
                 outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8
-                Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                 File Output Operator
                   compressed: false
-                  Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                   table:
                       input format: org.apache.hadoop.mapred.TextInputFormat
                       output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
@@ -463,45 +465,45 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc_string
 #### A masked pattern was here ####
 NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
-true	true	true	true	true	true	true	true	true
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL
 PREHOOK: query: -- Wrong format. Should all be NULL.
 EXPLAIN SELECT
   to_unix_timestamp(stimestamp1) AS c1,
@@ -639,11 +641,11 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc_string
-                  Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: ctimestamp1 (type: timestamp)
                     outputColumnNames: ctimestamp1
-                    Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
                       aggregations: min(ctimestamp1), max(ctimestamp1), count(ctimestamp1), count()
                       mode: hash
@@ -694,7 +696,7 @@ FROM alltypesorc_string
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc_string
 #### A masked pattern was here ####
-1969-12-31 23:59:44.088	1970-01-01 00:00:15.007	39	40
+NULL	NULL	0	40
 PREHOOK: query: -- SUM of timestamps are not vectorized reduce-side because they produce a double instead of a long (HIVE-8211)...
 EXPLAIN SELECT
   round(sum(ctimestamp1), 3)
@@ -720,11 +722,11 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc_string
-                  Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: ctimestamp1 (type: timestamp)
                     outputColumnNames: ctimestamp1
-                    Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
                       aggregations: sum(ctimestamp1)
                       mode: hash
@@ -772,7 +774,7 @@ FROM alltypesorc_string
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc_string
 #### A masked pattern was here ####
-1123143.857
+NULL
 PREHOOK: query: EXPLAIN SELECT
   round(avg(ctimestamp1), 0),
   variance(ctimestamp1) between 8.97077295279421E19 and 8.97077295279422E19,
@@ -810,11 +812,11 @@ STAGE PLANS:
             Map Operator Tree:
                 TableScan
                   alias: alltypesorc_string
-                  Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                  Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                   Select Operator
                     expressions: ctimestamp1 (type: timestamp)
                     outputColumnNames: ctimestamp1
-                    Statistics: Num rows: 40 Data size: 5694 Basic stats: COMPLETE Column stats: NONE
+                    Statistics: Num rows: 40 Data size: 84 Basic stats: COMPLETE Column stats: NONE
                     Group By Operator
                       aggregations: avg(ctimestamp1), variance(ctimestamp1), var_pop(ctimestamp1), var_samp(ctimestamp1), std(ctimestamp1), stddev(ctimestamp1), stddev_pop(ctimestamp1), stddev_samp(ctimestamp1)
                       mode: hash
@@ -876,4 +878,4 @@ FROM alltypesorc_string
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc_string
 #### A masked pattern was here ####
-2.8798560435897E13	true	true	true	9.471416447815E9	9.471416447815E9	9.471416447815E9	9.595231068211E9
+NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/subquery_exists.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/subquery_exists.q.out b/ql/src/test/results/clientpositive/subquery_exists.q.out
index da18d2f..776b145 100644
--- a/ql/src/test/results/clientpositive/subquery_exists.q.out
+++ b/ql/src/test/results/clientpositive/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/temp_table.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/temp_table.q.out b/ql/src/test/results/clientpositive/temp_table.q.out
index cad71fd..2c5730d 100644
--- a/ql/src/test/results/clientpositive/temp_table.q.out
+++ b/ql/src/test/results/clientpositive/temp_table.q.out
@@ -228,48 +228,70 @@ 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
+    Map Reduce
+      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)
+      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
@@ -396,11 +418,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/tez/alter_merge_2_orc.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/alter_merge_2_orc.q.out b/ql/src/test/results/clientpositive/tez/alter_merge_2_orc.q.out
index 1ccae8e..7e30942 100644
--- a/ql/src/test/results/clientpositive/tez/alter_merge_2_orc.q.out
+++ b/ql/src/test/results/clientpositive/tez/alter_merge_2_orc.q.out
@@ -31,31 +31,31 @@ ds                  	string
 ts                  	string              	                    
 	 	 
 #### A masked pattern was here ####
-PREHOOK: query: insert overwrite table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src
+PREHOOK: query: insert overwrite table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src order by key, value
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@src_orc_merge_test_part@ds=2012-01-03/ts=2012-01-03+14%3A46%3A31
-POSTHOOK: query: insert overwrite table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src
+POSTHOOK: query: insert overwrite table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src order by key, value
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@src_orc_merge_test_part@ds=2012-01-03/ts=2012-01-03+14%3A46%3A31
 POSTHOOK: Lineage: src_orc_merge_test_part PARTITION(ds=2012-01-03,ts=2012-01-03+14:46:31).key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), ]
 POSTHOOK: Lineage: src_orc_merge_test_part PARTITION(ds=2012-01-03,ts=2012-01-03+14:46:31).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
-PREHOOK: query: insert into table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src limit 100
+PREHOOK: query: insert into table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src order by key, value limit 100
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@src_orc_merge_test_part@ds=2012-01-03/ts=2012-01-03+14%3A46%3A31
-POSTHOOK: query: insert into table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src limit 100
+POSTHOOK: query: insert into table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src order by key, value limit 100
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@src_orc_merge_test_part@ds=2012-01-03/ts=2012-01-03+14%3A46%3A31
 POSTHOOK: Lineage: src_orc_merge_test_part PARTITION(ds=2012-01-03,ts=2012-01-03+14:46:31).key EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), ]
 POSTHOOK: Lineage: src_orc_merge_test_part PARTITION(ds=2012-01-03,ts=2012-01-03+14:46:31).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ]
-PREHOOK: query: insert into table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src limit 10
+PREHOOK: query: insert into table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src order by key, value limit 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src
 PREHOOK: Output: default@src_orc_merge_test_part@ds=2012-01-03/ts=2012-01-03+14%3A46%3A31
-POSTHOOK: query: insert into table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src limit 10
+POSTHOOK: query: insert into table src_orc_merge_test_part partition(ds='2012-01-03', ts='2012-01-03+14:46:31') select * from src order by key, value limit 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src
 POSTHOOK: Output: default@src_orc_merge_test_part@ds=2012-01-03/ts=2012-01-03+14%3A46%3A31
@@ -82,7 +82,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src_orc_merge_test_part
 POSTHOOK: Input: default@src_orc_merge_test_part@ds=2012-01-03/ts=2012-01-03+14%3A46%3A31
 #### A masked pattern was here ####
-159653	47778930280
+143807	50348357904
 PREHOOK: query: alter table src_orc_merge_test_part partition (ds='2012-01-03', ts='2012-01-03+14:46:31') concatenate
 PREHOOK: type: ALTER_PARTITION_MERGE
 PREHOOK: Input: default@src_orc_merge_test_part
@@ -112,7 +112,7 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@src_orc_merge_test_part
 POSTHOOK: Input: default@src_orc_merge_test_part@ds=2012-01-03/ts=2012-01-03+14%3A46%3A31
 #### A masked pattern was here ####
-159653	47778930280
+143807	50348357904
 PREHOOK: query: drop table src_orc_merge_test_part
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@src_orc_merge_test_part

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/tez/auto_join0.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/auto_join0.q.out b/ql/src/test/results/clientpositive/tez/auto_join0.q.out
index cea6f99..beaac17 100644
--- a/ql/src/test/results/clientpositive/tez/auto_join0.q.out
+++ b/ql/src/test/results/clientpositive/tez/auto_join0.q.out
@@ -1,23 +1,27 @@
-Warning: Map Join MAPJOIN[20][bigTable=?] in task 'Map 1' is a cross product
-PREHOOK: query: explain 
+Warning: Map Join MAPJOIN[24][bigTable=?] in task 'Reducer 2' is a cross product
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+explain 
 select sum(hash(a.k1,a.v1,a.k2, a.v2))
 from (
 SELECT src1.key as k1, src1.value as v1, 
        src2.key as k2, src2.value as v2 FROM 
-  (SELECT * FROM src WHERE src.key < 10) src1 
+  (SELECT * FROM src WHERE src.key < 10 order by src.key, src.value) src1
     JOIN 
-  (SELECT * FROM src WHERE src.key < 10) src2
+  (SELECT * FROM src WHERE src.key < 10 order by src.key, src.value) src2
   SORT BY k1, v1, k2, v2
 ) a
 PREHOOK: type: QUERY
-POSTHOOK: query: explain 
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+explain 
 select sum(hash(a.k1,a.v1,a.k2, a.v2))
 from (
 SELECT src1.key as k1, src1.value as v1, 
        src2.key as k2, src2.value as v2 FROM 
-  (SELECT * FROM src WHERE src.key < 10) src1 
+  (SELECT * FROM src WHERE src.key < 10 order by src.key, src.value) src1
     JOIN 
-  (SELECT * FROM src WHERE src.key < 10) src2
+  (SELECT * FROM src WHERE src.key < 10 order by src.key, src.value) src2
   SORT BY k1, v1, k2, v2
 ) a
 POSTHOOK: type: QUERY
@@ -29,9 +33,10 @@ STAGE PLANS:
   Stage: Stage-1
     Tez
       Edges:
-        Map 1 <- Map 4 (BROADCAST_EDGE)
-        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+        Reducer 2 <- Map 1 (SIMPLE_EDGE), Reducer 6 (BROADCAST_EDGE)
         Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+        Reducer 6 <- Map 5 (SIMPLE_EDGE)
 #### A masked pattern was here ####
       Vertices:
         Map 1 
@@ -46,22 +51,11 @@ STAGE PLANS:
                       expressions: key (type: string), value (type: string)
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
-                      Map Join Operator
-                        condition map:
-                             Inner Join 0 to 1
-                        keys:
-                          0 
-                          1 
-                        outputColumnNames: _col0, _col1, _col2, _col3
-                        input vertices:
-                          1 Map 4
-                        Statistics: Num rows: 182 Data size: 1939 Basic stats: COMPLETE Column stats: NONE
-                        HybridGraceHashJoin: true
-                        Reduce Output Operator
-                          key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
-                          sort order: ++++
-                          Statistics: Num rows: 182 Data size: 1939 Basic stats: COMPLETE Column stats: NONE
-        Map 4 
+                      Reduce Output Operator
+                        key expressions: _col0 (type: string), _col1 (type: string)
+                        sort order: ++
+                        Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
+        Map 5 
             Map Operator Tree:
                 TableScan
                   alias: src
@@ -74,12 +68,33 @@ STAGE PLANS:
                       outputColumnNames: _col0, _col1
                       Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
                       Reduce Output Operator
-                        sort order: 
+                        key expressions: _col0 (type: string), _col1 (type: string)
+                        sort order: ++
                         Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
-                        value expressions: _col0 (type: string), _col1 (type: string)
         Reducer 2 
             Reduce Operator Tree:
               Select Operator
+                expressions: KEY.reducesinkkey0 (type: string), KEY.reducesinkkey1 (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
+                Map Join Operator
+                  condition map:
+                       Inner Join 0 to 1
+                  keys:
+                    0 
+                    1 
+                  outputColumnNames: _col0, _col1, _col2, _col3
+                  input vertices:
+                    1 Reducer 6
+                  Statistics: Num rows: 182 Data size: 1939 Basic stats: COMPLETE Column stats: NONE
+                  HybridGraceHashJoin: true
+                  Reduce Output Operator
+                    key expressions: _col0 (type: string), _col1 (type: string), _col2 (type: string), _col3 (type: string)
+                    sort order: ++++
+                    Statistics: Num rows: 182 Data size: 1939 Basic stats: COMPLETE Column stats: NONE
+        Reducer 3 
+            Reduce Operator Tree:
+              Select Operator
                 expressions: KEY.reducesinkkey0 (type: string), KEY.reducesinkkey1 (type: string), KEY.reducesinkkey2 (type: string), KEY.reducesinkkey3 (type: string)
                 outputColumnNames: _col0, _col1, _col2, _col3
                 Statistics: Num rows: 182 Data size: 1939 Basic stats: COMPLETE Column stats: NONE
@@ -92,7 +107,7 @@ STAGE PLANS:
                     sort order: 
                     Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE Column stats: NONE
                     value expressions: _col0 (type: bigint)
-        Reducer 3 
+        Reducer 4 
             Reduce Operator Tree:
               Group By Operator
                 aggregations: sum(VALUE._col0)
@@ -106,6 +121,16 @@ 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
+        Reducer 6 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: string), KEY.reducesinkkey1 (type: string)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  sort order: 
+                  Statistics: Num rows: 166 Data size: 1763 Basic stats: COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: string), _col1 (type: string)
 
   Stage: Stage-0
     Fetch Operator
@@ -113,14 +138,14 @@ STAGE PLANS:
       Processor Tree:
         ListSink
 
-Warning: Map Join MAPJOIN[20][bigTable=?] in task 'Map 1' is a cross product
+Warning: Map Join MAPJOIN[24][bigTable=?] in task 'Reducer 2' is a cross product
 PREHOOK: query: select sum(hash(a.k1,a.v1,a.k2, a.v2))
 from (
 SELECT src1.key as k1, src1.value as v1, 
        src2.key as k2, src2.value as v2 FROM 
-  (SELECT * FROM src WHERE src.key < 10) src1 
+  (SELECT * FROM src WHERE src.key < 10 order by src.key, src.value) src1
     JOIN 
-  (SELECT * FROM src WHERE src.key < 10) src2
+  (SELECT * FROM src WHERE src.key < 10 order by src.key, src.value) src2
   SORT BY k1, v1, k2, v2
 ) a
 PREHOOK: type: QUERY
@@ -130,9 +155,9 @@ POSTHOOK: query: select sum(hash(a.k1,a.v1,a.k2, a.v2))
 from (
 SELECT src1.key as k1, src1.value as v1, 
        src2.key as k2, src2.value as v2 FROM 
-  (SELECT * FROM src WHERE src.key < 10) src1 
+  (SELECT * FROM src WHERE src.key < 10 order by src.key, src.value) src1
     JOIN 
-  (SELECT * FROM src WHERE src.key < 10) src2
+  (SELECT * FROM src WHERE src.key < 10 order by src.key, src.value) src2
   SORT BY k1, v1, k2, v2
 ) a
 POSTHOOK: type: QUERY

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/tez/auto_join1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/auto_join1.q.out b/ql/src/test/results/clientpositive/tez/auto_join1.q.out
index 078d504..41cbcc7 100644
--- a/ql/src/test/results/clientpositive/tez/auto_join1.q.out
+++ b/ql/src/test/results/clientpositive/tez/auto_join1.q.out
@@ -1,8 +1,12 @@
-PREHOOK: query: CREATE TABLE dest_j1(key INT, value STRING) STORED AS TEXTFILE
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+CREATE TABLE dest_j1(key INT, value STRING) STORED AS TEXTFILE
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@dest_j1
-POSTHOOK: query: CREATE TABLE dest_j1(key INT, value STRING) STORED AS TEXTFILE
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+CREATE TABLE dest_j1(key INT, value STRING) STORED AS TEXTFILE
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@dest_j1

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/tez/auto_sortmerge_join_5.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/auto_sortmerge_join_5.q.out b/ql/src/test/results/clientpositive/tez/auto_sortmerge_join_5.q.out
index adcc1fa..4d85837 100644
--- a/ql/src/test/results/clientpositive/tez/auto_sortmerge_join_5.q.out
+++ b/ql/src/test/results/clientpositive/tez/auto_sortmerge_join_5.q.out
@@ -1,9 +1,15 @@
 PREHOOK: query: -- small no part, 4 bucket & big no part, 2 bucket
+
+-- SORT_QUERY_RESULTS
+
 CREATE TABLE bucket_small (key string, value string) CLUSTERED BY (key) SORTED BY (key) INTO 4 BUCKETS STORED AS TEXTFILE
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@bucket_small
 POSTHOOK: query: -- small no part, 4 bucket & big no part, 2 bucket
+
+-- SORT_QUERY_RESULTS
+
 CREATE TABLE bucket_small (key string, value string) CLUSTERED BY (key) SORTED BY (key) INTO 4 BUCKETS STORED AS TEXTFILE
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/tez/cbo_gby.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/cbo_gby.q.out b/ql/src/test/results/clientpositive/tez/cbo_gby.q.out
index 3dc8914..04597a7 100644
--- a/ql/src/test/results/clientpositive/tez/cbo_gby.q.out
+++ b/ql/src/test/results/clientpositive/tez/cbo_gby.q.out
@@ -1,20 +1,24 @@
-PREHOOK: query: -- 6. Test Select + TS + Join + Fil + GB + GB Having
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+-- 6. Test Select + TS + Join + Fil + GB + GB Having
 select key, (c_int+1)+2 as x, sum(c_int) from cbo_t1 group by c_float, cbo_t1.c_int, key
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
 PREHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
-POSTHOOK: query: -- 6. Test Select + TS + Join + Fil + GB + GB Having
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+-- 6. Test Select + TS + Join + Fil + GB + GB Having
 select key, (c_int+1)+2 as x, sum(c_int) from cbo_t1 group by c_float, cbo_t1.c_int, key
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t1
 POSTHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
-NULL	NULL	NULL
  1	4	2
  1 	4	2
 1	4	12
 1 	4	2
+NULL	NULL	NULL
 PREHOOK: query: select x, y, count(*) from (select key, (c_int+c_float+1+2) as x, sum(c_int) as y from cbo_t1 group by c_float, cbo_t1.c_int, key) R group by y, x
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
@@ -25,9 +29,9 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t1
 POSTHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
-NULL	NULL	1
-5.0	2	3
 5.0	12	1
+5.0	2	3
+NULL	NULL	1
 PREHOOK: query: select cbo_t3.c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from cbo_t1 where (cbo_t1.c_int + 1 >= 0) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0) group by c_float, cbo_t1.c_int, key order by a) cbo_t1 join (select key as p, c_int+1 as q, sum(c_int) as r from cbo_t2 where (cbo_t2.c_int + 1 >= 0) and (cbo_t2.c_int > 0 or cbo_t2.c_float >= 0)  group by c_float, cbo_t2.c_int, key order by q/10 desc, r asc) cbo_t2 on cbo_t1.a=p join cbo_t3 on cbo_t1.a=key where (b + cbo_t2.q >= 0) and (b > 0 or c_int >= 0) group by cbo_t3.c_int, c order by cbo_t3.c_int+c desc, c
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
@@ -80,8 +84,8 @@ POSTHOOK: Input: default@cbo_t2
 POSTHOOK: Input: default@cbo_t2@dt=2014
 POSTHOOK: Input: default@cbo_t3
 #### A masked pattern was here ####
-1	2	6
 1	12	6
+1	2	6
 PREHOOK: query: select cbo_t3.c_int, c, count(*) from (select key as a, c_int+1 as b, sum(c_int) as c from cbo_t1 where (cbo_t1.c_int + 1 >= 0) and (cbo_t1.c_int > 0 or cbo_t1.c_float >= 0)  group by c_float, cbo_t1.c_int, key having cbo_t1.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by c+a desc) cbo_t1 full outer join (select key as p, c_int+1 as q, sum(c_int) as r from cbo_t2 where (cbo_t2.c_int + 1 >= 0) and (cbo_t2.c_int > 0 or cbo_t2.c_float >= 0)  group by c_float, cbo_t2.c_int, key having cbo_t2.c_float > 0 and (c_int >=1 or c_float >= 1) and (c_int + c_float) >= 0 order by p+q desc, r asc) cbo_t2 on cbo_t1.a=p full outer join cbo_t3 on cbo_t1.a=key where (b + cbo_t2.q >= 0) and (b > 0 or c_int >= 0) group by cbo_t3.c_int, c having cbo_t3.c_int > 0 and (c_int >=1 or c >= 1) and (c_int + c) >= 0 order by cbo_t3.c_int
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
@@ -116,5 +120,5 @@ POSTHOOK: Input: default@cbo_t2
 POSTHOOK: Input: default@cbo_t2@dt=2014
 POSTHOOK: Input: default@cbo_t3
 #### A masked pattern was here ####
-1	2	6
 1	12	6
+1	2	6

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/tez/cbo_udf_udaf.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/cbo_udf_udaf.q.out b/ql/src/test/results/clientpositive/tez/cbo_udf_udaf.q.out
index ded043f..156d02f 100644
--- a/ql/src/test/results/clientpositive/tez/cbo_udf_udaf.q.out
+++ b/ql/src/test/results/clientpositive/tez/cbo_udf_udaf.q.out
@@ -1,10 +1,14 @@
-PREHOOK: query: -- 8. Test UDF/UDAF
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+-- 8. Test UDF/UDAF
 select count(*), count(c_int), sum(c_int), avg(c_int), max(c_int), min(c_int) from cbo_t1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
 PREHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
-POSTHOOK: query: -- 8. Test UDF/UDAF
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+-- 8. Test UDF/UDAF
 select count(*), count(c_int), sum(c_int), avg(c_int), max(c_int), min(c_int) from cbo_t1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t1
@@ -21,8 +25,8 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t1
 POSTHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
-2	0	NULL	NULL	NULL	NULL	3	6
 18	18	18	1.0	1	1	2	36
+2	0	NULL	NULL	NULL	NULL	3	6
 PREHOOK: query: select * from (select count(*) as a, count(distinct c_int) as b, sum(c_int) as c, avg(c_int) as d, max(c_int) as e, min(c_int) as f from cbo_t1) cbo_t1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
@@ -44,8 +48,8 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t1
 POSTHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
-2	0	NULL	NULL	NULL	NULL	3	6
 18	1	18	1.0	1	1	2	36
+2	0	NULL	NULL	NULL	NULL	3	6
 PREHOOK: query: select f,a,e,b from (select count(*) as a, count(c_int) as b, sum(c_int) as c, avg(c_int) as d, max(c_int) as e, min(c_int) as f from cbo_t1) cbo_t1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
@@ -78,11 +82,11 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t1
 POSTHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
-NULL	0	NULL
-1 	2	1.0
- 1 	2	1.0
  1	2	1.0
+ 1 	2	1.0
 1	12	1.0
+1 	2	1.0
+NULL	0	NULL
 PREHOOK: query: select count(distinct c_int) as a, avg(c_float) from cbo_t1 group by c_float order by a
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/tez/cbo_windowing.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/cbo_windowing.q.out b/ql/src/test/results/clientpositive/tez/cbo_windowing.q.out
index 1a274b0..57201b5 100644
--- a/ql/src/test/results/clientpositive/tez/cbo_windowing.q.out
+++ b/ql/src/test/results/clientpositive/tez/cbo_windowing.q.out
@@ -1,10 +1,14 @@
 PREHOOK: query: -- 9. Test Windowing Functions
+-- SORT_QUERY_RESULTS
+
 select count(c_int) over() from cbo_t1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
 PREHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
 POSTHOOK: query: -- 9. Test Windowing Functions
+-- SORT_QUERY_RESULTS
+
 select count(c_int) over() from cbo_t1
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t1
@@ -41,14 +45,6 @@ POSTHOOK: Input: default@cbo_t1
 POSTHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
 18	18.0	1	1	1	1	1	0.0	1	NULL
-18	18.0	1	1	2	1	1	0.0	1	NULL
-18	18.0	1	1	3	1	1	0.0	1	NULL
-18	18.0	1	1	4	1	1	0.0	1	NULL
-18	18.0	1	1	5	1	1	0.0	1	1.0
-18	18.0	1	1	6	1	1	0.0	1	1.0
-18	18.0	1	1	7	1	1	0.0	1	1.0
-18	18.0	1	1	8	1	1	0.0	1	1.0
-18	18.0	1	1	9	1	1	0.0	1	1.0
 18	18.0	1	1	10	1	1	0.0	1	1.0
 18	18.0	1	1	11	1	1	0.0	1	1.0
 18	18.0	1	1	12	1	1	0.0	1	1.0
@@ -59,7 +55,15 @@ POSTHOOK: Input: default@cbo_t1@dt=2014
 18	18.0	1	1	17	1	1	0.0	1	1.0
 18	18.0	1	1	18	1	1	0.0	1	1.0
 18	18.0	1	1	19	1	1	0.0	1	1.0
+18	18.0	1	1	2	1	1	0.0	1	NULL
 18	18.0	1	1	20	1	1	0.0	1	1.0
+18	18.0	1	1	3	1	1	0.0	1	NULL
+18	18.0	1	1	4	1	1	0.0	1	NULL
+18	18.0	1	1	5	1	1	0.0	1	1.0
+18	18.0	1	1	6	1	1	0.0	1	1.0
+18	18.0	1	1	7	1	1	0.0	1	1.0
+18	18.0	1	1	8	1	1	0.0	1	1.0
+18	18.0	1	1	9	1	1	0.0	1	1.0
 PREHOOK: query: select * from (select count(c_int) over(), sum(c_float) over(), max(c_int) over(), min(c_int) over(), row_number() over(), rank() over(), dense_rank() over(), percent_rank() over(), lead(c_int, 2, c_int) over(), lag(c_float, 2, c_float) over() from cbo_t1) cbo_t1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
@@ -71,14 +75,6 @@ POSTHOOK: Input: default@cbo_t1
 POSTHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
 18	18.0	1	1	1	1	1	0.0	1	NULL
-18	18.0	1	1	2	1	1	0.0	1	NULL
-18	18.0	1	1	3	1	1	0.0	1	NULL
-18	18.0	1	1	4	1	1	0.0	1	NULL
-18	18.0	1	1	5	1	1	0.0	1	1.0
-18	18.0	1	1	6	1	1	0.0	1	1.0
-18	18.0	1	1	7	1	1	0.0	1	1.0
-18	18.0	1	1	8	1	1	0.0	1	1.0
-18	18.0	1	1	9	1	1	0.0	1	1.0
 18	18.0	1	1	10	1	1	0.0	1	1.0
 18	18.0	1	1	11	1	1	0.0	1	1.0
 18	18.0	1	1	12	1	1	0.0	1	1.0
@@ -89,7 +85,15 @@ POSTHOOK: Input: default@cbo_t1@dt=2014
 18	18.0	1	1	17	1	1	0.0	1	1.0
 18	18.0	1	1	18	1	1	0.0	1	1.0
 18	18.0	1	1	19	1	1	0.0	1	1.0
+18	18.0	1	1	2	1	1	0.0	1	NULL
 18	18.0	1	1	20	1	1	0.0	1	1.0
+18	18.0	1	1	3	1	1	0.0	1	NULL
+18	18.0	1	1	4	1	1	0.0	1	NULL
+18	18.0	1	1	5	1	1	0.0	1	1.0
+18	18.0	1	1	6	1	1	0.0	1	1.0
+18	18.0	1	1	7	1	1	0.0	1	1.0
+18	18.0	1	1	8	1	1	0.0	1	1.0
+18	18.0	1	1	9	1	1	0.0	1	1.0
 PREHOOK: query: select x from (select count(c_int) over() as x, sum(c_float) over() from cbo_t1) cbo_t1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
@@ -171,13 +175,16 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t1
 POSTHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
-NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
-NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
 1	1	1	1.0	1.0	1.0	1.0	1.0	1.0
-1	1	2	1.0	2.0	1.0	2.0	1.0	1.0
 1	1	1	1.0	1.0	1.0	1.0	1.0	1.0
-1	1	2	1.0	2.0	1.0	2.0	1.0	1.0
 1	1	1	1.0	1.0	1.0	1.0	1.0	1.0
+1	1	1	1.0	1.0	1.0	1.0	1.0	1.0
+1	1	2	1.0	10.0	1.0	2.0	1.0	1.0
+1	1	2	1.0	11.0	1.0	2.0	1.0	1.0
+1	1	2	1.0	12.0	1.0	2.0	1.0	1.0
+1	1	2	1.0	2.0	1.0	2.0	1.0	1.0
+1	1	2	1.0	2.0	1.0	2.0	1.0	1.0
+1	1	2	1.0	2.0	1.0	2.0	1.0	1.0
 1	1	2	1.0	2.0	1.0	2.0	1.0	1.0
 1	1	2	1.0	3.0	1.0	2.0	1.0	1.0
 1	1	2	1.0	4.0	1.0	2.0	1.0	1.0
@@ -186,11 +193,8 @@ NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
 1	1	2	1.0	7.0	1.0	2.0	1.0	1.0
 1	1	2	1.0	8.0	1.0	2.0	1.0	1.0
 1	1	2	1.0	9.0	1.0	2.0	1.0	1.0
-1	1	2	1.0	10.0	1.0	2.0	1.0	1.0
-1	1	2	1.0	11.0	1.0	2.0	1.0	1.0
-1	1	2	1.0	12.0	1.0	2.0	1.0	1.0
-1	1	1	1.0	1.0	1.0	1.0	1.0	1.0
-1	1	2	1.0	2.0	1.0	2.0	1.0	1.0
+NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
 PREHOOK: query: select i, a, h, b, c, d, e, f, g, a as x, a +1 as y from (select max(c_int) over (partition by key order by value range UNBOUNDED PRECEDING) a, min(c_int) over (partition by key order by value range current row) b, count(c_int) over(partition by key order by value range 1 PRECEDING) c, avg(value) over (partition by key order by value range between unbounded preceding and unbounded following) d, sum(value) over (partition by key order by value range between unbounded preceding and current row) e, avg(c_float) over (partition by key order by value range between 1 preceding and unbounded following) f, sum(c_float) over (partition by key order by value range between 1 preceding and current row) g, max(c_float) over (partition by key order by value range between 1 preceding and unbounded following) h, min(c_float) over (partition by key order by value range between 1 preceding and 1 following) i from cbo_t1) cbo_t1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@cbo_t1
@@ -201,12 +205,6 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@cbo_t1
 POSTHOOK: Input: default@cbo_t1@dt=2014
 #### A masked pattern was here ####
-NULL	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
-NULL	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
-1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
-1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
-1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
-1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
 1.0	1	1.0	1	12	1.0	12.0	1.0	12.0	1	2
 1.0	1	1.0	1	12	1.0	12.0	1.0	12.0	1	2
 1.0	1	1.0	1	12	1.0	12.0	1.0	12.0	1	2
@@ -221,6 +219,12 @@ NULL	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
 1.0	1	1.0	1	12	1.0	12.0	1.0	12.0	1	2
 1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
 1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
+1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
+1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
+1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
+1.0	1	1.0	1	2	1.0	2.0	1.0	2.0	1	2
+NULL	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
+NULL	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL
 PREHOOK: query: select *, rank() over(partition by key order by value) as rr from src1
 PREHOOK: type: QUERY
 PREHOOK: Input: default@src1

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/tez/cross_product_check_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/cross_product_check_1.q.out b/ql/src/test/results/clientpositive/tez/cross_product_check_1.q.out
index 9274a59..35c4ea8 100644
--- a/ql/src/test/results/clientpositive/tez/cross_product_check_1.q.out
+++ b/ql/src/test/results/clientpositive/tez/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
@@ -189,12 +193,12 @@ STAGE PLANS:
 Warning: Shuffle Join MERGEJOIN[24][tables = [a, od1]] in Stage '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:
@@ -306,9 +310,9 @@ STAGE PLANS:
 
 Warning: Shuffle Join MERGEJOIN[17][tables = [d1, d2]] in Stage 'Reducer 2' is a cross product
 Warning: Shuffle Join MERGEJOIN[18][tables = [a, od1]] in Stage '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
@@ -410,11 +414,11 @@ STAGE PLANS:
 
 Warning: Shuffle Join MERGEJOIN[29][tables = [ss, od1]] in Stage '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/tez/cross_product_check_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/cross_product_check_2.q.out b/ql/src/test/results/clientpositive/tez/cross_product_check_2.q.out
index f732a8d..14dd820 100644
--- a/ql/src/test/results/clientpositive/tez/cross_product_check_2.q.out
+++ b/ql/src/test/results/clientpositive/tez/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
@@ -71,14 +75,14 @@ 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
                   Select Operator
                     expressions: key (type: string), value (type: string)
                     outputColumnNames: _col0, _col1
-                    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
                     Reduce Output Operator
                       sort order: 
-                      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
                       value expressions: _col0 (type: string), _col1 (type: string)
 
   Stage: Stage-0
@@ -108,10 +112,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
@@ -121,25 +125,25 @@ 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
                       HybridGraceHashJoin: true
                       Reduce Output Operator
                         sort order: 
-                        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
                         value expressions: _col0 (type: string), _col1 (type: string), _col5 (type: string), _col6 (type: string)
         Map 2 
             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
                     Reduce Output Operator
                       key expressions: key (type: string)
                       sort order: +
                       Map-reduce partition columns: key (type: string)
-                      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
                       value expressions: value (type: string)
         Map 3 
             Map Operator Tree:
@@ -203,10 +207,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
@@ -216,31 +220,31 @@ 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
                       HybridGraceHashJoin: true
                       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
         Map 3 
             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
                     Reduce Output Operator
                       key expressions: key (type: string)
                       sort order: +
                       Map-reduce partition columns: key (type: string)
-                      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 4 
             Map Operator Tree:
                 TableScan
@@ -274,10 +278,10 @@ 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
                 Reduce Output Operator
                   sort order: 
-                  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
                   value expressions: _col0 (type: string)
 
   Stage: Stage-0
@@ -309,7 +313,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
@@ -319,26 +323,26 @@ 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
                     HybridGraceHashJoin: true
                     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
         Map 3 
             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
                   Reduce Output Operator
                     sort order: 
-                    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
         Map 4 
             Map Operator Tree:
                 TableScan
@@ -372,10 +376,10 @@ 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
                 Reduce Output Operator
                   sort order: 
-                  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
                   value expressions: _col0 (type: string)
 
   Stage: Stage-0
@@ -429,10 +433,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
@@ -442,31 +446,31 @@ 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
                       HybridGraceHashJoin: true
                       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
         Map 5 
             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
                     Reduce Output Operator
                       key expressions: key (type: string)
                       sort order: +
                       Map-reduce partition columns: key (type: string)
-                      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
         Reducer 2 
             Reduce Operator Tree:
               Group By Operator
@@ -498,10 +502,10 @@ 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
                 Reduce Output Operator
                   sort order: 
-                  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
                   value expressions: _col0 (type: string)
 
   Stage: Stage-0

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/tez/ctas.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/ctas.q.out b/ql/src/test/results/clientpositive/tez/ctas.q.out
index d576fa5..5e9aee2 100644
--- a/ql/src/test/results/clientpositive/tez/ctas.q.out
+++ b/ql/src/test/results/clientpositive/tez/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/tez/dynpart_sort_optimization2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/dynpart_sort_optimization2.q.out b/ql/src/test/results/clientpositive/tez/dynpart_sort_optimization2.q.out
index 5880ba0..6b6d912 100644
--- a/ql/src/test/results/clientpositive/tez/dynpart_sort_optimization2.q.out
+++ b/ql/src/test/results/clientpositive/tez/dynpart_sort_optimization2.q.out
@@ -1,6 +1,10 @@
-PREHOOK: query: drop table ss
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+drop table ss
 PREHOOK: type: DROPTABLE
-POSTHOOK: query: drop table ss
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+drop table ss
 POSTHOOK: type: DROPTABLE
 PREHOOK: query: drop table ss_orc
 PREHOOK: type: DROPTABLE
@@ -223,17 +227,17 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@ss_part
 POSTHOOK: Input: default@ss_part@ss_sold_date_sk=2452617
 #### A masked pattern was here ####
+10022.63	3952.8	2452617
+1765.07	-4648.8	2452617
 2.1	-2026.3	2452617
 2.99	-11.32	2452617
-85.8	25.61	2452617
-552.96	-1363.84	2452617
-565.92	196.48	2452617
-879.07	-2185.76	2452617
-1765.07	-4648.8	2452617
 3423.95	-3164.07	2452617
 5362.01	-600.28	2452617
+552.96	-1363.84	2452617
+565.92	196.48	2452617
 7412.83	2071.68	2452617
-10022.63	3952.8	2452617
+85.8	25.61	2452617
+879.07	-2185.76	2452617
 PREHOOK: query: desc formatted ss_part partition(ss_sold_date_sk=2452638)
 PREHOOK: type: DESCTABLE
 PREHOOK: Input: default@ss_part
@@ -286,18 +290,18 @@ POSTHOOK: Input: default@ss_part
 POSTHOOK: Input: default@ss_part@ss_sold_date_sk=2452638
 #### A masked pattern was here ####
 0.15	-241.22	2452638
+10171.1	660.48	2452638
+1327.08	57.97	2452638
+1413.19	178.08	2452638
 150.39	-162.12	2452638
+1524.33	494.37	2452638
 156.67	-4626.56	2452638
 181.03	-207.24	2452638
+1971.35	-488.25	2452638
 267.01	-3266.36	2452638
 317.87	-3775.38	2452638
-1327.08	57.97	2452638
-1413.19	178.08	2452638
-1524.33	494.37	2452638
-1971.35	-488.25	2452638
 4133.98	-775.72	2452638
 4329.49	-4000.51	2452638
-10171.1	660.48	2452638
 PREHOOK: query: explain insert overwrite table ss_part partition (ss_sold_date_sk)
 select ss_net_paid_inc_tax,
   ss_net_profit,
@@ -455,16 +459,16 @@ POSTHOOK: Input: default@ss_part
 POSTHOOK: Input: default@ss_part@ss_sold_date_sk=2452617
 #### A masked pattern was here ####
 10022.63	3952.8	2452617
+1765.07	-4648.8	2452617
+2.1	-2026.3	2452617
 2.99	-11.32	2452617
 3423.95	-3164.07	2452617
 5362.01	-600.28	2452617
+552.96	-1363.84	2452617
 565.92	196.48	2452617
-85.8	25.61	2452617
 7412.83	2071.68	2452617
+85.8	25.61	2452617
 879.07	-2185.76	2452617
-1765.07	-4648.8	2452617
-552.96	-1363.84	2452617
-2.1	-2026.3	2452617
 PREHOOK: query: desc formatted ss_part partition(ss_sold_date_sk=2452638)
 PREHOOK: type: DESCTABLE
 PREHOOK: Input: default@ss_part
@@ -516,19 +520,19 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@ss_part
 POSTHOOK: Input: default@ss_part@ss_sold_date_sk=2452638
 #### A masked pattern was here ####
-4329.49	-4000.51	2452638
+0.15	-241.22	2452638
+10171.1	660.48	2452638
+1327.08	57.97	2452638
 1413.19	178.08	2452638
 150.39	-162.12	2452638
 1524.33	494.37	2452638
-0.15	-241.22	2452638
-267.01	-3266.36	2452638
+156.67	-4626.56	2452638
 181.03	-207.24	2452638
 1971.35	-488.25	2452638
-1327.08	57.97	2452638
-156.67	-4626.56	2452638
+267.01	-3266.36	2452638
 317.87	-3775.38	2452638
-10171.1	660.48	2452638
 4133.98	-775.72	2452638
+4329.49	-4000.51	2452638
 PREHOOK: query: -- SORT DYNAMIC PARTITION DISABLED
 
 explain insert overwrite table ss_part partition (ss_sold_date_sk)
@@ -706,17 +710,17 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@ss_part
 POSTHOOK: Input: default@ss_part@ss_sold_date_sk=2452617
 #### A masked pattern was here ####
+10022.63	3952.8	2452617
+1765.07	-4648.8	2452617
 2.1	-2026.3	2452617
 2.99	-11.32	2452617
-85.8	25.61	2452617
-552.96	-1363.84	2452617
-565.92	196.48	2452617
-879.07	-2185.76	2452617
-1765.07	-4648.8	2452617
 3423.95	-3164.07	2452617
 5362.01	-600.28	2452617
+552.96	-1363.84	2452617
+565.92	196.48	2452617
 7412.83	2071.68	2452617
-10022.63	3952.8	2452617
+85.8	25.61	2452617
+879.07	-2185.76	2452617
 PREHOOK: query: desc formatted ss_part partition(ss_sold_date_sk=2452638)
 PREHOOK: type: DESCTABLE
 PREHOOK: Input: default@ss_part
@@ -769,18 +773,18 @@ POSTHOOK: Input: default@ss_part
 POSTHOOK: Input: default@ss_part@ss_sold_date_sk=2452638
 #### A masked pattern was here ####
 0.15	-241.22	2452638
+10171.1	660.48	2452638
+1327.08	57.97	2452638
+1413.19	178.08	2452638
 150.39	-162.12	2452638
+1524.33	494.37	2452638
 156.67	-4626.56	2452638
 181.03	-207.24	2452638
+1971.35	-488.25	2452638
 267.01	-3266.36	2452638
 317.87	-3775.38	2452638
-1327.08	57.97	2452638
-1413.19	178.08	2452638
-1524.33	494.37	2452638
-1971.35	-488.25	2452638
 4133.98	-775.72	2452638
 4329.49	-4000.51	2452638
-10171.1	660.48	2452638
 PREHOOK: query: explain insert overwrite table ss_part partition (ss_sold_date_sk)
 select ss_net_paid_inc_tax,
   ss_net_profit,
@@ -936,17 +940,17 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@ss_part
 POSTHOOK: Input: default@ss_part@ss_sold_date_sk=2452617
 #### A masked pattern was here ####
+10022.63	3952.8	2452617
+1765.07	-4648.8	2452617
+2.1	-2026.3	2452617
+2.99	-11.32	2452617
 3423.95	-3164.07	2452617
 5362.01	-600.28	2452617
+552.96	-1363.84	2452617
 565.92	196.48	2452617
-85.8	25.61	2452617
 7412.83	2071.68	2452617
+85.8	25.61	2452617
 879.07	-2185.76	2452617
-1765.07	-4648.8	2452617
-552.96	-1363.84	2452617
-2.1	-2026.3	2452617
-10022.63	3952.8	2452617
-2.99	-11.32	2452617
 PREHOOK: query: desc formatted ss_part partition(ss_sold_date_sk=2452638)
 PREHOOK: type: DESCTABLE
 PREHOOK: Input: default@ss_part
@@ -998,19 +1002,19 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@ss_part
 POSTHOOK: Input: default@ss_part@ss_sold_date_sk=2452638
 #### A masked pattern was here ####
-4329.49	-4000.51	2452638
+0.15	-241.22	2452638
+10171.1	660.48	2452638
+1327.08	57.97	2452638
 1413.19	178.08	2452638
 150.39	-162.12	2452638
 1524.33	494.37	2452638
-0.15	-241.22	2452638
-267.01	-3266.36	2452638
+156.67	-4626.56	2452638
 181.03	-207.24	2452638
 1971.35	-488.25	2452638
-1327.08	57.97	2452638
-156.67	-4626.56	2452638
+267.01	-3266.36	2452638
 317.87	-3775.38	2452638
-10171.1	660.48	2452638
 4133.98	-775.72	2452638
+4329.49	-4000.51	2452638
 PREHOOK: query: -- VECTORIZATION IS ENABLED
 
 create table ss_orc (
@@ -1245,17 +1249,17 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@ss_part_orc
 POSTHOOK: Input: default@ss_part_orc@ss_sold_date_sk=2452617
 #### A masked pattern was here ####
+10022.63	3952.8	2452617
+1765.07	-4648.8	2452617
 2.1	-2026.3	2452617
 2.99	-11.32	2452617
-85.8	25.61	2452617
-552.96	-1363.84	2452617
-565.92	196.48	2452617
-879.07	-2185.76	2452617
-1765.07	-4648.8	2452617
 3423.95	-3164.07	2452617
 5362.01	-600.28	2452617
+552.96	-1363.84	2452617
+565.92	196.48	2452617
 7412.83	2071.68	2452617
-10022.63	3952.8	2452617
+85.8	25.61	2452617
+879.07	-2185.76	2452617
 PREHOOK: query: desc formatted ss_part_orc partition(ss_sold_date_sk=2452638)
 PREHOOK: type: DESCTABLE
 PREHOOK: Input: default@ss_part_orc
@@ -1308,18 +1312,18 @@ POSTHOOK: Input: default@ss_part_orc
 POSTHOOK: Input: default@ss_part_orc@ss_sold_date_sk=2452638
 #### A masked pattern was here ####
 0.15	-241.22	2452638
+10171.1	660.48	2452638
+1327.08	57.97	2452638
+1413.19	178.08	2452638
 150.39	-162.12	2452638
+1524.33	494.37	2452638
 156.67	-4626.56	2452638
 181.03	-207.24	2452638
+1971.35	-488.25	2452638
 267.01	-3266.36	2452638
 317.87	-3775.38	2452638
-1327.08	57.97	2452638
-1413.19	178.08	2452638
-1524.33	494.37	2452638
-1971.35	-488.25	2452638
 4133.98	-775.72	2452638
 4329.49	-4000.51	2452638
-10171.1	660.48	2452638
 PREHOOK: query: explain insert overwrite table ss_part_orc partition (ss_sold_date_sk)
 select ss_net_paid_inc_tax,
   ss_net_profit,
@@ -1477,17 +1481,17 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@ss_part_orc
 POSTHOOK: Input: default@ss_part_orc@ss_sold_date_sk=2452617
 #### A masked pattern was here ####
+10022.63	3952.8	2452617
+1765.07	-4648.8	2452617
+2.1	-2026.3	2452617
+2.99	-11.32	2452617
 3423.95	-3164.07	2452617
 5362.01	-600.28	2452617
+552.96	-1363.84	2452617
 565.92	196.48	2452617
-85.8	25.61	2452617
 7412.83	2071.68	2452617
+85.8	25.61	2452617
 879.07	-2185.76	2452617
-1765.07	-4648.8	2452617
-552.96	-1363.84	2452617
-2.1	-2026.3	2452617
-10022.63	3952.8	2452617
-2.99	-11.32	2452617
 PREHOOK: query: desc formatted ss_part_orc partition(ss_sold_date_sk=2452638)
 PREHOOK: type: DESCTABLE
 PREHOOK: Input: default@ss_part_orc
@@ -1539,19 +1543,19 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@ss_part_orc
 POSTHOOK: Input: default@ss_part_orc@ss_sold_date_sk=2452638
 #### A masked pattern was here ####
-4329.49	-4000.51	2452638
+0.15	-241.22	2452638
+10171.1	660.48	2452638
+1327.08	57.97	2452638
 1413.19	178.08	2452638
 150.39	-162.12	2452638
 1524.33	494.37	2452638
-0.15	-241.22	2452638
-267.01	-3266.36	2452638
+156.67	-4626.56	2452638
 181.03	-207.24	2452638
 1971.35	-488.25	2452638
-1327.08	57.97	2452638
-156.67	-4626.56	2452638
+267.01	-3266.36	2452638
 317.87	-3775.38	2452638
-10171.1	660.48	2452638
 4133.98	-775.72	2452638
+4329.49	-4000.51	2452638
 PREHOOK: query: drop table ss_orc
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@ss_orc
@@ -1702,21 +1706,21 @@ POSTHOOK: Input: default@src
 POSTHOOK: Output: default@hive13_dp1@day=day
 POSTHOOK: Lineage: hive13_dp1 PARTITION(day=day).k1 EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), ]
 POSTHOOK: Lineage: hive13_dp1 PARTITION(day=day).k2 EXPRESSION [(src)src.FieldSchema(name:value, type:string, comment:default), ]
-PREHOOK: query: select * from hive13_dp1 limit 5
+PREHOOK: query: select * from hive13_dp1 order by k1, k2 limit 5
 PREHOOK: type: QUERY
 PREHOOK: Input: default@hive13_dp1
 PREHOOK: Input: default@hive13_dp1@day=day
 #### A masked pattern was here ####
-POSTHOOK: query: select * from hive13_dp1 limit 5
+POSTHOOK: query: select * from hive13_dp1 order by k1, k2 limit 5
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@hive13_dp1
 POSTHOOK: Input: default@hive13_dp1@day=day
 #### A masked pattern was here ####
 0	3	day
-10	1	day
-100	2	day
-103	2	day
-104	2	day
+2	1	day
+4	1	day
+5	3	day
+8	1	day
 PREHOOK: query: explain insert overwrite table `hive13_dp1` partition(`day`)
 select
     key k1,
@@ -1829,21 +1833,21 @@ POSTHOOK: Input: default@src
 POSTHOOK: Output: default@hive13_dp1@day=day
 POSTHOOK: Lineage: hive13_dp1 PARTITION(day=day).k1 EXPRESSION [(src)src.FieldSchema(name:key, type:string, comment:default), ]
 POSTHOOK: Lineage: hive13_dp1 PARTITION(day=day).k2 EXPRESSION [(src)src.FieldSchema(name:value, type:string, comment:default), ]
-PREHOOK: query: select * from hive13_dp1 limit 5
+PREHOOK: query: select * from hive13_dp1 order by k1, k2 limit 5
 PREHOOK: type: QUERY
 PREHOOK: Input: default@hive13_dp1
 PREHOOK: Input: default@hive13_dp1@day=day
 #### A masked pattern was here ####
-POSTHOOK: query: select * from hive13_dp1 limit 5
+POSTHOOK: query: select * from hive13_dp1 order by k1, k2 limit 5
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@hive13_dp1
 POSTHOOK: Input: default@hive13_dp1@day=day
 #### A masked pattern was here ####
 0	3	day
-10	1	day
-100	2	day
-103	2	day
-104	2	day
+2	1	day
+4	1	day
+5	3	day
+8	1	day
 PREHOOK: query: drop table hive13_dp1
 PREHOOK: type: DROPTABLE
 PREHOOK: Input: default@hive13_dp1

http://git-wip-us.apache.org/repos/asf/hive/blob/7a02f726/ql/src/test/results/clientpositive/tez/explainuser_2.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/explainuser_2.q.out b/ql/src/test/results/clientpositive/tez/explainuser_2.q.out
index 0511819..0340714 100644
--- a/ql/src/test/results/clientpositive/tez/explainuser_2.q.out
+++ b/ql/src/test/results/clientpositive/tez/explainuser_2.q.out
@@ -1,8 +1,12 @@
-PREHOOK: query: CREATE TABLE dest_j1(key STRING, value STRING, val2 STRING) STORED AS TEXTFILE
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+CREATE TABLE dest_j1(key STRING, value STRING, val2 STRING) STORED AS TEXTFILE
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@dest_j1
-POSTHOOK: query: CREATE TABLE dest_j1(key STRING, value STRING, val2 STRING) STORED AS TEXTFILE
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+CREATE TABLE dest_j1(key STRING, value STRING, val2 STRING) STORED AS TEXTFILE
 POSTHOOK: type: CREATETABLE
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@dest_j1


Mime
View raw message