http://git-wip-us.apache.org/repos/asf/hive/blob/63deec40/ql/src/test/results/clientpositive/tez/update_all_types.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/update_all_types.q.out 
b/ql/src/test/results/clientpositive/tez/update_all_types.q.out
index 38e0c27..ca098fb 100644
--- a/ql/src/test/results/clientpositive/tez/update_all_types.q.out
+++ b/ql/src/test/results/clientpositive/tez/update_all_types.q.out
@@ -1,4 +1,6 @@
-PREHOOK: query: create table acid_uat(ti tinyint,
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+create table acid_uat(ti tinyint,
                  si smallint,
                  i int,
                  j int,
@@ -15,7 +17,9 @@ PREHOOK: query: create table acid_uat(ti tinyint,
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default
 PREHOOK: Output: default@acid_uat
-POSTHOOK: query: create table acid_uat(ti tinyint,
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+create table acid_uat(ti tinyint,
                  si smallint,
                  i int,
                  j int,
@@ -92,16 +96,16 @@ POSTHOOK: query: select * from acid_uat order by i
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@acid_uat
 #### A masked pattern was here ####
-11     NULL    -1073279343     -1073279343     -1595604468     11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    oj1YrV5Wa       oj1YrV5Wa       
P76636jJ6qM17d7DIy                      true
-NULL   -7382   -1073051226     -1073051226     -1887561756     NULL    -7382.0 
NULL    NULL    1969-12-31      A34p7oRr2WvUJNf A34p7oRr2WvUJNf 
4hA4KQj2vD3fI6gX82220d                  false
-11     NULL    -1072910839     -1072910839     2048385991      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    0iqrc5  0iqrc5  KbaDXiN85adbHRx58v      
                false
-NULL   8373    -1072081801     -1072081801     1864027286      NULL    8373.0  
NULL    NULL    1969-12-31      dPkN74F7        dPkN74F7        
4KWs6gw7lv2WYd66P                       true
-NULL   -5470   -1072076362     -1072076362     1864027286      NULL    -5470.0 
NULL    NULL    1969-12-31      2uLyD28144vklju213J1mr  2uLyD28144vklju213J1mr  
4KWs6gw7lv2WYd66P                       true
 -51    NULL    -1071480828     -1071480828     -1401575336     -51.0   NULL    
-51     1969-12-31 16:00:08.451 NULL    aw724t8c5558x2xneC624   
aw724t8c5558x2xneC624   4uE7l74tESBiKfu7c8wM7GA                 true
+11     NULL    -1069736047     -1069736047     -453772520      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    k17Am8uPHWk02cEf1jet    
k17Am8uPHWk02cEf1jet    qrXLLNX1                                true
+11     NULL    -1072910839     -1072910839     2048385991      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    0iqrc5  0iqrc5  KbaDXiN85adbHRx58v      
                false
+11     NULL    -1073279343     -1073279343     -1595604468     11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    oj1YrV5Wa       oj1YrV5Wa       
P76636jJ6qM17d7DIy                      true
 8      NULL    -1071363017     -1071363017     1349676361      8.0     NULL    
8       1969-12-31 16:00:15.892 NULL    Anj0oF  Anj0oF  IwE1G7Qb0B1NEfV030g     
                true
+NULL   -5470   -1072076362     -1072076362     1864027286      NULL    -5470.0 
NULL    NULL    1969-12-31      2uLyD28144vklju213J1mr  2uLyD28144vklju213J1mr  
4KWs6gw7lv2WYd66P                       true
+NULL   -7382   -1073051226     -1073051226     -1887561756     NULL    -7382.0 
NULL    NULL    1969-12-31      A34p7oRr2WvUJNf A34p7oRr2WvUJNf 
4hA4KQj2vD3fI6gX82220d                  false
 NULL   -741    -1070883071     -1070883071     -1645852809     NULL    -741.0  
NULL    NULL    1969-12-31      0ruyd6Y50JpdGRf6HqD     0ruyd6Y50JpdGRf6HqD     
xH7445Rals48VOulSyR5F                   false
 NULL   -947    -1070551679     -1070551679     1864027286      NULL    -947.0  
NULL    NULL    1969-12-31      iUR3Q   iUR3Q   4KWs6gw7lv2WYd66P               
        false
-11     NULL    -1069736047     -1069736047     -453772520      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    k17Am8uPHWk02cEf1jet    
k17Am8uPHWk02cEf1jet    qrXLLNX1                                true
+NULL   8373    -1072081801     -1072081801     1864027286      NULL    8373.0  
NULL    NULL    1969-12-31      dPkN74F7        dPkN74F7        
4KWs6gw7lv2WYd66P                       true
 PREHOOK: query: update acid_uat set
     ti = 1,
     si = 2,
@@ -146,16 +150,16 @@ POSTHOOK: query: select * from acid_uat order by i
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@acid_uat
 #### A masked pattern was here ####
-11     NULL    -1073279343     -1073279343     -1595604468     11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    oj1YrV5Wa       oj1YrV5Wa       
P76636jJ6qM17d7DIy                      true
-NULL   -7382   -1073051226     -1073051226     -1887561756     NULL    -7382.0 
NULL    NULL    1969-12-31      A34p7oRr2WvUJNf A34p7oRr2WvUJNf 
4hA4KQj2vD3fI6gX82220d                  false
-11     NULL    -1072910839     -1072910839     2048385991      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    0iqrc5  0iqrc5  KbaDXiN85adbHRx58v      
                false
-NULL   8373    -1072081801     -1072081801     1864027286      NULL    8373.0  
NULL    NULL    1969-12-31      dPkN74F7        dPkN74F7        
4KWs6gw7lv2WYd66P                       true
-NULL   -5470   -1072076362     -1072076362     1864027286      NULL    -5470.0 
NULL    NULL    1969-12-31      2uLyD28144vklju213J1mr  2uLyD28144vklju213J1mr  
4KWs6gw7lv2WYd66P                       true
 -51    NULL    -1071480828     -1071480828     -1401575336     -51.0   NULL    
-51     1969-12-31 16:00:08.451 NULL    aw724t8c5558x2xneC624   
aw724t8c5558x2xneC624   4uE7l74tESBiKfu7c8wM7GA                 true
-8      NULL    -1071363017     -1071363017     1349676361      8.0     NULL    
8       1969-12-31 16:00:15.892 NULL    Anj0oF  Anj0oF  IwE1G7Qb0B1NEfV030g     
                true
 1      2       -1070883071     3       4       3.14    6.28    5.99    NULL    
2014-09-01      its a beautiful day in the neighbhorhood        a beautiful day 
for a neighbor  wont you be mine                        true
-NULL   -947    -1070551679     -1070551679     1864027286      NULL    -947.0  
NULL    NULL    1969-12-31      iUR3Q   iUR3Q   4KWs6gw7lv2WYd66P               
        false
 11     NULL    -1069736047     -1069736047     -453772520      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    k17Am8uPHWk02cEf1jet    
k17Am8uPHWk02cEf1jet    qrXLLNX1                                true
+11     NULL    -1072910839     -1072910839     2048385991      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    0iqrc5  0iqrc5  KbaDXiN85adbHRx58v      
                false
+11     NULL    -1073279343     -1073279343     -1595604468     11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    oj1YrV5Wa       oj1YrV5Wa       
P76636jJ6qM17d7DIy                      true
+8      NULL    -1071363017     -1071363017     1349676361      8.0     NULL    
8       1969-12-31 16:00:15.892 NULL    Anj0oF  Anj0oF  IwE1G7Qb0B1NEfV030g     
                true
+NULL   -5470   -1072076362     -1072076362     1864027286      NULL    -5470.0 
NULL    NULL    1969-12-31      2uLyD28144vklju213J1mr  2uLyD28144vklju213J1mr  
4KWs6gw7lv2WYd66P                       true
+NULL   -7382   -1073051226     -1073051226     -1887561756     NULL    -7382.0 
NULL    NULL    1969-12-31      A34p7oRr2WvUJNf A34p7oRr2WvUJNf 
4hA4KQj2vD3fI6gX82220d                  false
+NULL   -947    -1070551679     -1070551679     1864027286      NULL    -947.0  
NULL    NULL    1969-12-31      iUR3Q   iUR3Q   4KWs6gw7lv2WYd66P               
        false
+NULL   8373    -1072081801     -1072081801     1864027286      NULL    8373.0  
NULL    NULL    1969-12-31      dPkN74F7        dPkN74F7        
4KWs6gw7lv2WYd66P                       true
 PREHOOK: query: update acid_uat set
   ti = ti * 2,
   si = cast(f as int),
@@ -180,13 +184,13 @@ POSTHOOK: query: select * from acid_uat order by i
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@acid_uat
 #### A masked pattern was here ####
-11     NULL    -1073279343     -1073279343     -1595604468     11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    oj1YrV5Wa       oj1YrV5Wa       
P76636jJ6qM17d7DIy                      true
-NULL   -7382   -1073051226     -1073051226     -1887561756     NULL    -7382.0 
NULL    NULL    1969-12-31      A34p7oRr2WvUJNf A34p7oRr2WvUJNf 
4hA4KQj2vD3fI6gX82220d                  false
-11     NULL    -1072910839     -1072910839     2048385991      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    0iqrc5  0iqrc5  KbaDXiN85adbHRx58v      
                false
-NULL   8373    -1072081801     -1072081801     1864027286      NULL    8373.0  
NULL    NULL    1969-12-31      dPkN74F7        dPkN74F7        
4KWs6gw7lv2WYd66P                       true
-NULL   -5470   -1072076362     -1072076362     1864027286      NULL    -5470.0 
NULL    NULL    1969-12-31      2uLyD28144vklju213J1mr  2uLyD28144vklju213J1mr  
4KWs6gw7lv2WYd66P                       true
 -102   -51     -1071480828     -1071480828     -1401575336     -51.0   -51.0   
-51     1969-12-31 16:00:08.451 NULL    aw724t8c5558x2xneC624   
aw724t8c5558x2xneC624   4uE7l74tESBiKfu7c8wM7GA                 true
-8      NULL    -1071363017     -1071363017     1349676361      8.0     NULL    
8       1969-12-31 16:00:15.892 NULL    Anj0oF  Anj0oF  IwE1G7Qb0B1NEfV030g     
                true
 1      2       -1070883071     3       4       3.14    6.28    5.99    NULL    
2014-09-01      its a beautiful day in the neighbhorhood        a beautiful day 
for a neighbor  wont you be mine                        true
-NULL   -947    -1070551679     -1070551679     1864027286      NULL    -947.0  
NULL    NULL    1969-12-31      iUR3Q   iUR3Q   4KWs6gw7lv2WYd66P               
        false
 11     NULL    -1069736047     -1069736047     -453772520      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    k17Am8uPHWk02cEf1jet    
k17Am8uPHWk02cEf1jet    qrXLLNX1                                true
+11     NULL    -1072910839     -1072910839     2048385991      11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    0iqrc5  0iqrc5  KbaDXiN85adbHRx58v      
                false
+11     NULL    -1073279343     -1073279343     -1595604468     11.0    NULL    
11      1969-12-31 16:00:02.351 NULL    oj1YrV5Wa       oj1YrV5Wa       
P76636jJ6qM17d7DIy                      true
+8      NULL    -1071363017     -1071363017     1349676361      8.0     NULL    
8       1969-12-31 16:00:15.892 NULL    Anj0oF  Anj0oF  IwE1G7Qb0B1NEfV030g     
                true
+NULL   -5470   -1072076362     -1072076362     1864027286      NULL    -5470.0 
NULL    NULL    1969-12-31      2uLyD28144vklju213J1mr  2uLyD28144vklju213J1mr  
4KWs6gw7lv2WYd66P                       true
+NULL   -7382   -1073051226     -1073051226     -1887561756     NULL    -7382.0 
NULL    NULL    1969-12-31      A34p7oRr2WvUJNf A34p7oRr2WvUJNf 
4hA4KQj2vD3fI6gX82220d                  false
+NULL   -947    -1070551679     -1070551679     1864027286      NULL    -947.0  
NULL    NULL    1969-12-31      iUR3Q   iUR3Q   4KWs6gw7lv2WYd66P               
        false
+NULL   8373    -1072081801     -1072081801     1864027286      NULL    8373.0  
NULL    NULL    1969-12-31      dPkN74F7        dPkN74F7        
4KWs6gw7lv2WYd66P                       true

http://git-wip-us.apache.org/repos/asf/hive/blob/63deec40/ql/src/test/results/clientpositive/tez/update_orig_table.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/update_orig_table.q.out 
b/ql/src/test/results/clientpositive/tez/update_orig_table.q.out
index de7dc86..66533e1 100644
--- a/ql/src/test/results/clientpositive/tez/update_orig_table.q.out
+++ b/ql/src/test/results/clientpositive/tez/update_orig_table.q.out
@@ -1,4 +1,6 @@
-PREHOOK: query: create table acid_uot(
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+create table acid_uot(
     ctinyint TINYINT,
     csmallint SMALLINT,
     cint INT,
@@ -15,7 +17,9 @@ PREHOOK: type: CREATETABLE
 #### A masked pattern was here ####
 PREHOOK: Output: database:default
 PREHOOK: Output: default@acid_uot
-POSTHOOK: query: create table acid_uot(
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+create table acid_uot(
     ctinyint TINYINT,
     csmallint SMALLINT,
     cint INT,
@@ -49,11 +53,10 @@ POSTHOOK: type: QUERY
 POSTHOOK: Input: default@acid_uot
 #### A masked pattern was here ####
 -51    NULL    -1071480828     -1401575336     -51.0   NULL    fred    
4uE7l74tESBiKfu7c8wM7GA 1969-12-31 16:00:08.451 NULL    true    true
-NULL   -5470   -1072076362     1864027286      NULL    -5470.0 fred    
4KWs6gw7lv2WYd66P       NULL    1969-12-31 16:00:01.836 true    true
-NULL   8373    -1072081801     1864027286      NULL    8373.0  fred    
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:56.465 true    true
+11     NULL    -1072910839     2048385991      11.0    NULL    fred    
KbaDXiN85adbHRx58v      1969-12-31 16:00:02.351 NULL    false   false
+11     NULL    -1073279343     -1595604468     11.0    NULL    fred    
P76636jJ6qM17d7DIy      1969-12-31 16:00:02.351 NULL    true    true
 8      NULL    -1071363017     1349676361      8.0     NULL    fred    
IwE1G7Qb0B1NEfV030g     1969-12-31 16:00:15.892 NULL    true    true
+NULL   -5470   -1072076362     1864027286      NULL    -5470.0 fred    
4KWs6gw7lv2WYd66P       NULL    1969-12-31 16:00:01.836 true    true
 NULL   -7382   -1073051226     -1887561756     NULL    -7382.0 fred    
4hA4KQj2vD3fI6gX82220d  NULL    1969-12-31 16:00:10.331 false   false
-11     NULL    -1073279343     -1595604468     11.0    NULL    fred    
P76636jJ6qM17d7DIy      1969-12-31 16:00:02.351 NULL    true    true
-11     NULL    -1072910839     2048385991      11.0    NULL    fred    
KbaDXiN85adbHRx58v      1969-12-31 16:00:02.351 NULL    false   false
 NULL   -741    -1070883071     -1645852809     NULL    -741.0  fred    
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:51.293 false   false
-#### A masked pattern was here ####
+NULL   8373    -1072081801     1864027286      NULL    8373.0  fred    
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:56.465 true    true

http://git-wip-us.apache.org/repos/asf/hive/blob/63deec40/ql/src/test/results/clientpositive/tez/vector_coalesce.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/vector_coalesce.q.out 
b/ql/src/test/results/clientpositive/tez/vector_coalesce.q.out
index c787ce9..1e01ab5 100644
--- a/ql/src/test/results/clientpositive/tez/vector_coalesce.q.out
+++ b/ql/src/test/results/clientpositive/tez/vector_coalesce.q.out
@@ -1,137 +1,264 @@
-PREHOOK: query: EXPLAIN SELECT cdouble, cstring1, cint, cfloat, csmallint, 
coalesce(cdouble, cstring1, cint, cfloat, csmallint) 
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+EXPLAIN SELECT cdouble, cstring1, cint, cfloat, csmallint, coalesce(cdouble, 
cstring1, cint, cfloat, csmallint) as c
 FROM alltypesorc
-WHERE (cdouble IS NULL) LIMIT 10
+WHERE (cdouble IS NULL)
+ORDER BY cdouble, cstring1, cint, cfloat, csmallint, c
+LIMIT 10
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN SELECT cdouble, cstring1, cint, cfloat, csmallint, 
coalesce(cdouble, cstring1, cint, cfloat, csmallint) 
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+EXPLAIN SELECT cdouble, cstring1, cint, cfloat, csmallint, coalesce(cdouble, 
cstring1, cint, cfloat, csmallint) as c
 FROM alltypesorc
-WHERE (cdouble IS NULL) LIMIT 10
+WHERE (cdouble IS NULL)
+ORDER BY cdouble, cstring1, cint, cfloat, csmallint, c
+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
+    Tez
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: alltypesorc
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: cdouble is null (type: boolean)
+                    Statistics: Num rows: 6144 Data size: 1320982 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cstring1 (type: string), cint (type: int), 
cfloat (type: float), csmallint (type: smallint), 
COALESCE(null,cstring1,cint,cfloat,csmallint) (type: string)
+                      outputColumnNames: _col1, _col2, _col3, _col4, _col5
+                      Statistics: Num rows: 6144 Data size: 1320982 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: null (type: double), _col1 (type: 
string), _col2 (type: int), _col3 (type: float), _col4 (type: smallint), _col5 
(type: string)
+                        sort order: ++++++
+                        Statistics: Num rows: 6144 Data size: 1320982 Basic 
stats: COMPLETE Column stats: NONE
+            Execution mode: vectorized
+        Reducer 2 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: null (type: double), KEY.reducesinkkey1 (type: 
string), KEY.reducesinkkey2 (type: int), KEY.reducesinkkey3 (type: float), 
KEY.reducesinkkey4 (type: smallint), KEY.reducesinkkey5 (type: string)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
+                Statistics: Num rows: 6144 Data size: 1320982 Basic stats: 
COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 10
+                  Statistics: Num rows: 10 Data size: 2150 Basic stats: 
COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 2150 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
+            Execution mode: vectorized
+
   Stage: Stage-0
     Fetch Operator
       limit: 10
       Processor Tree:
-        TableScan
-          alias: alltypesorc
-          Filter Operator
-            predicate: cdouble is null (type: boolean)
-            Select Operator
-              expressions: null (type: double), cstring1 (type: string), cint 
(type: int), cfloat (type: float), csmallint (type: smallint), 
COALESCE(null,cstring1,cint,cfloat,csmallint) (type: string)
-              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5
-              Limit
-                Number of rows: 10
-                ListSink
+        ListSink
 
-PREHOOK: query: SELECT cdouble, cstring1, cint, cfloat, csmallint, 
coalesce(cdouble, cstring1, cint, cfloat, csmallint) 
+PREHOOK: query: SELECT cdouble, cstring1, cint, cfloat, csmallint, 
coalesce(cdouble, cstring1, cint, cfloat, csmallint) as c 
 FROM alltypesorc
-WHERE (cdouble IS NULL) LIMIT 10
+WHERE (cdouble IS NULL)
+ORDER BY cdouble, cstring1, cint, cfloat, csmallint, c
+LIMIT 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT cdouble, cstring1, cint, cfloat, csmallint, 
coalesce(cdouble, cstring1, cint, cfloat, csmallint) 
+POSTHOOK: query: SELECT cdouble, cstring1, cint, cfloat, csmallint, 
coalesce(cdouble, cstring1, cint, cfloat, csmallint) as c 
 FROM alltypesorc
-WHERE (cdouble IS NULL) LIMIT 10
+WHERE (cdouble IS NULL)
+ORDER BY cdouble, cstring1, cint, cfloat, csmallint, c
+LIMIT 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-NULL   LFgU5WT87C2yJ4W4YU0r8Pp -285355633      -51.0   NULL    
LFgU5WT87C2yJ4W4YU0r8Pp
-NULL   75bFXC7TqGo1SEaYAx4C58m NULL    -51.0   NULL    75bFXC7TqGo1SEaYAx4C58m
-NULL   v3p153e2bSkGS70v04G     354670578       -51.0   NULL    
v3p153e2bSkGS70v04G
-NULL   0pOH7A4O8aQ37NuBqn      951003458       -51.0   NULL    
0pOH7A4O8aQ37NuBqn
-NULL   8ShAFcD734S8Q26WjMwpq0Q 164554497       -51.0   NULL    
8ShAFcD734S8Q26WjMwpq0Q
-NULL   nOF31ehjY7ULCHMf        455419170       -51.0   NULL    nOF31ehjY7ULCHMf
-NULL   t32s57Cjt4a250qQgVNAB5T -109813638      -51.0   NULL    
t32s57Cjt4a250qQgVNAB5T
-NULL   nvO822k30OaH37Il        665801232       -51.0   NULL    nvO822k30OaH37Il
-NULL   M152O   -601502867      -51.0   NULL    M152O
-NULL   FgJ7Hft6845s1766oyt82q  199879534       -51.0   NULL    
FgJ7Hft6845s1766oyt82q
-PREHOOK: query: EXPLAIN SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, 
(cdouble+log2(cint)), 0) 
+NULL   NULL    -413196097      -51.0   NULL    -413196097
+NULL   NULL    -413553449      11.0    NULL    -413553449
+NULL   NULL    -457224565      11.0    NULL    -457224565
+NULL   NULL    -591488718      -51.0   NULL    -591488718
+NULL   NULL    -656987896      8.0     NULL    -656987896
+NULL   NULL    -670908417      8.0     NULL    -670908417
+NULL   NULL    -738306196      -51.0   NULL    -738306196
+NULL   NULL    -819152895      8.0     NULL    -819152895
+NULL   NULL    -827212561      8.0     NULL    -827212561
+NULL   NULL    -949587513      11.0    NULL    -949587513
+PREHOOK: query: EXPLAIN SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, 
(cdouble+log2(cint)), 0) as c
 FROM alltypesorc
-WHERE (ctinyint IS NULL) LIMIT 10
+WHERE (ctinyint IS NULL)
+ORDER BY ctinyint, cdouble, cint, c
+LIMIT 10
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, 
(cdouble+log2(cint)), 0) 
+POSTHOOK: query: EXPLAIN SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, 
(cdouble+log2(cint)), 0) as c
 FROM alltypesorc
-WHERE (ctinyint IS NULL) LIMIT 10
+WHERE (ctinyint IS NULL)
+ORDER BY ctinyint, cdouble, cint, c
+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
+    Tez
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: alltypesorc
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ctinyint is null (type: boolean)
+                    Statistics: Num rows: 6144 Data size: 1320982 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cdouble (type: double), cint (type: int), 
COALESCE(null,(cdouble + log2(cint)),0) (type: double)
+                      outputColumnNames: _col1, _col2, _col3
+                      Statistics: Num rows: 6144 Data size: 1320982 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: null (type: tinyint), _col1 (type: 
double), _col2 (type: int), _col3 (type: double)
+                        sort order: ++++
+                        Statistics: Num rows: 6144 Data size: 1320982 Basic 
stats: COMPLETE Column stats: NONE
+            Execution mode: vectorized
+        Reducer 2 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: null (type: tinyint), KEY.reducesinkkey1 (type: 
double), KEY.reducesinkkey2 (type: int), KEY.reducesinkkey3 (type: double)
+                outputColumnNames: _col0, _col1, _col2, _col3
+                Statistics: Num rows: 6144 Data size: 1320982 Basic stats: 
COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 10
+                  Statistics: Num rows: 10 Data size: 2150 Basic stats: 
COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 2150 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
+            Execution mode: vectorized
+
   Stage: Stage-0
     Fetch Operator
       limit: 10
       Processor Tree:
-        TableScan
-          alias: alltypesorc
-          Filter Operator
-            predicate: ctinyint is null (type: boolean)
-            Select Operator
-              expressions: null (type: tinyint), cdouble (type: double), cint 
(type: int), COALESCE(null,(cdouble + log2(cint)),0) (type: double)
-              outputColumnNames: _col0, _col1, _col2, _col3
-              Limit
-                Number of rows: 10
-                ListSink
+        ListSink
 
-PREHOOK: query: SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, 
(cdouble+log2(cint)), 0) 
+PREHOOK: query: SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, 
(cdouble+log2(cint)), 0) as c
 FROM alltypesorc
-WHERE (ctinyint IS NULL) LIMIT 10
+WHERE (ctinyint IS NULL)
+ORDER BY ctinyint, cdouble, cint, c
+LIMIT 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, 
(cdouble+log2(cint)), 0) 
+POSTHOOK: query: SELECT ctinyint, cdouble, cint, coalesce(ctinyint+10, 
(cdouble+log2(cint)), 0) as c
 FROM alltypesorc
-WHERE (ctinyint IS NULL) LIMIT 10
+WHERE (ctinyint IS NULL)
+ORDER BY ctinyint, cdouble, cint, c
+LIMIT 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-NULL   -4213.0 528534767       -4184.022576865738
-NULL   -3012.0 528534767       -2983.0225768657383
-NULL   -4016.0 528534767       -3987.0225768657383
-NULL   -11534.0        528534767       -11505.022576865738
-NULL   -6147.0 528534767       -6118.022576865738
-NULL   -7680.0 528534767       -7651.022576865738
-NULL   -7314.0 528534767       -7285.022576865738
-NULL   11254.0 528534767       11282.977423134262
-NULL   13889.0 528534767       13917.977423134262
-NULL   3321.0  528534767       3349.9774231342617
-PREHOOK: query: EXPLAIN SELECT cfloat, cbigint, coalesce(cfloat, cbigint, 0) 
+NULL   NULL    -1015272448     0.0
+NULL   NULL    -609074876      0.0
+NULL   NULL    -700300206      0.0
+NULL   NULL    -726473298      0.0
+NULL   NULL    -738747840      0.0
+NULL   NULL    -838810013      0.0
+NULL   NULL    -850295959      0.0
+NULL   NULL    -886426182      0.0
+NULL   NULL    -899422227      0.0
+NULL   NULL    -971543377      0.0
+PREHOOK: query: EXPLAIN SELECT cfloat, cbigint, coalesce(cfloat, cbigint, 0) 
as c
 FROM alltypesorc
-WHERE (cfloat IS NULL AND cbigint IS NULL) LIMIT 10
+WHERE (cfloat IS NULL AND cbigint IS NULL)
+ORDER BY cfloat, cbigint, c
+LIMIT 10
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN SELECT cfloat, cbigint, coalesce(cfloat, cbigint, 0) 
+POSTHOOK: query: EXPLAIN SELECT cfloat, cbigint, coalesce(cfloat, cbigint, 0) 
as c
 FROM alltypesorc
-WHERE (cfloat IS NULL AND cbigint IS NULL) LIMIT 10
+WHERE (cfloat IS NULL AND cbigint IS NULL)
+ORDER BY cfloat, cbigint, c
+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
+    Tez
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: alltypesorc
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (cfloat is null and cbigint is null) (type: 
boolean)
+                    Statistics: Num rows: 3072 Data size: 660491 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: 0.0 (type: float)
+                      outputColumnNames: _col2
+                      Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: null (type: float), null (type: 
bigint), _col2 (type: float)
+                        sort order: +++
+                        Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+            Execution mode: vectorized
+        Reducer 2 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: null (type: float), null (type: bigint), 
KEY.reducesinkkey2 (type: float)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 3072 Data size: 660491 Basic stats: 
COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 10
+                  Statistics: Num rows: 10 Data size: 2150 Basic stats: 
COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 2150 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
+            Execution mode: vectorized
+
   Stage: Stage-0
     Fetch Operator
       limit: 10
       Processor Tree:
-        TableScan
-          alias: alltypesorc
-          Filter Operator
-            predicate: (cfloat is null and cbigint is null) (type: boolean)
-            Select Operator
-              expressions: null (type: float), null (type: bigint), 0.0 (type: 
float)
-              outputColumnNames: _col0, _col1, _col2
-              Limit
-                Number of rows: 10
-                ListSink
+        ListSink
 
-PREHOOK: query: SELECT cfloat, cbigint, coalesce(cfloat, cbigint, 0) 
+PREHOOK: query: SELECT cfloat, cbigint, coalesce(cfloat, cbigint, 0) as c
 FROM alltypesorc
-WHERE (cfloat IS NULL AND cbigint IS NULL) LIMIT 10
+WHERE (cfloat IS NULL AND cbigint IS NULL)
+ORDER BY cfloat, cbigint, c
+LIMIT 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT cfloat, cbigint, coalesce(cfloat, cbigint, 0) 
+POSTHOOK: query: SELECT cfloat, cbigint, coalesce(cfloat, cbigint, 0) as c
 FROM alltypesorc
-WHERE (cfloat IS NULL AND cbigint IS NULL) LIMIT 10
+WHERE (cfloat IS NULL AND cbigint IS NULL)
+ORDER BY cfloat, cbigint, c
+LIMIT 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
@@ -145,52 +272,93 @@ NULL      NULL    0.0
 NULL   NULL    0.0
 NULL   NULL    0.0
 NULL   NULL    0.0
-PREHOOK: query: EXPLAIN SELECT ctimestamp1, ctimestamp2, coalesce(ctimestamp1, 
ctimestamp2) 
+PREHOOK: query: EXPLAIN SELECT ctimestamp1, ctimestamp2, coalesce(ctimestamp1, 
ctimestamp2) as c
 FROM alltypesorc 
-WHERE ctimestamp1 IS NOT NULL OR ctimestamp2 IS NOT NULL LIMIT 10
+WHERE ctimestamp1 IS NOT NULL OR ctimestamp2 IS NOT NULL
+ORDER BY ctimestamp1, ctimestamp2, c
+LIMIT 10
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN SELECT ctimestamp1, ctimestamp2, 
coalesce(ctimestamp1, ctimestamp2) 
+POSTHOOK: query: EXPLAIN SELECT ctimestamp1, ctimestamp2, 
coalesce(ctimestamp1, ctimestamp2) as c
 FROM alltypesorc 
-WHERE ctimestamp1 IS NOT NULL OR ctimestamp2 IS NOT NULL LIMIT 10
+WHERE ctimestamp1 IS NOT NULL OR ctimestamp2 IS NOT NULL
+ORDER BY ctimestamp1, ctimestamp2, c
+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
+    Tez
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: alltypesorc
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (ctimestamp1 is not null or ctimestamp2 is not 
null) (type: boolean)
+                    Statistics: Num rows: 12288 Data size: 2641964 Basic 
stats: COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ctimestamp1 (type: timestamp), ctimestamp2 
(type: timestamp), COALESCE(ctimestamp1,ctimestamp2) (type: timestamp)
+                      outputColumnNames: _col0, _col1, _col2
+                      Statistics: Num rows: 12288 Data size: 2641964 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: timestamp), _col1 (type: 
timestamp), _col2 (type: timestamp)
+                        sort order: +++
+                        Statistics: Num rows: 12288 Data size: 2641964 Basic 
stats: COMPLETE Column stats: NONE
+            Execution mode: vectorized
+        Reducer 2 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: timestamp), 
KEY.reducesinkkey1 (type: timestamp), KEY.reducesinkkey2 (type: timestamp)
+                outputColumnNames: _col0, _col1, _col2
+                Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 10
+                  Statistics: Num rows: 10 Data size: 2150 Basic stats: 
COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 2150 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
+            Execution mode: vectorized
+
   Stage: Stage-0
     Fetch Operator
       limit: 10
       Processor Tree:
