Saving all output to "!!{outputDirectory}!!/semijoin.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/semijoin.q >>> >>> >>> >>> >>> >>> create table t1 as select cast(key as int) key, value from src where key <= 10; 'key','value' No rows selected >>> >>> select * from t1 sort by key; 'key','value' '0','val_0' '0','val_0' '0','val_0' '2','val_2' '4','val_4' '5','val_5' '5','val_5' '5','val_5' '8','val_8' '9','val_9' '10','val_10' 11 rows selected >>> >>> create table t2 as select cast(2*key as int) key, value from t1; 'key','value' No rows selected >>> >>> select * from t2 sort by key; 'key','value' '0','val_0' '0','val_0' '0','val_0' '4','val_2' '8','val_4' '10','val_5' '10','val_5' '10','val_5' '16','val_8' '18','val_9' '20','val_10' 11 rows selected >>> >>> create table t3 as select * from (select * from t1 union all select * from t2) b; 'key','value' No rows selected >>> select * from t3 sort by key, value; 'key','value' '0','val_0' '0','val_0' '0','val_0' '0','val_0' '0','val_0' '0','val_0' '2','val_2' '4','val_2' '4','val_4' '5','val_5' '5','val_5' '5','val_5' '8','val_4' '8','val_8' '9','val_9' '10','val_10' '10','val_5' '10','val_5' '10','val_5' '16','val_8' '18','val_9' '20','val_10' 22 rows selected >>> >>> create table t4 (key int, value string); No rows affected >>> select * from t4; 'key','value' No rows selected >>> >>> explain select * from t1 a left semi join t2 b on a.key=b.key sort by a.key, a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: string' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' outputColumnNames: _col0, _col1' ' 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: string' ' sort order: ++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' 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' '' '' 107 rows selected >>> select * from t1 a left semi join t2 b on a.key=b.key sort by a.key, a.value; 'key','value' '0','val_0' '0','val_0' '0','val_0' '4','val_4' '8','val_8' '10','val_10' 6 rows selected >>> >>> explain select * from t2 a left semi join t1 b on b.key=a.key sort by a.key, a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t2) a) (TOK_TABREF (TOK_TABNAME t1) b) (= (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL a) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: string' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' outputColumnNames: _col0, _col1' ' 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: string' ' sort order: ++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' 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' '' '' 107 rows selected >>> select * from t2 a left semi join t1 b on b.key=a.key sort by a.key, a.value; 'key','value' '0','val_0' '0','val_0' '0','val_0' '4','val_2' '8','val_4' '10','val_5' '10','val_5' '10','val_5' 8 rows selected >>> >>> explain select * from t1 a left semi join t4 b on b.key=a.key sort by a.key, a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t4) b) (= (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL a) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: string' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' outputColumnNames: _col0, _col1' ' 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: string' ' sort order: ++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' 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' '' '' 107 rows selected >>> select * from t1 a left semi join t4 b on b.key=a.key sort by a.key, a.value; 'key','value' No rows selected >>> >>> explain select a.value from t1 a left semi join t3 b on (b.key = a.key and b.key < '15') sort by a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t3) b) (and (= (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL a) key)) (< (. (TOK_TABLE_OR_COL b) key) '15')))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) value))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: value' ' type: string' ' b ' ' TableScan' ' alias: b' ' Filter Operator' ' predicate:' ' expr: (key < 15)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col1' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col1' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col1' ' Select Operator' ' expressions:' ' expr: _col1' ' type: string' ' outputColumnNames: _col0' ' 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: string' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: string' ' 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' '' '' 105 rows selected >>> select a.value from t1 a left semi join t3 b on (b.key = a.key and b.key < '15') sort by a.value; 'value' 'val_0' 'val_0' 'val_0' 'val_10' 'val_2' 'val_4' 'val_5' 'val_5' 'val_5' 'val_8' 'val_9' 11 rows selected >>> >>> explain select * from t1 a left semi join t2 b on a.key = b.key and b.value < "val_10" sort by a.key, a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t2) b) (and (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)) (< (. (TOK_TABLE_OR_COL b) value) "val_10")))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: string' ' b ' ' TableScan' ' alias: b' ' Filter Operator' ' predicate:' ' expr: (value < 'val_10')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' outputColumnNames: key, value' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' outputColumnNames: _col0, _col1' ' 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: string' ' sort order: ++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' 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' '' '' 115 rows selected >>> select * from t1 a left semi join t2 b on a.key = b.key and b.value < "val_10" sort by a.key, a.value; 'key','value' '0','val_0' '0','val_0' '0','val_0' 3 rows selected >>> >>> explain select a.value from t1 a left semi join (select key from t3 where key > 5) b on a.key = b.key sort by a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME t3))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_TABLE_OR_COL key))) (TOK_WHERE (> (TOK_TABLE_OR_COL key) 5)))) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) value))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: value' ' type: string' ' b:t3 ' ' TableScan' ' alias: t3' ' Filter Operator' ' predicate:' ' expr: (key > 5)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col1' ' Select Operator' ' expressions:' ' expr: _col1' ' type: string' ' outputColumnNames: _col0' ' 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: string' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: string' ' 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' '' '' 108 rows selected >>> select a.value from t1 a left semi join (select key from t3 where key > 5) b on a.key = b.key sort by a.value; 'value' 'val_10' 'val_8' 'val_9' 3 rows selected >>> >>> explain select a.value from t1 a left semi join (select key , value from t2 where key > 5) b on a.key = b.key and b.value <= 'val_20' sort by a.value ; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME t2))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_TABLE_OR_COL key)) (TOK_SELEXPR (TOK_TABLE_OR_COL value))) (TOK_WHERE (> (TOK_TABLE_OR_COL key) 5)))) b) (and (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)) (<= (. (TOK_TABLE_OR_COL b) value) 'val_20')))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) value))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: value' ' type: string' ' b:t2 ' ' TableScan' ' alias: t2' ' Filter Operator' ' predicate:' ' expr: ((key > 5) and (value <= 'val_20'))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' outputColumnNames: _col0, _col1' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col1' ' Select Operator' ' expressions:' ' expr: _col1' ' type: string' ' outputColumnNames: _col0' ' 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: string' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: string' ' 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' '' '' 114 rows selected >>> select a.value from t1 a left semi join (select key , value from t2 where key > 5) b on a.key = b.key and b.value <= 'val_20' sort by a.value ; 'value' No rows selected >>> >>> explain select * from t2 a left semi join (select key , value from t1 where key > 2) b on a.key = b.key sort by a.key, a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t2) a) (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME t1))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_TABLE_OR_COL key)) (TOK_SELEXPR (TOK_TABLE_OR_COL value))) (TOK_WHERE (> (TOK_TABLE_OR_COL key) 2)))) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: string' ' b:t1 ' ' TableScan' ' alias: t1' ' Filter Operator' ' predicate:' ' expr: (key > 2)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' outputColumnNames: _col0, _col1' ' 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: string' ' sort order: ++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' 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' '' '' 116 rows selected >>> select * from t2 a left semi join (select key , value from t1 where key > 2) b on a.key = b.key sort by a.key, a.value; 'key','value' '4','val_2' '8','val_4' '10','val_5' '10','val_5' '10','val_5' 5 rows selected >>> >>> explain select /*+ mapjoin(b) */ a.key from t3 a left semi join t1 b on a.key = b.key sort by a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t3) a) (TOK_TABREF (TOK_TABNAME t1) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_HINTLIST (TOK_HINT TOK_MAPJOIN (TOK_HINTARGLIST b))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' 'STAGE DEPENDENCIES:' ' Stage-4 is a root stage' ' Stage-1 depends on stages: Stage-4' ' Stage-2 depends on stages: Stage-1' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-4' ' Map Reduce Local Work' ' Alias -> Map Local Tables:' ' b ' ' Fetch Operator' ' limit: -1' ' Alias -> Map Local Operator Tree:' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' HashTable Sink Operator' ' condition expressions:' ' 0 {key}' ' 1 ' ' handleSkewJoin: false' ' keys:' ' 0 [Column[key]]' ' 1 [Column[_col0]]' ' Position of Big Table: 0' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Map Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {key}' ' 1 ' ' handleSkewJoin: false' ' keys:' ' 0 [Column[key]]' ' 1 [Column[_col0]]' ' outputColumnNames: _col0' ' Position of Big Table: 0' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.SequenceFileInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat' ' Local Work:' ' Map Reduce Local Work' '' ' Stage: Stage-2' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' 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' '' '' 106 rows selected >>> select /*+ mapjoin(b) */ a.key from t3 a left semi join t1 b on a.key = b.key sort by a.key; 'key' '0' '0' '0' '0' '0' '0' '2' '4' '4' '5' '5' '5' '8' '8' '9' '10' '10' '10' '10' 19 rows selected >>> >>> explain select * from t1 a left semi join t2 b on a.key = 2*b.key sort by a.key, a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (* 2 (. (TOK_TABLE_OR_COL b) key))))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: string' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: (2 * _col0)' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: (2 * _col0)' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' outputColumnNames: _col0, _col1' ' 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: string' ' sort order: ++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' 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' '' '' 107 rows selected >>> select * from t1 a left semi join t2 b on a.key = 2*b.key sort by a.key, a.value; 'key','value' '0','val_0' '0','val_0' '0','val_0' '8','val_8' 4 rows selected >>> >>> explain select * from t1 a join t2 b on a.key = b.key left semi join t3 c on b.key = c.key sort by a.key, a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_JOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key))) (TOK_TABREF (TOK_TABNAME t3) c) (= (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL c) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: string' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 1' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' c ' ' TableScan' ' alias: c' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 2' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' Left Semi Join 1 to 2' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0} {VALUE._col1}' ' 2 ' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1, _col4, _col5' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col4' ' type: int' ' expr: _col5' ' type: string' ' 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: string' ' sort order: ++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: int' ' expr: _col3' ' type: string' ' 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' '' '' 134 rows selected >>> select * from t1 a join t2 b on a.key = b.key left semi join t3 c on b.key = c.key sort by a.key, a.value; 'key','value','key','value' '0','val_0','0','val_0' '0','val_0','0','val_0' '0','val_0','0','val_0' '0','val_0','0','val_0' '0','val_0','0','val_0' '0','val_0','0','val_0' '0','val_0','0','val_0' '0','val_0','0','val_0' '0','val_0','0','val_0' '4','val_4','4','val_2' '8','val_8','8','val_4' '10','val_10','10','val_5' '10','val_10','10','val_5' '10','val_10','10','val_5' 14 rows selected >>> >>> explain select * from t3 a left semi join t1 b on a.key = b.key and a.value=b.value sort by a.key, a.value; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t3) a) (TOK_TABREF (TOK_TABNAME t1) b) (and (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)) (= (. (TOK_TABLE_OR_COL a) value) (. (TOK_TABLE_OR_COL b) value))))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) 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: string' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' tag: 0' ' value expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' outputColumnNames: key, value' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' sort order: ++' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' outputColumnNames: _col0, _col1' ' 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: string' ' sort order: ++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' 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' '' '' 119 rows selected >>> select * from t3 a left semi join t1 b on a.key = b.key and a.value=b.value sort by a.key, a.value; 'key','value' '0','val_0' '0','val_0' '0','val_0' '0','val_0' '0','val_0' '0','val_0' '2','val_2' '4','val_4' '5','val_5' '5','val_5' '5','val_5' '8','val_8' '9','val_9' '10','val_10' 14 rows selected >>> >>> explain select /*+ mapjoin(b, c) */ a.key from t3 a left semi join t1 b on a.key = b.key left semi join t2 c on a.key = c.key sort by a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t3) a) (TOK_TABREF (TOK_TABNAME t1) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key))) (TOK_TABREF (TOK_TABNAME t2) 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_HINTLIST (TOK_HINT TOK_MAPJOIN (TOK_HINTARGLIST b c))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-1 depends on stages: Stage-5' ' Stage-2 depends on stages: Stage-1' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce Local Work' ' Alias -> Map Local Tables:' ' b ' ' Fetch Operator' ' limit: -1' ' c ' ' Fetch Operator' ' limit: -1' ' Alias -> Map Local Operator Tree:' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' HashTable Sink Operator' ' condition expressions:' ' 0 {key}' ' 1 ' ' 2 ' ' handleSkewJoin: false' ' keys:' ' 0 [Column[key]]' ' 1 [Column[_col0]]' ' 2 [Column[_col0]]' ' Position of Big Table: 0' ' c ' ' TableScan' ' alias: c' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' HashTable Sink Operator' ' condition expressions:' ' 0 {key}' ' 1 ' ' 2 ' ' handleSkewJoin: false' ' keys:' ' 0 [Column[key]]' ' 1 [Column[_col0]]' ' 2 [Column[_col0]]' ' Position of Big Table: 0' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Map Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' Left Semi Join 0 to 2' ' condition expressions:' ' 0 {key}' ' 1 ' ' 2 ' ' handleSkewJoin: false' ' keys:' ' 0 [Column[key]]' ' 1 [Column[_col0]]' ' 2 [Column[_col0]]' ' outputColumnNames: _col0' ' Position of Big Table: 0' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.SequenceFileInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat' ' Local Work:' ' Map Reduce Local Work' '' ' Stage: Stage-2' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' 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' '' '' 140 rows selected >>> select /*+ mapjoin(b, c) */ a.key from t3 a left semi join t1 b on a.key = b.key left semi join t2 c on a.key = c.key sort by a.key; 'key' '0' '0' '0' '0' '0' '0' '4' '4' '8' '8' '10' '10' '10' '10' 14 rows selected >>> >>> explain select a.key from t3 a left outer join t1 b on a.key = b.key left semi join t2 c on b.key = c.key sort by a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_LEFTOUTERJOIN (TOK_TABREF (TOK_TABNAME t3) a) (TOK_TABREF (TOK_TABNAME t1) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key))) (TOK_TABREF (TOK_TABNAME t2) c) (= (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL c) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' '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' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 1' ' c ' ' TableScan' ' alias: c' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 2' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Outer Join0 to 1' ' Left Semi Join 1 to 2' ' condition expressions:' ' 0 {VALUE._col0}' ' 1 ' ' 2 ' ' handleSkewJoin: false' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' 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' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' 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 a.key from t3 a left outer join t1 b on a.key = b.key left semi join t2 c on b.key = c.key sort by a.key; 'key' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '4' '4' '8' '8' '10' '10' '10' '10' 26 rows selected >>> >>> explain select a.key from t1 a right outer join t3 b on a.key = b.key left semi join t2 c on b.key = c.key sort by a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_RIGHTOUTERJOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t3) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key))) (TOK_TABREF (TOK_TABNAME t2) c) (= (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL c) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' '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' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 1' ' c ' ' TableScan' ' alias: c' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 2' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Right Outer Join0 to 1' ' Left Semi Join 1 to 2' ' condition expressions:' ' 0 {VALUE._col0}' ' 1 ' ' 2 ' ' handleSkewJoin: false' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' 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' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' 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 a.key from t1 a right outer join t3 b on a.key = b.key left semi join t2 c on b.key = c.key sort by a.key; 'key' '' '' '' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '4' '4' '8' '8' '10' '10' '10' '10' 29 rows selected >>> >>> explain select a.key from t1 a full outer join t3 b on a.key = b.key left semi join t2 c on b.key = c.key sort by a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTSEMIJOIN (TOK_FULLOUTERJOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t3) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key))) (TOK_TABREF (TOK_TABNAME t2) c) (= (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL c) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' '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' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: int' ' tag: 1' ' c ' ' TableScan' ' alias: c' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 2' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Outer Join 0 to 1' ' Left Semi Join 1 to 2' ' condition expressions:' ' 0 {VALUE._col0}' ' 1 ' ' 2 ' ' handleSkewJoin: false' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' 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' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' 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 a.key from t1 a full outer join t3 b on a.key = b.key left semi join t2 c on b.key = c.key sort by a.key; 'key' '' '' '' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '4' '4' '8' '8' '10' '10' '10' '10' 29 rows selected >>> >>> explain select a.key from t3 a left semi join t2 b on a.key = b.key left outer join t1 c on a.key = c.key sort by a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTOUTERJOIN (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t3) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key))) (TOK_TABREF (TOK_TABNAME t1) 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_TABLE_OR_COL a) key))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' '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' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' 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' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' Left Outer Join0 to 2' ' condition expressions:' ' 0 {VALUE._col0}' ' 1 ' ' 2 ' ' handleSkewJoin: false' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' 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' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' 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 a.key from t3 a left semi join t2 b on a.key = b.key left outer join t1 c on a.key = c.key sort by a.key; 'key' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '4' '4' '8' '8' '10' '10' '10' '10' '16' '18' '20' 29 rows selected >>> >>> explain select a.key from t3 a left semi join t2 b on a.key = b.key right outer join t1 c on a.key = c.key sort by a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_RIGHTOUTERJOIN (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t3) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key))) (TOK_TABREF (TOK_TABNAME t1) 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_TABLE_OR_COL a) key))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' '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' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' 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' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' Right Outer Join0 to 2' ' condition expressions:' ' 0 {VALUE._col0}' ' 1 ' ' 2 ' ' handleSkewJoin: false' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' 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' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' 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 a.key from t3 a left semi join t2 b on a.key = b.key right outer join t1 c on a.key = c.key sort by a.key; 'key' '' '' '' '' '' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '4' '4' '8' '8' '10' '10' '10' '10' 31 rows selected >>> >>> explain select a.key from t3 a left semi join t1 b on a.key = b.key full outer join t2 c on a.key = c.key sort by a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_FULLOUTERJOIN (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t3) a) (TOK_TABREF (TOK_TABNAME t1) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key))) (TOK_TABREF (TOK_TABNAME t2) 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_TABLE_OR_COL a) key))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' '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' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' 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' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' Outer Join 0 to 2' ' condition expressions:' ' 0 {VALUE._col0}' ' 1 ' ' 2 ' ' handleSkewJoin: false' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' 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' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' 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 a.key from t3 a left semi join t1 b on a.key = b.key full outer join t2 c on a.key = c.key sort by a.key; 'key' '' '' '' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '2' '4' '4' '5' '5' '5' '8' '8' '9' '10' '10' '10' '10' '10' '10' '10' '10' '10' '10' '10' '10' 42 rows selected >>> >>> explain select a.key from t3 a left semi join t2 b on a.key = b.key left outer join t1 c on a.value = c.value sort by a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_LEFTOUTERJOIN (TOK_LEFTSEMIJOIN (TOK_TABREF (TOK_TABNAME t3) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key))) (TOK_TABREF (TOK_TABNAME t1) c) (= (. (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_TABLE_OR_COL a) key))) (TOK_SORTBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-2 depends on stages: Stage-1' ' Stage-3 depends on stages: Stage-2' ' 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: string' ' b ' ' TableScan' ' alias: b' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' outputColumnNames: key' ' Group By Operator' ' bucketGroup: false' ' keys:' ' expr: key' ' type: int' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: int' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Semi Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1' ' 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:' ' $INTNAME ' ' Reduce Output Operator' ' key expressions:' ' expr: _col1' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col1' ' type: string' ' tag: 0' ' value expressions:' ' expr: _col0' ' type: int' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: value' ' type: string' ' tag: 1' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Outer Join0 to 1' ' condition expressions:' ' 0 {VALUE._col0}' ' 1 ' ' handleSkewJoin: false' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' outputColumnNames: _col0' ' 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-3' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: int' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' 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' '' '' 146 rows selected >>> select a.key from t3 a left semi join t2 b on a.key = b.key left outer join t1 c on a.value = c.value sort by a.key; 'key' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '0' '4' '4' '8' '8' '10' '10' '10' '10' '10' '10' '10' '10' '10' '10' '16' '18' '20' 35 rows selected >>> >>> >>> >>> >>> >>> !record