Saving all output to "!!{outputDirectory}!!/index_auto_self_join.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/index_auto_self_join.q >>> -- try the query without indexing, with manual indexing, and with automatic indexing >>> >>> EXPLAIN SELECT a.key, b.key FROM src a JOIN src b ON (a.value = b.value) WHERE a.key > 80 AND a.key < 100 AND b.key > 70 AND b.key < 90 ORDER BY a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME src) a) (TOK_TABREF (TOK_TABNAME src) b) (= (. (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_TABLE_OR_COL a) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL b) key))) (TOK_WHERE (AND (AND (AND (> (. (TOK_TABLE_OR_COL a) key) 80) (< (. (TOK_TABLE_OR_COL a) key) 100)) (> (. (TOK_TABLE_OR_COL b) key) 70)) (< (. (TOK_TABLE_OR_COL b) key) 90))) (TOK_ORDERBY (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' ' Filter Operator' ' predicate:' ' expr: ((key > 80.0) and (key < 100.0))' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: value' ' type: string' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' b ' ' TableScan' ' alias: b' ' Filter Operator' ' predicate:' ' expr: ((key > 70.0) and (key < 90.0))' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: value' ' type: string' ' 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}' ' 1 {VALUE._col0}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col4' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col4' ' 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: 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' '' '' 102 rows selected >>> SELECT a.key, b.key FROM src a JOIN src b ON (a.value = b.value) WHERE a.key > 80 AND a.key < 100 AND b.key > 70 AND b.key < 90 ORDER BY a.key; 'key','key' '82','82' '83','83' '83','83' '83','83' '83','83' '84','84' '84','84' '84','84' '84','84' '85','85' '86','86' '87','87' 12 rows selected >>> >>> CREATE INDEX src_index ON TABLE src(key) as 'BITMAP' WITH DEFERRED REBUILD; No rows affected >>> ALTER INDEX src_index ON src REBUILD; No rows affected >>> >>> SET hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat; No rows affected >>> SET hive.optimize.index.filter=true; No rows affected >>> SET hive.optimize.index.filter.compact.minsize=0; No rows affected >>> >>> EXPLAIN SELECT a.key, b.key FROM src a JOIN src b ON (a.value = b.value) WHERE a.key > 80 AND a.key < 100 AND b.key > 70 AND b.key < 90 ORDER BY a.key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME src) a) (TOK_TABREF (TOK_TABNAME src) b) (= (. (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_TABLE_OR_COL a) key)) (TOK_SELEXPR (. (TOK_TABLE_OR_COL b) key))) (TOK_WHERE (AND (AND (AND (> (. (TOK_TABLE_OR_COL a) key) 80) (< (. (TOK_TABLE_OR_COL a) key) 100)) (> (. (TOK_TABLE_OR_COL b) key) 70)) (< (. (TOK_TABLE_OR_COL b) key) 90))) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-4 depends on stages: Stage-5' ' Stage-1 depends on stages: Stage-4, Stage-6' ' Stage-2 depends on stages: Stage-1' ' Stage-7 is a root stage' ' Stage-6 depends on stages: Stage-7' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' tmp_index:ind0:index_auto_self_join__src_src_index__ ' ' TableScan' ' alias: index_auto_self_join__src_src_index__' ' filterExpr:' ' expr: (((key > 70.0) and (key < 90.0)) and (not EWAH_BITMAP_EMPTY(_bitmaps)))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (((key > 70.0) and (key < 90.0)) and (not EWAH_BITMAP_EMPTY(_bitmaps)))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offset' ' type: bigint' ' expr: _bitmaps' ' type: array' ' outputColumnNames: _col1, _col2, _col3' ' Select Operator' ' expressions:' ' expr: _col1' ' type: string' ' expr: _col2' ' type: bigint' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: bigint' ' outputColumnNames: _col0, _col1' ' Group By Operator' ' aggregations:' ' expr: collect_set(_col1)' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: string' ' tag: -1' ' value expressions:' ' expr: _col1' ' type: array' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: collect_set(VALUE._col0)' ' bucketGroup: false' ' keys:' ' expr: KEY._col0' ' type: string' ' mode: mergepartial' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: array' ' outputColumnNames: _col0, _col1' ' File Output Operator' ' compressed: false' ' GlobalTableId: 1' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' '' ' Stage: Stage-4' ' Move Operator' ' files:' ' hdfs directory: true' ' destination: file:!!{hive.exec.scratchdir}!!' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' filterExpr:' ' expr: ((key > 80.0) and (key < 100.0))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key > 80.0) and (key < 100.0))' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: value' ' type: string' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' b ' ' TableScan' ' alias: b' ' filterExpr:' ' expr: ((key > 70.0) and (key < 90.0))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key > 70.0) and (key < 90.0))' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: value' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: value' ' type: string' ' 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}' ' 1 {VALUE._col0}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col4' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col4' ' 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: 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-7' ' Map Reduce' ' Alias -> Map Operator Tree:' ' tmp_index:ind0:index_auto_self_join__src_src_index__ ' ' TableScan' ' alias: index_auto_self_join__src_src_index__' ' filterExpr:' ' expr: (((key > 80.0) and (key < 100.0)) and (not EWAH_BITMAP_EMPTY(_bitmaps)))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (((key > 80.0) and (key < 100.0)) and (not EWAH_BITMAP_EMPTY(_bitmaps)))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offset' ' type: bigint' ' expr: _bitmaps' ' type: array' ' outputColumnNames: _col1, _col2, _col3' ' Select Operator' ' expressions:' ' expr: _col1' ' type: string' ' expr: _col2' ' type: bigint' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: bigint' ' outputColumnNames: _col0, _col1' ' Group By Operator' ' aggregations:' ' expr: collect_set(_col1)' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: string' ' tag: -1' ' value expressions:' ' expr: _col1' ' type: array' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: collect_set(VALUE._col0)' ' bucketGroup: false' ' keys:' ' expr: KEY._col0' ' type: string' ' mode: mergepartial' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: array' ' outputColumnNames: _col0, _col1' ' File Output Operator' ' compressed: false' ' GlobalTableId: 1' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' '' ' Stage: Stage-6' ' Move Operator' ' files:' ' hdfs directory: true' ' destination: file:!!{hive.exec.scratchdir}!!' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 286 rows selected >>> SELECT a.key, b.key FROM src a JOIN src b ON (a.value = b.value) WHERE a.key > 80 AND a.key < 100 AND b.key > 70 AND b.key < 90 ORDER BY a.key; 'key','key' '82','82' '83','83' '83','83' '83','83' '83','83' '84','84' '84','84' '84','84' '84','84' '85','85' '86','86' '87','87' 12 rows selected >>> >>> DROP INDEX src_index on src; No rows affected >>> !record