-        TableScan
-          alias: alltypesorc
-          Filter Operator
-            predicate: (ctimestamp1 is not null or ctimestamp2 is not null) 
(type: boolean)
-            Select Operator
-              expressions: ctimestamp1 (type: timestamp), ctimestamp2 (type: 
timestamp), COALESCE(ctimestamp1,ctimestamp2) (type: timestamp)
-              outputColumnNames: _col0, _col1, _col2
-              Limit
-                Number of rows: 10
-                ListSink
+        ListSink
 
-PREHOOK: query: SELECT ctimestamp1, ctimestamp2, coalesce(ctimestamp1, 
ctimestamp2) 
+PREHOOK: query: SELECT ctimestamp1, ctimestamp2, coalesce(ctimestamp1, 
ctimestamp2) as c
 FROM alltypesorc 
-WHERE ctimestamp1 IS NOT NULL OR ctimestamp2 IS NOT NULL LIMIT 10
+WHERE ctimestamp1 IS NOT NULL OR ctimestamp2 IS NOT NULL
+ORDER BY ctimestamp1, ctimestamp2, c
+LIMIT 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT ctimestamp1, ctimestamp2, coalesce(ctimestamp1, 
ctimestamp2) 
+POSTHOOK: query: SELECT ctimestamp1, ctimestamp2, coalesce(ctimestamp1, 
ctimestamp2) as c
 FROM alltypesorc 
