http://git-wip-us.apache.org/repos/asf/hive/blob/63b1ea30/ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_1.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_1.q.out 
b/ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_1.q.out
new file mode 100644
index 0000000..8a46807
--- /dev/null
+++ b/ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_1.q.out
@@ -0,0 +1,791 @@
+PREHOOK: query: -- First try with regular mergejoin
+explain
+select
+  *
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+order by a.cint
+PREHOOK: type: QUERY
+POSTHOOK: query: -- First try with regular mergejoin
+explain
+select
+  *
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+order by a.cint
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  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), Map 4 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (cint BETWEEN 1000000 AND 3000000 and cint is 
not null) (type: boolean)
+                    Statistics: Num rows: 3072 Data size: 660491 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ctinyint (type: tinyint), csmallint (type: 
smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), 
cdouble (type: double), cstring1 (type: string), cstring2 (type: string), 
ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: 
boolean), cboolean2 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                      Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col2 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col2 (type: int)
+                        Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), 
_col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 
(type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
+        Map 4 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((cbigint is not null and cint BETWEEN 1000000 
AND 3000000) and cint is not null) (type: boolean)
+                    Statistics: Num rows: 1536 Data size: 330245 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ctinyint (type: tinyint), csmallint (type: 
smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), 
cdouble (type: double), cstring1 (type: string), cstring2 (type: string), 
ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: 
boolean), cboolean2 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                      Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col2 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col2 (type: int)
+                        Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), 
_col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 
(type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
+        Reducer 2 
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col2 (type: int)
+                  1 _col2 (type: int)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23
+                Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col2 (type: int)
+                  sort order: +
+                  Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), 
_col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 
(type: timestamp), _col10 (type: boolean), _col11 (type: boolean), _col12 
(type: tinyint), _col13 (type: smallint), _col14 (type: int), _col15 (type: 
bigint), _col16 (type: float), _col17 (type: double), _col18 (type: string), 
_col19 (type: string), _col20 (type: timestamp), _col21 (type: timestamp), 
_col22 (type: boolean), _col23 (type: boolean)
+        Reducer 3 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: tinyint), VALUE._col1 (type: 
smallint), KEY.reducesinkkey0 (type: int), VALUE._col2 (type: bigint), 
VALUE._col3 (type: float), VALUE._col4 (type: double), VALUE._col5 (type: 
string), VALUE._col6 (type: string), VALUE._col7 (type: timestamp), VALUE._col8 
(type: timestamp), VALUE._col9 (type: boolean), VALUE._col10 (type: boolean), 
VALUE._col11 (type: tinyint), VALUE._col12 (type: smallint), VALUE._col13 
(type: int), VALUE._col14 (type: bigint), VALUE._col15 (type: float), 
VALUE._col16 (type: double), VALUE._col17 (type: string), VALUE._col18 (type: 
string), VALUE._col19 (type: timestamp), VALUE._col20 (type: timestamp), 
VALUE._col21 (type: boolean), VALUE._col22 (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23
+                Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 3379 Data size: 726540 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: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select
+  *
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+order by a.cint
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select
+  *
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+order by a.cint
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+11     NULL    1000828 1531084669      11.0    NULL    wM316f6NqGIkoP388j3F6   
poWQQo3Upvt3Wh  1969-12-31 16:00:02.351 NULL    false   true    11      NULL    
1000828 1531084669      11.0    NULL    wM316f6NqGIkoP388j3F6   poWQQo3Upvt3Wh  
1969-12-31 16:00:02.351 NULL    false   true
+NULL   -3799   1248059 1864027286      NULL    -3799.0 Uhps6mMh3IfHB3j7yH62K   
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:54.622 false   true    NULL    
-3799   1248059 1864027286      NULL    -3799.0 Uhps6mMh3IfHB3j7yH62K   
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:54.622 false   true
+NULL   10782   1286921 1864027286      NULL    10782.0 ODLrXI8882q8LS8 
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:52.138 true    true    NULL    
10782   1286921 1864027286      NULL    10782.0 ODLrXI8882q8LS8 
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:52.138 true    true
+NULL   -13036  1288927 -1645852809     NULL    -13036.0        yinBY725P7V2    
xH7445Rals48VOulSyR5F   NULL    1969-12-31 16:00:00.763 true    false   NULL    
-13036  1288927 -1645852809     NULL    -13036.0        yinBY725P7V2    
xH7445Rals48VOulSyR5F   NULL    1969-12-31 16:00:00.763 true    false
+11     NULL    1310786 -413875656      11.0    NULL    W0rvA4H1xn0xMG4uk0      
8yVVjG  1969-12-31 16:00:02.351 NULL    false   true    11      NULL    1310786 
-413875656      11.0    NULL    W0rvA4H1xn0xMG4uk0      8yVVjG  1969-12-31 
16:00:02.351 NULL    false   true
+-51    NULL    2089466 -240556350      -51.0   NULL    cXX24dH7tblSj46j2g      
C31eea0wrHHqvj  1969-12-31 16:00:08.451 NULL    true    true    -51     NULL    
2089466 -240556350      -51.0   NULL    cXX24dH7tblSj46j2g      C31eea0wrHHqvj  
1969-12-31 16:00:08.451 NULL    true    true
+NULL   -8915   2101183 1864027286      NULL    -8915.0 x7By66525       
4KWs6gw7lv2WYd66P       NULL    1969-12-31 16:00:05.831 false   true    NULL    
-8915   2101183 1864027286      NULL    -8915.0 x7By66525       
4KWs6gw7lv2WYd66P       NULL    1969-12-31 16:00:05.831 false   true
+8      NULL    2229621 -381406148      8.0     NULL    q7onkS7QRPh5ghOK        
oKb0bi  1969-12-31 16:00:15.892 NULL    true    false   8       NULL    2229621 
-381406148      8.0     NULL    q7onkS7QRPh5ghOK        oKb0bi  1969-12-31 
16:00:15.892 NULL    true    false
+8      NULL    2433892 -1611863517     8.0     NULL    674ILv3V2TxFqXP6wSbL    
VLprkK2XfX      1969-12-31 16:00:15.892 NULL    false   true    8       NULL    
2433892 -1611863517     8.0     NULL    674ILv3V2TxFqXP6wSbL    VLprkK2XfX      
1969-12-31 16:00:15.892 NULL    false   true
+-51    NULL    2949963 -1580871111     -51.0   NULL    0K68k3bdl7jO7   TPPAu   
1969-12-31 16:00:08.451 NULL    true    false   -51     NULL    2949963 
-1580871111     -51.0   NULL    0K68k3bdl7jO7   TPPAu   1969-12-31 16:00:08.451 
NULL    true    false
+PREHOOK: query: explain
+select
+  count(*)
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+  count(*)
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  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), Map 4 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (cint BETWEEN 1000000 AND 3000000 and cint is 
not null) (type: boolean)
+                    Statistics: Num rows: 3072 Data size: 660491 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cint (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+        Map 4 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((cbigint is not null and cint BETWEEN 1000000 
AND 3000000) and cint is not null) (type: boolean)
+                    Statistics: Num rows: 1536 Data size: 330245 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cint (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+        Reducer 2 
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col0 (type: int)
+                  1 _col0 (type: int)
+                Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: count()
+                  mode: hash
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: NONE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: NONE
+                    value expressions: _col0 (type: bigint)
+        Reducer 3 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: count(VALUE._col0)
+                mode: mergepartial
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 1 Data size: 8 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: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select
+  count(*)
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select
+  count(*)
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+10
+PREHOOK: query: explain
+select
+  a.csmallint, count(*) c1
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+group by a.csmallint
+order by c1
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+  a.csmallint, count(*) c1
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+group by a.csmallint
+order by c1
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  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), Map 5 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (cint BETWEEN 1000000 AND 3000000 and cint is 
not null) (type: boolean)
+                    Statistics: Num rows: 3072 Data size: 660491 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: csmallint (type: smallint), cint (type: int)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col1 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col1 (type: int)
+                        Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: smallint)
+        Map 5 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((cbigint is not null and cint BETWEEN 1000000 
AND 3000000) and cint is not null) (type: boolean)
+                    Statistics: Num rows: 1536 Data size: 330245 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cint (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+        Reducer 2 
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 _col1 (type: int)
+                  1 _col0 (type: int)
+                outputColumnNames: _col0
+                Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                Group By Operator
+                  aggregations: count()
+                  keys: _col0 (type: smallint)
+                  mode: hash
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: smallint)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: smallint)
+                    Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: bigint)
+        Reducer 3 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: count(VALUE._col0)
+                keys: KEY._col0 (type: smallint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 1689 Data size: 363162 Basic stats: 
COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col1 (type: bigint)
+                  sort order: +
+                  Statistics: Num rows: 1689 Data size: 363162 Basic stats: 
COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: smallint)
+        Reducer 4 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: smallint), KEY.reducesinkkey0 
(type: bigint)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 1689 Data size: 363162 Basic stats: 
COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 1689 Data size: 363162 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: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select
+  a.csmallint, count(*) c1
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+group by a.csmallint
+order by c1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select
+  a.csmallint, count(*) c1
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+group by a.csmallint
+order by c1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+10782  1
+-3799  1
+-8915  1
+-13036 1
+NULL   6
+PREHOOK: query: -- Try with dynamically partitioned hashjoin
+explain
+select
+  *
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+order by a.cint
+PREHOOK: type: QUERY
+POSTHOOK: query: -- Try with dynamically partitioned hashjoin
+explain
+select
+  *
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+order by a.cint
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+      Edges:
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE), Map 4 (CUSTOM_SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (cint BETWEEN 1000000 AND 3000000 and cint is 
not null) (type: boolean)
+                    Statistics: Num rows: 3072 Data size: 660491 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ctinyint (type: tinyint), csmallint (type: 
smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), 
cdouble (type: double), cstring1 (type: string), cstring2 (type: string), 
ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: 
boolean), cboolean2 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                      Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col2 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col2 (type: int)
+                        Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), 
_col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 
(type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
+        Map 4 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((cbigint is not null and cint BETWEEN 1000000 
AND 3000000) and cint is not null) (type: boolean)
+                    Statistics: Num rows: 1536 Data size: 330245 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ctinyint (type: tinyint), csmallint (type: 
smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), 
cdouble (type: double), cstring1 (type: string), cstring2 (type: string), 
ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: 
boolean), cboolean2 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                      Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col2 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col2 (type: int)
+                        Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), 
_col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 
(type: timestamp), _col10 (type: boolean), _col11 (type: boolean)
+        Reducer 2 
+            Reduce Operator Tree:
+              Map Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 KEY.reducesinkkey0 (type: int)
+                  1 KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23
+                input vertices:
+                  1 Map 4
+                Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                HybridGraceHashJoin: true
+                Reduce Output Operator
+                  key expressions: _col2 (type: int)
+                  sort order: +
+                  Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col3 (type: bigint), _col4 (type: float), _col5 (type: double), 
_col6 (type: string), _col7 (type: string), _col8 (type: timestamp), _col9 
(type: timestamp), _col10 (type: boolean), _col11 (type: boolean), _col12 
(type: tinyint), _col13 (type: smallint), _col14 (type: int), _col15 (type: 
bigint), _col16 (type: float), _col17 (type: double), _col18 (type: string), 
_col19 (type: string), _col20 (type: timestamp), _col21 (type: timestamp), 
_col22 (type: boolean), _col23 (type: boolean)
+        Reducer 3 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: tinyint), VALUE._col1 (type: 
smallint), KEY.reducesinkkey0 (type: int), VALUE._col2 (type: bigint), 
VALUE._col3 (type: float), VALUE._col4 (type: double), VALUE._col5 (type: 
string), VALUE._col6 (type: string), VALUE._col7 (type: timestamp), VALUE._col8 
(type: timestamp), VALUE._col9 (type: boolean), VALUE._col10 (type: boolean), 
VALUE._col11 (type: tinyint), VALUE._col12 (type: smallint), VALUE._col13 
(type: int), VALUE._col14 (type: bigint), VALUE._col15 (type: float), 
VALUE._col16 (type: double), VALUE._col17 (type: string), VALUE._col18 (type: 
string), VALUE._col19 (type: timestamp), VALUE._col20 (type: timestamp), 
VALUE._col21 (type: boolean), VALUE._col22 (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, 
_col16, _col17, _col18, _col19, _col20, _col21, _col22, _col23
+                Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 3379 Data size: 726540 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: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select
+  *
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+order by a.cint
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select
+  *
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+order by a.cint
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+11     NULL    1000828 1531084669      11.0    NULL    wM316f6NqGIkoP388j3F6   
poWQQo3Upvt3Wh  1969-12-31 16:00:02.351 NULL    false   true    11      NULL    
1000828 1531084669      11.0    NULL    wM316f6NqGIkoP388j3F6   poWQQo3Upvt3Wh  
1969-12-31 16:00:02.351 NULL    false   true
+NULL   -3799   1248059 1864027286      NULL    -3799.0 Uhps6mMh3IfHB3j7yH62K   
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:54.622 false   true    NULL    
-3799   1248059 1864027286      NULL    -3799.0 Uhps6mMh3IfHB3j7yH62K   
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:54.622 false   true
+NULL   10782   1286921 1864027286      NULL    10782.0 ODLrXI8882q8LS8 
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:52.138 true    true    NULL    
10782   1286921 1864027286      NULL    10782.0 ODLrXI8882q8LS8 
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:52.138 true    true
+NULL   -13036  1288927 -1645852809     NULL    -13036.0        yinBY725P7V2    
xH7445Rals48VOulSyR5F   NULL    1969-12-31 16:00:00.763 true    false   NULL    
-13036  1288927 -1645852809     NULL    -13036.0        yinBY725P7V2    
xH7445Rals48VOulSyR5F   NULL    1969-12-31 16:00:00.763 true    false
+11     NULL    1310786 -413875656      11.0    NULL    W0rvA4H1xn0xMG4uk0      
8yVVjG  1969-12-31 16:00:02.351 NULL    false   true    11      NULL    1310786 
-413875656      11.0    NULL    W0rvA4H1xn0xMG4uk0      8yVVjG  1969-12-31 
16:00:02.351 NULL    false   true
+-51    NULL    2089466 -240556350      -51.0   NULL    cXX24dH7tblSj46j2g      
C31eea0wrHHqvj  1969-12-31 16:00:08.451 NULL    true    true    -51     NULL    
2089466 -240556350      -51.0   NULL    cXX24dH7tblSj46j2g      C31eea0wrHHqvj  
1969-12-31 16:00:08.451 NULL    true    true
+NULL   -8915   2101183 1864027286      NULL    -8915.0 x7By66525       
4KWs6gw7lv2WYd66P       NULL    1969-12-31 16:00:05.831 false   true    NULL    
-8915   2101183 1864027286      NULL    -8915.0 x7By66525       
4KWs6gw7lv2WYd66P       NULL    1969-12-31 16:00:05.831 false   true
+8      NULL    2229621 -381406148      8.0     NULL    q7onkS7QRPh5ghOK        
oKb0bi  1969-12-31 16:00:15.892 NULL    true    false   8       NULL    2229621 
-381406148      8.0     NULL    q7onkS7QRPh5ghOK        oKb0bi  1969-12-31 
16:00:15.892 NULL    true    false
+8      NULL    2433892 -1611863517     8.0     NULL    674ILv3V2TxFqXP6wSbL    
VLprkK2XfX      1969-12-31 16:00:15.892 NULL    false   true    8       NULL    
2433892 -1611863517     8.0     NULL    674ILv3V2TxFqXP6wSbL    VLprkK2XfX      
1969-12-31 16:00:15.892 NULL    false   true
+-51    NULL    2949963 -1580871111     -51.0   NULL    0K68k3bdl7jO7   TPPAu   
1969-12-31 16:00:08.451 NULL    true    false   -51     NULL    2949963 
-1580871111     -51.0   NULL    0K68k3bdl7jO7   TPPAu   1969-12-31 16:00:08.451 
NULL    true    false
+PREHOOK: query: explain
+select
+  count(*)
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+  count(*)
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+      Edges:
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE), Map 4 (CUSTOM_SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (cint BETWEEN 1000000 AND 3000000 and cint is 
not null) (type: boolean)
+                    Statistics: Num rows: 3072 Data size: 660491 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cint (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+        Map 4 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((cbigint is not null and cint BETWEEN 1000000 
AND 3000000) and cint is not null) (type: boolean)
+                    Statistics: Num rows: 1536 Data size: 330245 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cint (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+        Reducer 2 
+            Reduce Operator Tree:
+              Map Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 KEY.reducesinkkey0 (type: int)
+                  1 KEY.reducesinkkey0 (type: int)
+                input vertices:
+                  1 Map 4
+                Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                HybridGraceHashJoin: true
+                Group By Operator
+                  aggregations: count()
+                  mode: hash
+                  outputColumnNames: _col0
+                  Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: NONE
+                  Reduce Output Operator
+                    sort order: 
+                    Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: NONE
+                    value expressions: _col0 (type: bigint)
+        Reducer 3 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: count(VALUE._col0)
+                mode: mergepartial
+                outputColumnNames: _col0
+                Statistics: Num rows: 1 Data size: 8 Basic stats: COMPLETE 
Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 1 Data size: 8 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: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select
+  count(*)
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select
+  count(*)
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+10
+PREHOOK: query: explain
+select
+  a.csmallint, count(*) c1
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+group by a.csmallint
+order by c1
+PREHOOK: type: QUERY
+POSTHOOK: query: explain
+select
+  a.csmallint, count(*) c1
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+group by a.csmallint
+order by c1
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+      Edges:
+        Reducer 2 <- Map 1 (CUSTOM_SIMPLE_EDGE), Map 5 (CUSTOM_SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Reducer 4 <- Reducer 3 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (cint BETWEEN 1000000 AND 3000000 and cint is 
not null) (type: boolean)
+                    Statistics: Num rows: 3072 Data size: 660491 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: csmallint (type: smallint), cint (type: int)
+                      outputColumnNames: _col0, _col1
+                      Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col1 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col1 (type: int)
+                        Statistics: Num rows: 3072 Data size: 660491 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: smallint)
+        Map 5 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((cbigint is not null and cint BETWEEN 1000000 
AND 3000000) and cint is not null) (type: boolean)
+                    Statistics: Num rows: 1536 Data size: 330245 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: cint (type: int)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: _col0 (type: int)
+                        sort order: +
+                        Map-reduce partition columns: _col0 (type: int)
+                        Statistics: Num rows: 1536 Data size: 330245 Basic 
stats: COMPLETE Column stats: NONE
+        Reducer 2 
+            Reduce Operator Tree:
+              Map Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 KEY.reducesinkkey0 (type: int)
+                  1 KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col0
+                input vertices:
+                  1 Map 5
+                Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                HybridGraceHashJoin: true
+                Group By Operator
+                  aggregations: count()
+                  keys: _col0 (type: smallint)
+                  mode: hash
+                  outputColumnNames: _col0, _col1
+                  Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col0 (type: smallint)
+                    sort order: +
+                    Map-reduce partition columns: _col0 (type: smallint)
+                    Statistics: Num rows: 3379 Data size: 726540 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col1 (type: bigint)
+        Reducer 3 
+            Reduce Operator Tree:
+              Group By Operator
+                aggregations: count(VALUE._col0)
+                keys: KEY._col0 (type: smallint)
+                mode: mergepartial
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 1689 Data size: 363162 Basic stats: 
COMPLETE Column stats: NONE
+                Reduce Output Operator
+                  key expressions: _col1 (type: bigint)
+                  sort order: +
+                  Statistics: Num rows: 1689 Data size: 363162 Basic stats: 
COMPLETE Column stats: NONE
+                  value expressions: _col0 (type: smallint)
+        Reducer 4 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: VALUE._col0 (type: smallint), KEY.reducesinkkey0 
(type: bigint)
+                outputColumnNames: _col0, _col1
+                Statistics: Num rows: 1689 Data size: 363162 Basic stats: 
COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 1689 Data size: 363162 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: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select
+  a.csmallint, count(*) c1
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+group by a.csmallint
+order by c1
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+POSTHOOK: query: select
+  a.csmallint, count(*) c1
+from alltypesorc a join alltypesorc b on a.cint = b.cint
+where
+  a.cint between 1000000 and 3000000 and b.cbigint is not null
+group by a.csmallint
+order by c1
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+#### A masked pattern was here ####
+10782  1
+-3799  1
+-8915  1
+-13036 1
+NULL   6

http://git-wip-us.apache.org/repos/asf/hive/blob/63b1ea30/ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_2.q.out
----------------------------------------------------------------------
diff --git 
a/ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_2.q.out 
b/ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_2.q.out
new file mode 100644
index 0000000..0cf6b79
--- /dev/null
+++ b/ql/src/test/results/clientpositive/tez/tez_dynpart_hashjoin_2.q.out
@@ -0,0 +1,637 @@
+PREHOOK: query: -- Multiple tables, and change the order of the big table 
(alltypesorc)
+-- First try with regular mergejoin
+explain
+select
+  a.*
+from
+  alltypesorc a,
+  src b,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+PREHOOK: type: QUERY
+POSTHOOK: query: -- Multiple tables, and change the order of the big table 
(alltypesorc)
+-- First try with regular mergejoin
+explain
+select
+  a.*
+from
+  alltypesorc a,
+  src b,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  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), Reducer 5 (SIMPLE_EDGE)
+        Reducer 3 <- Reducer 2 (SIMPLE_EDGE)
+        Reducer 5 <- Map 4 (SIMPLE_EDGE), Map 6 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: b
+                  Statistics: Num rows: 500 Data size: 5312 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (UDFToInteger(key) + 0) is not null (type: 
boolean)
+                    Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: (UDFToInteger(_col0) + 0) (type: int)
+                        sort order: +
+                        Map-reduce partition columns: (UDFToInteger(_col0) + 
0) (type: int)
+                        Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+        Map 4 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((csmallint < 100) and UDFToInteger(csmallint) 
is not null) (type: boolean)
+                    Statistics: Num rows: 2048 Data size: 440327 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ctinyint (type: tinyint), csmallint (type: 
smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), 
cdouble (type: double), cstring1 (type: string), cstring2 (type: string), 
ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: 
boolean), cboolean2 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                      Statistics: Num rows: 2048 Data size: 440327 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: UDFToInteger(_col1) (type: int)
+                        sort order: +
+                        Map-reduce partition columns: UDFToInteger(_col1) 
(type: int)
+                        Statistics: Num rows: 2048 Data size: 440327 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 
(type: double), _col6 (type: string), _col7 (type: string), _col8 (type: 
timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: 
boolean)
+        Map 6 
+            Map Operator Tree:
+                TableScan
+                  alias: b
+                  Statistics: Num rows: 500 Data size: 5312 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: UDFToInteger(key) is not null (type: boolean)
+                    Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: UDFToInteger(_col0) (type: int)
+                        sort order: +
+                        Map-reduce partition columns: UDFToInteger(_col0) 
(type: int)
+                        Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+        Reducer 2 
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 (UDFToInteger(_col0) + 0) (type: int)
+                  1 UDFToInteger(_col1) (type: int)
+                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, 
_col7, _col8, _col9, _col10, _col11, _col12
+                Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col1 (type: tinyint), _col2 (type: smallint), 
_col3 (type: int), _col4 (type: bigint), _col5 (type: float), _col6 (type: 
double), _col7 (type: string), _col8 (type: string), _col9 (type: timestamp), 
_col10 (type: timestamp), _col11 (type: boolean), _col12 (type: boolean)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                  Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col1 (type: smallint), _col0 (type: 
tinyint), _col2 (type: int)
+                    sort order: +++
+                    Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col3 (type: bigint), _col4 (type: 
float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 
(type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 
(type: boolean)
+        Reducer 3 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey1 (type: tinyint), 
KEY.reducesinkkey0 (type: smallint), KEY.reducesinkkey2 (type: int), 
VALUE._col0 (type: bigint), VALUE._col1 (type: float), VALUE._col2 (type: 
double), VALUE._col3 (type: string), VALUE._col4 (type: string), VALUE._col5 
(type: timestamp), VALUE._col6 (type: timestamp), VALUE._col7 (type: boolean), 
VALUE._col8 (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 2477 Data size: 532794 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
+        Reducer 5 
+            Reduce Operator Tree:
+              Merge Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 UDFToInteger(_col1) (type: int)
+                  1 UDFToInteger(_col0) (type: int)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                Statistics: Num rows: 2252 Data size: 484359 Basic stats: 
COMPLETE Column stats: NONE
+                Select Operator
+                  expressions: _col0 (type: tinyint), _col1 (type: smallint), 
_col10 (type: boolean), _col11 (type: boolean), _col2 (type: int), _col3 (type: 
bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 
(type: string), _col8 (type: timestamp), _col9 (type: timestamp)
+                  outputColumnNames: _col0, _col1, _col10, _col11, _col2, 
_col3, _col4, _col5, _col6, _col7, _col8, _col9
+                  Statistics: Num rows: 2252 Data size: 484359 Basic stats: 
COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: UDFToInteger(_col1) (type: int)
+                    sort order: +
+                    Map-reduce partition columns: UDFToInteger(_col1) (type: 
int)
+                    Statistics: Num rows: 2252 Data size: 484359 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 
(type: double), _col6 (type: string), _col7 (type: string), _col8 (type: 
timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: 
boolean)
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select
+  a.*
+from
+  alltypesorc a,
+  src b,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select
+  a.*
+from
+  alltypesorc a,
+  src b,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+-19    8       626923679       NULL    -19.0   8.0     821UdmGbkEf4j   NULL    
1969-12-31 15:59:46.619 1969-12-31 15:59:46.95  true    NULL
+6      8       528534767       NULL    6.0     8.0     cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:45.459 1969-12-31 16:00:00.236 true    NULL
+NULL   9       -470743566      -1887561756     NULL    9.0     
swx5K33Sm5qcKR5B        4hA4KQj2vD3fI6gX82220d  NULL    1969-12-31 16:00:07.318 
true    false
+NULL   10      813877020       -1645852809     NULL    10.0    
4QG23O2GKF6BUe13O7A2C   xH7445Rals48VOulSyR5F   NULL    1969-12-31 16:00:05.851 
false   false
+-62    10      528534767       NULL    -62.0   10.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.265 1969-12-31 15:59:56.584 true    NULL
+NULL   19      312515097       1864027286      NULL    19.0    ds5YqbRvhf3Sb2  
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:56.211 false   true
+-7     19      528534767       NULL    -7.0    19.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 16:00:13.994 1969-12-31 15:59:55.362 true    NULL
+-45    20      253665376       NULL    -45.0   20.0    1cGVWH7n1QU     NULL    
1969-12-31 16:00:09.949 1969-12-31 16:00:10.979 true    NULL
+NULL   34      510824788       -1887561756     NULL    34.0    nj1bXoh6k       
4hA4KQj2vD3fI6gX82220d  NULL    1969-12-31 15:59:46.017 true    false
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+61     41      528534767       NULL    61.0    41.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:55.708 1969-12-31 16:00:14.412 true    NULL
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+39     74      626923679       NULL    39.0    74.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:10.403 1969-12-31 16:00:12.52  true    NULL
+47     74      626923679       NULL    47.0    74.0    821UdmGbkEf4j   NULL    
1969-12-31 15:59:57.849 1969-12-31 15:59:57.569 true    NULL
+-22    77      528534767       NULL    -22.0   77.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:45.928 1969-12-31 15:59:43.621 true    NULL
+PREHOOK: query: -- noconditionaltask.size needs to be low enough that entire 
filtered table results do not fit in one task's hash table
+-- Try with dynamically partitioned hash join 
+explain
+select
+  a.*
+from
+  alltypesorc a,
+  src b,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+PREHOOK: type: QUERY
+POSTHOOK: query: -- noconditionaltask.size needs to be low enough that entire 
filtered table results do not fit in one task's hash table
+-- Try with dynamically partitioned hash join 
+explain
+select
+  a.*
+from
+  alltypesorc a,
+  src b,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+      Edges:
+        Reducer 3 <- Map 2 (CUSTOM_SIMPLE_EDGE), Map 6 (CUSTOM_SIMPLE_EDGE)
+        Reducer 4 <- Map 1 (CUSTOM_SIMPLE_EDGE), Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: b
+                  Statistics: Num rows: 500 Data size: 5312 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (UDFToInteger(key) + 0) is not null (type: 
boolean)
+                    Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: (UDFToInteger(_col0) + 0) (type: int)
+                        sort order: +
+                        Map-reduce partition columns: (UDFToInteger(_col0) + 
0) (type: int)
+                        Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+        Map 2 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((csmallint < 100) and UDFToInteger(csmallint) 
is not null) (type: boolean)
+                    Statistics: Num rows: 2048 Data size: 440327 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ctinyint (type: tinyint), csmallint (type: 
smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), 
cdouble (type: double), cstring1 (type: string), cstring2 (type: string), 
ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: 
boolean), cboolean2 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                      Statistics: Num rows: 2048 Data size: 440327 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: UDFToInteger(_col1) (type: int)
+                        sort order: +
+                        Map-reduce partition columns: UDFToInteger(_col1) 
(type: int)
+                        Statistics: Num rows: 2048 Data size: 440327 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 
(type: double), _col6 (type: string), _col7 (type: string), _col8 (type: 
timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: 
boolean)
+        Map 6 
+            Map Operator Tree:
+                TableScan
+                  alias: b
+                  Statistics: Num rows: 500 Data size: 5312 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: UDFToInteger(key) is not null (type: boolean)
+                    Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: UDFToInteger(_col0) (type: int)
+                        sort order: +
+                        Map-reduce partition columns: UDFToInteger(_col0) 
(type: int)
+                        Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+        Reducer 3 
+            Reduce Operator Tree:
+              Map Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 KEY.reducesinkkey0 (type: int)
+                  1 KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                input vertices:
+                  1 Map 6
+                Statistics: Num rows: 2252 Data size: 484359 Basic stats: 
COMPLETE Column stats: NONE
+                HybridGraceHashJoin: true
+                Select Operator
+                  expressions: _col0 (type: tinyint), _col1 (type: smallint), 
_col10 (type: boolean), _col11 (type: boolean), _col2 (type: int), _col3 (type: 
bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 
(type: string), _col8 (type: timestamp), _col9 (type: timestamp)
+                  outputColumnNames: _col0, _col1, _col10, _col11, _col2, 
_col3, _col4, _col5, _col6, _col7, _col8, _col9
+                  Statistics: Num rows: 2252 Data size: 484359 Basic stats: 
COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: UDFToInteger(_col1) (type: int)
+                    sort order: +
+                    Map-reduce partition columns: UDFToInteger(_col1) (type: 
int)
+                    Statistics: Num rows: 2252 Data size: 484359 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 
(type: double), _col6 (type: string), _col7 (type: string), _col8 (type: 
timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: 
boolean)
+        Reducer 4 
+            Reduce Operator Tree:
+              Map Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 KEY.reducesinkkey0 (type: int)
+                  1 KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, 
_col7, _col8, _col9, _col10, _col11, _col12
+                input vertices:
+                  0 Map 1
+                Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                HybridGraceHashJoin: true
+                Select Operator
+                  expressions: _col1 (type: tinyint), _col2 (type: smallint), 
_col3 (type: int), _col4 (type: bigint), _col5 (type: float), _col6 (type: 
double), _col7 (type: string), _col8 (type: string), _col9 (type: timestamp), 
_col10 (type: timestamp), _col11 (type: boolean), _col12 (type: boolean)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                  Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col1 (type: smallint), _col0 (type: 
tinyint), _col2 (type: int)
+                    sort order: +++
+                    Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col3 (type: bigint), _col4 (type: 
float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 
(type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 
(type: boolean)
+        Reducer 5 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey1 (type: tinyint), 
KEY.reducesinkkey0 (type: smallint), KEY.reducesinkkey2 (type: int), 
VALUE._col0 (type: bigint), VALUE._col1 (type: float), VALUE._col2 (type: 
double), VALUE._col3 (type: string), VALUE._col4 (type: string), VALUE._col5 
(type: timestamp), VALUE._col6 (type: timestamp), VALUE._col7 (type: boolean), 
VALUE._col8 (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 2477 Data size: 532794 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: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select
+  a.*
+from
+  alltypesorc a,
+  src b,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select
+  a.*
+from
+  alltypesorc a,
+  src b,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+-19    8       626923679       NULL    -19.0   8.0     821UdmGbkEf4j   NULL    
1969-12-31 15:59:46.619 1969-12-31 15:59:46.95  true    NULL
+6      8       528534767       NULL    6.0     8.0     cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:45.459 1969-12-31 16:00:00.236 true    NULL
+NULL   9       -470743566      -1887561756     NULL    9.0     
swx5K33Sm5qcKR5B        4hA4KQj2vD3fI6gX82220d  NULL    1969-12-31 16:00:07.318 
true    false
+NULL   10      813877020       -1645852809     NULL    10.0    
4QG23O2GKF6BUe13O7A2C   xH7445Rals48VOulSyR5F   NULL    1969-12-31 16:00:05.851 
false   false
+-62    10      528534767       NULL    -62.0   10.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.265 1969-12-31 15:59:56.584 true    NULL
+NULL   19      312515097       1864027286      NULL    19.0    ds5YqbRvhf3Sb2  
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:56.211 false   true
+-7     19      528534767       NULL    -7.0    19.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 16:00:13.994 1969-12-31 15:59:55.362 true    NULL
+-45    20      253665376       NULL    -45.0   20.0    1cGVWH7n1QU     NULL    
1969-12-31 16:00:09.949 1969-12-31 16:00:10.979 true    NULL
+NULL   34      510824788       -1887561756     NULL    34.0    nj1bXoh6k       
4hA4KQj2vD3fI6gX82220d  NULL    1969-12-31 15:59:46.017 true    false
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+61     41      528534767       NULL    61.0    41.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:55.708 1969-12-31 16:00:14.412 true    NULL
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+39     74      626923679       NULL    39.0    74.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:10.403 1969-12-31 16:00:12.52  true    NULL
+47     74      626923679       NULL    47.0    74.0    821UdmGbkEf4j   NULL    
1969-12-31 15:59:57.849 1969-12-31 15:59:57.569 true    NULL
+-22    77      528534767       NULL    -22.0   77.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:45.928 1969-12-31 15:59:43.621 true    NULL
+PREHOOK: query: -- Try different order of tables
+explain
+select
+  a.*
+from
+  src b,
+  alltypesorc a,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+PREHOOK: type: QUERY
+POSTHOOK: query: -- Try different order of tables
+explain
+select
+  a.*
+from
+  src b,
+  alltypesorc a,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+POSTHOOK: type: QUERY
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 depends on stages: Stage-1
+
+STAGE PLANS:
+  Stage: Stage-1
+    Tez
+      Edges:
+        Reducer 3 <- Map 2 (CUSTOM_SIMPLE_EDGE), Map 6 (CUSTOM_SIMPLE_EDGE)
+        Reducer 4 <- Map 1 (CUSTOM_SIMPLE_EDGE), Reducer 3 (CUSTOM_SIMPLE_EDGE)
+        Reducer 5 <- Reducer 4 (SIMPLE_EDGE)
+#### A masked pattern was here ####
+      Vertices:
+        Map 1 
+            Map Operator Tree:
+                TableScan
+                  alias: b
+                  Statistics: Num rows: 500 Data size: 5312 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: (UDFToInteger(key) + 0) is not null (type: 
boolean)
+                    Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: (UDFToInteger(_col0) + 0) (type: int)
+                        sort order: +
+                        Map-reduce partition columns: (UDFToInteger(_col0) + 
0) (type: int)
+                        Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+        Map 2 
+            Map Operator Tree:
+                TableScan
+                  alias: a
+                  Statistics: Num rows: 12288 Data size: 2641964 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: ((csmallint < 100) and UDFToInteger(csmallint) 
is not null) (type: boolean)
+                    Statistics: Num rows: 2048 Data size: 440327 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: ctinyint (type: tinyint), csmallint (type: 
smallint), cint (type: int), cbigint (type: bigint), cfloat (type: float), 
cdouble (type: double), cstring1 (type: string), cstring2 (type: string), 
ctimestamp1 (type: timestamp), ctimestamp2 (type: timestamp), cboolean1 (type: 
boolean), cboolean2 (type: boolean)
+                      outputColumnNames: _col0, _col1, _col2, _col3, _col4, 
_col5, _col6, _col7, _col8, _col9, _col10, _col11
+                      Statistics: Num rows: 2048 Data size: 440327 Basic 
stats: COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: UDFToInteger(_col1) (type: int)
+                        sort order: +
+                        Map-reduce partition columns: UDFToInteger(_col1) 
(type: int)
+                        Statistics: Num rows: 2048 Data size: 440327 Basic 
stats: COMPLETE Column stats: NONE
+                        value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 
(type: double), _col6 (type: string), _col7 (type: string), _col8 (type: 
timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: 
boolean)
+        Map 6 
+            Map Operator Tree:
+                TableScan
+                  alias: b
+                  Statistics: Num rows: 500 Data size: 5312 Basic stats: 
COMPLETE Column stats: NONE
+                  Filter Operator
+                    predicate: UDFToInteger(key) is not null (type: boolean)
+                    Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                    Select Operator
+                      expressions: key (type: string)
+                      outputColumnNames: _col0
+                      Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+                      Reduce Output Operator
+                        key expressions: UDFToInteger(_col0) (type: int)
+                        sort order: +
+                        Map-reduce partition columns: UDFToInteger(_col0) 
(type: int)
+                        Statistics: Num rows: 250 Data size: 2656 Basic stats: 
COMPLETE Column stats: NONE
+        Reducer 3 
+            Reduce Operator Tree:
+              Map Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 KEY.reducesinkkey0 (type: int)
+                  1 KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                input vertices:
+                  1 Map 6
+                Statistics: Num rows: 2252 Data size: 484359 Basic stats: 
COMPLETE Column stats: NONE
+                HybridGraceHashJoin: true
+                Select Operator
+                  expressions: _col0 (type: tinyint), _col1 (type: smallint), 
_col10 (type: boolean), _col11 (type: boolean), _col2 (type: int), _col3 (type: 
bigint), _col4 (type: float), _col5 (type: double), _col6 (type: string), _col7 
(type: string), _col8 (type: timestamp), _col9 (type: timestamp)
+                  outputColumnNames: _col0, _col1, _col10, _col11, _col2, 
_col3, _col4, _col5, _col6, _col7, _col8, _col9
+                  Statistics: Num rows: 2252 Data size: 484359 Basic stats: 
COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: UDFToInteger(_col1) (type: int)
+                    sort order: +
+                    Map-reduce partition columns: UDFToInteger(_col1) (type: 
int)
+                    Statistics: Num rows: 2252 Data size: 484359 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col0 (type: tinyint), _col1 (type: 
smallint), _col2 (type: int), _col3 (type: bigint), _col4 (type: float), _col5 
(type: double), _col6 (type: string), _col7 (type: string), _col8 (type: 
timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 (type: 
boolean)
+        Reducer 4 
+            Reduce Operator Tree:
+              Map Join Operator
+                condition map:
+                     Inner Join 0 to 1
+                keys:
+                  0 KEY.reducesinkkey0 (type: int)
+                  1 KEY.reducesinkkey0 (type: int)
+                outputColumnNames: _col1, _col2, _col3, _col4, _col5, _col6, 
_col7, _col8, _col9, _col10, _col11, _col12
+                input vertices:
+                  0 Map 1
+                Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                HybridGraceHashJoin: true
+                Select Operator
+                  expressions: _col1 (type: tinyint), _col2 (type: smallint), 
_col3 (type: int), _col4 (type: bigint), _col5 (type: float), _col6 (type: 
double), _col7 (type: string), _col8 (type: string), _col9 (type: timestamp), 
_col10 (type: timestamp), _col11 (type: boolean), _col12 (type: boolean)
+                  outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                  Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                  Reduce Output Operator
+                    key expressions: _col1 (type: smallint), _col0 (type: 
tinyint), _col2 (type: int)
+                    sort order: +++
+                    Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                    value expressions: _col3 (type: bigint), _col4 (type: 
float), _col5 (type: double), _col6 (type: string), _col7 (type: string), _col8 
(type: timestamp), _col9 (type: timestamp), _col10 (type: boolean), _col11 
(type: boolean)
+        Reducer 5 
+            Reduce Operator Tree:
+              Select Operator
+                expressions: KEY.reducesinkkey1 (type: tinyint), 
KEY.reducesinkkey0 (type: smallint), KEY.reducesinkkey2 (type: int), 
VALUE._col0 (type: bigint), VALUE._col1 (type: float), VALUE._col2 (type: 
double), VALUE._col3 (type: string), VALUE._col4 (type: string), VALUE._col5 
(type: timestamp), VALUE._col6 (type: timestamp), VALUE._col7 (type: boolean), 
VALUE._col8 (type: boolean)
+                outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, 
_col6, _col7, _col8, _col9, _col10, _col11
+                Statistics: Num rows: 2477 Data size: 532794 Basic stats: 
COMPLETE Column stats: NONE
+                File Output Operator
+                  compressed: false
+                  Statistics: Num rows: 2477 Data size: 532794 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: -1
+      Processor Tree:
+        ListSink
+
+PREHOOK: query: select
+  a.*
+from
+  src b,
+  alltypesorc a,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+PREHOOK: type: QUERY
+PREHOOK: Input: default@alltypesorc
+PREHOOK: Input: default@src
+#### A masked pattern was here ####
+POSTHOOK: query: select
+  a.*
+from
+  src b,
+  alltypesorc a,
+  src c
+where
+  a.csmallint = cast(b.key as int) and a.csmallint = (cast(c.key as int) + 0)
+  and (a.csmallint < 100)
+order by a.csmallint, a.ctinyint, a.cint
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@alltypesorc
+POSTHOOK: Input: default@src
+#### A masked pattern was here ####
+-19    8       626923679       NULL    -19.0   8.0     821UdmGbkEf4j   NULL    
1969-12-31 15:59:46.619 1969-12-31 15:59:46.95  true    NULL
+6      8       528534767       NULL    6.0     8.0     cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:45.459 1969-12-31 16:00:00.236 true    NULL
+NULL   9       -470743566      -1887561756     NULL    9.0     
swx5K33Sm5qcKR5B        4hA4KQj2vD3fI6gX82220d  NULL    1969-12-31 16:00:07.318 
true    false
+NULL   10      813877020       -1645852809     NULL    10.0    
4QG23O2GKF6BUe13O7A2C   xH7445Rals48VOulSyR5F   NULL    1969-12-31 16:00:05.851 
false   false
+-62    10      528534767       NULL    -62.0   10.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.265 1969-12-31 15:59:56.584 true    NULL
+NULL   19      312515097       1864027286      NULL    19.0    ds5YqbRvhf3Sb2  
4KWs6gw7lv2WYd66P       NULL    1969-12-31 15:59:56.211 false   true
+-7     19      528534767       NULL    -7.0    19.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 16:00:13.994 1969-12-31 15:59:55.362 true    NULL
+-45    20      253665376       NULL    -45.0   20.0    1cGVWH7n1QU     NULL    
1969-12-31 16:00:09.949 1969-12-31 16:00:10.979 true    NULL
+NULL   34      510824788       -1887561756     NULL    34.0    nj1bXoh6k       
4hA4KQj2vD3fI6gX82220d  NULL    1969-12-31 15:59:46.017 true    false
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+41     37      528534767       NULL    41.0    37.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:52.817 1969-12-31 15:59:53.672 true    NULL
+61     41      528534767       NULL    61.0    41.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:55.708 1969-12-31 16:00:14.412 true    NULL
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   58      -144190833      -1645852809     NULL    58.0    122J3HlhqBW1D43 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:46.315 true    false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+NULL   67      790444583       -1645852809     NULL    67.0    xptM81y 
xH7445Rals48VOulSyR5F   NULL    1969-12-31 15:59:58.622 false   false
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+-46    72      626923679       NULL    -46.0   72.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:11.411 1969-12-31 16:00:05.539 true    NULL
+39     74      626923679       NULL    39.0    74.0    821UdmGbkEf4j   NULL    
1969-12-31 16:00:10.403 1969-12-31 16:00:12.52  true    NULL
+47     74      626923679       NULL    47.0    74.0    821UdmGbkEf4j   NULL    
1969-12-31 15:59:57.849 1969-12-31 15:59:57.569 true    NULL
+-22    77      528534767       NULL    -22.0   77.0    cvLH6Eat2yFsyy7p        
NULL    1969-12-31 15:59:45.928 1969-12-31 15:59:43.621 true    NULL

Reply via email to