Saving all output to "!!{outputDirectory}!!/mapjoin_subquery.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/mapjoin_subquery.q >>> EXPLAIN SELECT /*+ MAPJOIN(z) */ subq.key1, z.value FROM (SELECT /*+ MAPJOIN(x) */ x.key as key1, x.value as value1, y.key as key2, y.value as value2 FROM src1 x JOIN src y ON (x.key = y.key)) subq JOIN srcpart z ON (subq.key1 = z.key and z.ds='2008-04-08' and z.hr=11); 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME src1) x) (TOK_TABREF (TOK_TABNAME src) y) (= (. (TOK_TABLE_OR_COL x) key) (. (TOK_TABLE_OR_COL y) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_HINTLIST (TOK_HINT TOK_MAPJOIN (TOK_HINTARGLIST x))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL x) key) key1) (TOK_SELEXPR (. (TOK_TABLE_OR_COL x) value) value1) (TOK_SELEXPR (. (TOK_TABLE_OR_COL y) key) key2) (TOK_SELEXPR (. (TOK_TABLE_OR_COL y) value) value2)))) subq) (TOK_TABREF (TOK_TABNAME srcpart) z) (and (and (= (. (TOK_TABLE_OR_COL subq) key1) (. (TOK_TABLE_OR_COL z) key)) (= (. (TOK_TABLE_OR_COL z) ds) '2008-04-08')) (= (. (TOK_TABLE_OR_COL z) hr) 11)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_HINTLIST (TOK_HINT TOK_MAPJOIN (TOK_HINTARGLIST z))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL subq) key1)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL z) value)))))' '' 'STAGE DEPENDENCIES:' ' Stage-4 is a root stage' ' Stage-1 depends on stages: Stage-4' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-4' ' Map Reduce Local Work' ' Alias -> Map Local Tables:' ' subq:x ' ' Fetch Operator' ' limit: -1' ' z ' ' Fetch Operator' ' limit: -1' ' Alias -> Map Local Operator Tree:' ' subq:x ' ' TableScan' ' alias: x' ' HashTable Sink Operator' ' condition expressions:' ' 0 {key}' ' 1 ' ' handleSkewJoin: false' ' keys:' ' 0 [Column[key]]' ' 1 [Column[key]]' ' Position of Big Table: 1' ' z ' ' TableScan' ' alias: z' ' HashTable Sink Operator' ' condition expressions:' ' 0 {_col0}' ' 1 {value}' ' handleSkewJoin: false' ' keys:' ' 0 [Column[_col0]]' ' 1 [Column[key]]' ' Position of Big Table: 0' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' subq:y ' ' TableScan' ' alias: y' ' Map Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {key}' ' 1 ' ' handleSkewJoin: false' ' keys:' ' 0 [Column[key]]' ' 1 [Column[key]]' ' outputColumnNames: _col0' ' Position of Big Table: 1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' outputColumnNames: _col0' ' Map Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {_col0}' ' 1 {value}' ' handleSkewJoin: false' ' keys:' ' 0 [Column[_col0]]' ' 1 [Column[key]]' ' outputColumnNames: _col0, _col5' ' Position of Big Table: 0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col5' ' type: string' ' outputColumnNames: _col0, _col5' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col5' ' type: string' ' outputColumnNames: _col0, _col1' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' ' Local Work:' ' Map Reduce Local Work' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 112 rows selected >>> >>> SELECT /*+ MAPJOIN(z) */ subq.key1, z.value FROM (SELECT /*+ MAPJOIN(x) */ x.key as key1, x.value as value1, y.key as key2, y.value as value2 FROM src1 x JOIN src y ON (x.key = y.key)) subq JOIN srcpart z ON (subq.key1 = z.key and z.ds='2008-04-08' and z.hr=11); 'key1','value' '238','val_238' '238','val_238' '311','val_311' '311','val_311' '311','val_311' '255','val_255' '255','val_255' '278','val_278' '278','val_278' '98','val_98' '98','val_98' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '150','val_150' '273','val_273' '273','val_273' '273','val_273' '224','val_224' '224','val_224' '369','val_369' '369','val_369' '369','val_369' '66','val_66' '128','val_128' '128','val_128' '128','val_128' '213','val_213' '213','val_213' '146','val_146' '146','val_146' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '128','val_128' '128','val_128' '128','val_128' '311','val_311' '311','val_311' '311','val_311' '213','val_213' '213','val_213' '278','val_278' '278','val_278' '311','val_311' '311','val_311' '311','val_311' '98','val_98' '98','val_98' '369','val_369' '369','val_369' '369','val_369' '238','val_238' '238','val_238' '273','val_273' '273','val_273' '273','val_273' '224','val_224' '224','val_224' '369','val_369' '369','val_369' '369','val_369' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '128','val_128' '128','val_128' '128','val_128' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '255','val_255' '255','val_255' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '146','val_146' '146','val_146' '273','val_273' '273','val_273' '273','val_273' 107 rows selected >>> >>> EXPLAIN SELECT /*+ MAPJOIN(z) */ subq.key1, z.value FROM (SELECT /*+ MAPJOIN(x) */ x.key as key1, x.value as value1, y.key as key2, y.value as value2 FROM src1 x JOIN src y ON (x.key = y.key)) subq JOIN srcpart z ON (subq.key1 = z.key and z.ds='2008-04-08' and z.hr=11) order by subq.key1; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME src1) x) (TOK_TABREF (TOK_TABNAME src) y) (= (. (TOK_TABLE_OR_COL x) key) (. (TOK_TABLE_OR_COL y) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_HINTLIST (TOK_HINT TOK_MAPJOIN (TOK_HINTARGLIST x))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL x) key) key1) (TOK_SELEXPR (. (TOK_TABLE_OR_COL x) value) value1) (TOK_SELEXPR (. (TOK_TABLE_OR_COL y) key) key2) (TOK_SELEXPR (. (TOK_TABLE_OR_COL y) value) value2)))) subq) (TOK_TABREF (TOK_TABNAME srcpart) z) (and (and (= (. (TOK_TABLE_OR_COL subq) key1) (. (TOK_TABLE_OR_COL z) key)) (= (. (TOK_TABLE_OR_COL z) ds) '2008-04-08')) (= (. (TOK_TABLE_OR_COL z) hr) 11)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_HINTLIST (TOK_HINT TOK_MAPJOIN (TOK_HINTARGLIST z))) (TOK_SELEXPR (. (TOK_TABLE_OR_COL subq) key1)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL z) value))) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL subq) key1)))))' '' '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:' ' subq:x ' ' Fetch Operator' ' limit: -1' ' z ' ' Fetch Operator' ' limit: -1' ' Alias -> Map Local Operator Tree:' ' subq:x ' ' TableScan' ' alias: x' ' HashTable Sink Operator' ' condition expressions:' ' 0 {key}' ' 1 ' ' handleSkewJoin: false' ' keys:' ' 0 [Column[key]]' ' 1 [Column[key]]' ' Position of Big Table: 1' ' z ' ' TableScan' ' alias: z' ' HashTable Sink Operator' ' condition expressions:' ' 0 {_col0}' ' 1 {value}' ' handleSkewJoin: false' ' keys:' ' 0 [Column[_col0]]' ' 1 [Column[key]]' ' Position of Big Table: 0' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' subq:y ' ' TableScan' ' alias: y' ' Map Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {key}' ' 1 ' ' handleSkewJoin: false' ' keys:' ' 0 [Column[key]]' ' 1 [Column[key]]' ' outputColumnNames: _col0' ' Position of Big Table: 1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' outputColumnNames: _col0' ' Map Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {_col0}' ' 1 {value}' ' handleSkewJoin: false' ' keys:' ' 0 [Column[_col0]]' ' 1 [Column[key]]' ' outputColumnNames: _col0, _col5' ' 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: string' ' expr: _col5' ' type: string' ' outputColumnNames: _col0, _col5' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col5' ' type: string' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: string' ' 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' '' '' 137 rows selected >>> >>> >>> SELECT /*+ MAPJOIN(z) */ subq.key1, z.value FROM (SELECT /*+ MAPJOIN(x) */ x.key as key1, x.value as value1, y.key as key2, y.value as value2 FROM src1 x JOIN src y ON (x.key = y.key)) subq JOIN srcpart z ON (subq.key1 = z.key and z.ds='2008-04-08' and z.hr=11) order by subq.key1; 'key1','value' '128','val_128' '128','val_128' '128','val_128' '128','val_128' '128','val_128' '128','val_128' '128','val_128' '128','val_128' '128','val_128' '146','val_146' '146','val_146' '146','val_146' '146','val_146' '150','val_150' '213','val_213' '213','val_213' '213','val_213' '213','val_213' '224','val_224' '224','val_224' '224','val_224' '224','val_224' '238','val_238' '238','val_238' '238','val_238' '238','val_238' '255','val_255' '255','val_255' '255','val_255' '255','val_255' '273','val_273' '273','val_273' '273','val_273' '273','val_273' '273','val_273' '273','val_273' '273','val_273' '273','val_273' '273','val_273' '278','val_278' '278','val_278' '278','val_278' '278','val_278' '311','val_311' '311','val_311' '311','val_311' '311','val_311' '311','val_311' '311','val_311' '311','val_311' '311','val_311' '311','val_311' '369','val_369' '369','val_369' '369','val_369' '369','val_369' '369','val_369' '369','val_369' '369','val_369' '369','val_369' '369','val_369' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '401','val_401' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '406','val_406' '66','val_66' '98','val_98' '98','val_98' '98','val_98' '98','val_98' 107 rows selected >>> !record