-WHERE ctimestamp1 IS NOT NULL OR ctimestamp2 IS NOT NULL LIMIT 10
+WHERE ctimestamp1 IS NOT NULL OR ctimestamp2 IS NOT NULL
+ORDER BY ctimestamp1, ctimestamp2, c
+LIMIT 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-1969-12-31 15:59:46.674        1969-12-31 16:00:08.875 1969-12-31 15:59:46.674
-NULL   1969-12-31 16:00:13.589 1969-12-31 16:00:13.589
-1969-12-31 15:59:55.787        1969-12-31 16:00:01.546 1969-12-31 15:59:55.787
-1969-12-31 15:59:44.187        1969-12-31 16:00:06.961 1969-12-31 15:59:44.187
-1969-12-31 15:59:50.434        1969-12-31 16:00:13.352 1969-12-31 15:59:50.434
-1969-12-31 16:00:15.007        1969-12-31 16:00:15.148 1969-12-31 16:00:15.007
-1969-12-31 16:00:07.021        1969-12-31 16:00:02.997 1969-12-31 16:00:07.021
-1969-12-31 16:00:04.963        1969-12-31 15:59:56.474 1969-12-31 16:00:04.963
-1969-12-31 15:59:52.176        1969-12-31 16:00:07.787 1969-12-31 15:59:52.176
-1969-12-31 15:59:44.569        1969-12-31 15:59:51.665 1969-12-31 15:59:44.569
+NULL   1969-12-31 15:59:30.929 1969-12-31 15:59:30.929
+NULL   1969-12-31 15:59:30.929 1969-12-31 15:59:30.929
+NULL   1969-12-31 15:59:30.929 1969-12-31 15:59:30.929
+NULL   1969-12-31 15:59:43.63  1969-12-31 15:59:43.63
+NULL   1969-12-31 15:59:43.658 1969-12-31 15:59:43.658
+NULL   1969-12-31 15:59:43.672 1969-12-31 15:59:43.672
+NULL   1969-12-31 15:59:43.684 1969-12-31 15:59:43.684
+NULL   1969-12-31 15:59:43.703 1969-12-31 15:59:43.703
+NULL   1969-12-31 15:59:43.704 1969-12-31 15:59:43.704
+NULL   1969-12-31 15:59:43.709 1969-12-31 15:59:43.709

