Saving all output to "!!{outputDirectory}!!/join_reorder.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/join_reorder.q >>> >>> >>> >>> >>> CREATE TABLE T1(key STRING, val STRING) STORED AS TEXTFILE; No rows affected >>> CREATE TABLE T2(key STRING, val STRING) STORED AS TEXTFILE; No rows affected >>> CREATE TABLE T3(key STRING, val STRING) STORED AS TEXTFILE; No rows affected >>> >>> LOAD DATA LOCAL INPATH '../data/files/T1.txt' INTO TABLE T1; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/T2.txt' INTO TABLE T2; No rows affected >>> LOAD DATA LOCAL INPATH '../data/files/T3.txt' INTO TABLE T3; No rows affected >>> >>> EXPLAIN FROM T1 a JOIN src c ON c.key+1=a.key SELECT a.key, a.val, c.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME T1) a) (TOK_TABREF (TOK_TABNAME src) c) (= (+ (. (TOK_TABLE_OR_COL c) key) 1) (. (TOK_TABLE_OR_COL a) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) val)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL c) key)))))' '' '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' ' Reduce Output Operator' ' key expressions:' ' expr: UDFToDouble(key)' ' type: double' ' sort order: +' ' Map-reduce partition columns:' ' expr: UDFToDouble(key)' ' type: double' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: (key + 1)' ' type: double' ' sort order: +' ' Map-reduce partition columns:' ' expr: (key + 1)' ' type: double' ' tag: 1' ' value expressions:' ' expr: key' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1, _col4' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' expr: _col4' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' 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' '' '' 73 rows selected >>> >>> EXPLAIN FROM T1 a JOIN src c ON c.key+1=a.key SELECT /*+ STREAMTABLE(a) */ a.key, a.val, c.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME T1) a) (TOK_TABREF (TOK_TABNAME src) c) (= (+ (. (TOK_TABLE_OR_COL c) key) 1) (. (TOK_TABLE_OR_COL a) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_HINTLIST (TOK_HINT TOK_STREAMTABLE (TOK_HINTARGLIST a))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) val)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL c) key)))))' '' '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' ' Reduce Output Operator' ' key expressions:' ' expr: UDFToDouble(key)' ' type: double' ' sort order: +' ' Map-reduce partition columns:' ' expr: UDFToDouble(key)' ' type: double' ' tag: 1' ' value expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: (key + 1)' ' type: double' ' sort order: +' ' Map-reduce partition columns:' ' expr: (key + 1)' ' type: double' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1, _col4' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' expr: _col4' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' 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' '' '' 73 rows selected >>> >>> FROM T1 a JOIN src c ON c.key+1=a.key SELECT a.key, a.val, c.key; 'key','val','key' '1','11','0' '1','11','0' '1','11','0' '3','13','2' 4 rows selected >>> >>> FROM T1 a JOIN src c ON c.key+1=a.key SELECT /*+ STREAMTABLE(a) */ a.key, a.val, c.key; 'key','val','key' '1','11','0' '1','11','0' '1','11','0' '3','13','2' 4 rows selected >>> >>> EXPLAIN FROM T1 a LEFT OUTER JOIN T2 b ON (b.key=a.key) RIGHT OUTER JOIN T3 c ON (c.val = a.val) SELECT a.key, b.key, a.val, c.val; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_RIGHTOUTERJOIN (TOK_LEFTOUTERJOIN (TOK_TABREF (TOK_TABNAME T1) a) (TOK_TABREF (TOK_TABNAME T2) b) (= (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL a) key))) (TOK_TABREF (TOK_TABNAME T3) c) (= (. (TOK_TABLE_OR_COL c) val) (. (TOK_TABLE_OR_COL a) val)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL b) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) val)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL c) val)))))' '' '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: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' tag: 1' ' value expressions:' ' expr: key' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Outer Join0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1, _col4' ' 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: _col4' ' type: string' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: val' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: val' ' type: string' ' tag: 1' ' value expressions:' ' expr: val' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Right Outer Join0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col4} {VALUE._col5}' ' 1 {VALUE._col1}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col4, _col5, _col9' ' Select Operator' ' expressions:' ' expr: _col4' ' type: string' ' expr: _col0' ' type: string' ' expr: _col5' ' type: string' ' expr: _col9' ' type: string' ' 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' '' '' 127 rows selected >>> >>> EXPLAIN FROM T1 a LEFT OUTER JOIN T2 b ON (b.key=a.key) RIGHT OUTER JOIN T3 c ON (c.val = a.val) SELECT /*+ STREAMTABLE(a) */ a.key, b.key, a.val, c.val; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_RIGHTOUTERJOIN (TOK_LEFTOUTERJOIN (TOK_TABREF (TOK_TABNAME T1) a) (TOK_TABREF (TOK_TABNAME T2) b) (= (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL a) key))) (TOK_TABREF (TOK_TABNAME T3) c) (= (. (TOK_TABLE_OR_COL c) val) (. (TOK_TABLE_OR_COL a) val)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_HINTLIST (TOK_HINT TOK_STREAMTABLE (TOK_HINTARGLIST a))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL b) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) val)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL c) val)))))' '' '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: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' tag: 1' ' value expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Left Outer Join0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1}' ' 1 {VALUE._col0}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1, _col4' ' 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: 1' ' value expressions:' ' expr: _col4' ' type: string' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: val' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: val' ' type: string' ' tag: 0' ' value expressions:' ' expr: val' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Right Outer Join0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col4} {VALUE._col5}' ' 1 {VALUE._col1}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col4, _col5, _col9' ' Select Operator' ' expressions:' ' expr: _col4' ' type: string' ' expr: _col0' ' type: string' ' expr: _col5' ' type: string' ' expr: _col9' ' type: string' ' 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' '' '' 127 rows selected >>> >>> FROM T1 a LEFT OUTER JOIN T2 b ON (b.key=a.key) RIGHT OUTER JOIN T3 c ON (c.val = a.val) SELECT a.key, b.key, a.val, c.val; 'key','key','val','val' '2','2','12','12' '','','','14' '','','','16' '7','','17','17' 4 rows selected >>> >>> FROM T1 a LEFT OUTER JOIN T2 b ON (b.key=a.key) RIGHT OUTER JOIN T3 c ON (c.val = a.val) SELECT /*+ STREAMTABLE(a) */ a.key, b.key, a.val, c.val; 'key','key','val','val' '2','2','12','12' '','','','14' '','','','16' '7','','17','17' 4 rows selected >>> >>> EXPLAIN FROM UNIQUEJOIN PRESERVE T1 a (a.key, a.val), PRESERVE T2 b (b.key, b.val), PRESERVE T3 c (c.key, c.val) SELECT a.key, b.key, c.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_UNIQUEJOIN PRESERVE (TOK_TABREF (TOK_TABNAME T1) a) (TOK_EXPLIST (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL a) val)) PRESERVE (TOK_TABREF (TOK_TABNAME T2) b) (TOK_EXPLIST (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL b) val)) PRESERVE (TOK_TABREF (TOK_TABNAME T3) c) (TOK_EXPLIST (. (TOK_TABLE_OR_COL c) key) (. (TOK_TABLE_OR_COL c) val)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL b) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL c) key)))))' '' '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' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' tag: 1' ' value expressions:' ' expr: key' ' type: string' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' tag: 2' ' value expressions:' ' expr: key' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Unique Join0 to 0' ' Unique Join0 to 0' ' Unique Join0 to 0' ' condition expressions:' ' 0 {VALUE._col0}' ' 1 {VALUE._col0}' ' 2 {VALUE._col0}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col4, _col8' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col4' ' type: string' ' expr: _col8' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' 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' '' 100 rows selected >>> >>> EXPLAIN FROM UNIQUEJOIN PRESERVE T1 a (a.key, a.val), PRESERVE T2 b (b.key, b.val), PRESERVE T3 c (c.key, c.val) SELECT /*+ STREAMTABLE(b) */ a.key, b.key, c.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_UNIQUEJOIN PRESERVE (TOK_TABREF (TOK_TABNAME T1) a) (TOK_EXPLIST (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL a) val)) PRESERVE (TOK_TABREF (TOK_TABNAME T2) b) (TOK_EXPLIST (. (TOK_TABLE_OR_COL b) key) (. (TOK_TABLE_OR_COL b) val)) PRESERVE (TOK_TABREF (TOK_TABNAME T3) c) (TOK_EXPLIST (. (TOK_TABLE_OR_COL c) key) (. (TOK_TABLE_OR_COL c) val)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_HINTLIST (TOK_HINT TOK_STREAMTABLE (TOK_HINTARGLIST b))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL a) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL b) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL c) key)))))' '' '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' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' b ' ' TableScan' ' alias: b' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' tag: 2' ' value expressions:' ' expr: key' ' type: string' ' c ' ' TableScan' ' alias: c' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' sort order: ++' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' expr: val' ' type: string' ' tag: 1' ' value expressions:' ' expr: key' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Unique Join0 to 0' ' Unique Join0 to 0' ' Unique Join0 to 0' ' condition expressions:' ' 0 {VALUE._col0}' ' 1 {VALUE._col0}' ' 2 {VALUE._col0}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col4, _col8' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col4' ' type: string' ' expr: _col8' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' 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' '' 100 rows selected >>> >>> FROM UNIQUEJOIN PRESERVE T1 a (a.key, a.val), PRESERVE T2 b (b.key, b.val), PRESERVE T3 c (c.key, c.val) SELECT a.key, b.key, c.key; 'key','key','key' '1','','' '2','','2' '','2','' '3','3','' '','4','4' '','5','' '','','6' '7','','7' '8','8','' '8','8','' '8','','' 11 rows selected >>> >>> FROM UNIQUEJOIN PRESERVE T1 a (a.key, a.val), PRESERVE T2 b (b.key, b.val), PRESERVE T3 c (c.key, c.val) SELECT /*+ STREAMTABLE(b) */ a.key, b.key, c.key; 'key','key','key' '1','','' '2','','2' '','2','' '3','3','' '','4','4' '','5','' '','','6' '7','','7' '8','8','' '8','8','' '8','','' 11 rows selected >>> >>> >>> >>> >>> !record