Saving all output to "!!{outputDirectory}!!/join_nullsafe.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/join_nullsafe.q >>> set hive.nullsafe.equijoin=true; No rows affected >>> >>> CREATE TABLE myinput1(key int, value int); No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in8.txt' INTO TABLE myinput1; No rows affected >>> >>> -- merging >>> explain select * from myinput1 a join myinput1 b on a.key<=>b.value ORDER BY a.key, a.value, b.key, b.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME myinput1) a) (TOK_TABREF (TOK_TABNAME myinput1) b) (<=> (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) value)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) value)))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-2 depends on stages: Stage-1' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 0' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: value' ' type: int' ' tag: 1' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0} {VALUE._col1}' ' handleSkewJoin: false' ' nullSafes: [true]' ' outputColumnNames: _col0, _col1, _col4, _col5' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' outputColumnNames: _col0, _col1, _col2, _col3' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.SequenceFileInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat' '' ' Stage: Stage-2' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' sort order: ++++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' Reduce Operator Tree:' ' Extract' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 113 rows selected >>> select * from myinput1 a join myinput1 b on a.key<=>b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','10','' '','','48','' '','10','','' '','10','10','' '','10','48','' '','35','','' '','35','10','' '','35','48','' '10','','','10' '100','100','100','100' 11 rows selected >>> >>> explain select * from myinput1 a join myinput1 b on a.key<=>b.value join myinput1 c on a.key=c.key ORDER BY a.key, a.value, b.key, b.value, c.key, c.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_JOIN (TOK_TABREF (TOK_TABNAME myinput1) a) (TOK_TABREF (TOK_TABNAME myinput1) b) (<=> (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) value))) (TOK_TABREF (TOK_TABNAME myinput1) c) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL c) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL c) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL c) value)))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-2 depends on stages: Stage-1' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 0' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: value' ' type: int' ' tag: 1' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 2' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' Inner Join 0 to 2' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0} {VALUE._col1}' ' 2 {VALUE._col0} {VALUE._col1}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1, _col4, _col5, _col8, _col9' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' expr: _col8' ' type: int' ' expr: _col9' ' type: int' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.SequenceFileInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat' '' ' Stage: Stage-2' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' sort order: ++++++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' Reduce Operator Tree:' ' Extract' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 143 rows selected >>> select * from myinput1 a join myinput1 b on a.key<=>b.value join myinput1 c on a.key=c.key ORDER BY a.key, a.value, b.key, b.value, c.key, c.value; 'key','value','key','value','key','value' '10','','','10','10','' '100','100','100','100','100','100' 2 rows selected >>> >>> explain select * from myinput1 a join myinput1 b on a.key<=>b.value join myinput1 c on a.key<=>c.key ORDER BY a.key, a.value, b.key, b.value, c.key, c.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_JOIN (TOK_TABREF (TOK_TABNAME myinput1) a) (TOK_TABREF (TOK_TABNAME myinput1) b) (<=> (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) value))) (TOK_TABREF (TOK_TABNAME myinput1) c) (<=> (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL c) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL c) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL c) value)))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-2 depends on stages: Stage-1' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 0' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: value' ' type: int' ' tag: 1' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 2' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' Inner Join 0 to 2' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0} {VALUE._col1}' ' 2 {VALUE._col0} {VALUE._col1}' ' handleSkewJoin: false' ' nullSafes: [true]' ' outputColumnNames: _col0, _col1, _col4, _col5, _col8, _col9' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' expr: _col8' ' type: int' ' expr: _col9' ' type: int' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.SequenceFileInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat' '' ' Stage: Stage-2' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' sort order: ++++++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' Reduce Operator Tree:' ' Extract' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 144 rows selected >>> select * from myinput1 a join myinput1 b on a.key<=>b.value join myinput1 c on a.key<=>c.key ORDER BY a.key, a.value, b.key, b.value, c.key, c.value; 'key','value','key','value','key','value' '','','','','','' '','','','','','10' '','','','','','35' '','','10','','','' '','','10','','','10' '','','10','','','35' '','','48','','','' '','','48','','','10' '','','48','','','35' '','10','','','','' '','10','','','','10' '','10','','','','35' '','10','10','','','' '','10','10','','','10' '','10','10','','','35' '','10','48','','','' '','10','48','','','10' '','10','48','','','35' '','35','','','','' '','35','','','','10' '','35','','','','35' '','35','10','','','' '','35','10','','','10' '','35','10','','','35' '','35','48','','','' '','35','48','','','10' '','35','48','','','35' '10','','','10','10','' '100','100','100','100','100','100' 29 rows selected >>> >>> explain select * from myinput1 a join myinput1 b on a.key<=>b.value AND a.value=b.key join myinput1 c on a.key<=>c.key AND a.value=c.value ORDER BY a.key, a.value, b.key, b.value, c.key, c.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_JOIN (TOK_TABREF (TOK_TABNAME myinput1) a) (TOK_TABREF (TOK_TABNAME myinput1) b) (AND (<=> (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) value)) (= (. (TOK_TABLE_OR_COL a) value) (. (TOK_TABLE_OR_COL b) key)))) (TOK_TABREF (TOK_TABNAME myinput1) c) (AND (<=> (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL c) key)) (= (. (TOK_TABLE_OR_COL a) value) (. (TOK_TABLE_OR_COL c) value))))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL c) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL c) value)))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-2 depends on stages: Stage-1' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' tag: 0' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: int' ' expr: key' ' type: int' ' sort order: ++' ' Map-reduce partition columns:' ' expr: value' ' type: int' ' expr: key' ' type: int' ' tag: 1' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' tag: 2' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' Inner Join 0 to 2' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0} {VALUE._col1}' ' 2 {VALUE._col0} {VALUE._col1}' ' handleSkewJoin: false' ' nullSafes: [true, false]' ' outputColumnNames: _col0, _col1, _col4, _col5, _col8, _col9' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' expr: _col8' ' type: int' ' expr: _col9' ' type: int' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.SequenceFileInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat' '' ' Stage: Stage-2' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' sort order: ++++++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' Reduce Operator Tree:' ' Extract' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 156 rows selected >>> select * from myinput1 a join myinput1 b on a.key<=>b.value AND a.value=b.key join myinput1 c on a.key<=>c.key AND a.value=c.value ORDER BY a.key, a.value, b.key, b.value, c.key, c.value; 'key','value','key','value','key','value' '','10','10','','','10' '100','100','100','100','100','100' 2 rows selected >>> >>> explain select * from myinput1 a join myinput1 b on a.key<=>b.value AND a.value<=>b.key join myinput1 c on a.key<=>c.key AND a.value<=>c.value ORDER BY a.key, a.value, b.key, b.value, c.key, c.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_JOIN (TOK_TABREF (TOK_TABNAME myinput1) a) (TOK_TABREF (TOK_TABNAME myinput1) b) (AND (<=> (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) value)) (<=> (. (TOK_TABLE_OR_COL a) value) (. (TOK_TABLE_OR_COL b) key)))) (TOK_TABREF (TOK_TABNAME myinput1) c) (AND (<=> (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL c) key)) (<=> (. (TOK_TABLE_OR_COL a) value) (. (TOK_TABLE_OR_COL c) value))))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL c) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL c) value)))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-2 depends on stages: Stage-1' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' tag: 0' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: int' ' expr: key' ' type: int' ' sort order: ++' ' Map-reduce partition columns:' ' expr: value' ' type: int' ' expr: key' ' type: int' ' tag: 1' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' tag: 2' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' Inner Join 0 to 2' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0} {VALUE._col1}' ' 2 {VALUE._col0} {VALUE._col1}' ' handleSkewJoin: false' ' nullSafes: [true, true]' ' outputColumnNames: _col0, _col1, _col4, _col5, _col8, _col9' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' expr: _col8' ' type: int' ' expr: _col9' ' type: int' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.SequenceFileInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat' '' ' Stage: Stage-2' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' sort order: ++++++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col2' ' type: int' ' expr: _col3' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' Reduce Operator Tree:' ' Extract' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 156 rows selected >>> select * from myinput1 a join myinput1 b on a.key<=>b.value AND a.value<=>b.key join myinput1 c on a.key<=>c.key AND a.value<=>c.value ORDER BY a.key, a.value, b.key, b.value, c.key, c.value; 'key','value','key','value','key','value' '','','','','','' '','10','10','','','10' '10','','','10','10','' '100','100','100','100','100','100' 4 rows selected >>> >>> -- outer joins >>> SELECT * FROM myinput1 a LEFT OUTER JOIN myinput1 b ON a.key<=>b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','10','' '','','48','' '','10','','' '','10','10','' '','10','48','' '','35','','' '','35','10','' '','35','48','' '10','','','10' '48','','','' '100','100','100','100' 12 rows selected >>> SELECT * FROM myinput1 a RIGHT OUTER JOIN myinput1 b ON a.key<=>b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','35' '','','10','' '','','48','' '','10','','' '','10','10','' '','10','48','' '','35','','' '','35','10','' '','35','48','' '10','','','10' '100','100','100','100' 12 rows selected >>> SELECT * FROM myinput1 a FULL OUTER JOIN myinput1 b ON a.key<=>b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','35' '','','10','' '','','48','' '','10','','' '','10','10','' '','10','48','' '','35','','' '','35','10','' '','35','48','' '10','','','10' '48','','','' '100','100','100','100' 13 rows selected >>> >>> -- map joins >>> SELECT /*+ MAPJOIN(a) */ * FROM myinput1 a JOIN myinput1 b ON a.key<=>b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','10','' '','','48','' '','10','','' '','10','10','' '','10','48','' '','35','','' '','35','10','' '','35','48','' '10','','','10' '100','100','100','100' 11 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM myinput1 a JOIN myinput1 b ON a.key<=>b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','10','' '','','48','' '','10','','' '','10','10','' '','10','48','' '','35','','' '','35','10','' '','35','48','' '10','','','10' '100','100','100','100' 11 rows selected >>> >>> -- smbs >>> CREATE TABLE smb_input1(key int, value int) CLUSTERED BY (key) SORTED BY (key) INTO 2 BUCKETS; No rows affected >>> CREATE TABLE smb_input2(key int, value int) CLUSTERED BY (value) SORTED BY (value) INTO 2 BUCKETS; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in8.txt' into table smb_input1; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in9.txt' into table smb_input1; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in8.txt' into table smb_input2; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/in9.txt' into table smb_input2; No rows affected >>> >>> SET hive.optimize.bucketmapJOIN = true; No rows affected >>> SET hive.optimize.bucketmapJOIN.sortedmerge = true; No rows affected >>> SET hive.input.format = org.apache.hadoop.hive.ql.io.BucketizedHiveInputFormat; No rows affected >>> >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a JOIN smb_input1 b ON a.key <=> b.key ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','','10' '','','','10' '','','','35' '','','','35' '','','','110' '','','','110' '','','','135' '','','','135' '','10','','' '','10','','' '','10','','10' '','10','','35' '','10','','110' '','10','','135' '','35','','' '','35','','' '','35','','10' '','35','','35' '','35','','110' '','35','','135' '','110','','' '','110','','' '','110','','10' '','110','','35' '','110','','110' '','110','','135' '','135','','' '','135','','' '','135','','10' '','135','','35' '','135','','110' '','135','','135' '10','','10','' '48','','48','' '100','100','100','100' '110','','110','' '148','','148','' '200','200','200','200' 42 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a JOIN smb_input1 b ON a.key <=> b.key AND a.value <=> b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '100','100','100','100' '200','200','200','200' 6 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a RIGHT OUTER JOIN smb_input1 b ON a.key <=> b.key ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','','10' '','','','10' '','','','35' '','','','35' '','','','110' '','','','110' '','','','135' '','','','135' '','10','','' '','10','','' '','10','','10' '','10','','35' '','10','','110' '','10','','135' '','35','','' '','35','','' '','35','','10' '','35','','35' '','35','','110' '','35','','135' '','110','','' '','110','','' '','110','','10' '','110','','35' '','110','','110' '','110','','135' '','135','','' '','135','','' '','135','','10' '','135','','35' '','135','','110' '','135','','135' '10','','10','' '48','','48','' '100','100','100','100' '110','','110','' '148','','148','' '200','200','200','200' 42 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input1 a JOIN smb_input1 b ON a.key <=> b.key ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','','10' '','','','10' '','','','35' '','','','35' '','','','110' '','','','110' '','','','135' '','','','135' '','10','','' '','10','','' '','10','','10' '','10','','35' '','10','','110' '','10','','135' '','35','','' '','35','','' '','35','','10' '','35','','35' '','35','','110' '','35','','135' '','110','','' '','110','','' '','110','','10' '','110','','35' '','110','','110' '','110','','135' '','135','','' '','135','','' '','135','','10' '','135','','35' '','135','','110' '','135','','135' '10','','10','' '48','','48','' '100','100','100','100' '110','','110','' '148','','148','' '200','200','200','200' 42 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input1 a LEFT OUTER JOIN smb_input1 b ON a.key <=> b.key ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','','10' '','','','10' '','','','35' '','','','35' '','','','110' '','','','110' '','','','135' '','','','135' '','10','','' '','10','','' '','10','','10' '','10','','35' '','10','','110' '','10','','135' '','35','','' '','35','','' '','35','','10' '','35','','35' '','35','','110' '','35','','135' '','110','','' '','110','','' '','110','','10' '','110','','35' '','110','','110' '','110','','135' '','135','','' '','135','','' '','135','','10' '','135','','35' '','135','','110' '','135','','135' '10','','10','' '48','','48','' '100','100','100','100' '110','','110','' '148','','148','' '200','200','200','200' 42 rows selected >>> >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a JOIN smb_input2 b ON a.key <=> b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','10','' '','','10','' '','','48','' '','','48','' '','','110','' '','','110','' '','','148','' '','','148','' '','10','','' '','10','','' '','10','10','' '','10','48','' '','10','110','' '','10','148','' '','35','','' '','35','','' '','35','10','' '','35','48','' '','35','110','' '','35','148','' '','110','','' '','110','','' '','110','10','' '','110','48','' '','110','110','' '','110','148','' '','135','','' '','135','','' '','135','10','' '','135','48','' '','135','110','' '','135','148','' '10','','','10' '100','100','100','100' '110','','','110' '200','200','200','200' 40 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input1 a JOIN smb_input2 b ON a.key <=> b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','10','' '','','10','' '','','48','' '','','48','' '','','110','' '','','110','' '','','148','' '','','148','' '','10','','' '','10','','' '','10','10','' '','10','48','' '','10','110','' '','10','148','' '','35','','' '','35','','' '','35','10','' '','35','48','' '','35','110','' '','35','148','' '','110','','' '','110','','' '','110','10','' '','110','48','' '','110','110','' '','110','148','' '','135','','' '','135','','' '','135','10','' '','135','48','' '','135','110','' '','135','148','' '10','','','10' '100','100','100','100' '110','','','110' '200','200','200','200' 40 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input1 a LEFT OUTER JOIN smb_input2 b ON a.key <=> b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','10','' '','','10','' '','','48','' '','','48','' '','','110','' '','','110','' '','','148','' '','','148','' '','10','','' '','10','','' '','10','10','' '','10','48','' '','10','110','' '','10','148','' '','35','','' '','35','','' '','35','10','' '','35','48','' '','35','110','' '','35','148','' '','110','','' '','110','','' '','110','10','' '','110','48','' '','110','110','' '','110','148','' '','135','','' '','135','','' '','135','10','' '','135','48','' '','135','110','' '','135','148','' '10','','','10' '48','','','' '100','100','100','100' '110','','','110' '148','','','' '200','200','200','200' 42 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input1 a RIGHT OUTER JOIN smb_input2 b ON a.key <=> b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','','35' '','','','135' '','','10','' '','','10','' '','','48','' '','','48','' '','','110','' '','','110','' '','','148','' '','','148','' '','10','','' '','10','','' '','10','10','' '','10','48','' '','10','110','' '','10','148','' '','35','','' '','35','','' '','35','10','' '','35','48','' '','35','110','' '','35','148','' '','110','','' '','110','','' '','110','10','' '','110','48','' '','110','110','' '','110','148','' '','135','','' '','135','','' '','135','10','' '','135','48','' '','135','110','' '','135','148','' '10','','','10' '100','100','100','100' '110','','','110' '200','200','200','200' 42 rows selected >>> >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input2 a JOIN smb_input2 b ON a.value <=> b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','10','' '','','10','' '','','48','' '','','48','' '','','110','' '','','110','' '','','148','' '','','148','' '','10','','10' '','35','','35' '','110','','110' '','135','','135' '10','','','' '10','','','' '10','','10','' '10','','48','' '10','','110','' '10','','148','' '48','','','' '48','','','' '48','','10','' '48','','48','' '48','','110','' '48','','148','' '100','100','100','100' '110','','','' '110','','','' '110','','10','' '110','','48','' '110','','110','' '110','','148','' '148','','','' '148','','','' '148','','10','' '148','','48','' '148','','110','' '148','','148','' '200','200','200','200' 42 rows selected >>> SELECT /*+ MAPJOIN(a) */ * FROM smb_input2 a RIGHT OUTER JOIN smb_input2 b ON a.value <=> b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','10','' '','','10','' '','','48','' '','','48','' '','','110','' '','','110','' '','','148','' '','','148','' '','10','','10' '','35','','35' '','110','','110' '','135','','135' '10','','','' '10','','','' '10','','10','' '10','','48','' '10','','110','' '10','','148','' '48','','','' '48','','','' '48','','10','' '48','','48','' '48','','110','' '48','','148','' '100','100','100','100' '110','','','' '110','','','' '110','','10','' '110','','48','' '110','','110','' '110','','148','' '148','','','' '148','','','' '148','','10','' '148','','48','' '148','','110','' '148','','148','' '200','200','200','200' 42 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input2 a JOIN smb_input2 b ON a.value <=> b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','10','' '','','10','' '','','48','' '','','48','' '','','110','' '','','110','' '','','148','' '','','148','' '','10','','10' '','35','','35' '','110','','110' '','135','','135' '10','','','' '10','','','' '10','','10','' '10','','48','' '10','','110','' '10','','148','' '48','','','' '48','','','' '48','','10','' '48','','48','' '48','','110','' '48','','148','' '100','100','100','100' '110','','','' '110','','','' '110','','10','' '110','','48','' '110','','110','' '110','','148','' '148','','','' '148','','','' '148','','10','' '148','','48','' '148','','110','' '148','','148','' '200','200','200','200' 42 rows selected >>> SELECT /*+ MAPJOIN(b) */ * FROM smb_input2 a LEFT OUTER JOIN smb_input2 b ON a.value <=> b.value ORDER BY a.key, a.value, b.key, b.value; 'key','value','key','value' '','','','' '','','','' '','','','' '','','','' '','','10','' '','','10','' '','','48','' '','','48','' '','','110','' '','','110','' '','','148','' '','','148','' '','10','','10' '','35','','35' '','110','','110' '','135','','135' '10','','','' '10','','','' '10','','10','' '10','','48','' '10','','110','' '10','','148','' '48','','','' '48','','','' '48','','10','' '48','','48','' '48','','110','' '48','','148','' '100','100','100','100' '110','','','' '110','','','' '110','','10','' '110','','48','' '110','','110','' '110','','148','' '148','','','' '148','','','' '148','','10','' '148','','48','' '148','','110','' '148','','148','' '200','200','200','200' 42 rows selected >>> >>> --HIVE-3315 join predicate transitive >>> explain select * from myinput1 a join myinput1 b on a.key<=>b.value AND a.key is NULL; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME myinput1) a) (TOK_TABREF (TOK_TABNAME myinput1) b) (AND (<=> (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) value)) (TOK_FUNCTION TOK_ISNULL (. (TOK_TABLE_OR_COL a) key))))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Filter Operator' ' predicate:' ' expr: key is null' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 0' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' b ' ' TableScan' ' alias: b' ' Filter Operator' ' predicate:' ' expr: value is null' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: value' ' type: int' ' tag: 1' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: int' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0} {VALUE._col1}' ' handleSkewJoin: false' ' nullSafes: [true]' ' outputColumnNames: _col0, _col1, _col4, _col5' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: int' ' expr: _col4' ' type: int' ' expr: _col5' ' type: int' ' outputColumnNames: _col0, _col1, _col2, _col3' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 86 rows selected >>> select * from myinput1 a join myinput1 b on a.key<=>b.value AND a.key is NULL; 'key','value','key','value' '','','','' '','','10','' '','','48','' '','10','','' '','10','10','' '','10','48','' '','35','','' '','35','10','' '','35','48','' 9 rows selected >>> !record