http://git-wip-us.apache.org/repos/asf/hive/blob/63deec40/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out 
b/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out
index b834985..448532a 100644
--- a/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out
+++ b/ql/src/test/results/clientpositive/tez/vector_decimal_expressions.q.out
@@ -1,51 +1,96 @@
-PREHOOK: query: CREATE TABLE decimal_test STORED AS ORC AS SELECT cdouble, 
CAST (((cdouble*22.1)/37) AS DECIMAL(20,10)) AS cdecimal1, CAST 
(((cdouble*9.3)/13) AS DECIMAL(23,14)) AS cdecimal2 FROM alltypesorc
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+CREATE TABLE decimal_test STORED AS ORC AS SELECT cdouble, CAST 
(((cdouble*22.1)/37) AS DECIMAL(20,10)) AS cdecimal1, CAST (((cdouble*9.3)/13) 
AS DECIMAL(23,14)) AS cdecimal2 FROM alltypesorc
 PREHOOK: type: CREATETABLE_AS_SELECT
 PREHOOK: Input: default@alltypesorc
 PREHOOK: Output: database:default
 PREHOOK: Output: default@decimal_test
-POSTHOOK: query: CREATE TABLE decimal_test STORED AS ORC AS SELECT cdouble, 
CAST (((cdouble*22.1)/37) AS DECIMAL(20,10)) AS cdecimal1, CAST 
(((cdouble*9.3)/13) AS DECIMAL(23,14)) AS cdecimal2 FROM alltypesorc
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+CREATE TABLE decimal_test STORED AS ORC AS SELECT cdouble, CAST 
(((cdouble*22.1)/37) AS DECIMAL(20,10)) AS cdecimal1, CAST (((cdouble*9.3)/13) 
AS DECIMAL(23,14)) AS cdecimal2 FROM alltypesorc
 POSTHOOK: type: CREATETABLE_AS_SELECT
 POSTHOOK: Input: default@alltypesorc
 POSTHOOK: Output: database:default
 POSTHOOK: Output: default@decimal_test
-PREHOOK: query: EXPLAIN SELECT cdecimal1 + cdecimal2, cdecimal1 - 
(2*cdecimal2), ((cdecimal1+2.34)/cdecimal2), (cdecimal1 * (cdecimal2/3.4)), 
cdecimal1 % 10, CAST(cdecimal1 AS INT), CAST(cdecimal2 AS SMALLINT), 
CAST(cdecimal2 AS TINYINT), CAST(cdecimal1 AS BIGINT), CAST (cdecimal1 AS 
BOOLEAN), CAST(cdecimal2 AS DOUBLE), CAST(cdecimal1 AS FLOAT), CAST(cdecimal2 
AS STRING), CAST(cdecimal1 AS TIMESTAMP) FROM decimal_test WHERE cdecimal1 > 0 
AND cdecimal1 < 12345.5678 AND cdecimal2 != 0 AND cdecimal2 > 1000 AND cdouble 
IS NOT NULL LIMIT 10
+PREHOOK: query: EXPLAIN SELECT cdecimal1 + cdecimal2 as c1, cdecimal1 - 
(2*cdecimal2) as c2, ((cdecimal1+2.34)/cdecimal2) as c3, (cdecimal1 * 
(cdecimal2/3.4)) as c4, cdecimal1 % 10 as c5, CAST(cdecimal1 AS INT) as c6, 
CAST(cdecimal2 AS SMALLINT) as c7, CAST(cdecimal2 AS TINYINT) as c8, 
CAST(cdecimal1 AS BIGINT) as c9, CAST (cdecimal1 AS BOOLEAN) as c10, 
CAST(cdecimal2 AS DOUBLE) as c11, CAST(cdecimal1 AS FLOAT) as c12, 
CAST(cdecimal2 AS STRING) as c13, CAST(cdecimal1 AS TIMESTAMP) as c14 FROM 
decimal_test WHERE cdecimal1 > 0 AND cdecimal1 < 12345.5678 AND cdecimal2 != 0 
AND cdecimal2 > 1000 AND cdouble IS NOT NULL
+ORDER BY c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14
+LIMIT 10
 PREHOOK: type: QUERY
-POSTHOOK: query: EXPLAIN SELECT cdecimal1 + cdecimal2, cdecimal1 - 
(2*cdecimal2), ((cdecimal1+2.34)/cdecimal2), (cdecimal1 * (cdecimal2/3.4)), 
cdecimal1 % 10, CAST(cdecimal1 AS INT), CAST(cdecimal2 AS SMALLINT), 
CAST(cdecimal2 AS TINYINT), CAST(cdecimal1 AS BIGINT), CAST (cdecimal1 AS 
BOOLEAN), CAST(cdecimal2 AS DOUBLE), CAST(cdecimal1 AS FLOAT), CAST(cdecimal2 
AS STRING), CAST(cdecimal1 AS TIMESTAMP) FROM decimal_test WHERE cdecimal1 > 0 
AND cdecimal1 < 12345.5678 AND cdecimal2 != 0 AND cdecimal2 > 1000 AND cdouble 
IS NOT NULL LIMIT 10
+POSTHOOK: query: EXPLAIN SELECT cdecimal1 + cdecimal2 as c1, cdecimal1 - 
(2*cdecimal2) as c2, ((cdecimal1+2.34)/cdecimal2) as c3, (cdecimal1 * 
(cdecimal2/3.4)) as c4, cdecimal1 % 10 as c5, CAST(cdecimal1 AS INT) as c6, 
CAST(cdecimal2 AS SMALLINT) as c7, CAST(cdecimal2 AS TINYINT) as c8, 
CAST(cdecimal1 AS BIGINT) as c9, CAST (cdecimal1 AS BOOLEAN) as c10, 
CAST(cdecimal2 AS DOUBLE) as c11, CAST(cdecimal1 AS FLOAT) as c12, 
CAST(cdecimal2 AS STRING) as c13, CAST(cdecimal1 AS TIMESTAMP) as c14 FROM 
decimal_test WHERE cdecimal1 > 0 AND cdecimal1 < 12345.5678 AND cdecimal2 != 0 
AND cdecimal2 > 1000 AND cdouble IS NOT NULL
+ORDER BY c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14
+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
+    Tez
+      Edges:
+        Reducer 2 <- Map 1 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: decimal_test
+                  Statistics: Num rows: 12288 Data size: 2128368 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (((((cdecimal1 > 0) and (cdecimal1 < 
12345.5678)) and (cdecimal2 <> 0)) and (cdecimal2 > 1000)) and cdouble is not 
null) (type: boolean)
+                    Statistics: Num rows: 228 Data size: 39491 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: (cdecimal1 + cdecimal2) (type: 
decimal(25,14)), (cdecimal1 - (2 * cdecimal2)) (type: decimal(26,14)), 
((UDFToDouble(cdecimal1) + 2.34) / UDFToDouble(cdecimal2)) (type: double), 
(UDFToDouble(cdecimal1) * (UDFToDouble(cdecimal2) / 3.4)) (type: double), 
(cdecimal1 % 10) (type: decimal(12,10)), UDFToInteger(cdecimal1) (type: int), 
UDFToShort(cdecimal2) (type: smallint), UDFToByte(cdecimal2) (type: tinyint), 
UDFToLong(cdecimal1) (type: bigint), UDFToBoolean(cdecimal1) (type: boolean), 
UDFToDouble(cdecimal2) (type: double), UDFToFloat(cdecimal1) (type: float), 
UDFToString(cdecimal2) (type: string), CAST( cdecimal1 AS TIMESTAMP) (type: 
timestamp)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
+                      Statistics: Num rows: 228 Data size: 39491 Basic stats: 
COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: decimal(25,14)), _col1 
(type: decimal(26,14)), _col2 (type: double), _col3 (type: double), _col4 
(type: decimal(12,10)), _col5 (type: int), _col6 (type: smallint), _col7 (type: 
tinyint), _col8 (type: bigint), _col9 (type: boolean), _col10 (type: double), 
_col11 (type: float), _col12 (type: string), _col13 (type: timestamp)
+                        sort order: ++++++++++++++
+                        Statistics: Num rows: 228 Data size: 39491 Basic 
stats: COMPLETE Column stats: NONE
+            Execution mode: vectorized
+        Reducer 2 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey0 (type: decimal(25,14)), 
KEY.reducesinkkey1 (type: decimal(26,14)), KEY.reducesinkkey2 (type: double), 
KEY.reducesinkkey3 (type: double), KEY.reducesinkkey4 (type: decimal(12,10)), 
KEY.reducesinkkey5 (type: int), KEY.reducesinkkey6 (type: smallint), 
KEY.reducesinkkey7 (type: tinyint), KEY.reducesinkkey8 (type: bigint), 
KEY.reducesinkkey9 (type: boolean), KEY.reducesinkkey10 (type: double), 
KEY.reducesinkkey11 (type: float), KEY.reducesinkkey12 (type: string), 
KEY.reducesinkkey13 (type: timestamp)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
+                Statistics: Num rows: 228 Data size: 39491 Basic stats: 
COMPLETE Column stats: NONE
+                Limit
+                  Number of rows: 10
+                  Statistics: Num rows: 10 Data size: 1730 Basic stats: 
COMPLETE Column stats: NONE
+                  File Output Operator
+                    compressed: false
+                    Statistics: Num rows: 10 Data size: 1730 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
+            Execution mode: vectorized
+
   Stage: Stage-0
     Fetch Operator
       limit: 10
       Processor Tree:
-        TableScan
-          alias: decimal_test
-          Filter Operator
-            predicate: (((((cdecimal1 > 0) and (cdecimal1 < 12345.5678)) and 
(cdecimal2 <> 0)) and (cdecimal2 > 1000)) and cdouble is not null) (type: 
boolean)
-            Select Operator
-              expressions: (cdecimal1 + cdecimal2) (type: decimal(25,14)), 
(cdecimal1 - (2 * cdecimal2)) (type: decimal(26,14)), ((UDFToDouble(cdecimal1) 
+ 2.34) / UDFToDouble(cdecimal2)) (type: double), (UDFToDouble(cdecimal1) * 
(UDFToDouble(cdecimal2) / 3.4)) (type: double), (cdecimal1 % 10) (type: 
decimal(12,10)), UDFToInteger(cdecimal1) (type: int), UDFToShort(cdecimal2) 
(type: smallint), UDFToByte(cdecimal2) (type: tinyint), UDFToLong(cdecimal1) 
(type: bigint), UDFToBoolean(cdecimal1) (type: boolean), UDFToDouble(cdecimal2) 
(type: double), UDFToFloat(cdecimal1) (type: float), UDFToString(cdecimal2) 
(type: string), CAST( cdecimal1 AS TIMESTAMP) (type: timestamp)
-              outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13
-              Limit
-                Number of rows: 10
-                ListSink
+        ListSink
 
-PREHOOK: query: SELECT cdecimal1 + cdecimal2, cdecimal1 - (2*cdecimal2), 
((cdecimal1+2.34)/cdecimal2), (cdecimal1 * (cdecimal2/3.4)), cdecimal1 % 10, 
CAST(cdecimal1 AS INT), CAST(cdecimal2 AS SMALLINT), CAST(cdecimal2 AS 
TINYINT), CAST(cdecimal1 AS BIGINT), CAST (cdecimal1 AS BOOLEAN), 
CAST(cdecimal2 AS DOUBLE), CAST(cdecimal1 AS FLOAT), CAST(cdecimal2 AS STRING), 
CAST(cdecimal1 AS TIMESTAMP) FROM decimal_test WHERE cdecimal1 > 0 AND 
cdecimal1 < 12345.5678 AND cdecimal2 != 0 AND cdecimal2 > 1000 AND cdouble IS 
NOT NULL LIMIT 10
+PREHOOK: query: SELECT cdecimal1 + cdecimal2 as c1, cdecimal1 - (2*cdecimal2) 
as c2, ((cdecimal1+2.34)/cdecimal2) as c3, (cdecimal1 * (cdecimal2/3.4)) as c4, 
cdecimal1 % 10 as c5, CAST(cdecimal1 AS INT) as c6, CAST(cdecimal2 AS SMALLINT) 
as c7, CAST(cdecimal2 AS TINYINT) as c8, CAST(cdecimal1 AS BIGINT) as c9, CAST 
(cdecimal1 AS BOOLEAN) as c10, CAST(cdecimal2 AS DOUBLE) as c11, CAST(cdecimal1 
AS FLOAT) as c12, CAST(cdecimal2 AS STRING) as c13, CAST(cdecimal1 AS 
TIMESTAMP) as c14 FROM decimal_test WHERE cdecimal1 > 0 AND cdecimal1 < 
12345.5678 AND cdecimal2 != 0 AND cdecimal2 > 1000 AND cdouble IS NOT NULL
+ORDER BY c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14
+LIMIT 10
 PREHOOK: type: QUERY
 PREHOOK: Input: default@decimal_test
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT cdecimal1 + cdecimal2, cdecimal1 - (2*cdecimal2), 
((cdecimal1+2.34)/cdecimal2), (cdecimal1 * (cdecimal2/3.4)), cdecimal1 % 10, 
CAST(cdecimal1 AS INT), CAST(cdecimal2 AS SMALLINT), CAST(cdecimal2 AS 
TINYINT), CAST(cdecimal1 AS BIGINT), CAST (cdecimal1 AS BOOLEAN), 
CAST(cdecimal2 AS DOUBLE), CAST(cdecimal1 AS FLOAT), CAST(cdecimal2 AS STRING), 
CAST(cdecimal1 AS TIMESTAMP) FROM decimal_test WHERE cdecimal1 > 0 AND 
cdecimal1 < 12345.5678 AND cdecimal2 != 0 AND cdecimal2 > 1000 AND cdouble IS 
NOT NULL LIMIT 10
+POSTHOOK: query: SELECT cdecimal1 + cdecimal2 as c1, cdecimal1 - (2*cdecimal2) 
as c2, ((cdecimal1+2.34)/cdecimal2) as c3, (cdecimal1 * (cdecimal2/3.4)) as c4, 
cdecimal1 % 10 as c5, CAST(cdecimal1 AS INT) as c6, CAST(cdecimal2 AS SMALLINT) 
as c7, CAST(cdecimal2 AS TINYINT) as c8, CAST(cdecimal1 AS BIGINT) as c9, CAST 
(cdecimal1 AS BOOLEAN) as c10, CAST(cdecimal2 AS DOUBLE) as c11, CAST(cdecimal1 
AS FLOAT) as c12, CAST(cdecimal2 AS STRING) as c13, CAST(cdecimal1 AS 
TIMESTAMP) as c14 FROM decimal_test WHERE cdecimal1 > 0 AND cdecimal1 < 
12345.5678 AND cdecimal2 != 0 AND cdecimal2 > 1000 AND cdouble IS NOT NULL
+ORDER BY c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14
+LIMIT 10
 POSTHOOK: type: QUERY
 POSTHOOK: Input: default@decimal_test
 #### A masked pattern was here ####
-19699.417463617423     -12507.913305613346     0.8351496686995997      
2.8303425077026896E7    3.6405405405    8963    10735   -17     8963    true    
10735.776923076923      8963.641        10735.776923076923      1969-12-31 
18:29:23.64054054
-9216.339708939685      -5851.80644490647       0.8353975893550668      
6195112.1797296945      3.6243243243    4193    5022    -98     4193    true    
5022.715384615385       4193.6245       5022.715384615385       1969-12-31 
17:09:53.624324324
-6514.8403326403464     -4136.5212058211928     0.8355907765708067      
3095563.9418919063      4.3864864865    2964    3550    -34     2964    true    
3550.4538461538464      2964.3865       3550.4538461538464      1969-12-31 
16:49:24.386486486
-7587.301455301477      -4817.467775467754      0.8354976172734904      
4198623.24324327        2.3783783784    3452    4134    38      3452    true    
4134.923076923077       3452.3784       4134.923076923077       1969-12-31 
16:57:32.378378378
-19197.972972973        -12189.527027027        0.835155361813429       
2.6880848817567654E7    5.472972973     8735    10462   -34     8735    true    
10462.5 8735.473        10462.5 1969-12-31 18:25:35.472972973
-17098.9945945946       -10856.8054054054       0.8351828165813104      
2.132423090270272E7     0.3945945946    7780    9318    102     7780    true    
9318.6  7780.3945       9318.6  1969-12-31 18:09:40.394594594
-12433.723076923077     -7894.646153846154      0.8352770361086894      
1.12754688E7    7.6     5657    6776    120     5657    true    
6776.123076923077       5657.6  6776.123076923077       1969-12-31 17:34:17.6
-7247.316839916862      -4601.598544698524      0.8355241651897876      
3830775.6932432684      7.6783783784    3297    3949    109     3297    true    
3949.638461538462       3297.6785       3949.638461538462       1969-12-31 
16:54:57.678378378
-14757.1700623700465    -9369.891476091493      0.8352226654922171      
1.5883214124324286E7    4.8162162162    6714    8042    106     6714    true    
8042.3538461538465      6714.8164       8042.3538461538465      1969-12-31 
17:51:54.816216216
-10964.832016631993     -6961.991060291086      0.8353232978714221      
8768719.779729689       9.2243243243    4989    5975    87      4989    true    
5975.607692307693       4989.224        5975.607692307693       1969-12-31 
17:23:09.224324324
+1836.441995841977      -1166.027234927254      0.8372697814833714      
245972.55810810256      5.6189189189    835     1000    -24     835     true    
1000.823076923077       835.6189        1000.823076923077       1969-12-31 
16:13:55.618918918
+1856.1322245322462     -1178.5293139292924     0.8372449787014038      
251275.4432432497       4.5783783784    844     1011    -13     844     true    
1011.5538461538462      844.57837       1011.5538461538462      1969-12-31 
16:14:04.578378378
+1858.7575883576155     -1180.196257796231      0.837241711366943       
251986.76756757565      5.772972973     845     1012    -12     845     true    
1012.9846153846155      845.77295       1012.9846153846155      1969-12-31 
16:14:05.772972973
+1862.6956340956693     -1182.6966735966386     0.8372368276344616      
253055.6391891997       7.5648648649    847     1015    -9      847     true    
1015.1307692307693      847.5649        1015.1307692307693      1969-12-31 
16:14:07.564864864
+1883.6985446985233     -1196.0322245322466     0.8372111259286499      
258794.49324323673      7.1216216216    857     1026    2       857     true    
1026.5769230769233      857.12164       1026.5769230769233      1969-12-31 
16:14:17.121621621
+1886.3239085238924     -1197.6991683991848     0.8372079534581902      
259516.37432431948      8.3162162162    858     1028    4       858     true    
1028.0076923076924      858.3162        1028.0076923076924      1969-12-31 
16:14:18.316216216
+1887.636590436577      -1198.532640332654      0.8372063705322131      
259877.69189188787      8.9135135135    858     1028    4       858     true    
1028.723076923077       858.9135        1028.723076923077       1969-12-31 
16:14:18.913513513
+1895.5126819126846     -1203.5334719334692     0.8371969190171343      
262050.87567567648      2.4972972973    862     1033    9       862     true    
1033.0153846153846      862.4973        1033.0153846153846      1969-12-31 
16:14:22.497297297
+1909.9521829522155     -1212.701663201631      0.8371797936946236      
266058.54729730723      9.0675675676    869     1040    16      869     true    
1040.8846153846155      869.06757       1040.8846153846155      1969-12-31 
16:14:29.067567567
+1913.8902286902692     -1215.2020790020384     0.8371751679995797      
267156.8270270395       0.8594594595    870     1043    19      870     true    
1043.0307692307692      870.85944       1043.0307692307692      1969-12-31 
16:14:30.859459459

http://git-wip-us.apache.org/repos/asf/hive/blob/63deec40/ql/src/test/results/clientpositive/tez/vectorization_0.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/vectorization_0.q.out 
b/ql/src/test/results/clientpositive/tez/vectorization_0.q.out
index 250f3d3..9bd62ad 100644
--- a/ql/src/test/results/clientpositive/tez/vectorization_0.q.out
+++ b/ql/src/test/results/clientpositive/tez/vectorization_0.q.out
@@ -1,4 +1,6 @@
-PREHOOK: query: -- Use ORDER BY clauses to generate 2 stages.
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+-- Use ORDER BY clauses to generate 2 stages.
 EXPLAIN
 SELECT MIN(ctinyint) as c1,
        MAX(ctinyint),
@@ -7,7 +9,9 @@ SELECT MIN(ctinyint) as c1,
 FROM   alltypesorc
 ORDER BY c1
 PREHOOK: type: QUERY
-POSTHOOK: query: -- Use ORDER BY clauses to generate 2 stages.
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+-- Use ORDER BY clauses to generate 2 stages.
 EXPLAIN
 SELECT MIN(ctinyint) as c1,
        MAX(ctinyint),

http://git-wip-us.apache.org/repos/asf/hive/blob/63deec40/ql/src/test/results/clientpositive/tez/vectorization_1.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/tez/vectorization_1.q.out 
b/ql/src/test/results/clientpositive/tez/vectorization_1.q.out
index 6f428e1..1b2d0e2 100644
--- a/ql/src/test/results/clientpositive/tez/vectorization_1.q.out
+++ b/ql/src/test/results/clientpositive/tez/vectorization_1.q.out
@@ -1,4 +1,6 @@
-PREHOOK: query: SELECT VAR_POP(ctinyint),
+PREHOOK: query: -- SORT_QUERY_RESULTS
+
+SELECT VAR_POP(ctinyint),
        (VAR_POP(ctinyint) / -26.28),
        SUM(cfloat),
        (-1.389 + SUM(cfloat)),
@@ -20,7 +22,9 @@ WHERE  (((cdouble > ctinyint)
 PREHOOK: type: QUERY
 PREHOOK: Input: default@alltypesorc
 #### A masked pattern was here ####
-POSTHOOK: query: SELECT VAR_POP(ctinyint),
+POSTHOOK: query: -- SORT_QUERY_RESULTS
+
+SELECT VAR_POP(ctinyint),
        (VAR_POP(ctinyint) / -26.28),
        SUM(cfloat),
        (-1.389 + SUM(cfloat)),

Reply via email to