Saving all output to "!!{outputDirectory}!!/union_view.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/union_view.q >>> CREATE TABLE src_union_1 (key int, value string) PARTITIONED BY (ds string); No rows affected >>> CREATE INDEX src_union_1_key_idx ON TABLE src_union_1(key) AS 'COMPACT' WITH DEFERRED REBUILD; No rows affected >>> >>> CREATE TABLE src_union_2 (key int, value string) PARTITIONED BY (ds string, part_1 string); No rows affected >>> CREATE INDEX src_union_2_key_idx ON TABLE src_union_2(key) AS 'COMPACT' WITH DEFERRED REBUILD; No rows affected >>> >>> CREATE TABLE src_union_3(key int, value string) PARTITIONED BY (ds string, part_1 string, part_2 string); No rows affected >>> CREATE INDEX src_union_3_key_idx ON TABLE src_union_3(key) AS 'COMPACT' WITH DEFERRED 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 >>> >>> SET hive.exec.pre.hooks=; No rows affected >>> SET hive.exec.post.hooks=; No rows affected >>> SET hive.semantic.analyzer.hook=; No rows affected >>> SET hive.merge.mapfiles=false; No rows affected >>> SET hive.merge.mapredfiles=false; No rows affected >>> >>> INSERT OVERWRITE TABLE src_union_1 PARTITION (ds='1') SELECT * FROM src; '_col0','_col1' No rows selected >>> ALTER INDEX src_union_1_key_idx ON src_union_1 PARTITION (ds='1') REBUILD; No rows affected >>> >>> INSERT OVERWRITE TABLE src_union_2 PARTITION (ds='2', part_1='1') SELECT * FROM src; '_col0','_col1' No rows selected >>> INSERT OVERWRITE TABLE src_union_2 PARTITION (ds='2', part_1='2') SELECT * FROM src; '_col0','_col1' No rows selected >>> ALTER INDEX src_union_2_key_idx ON src_union_2 PARTITION (ds='2', part_1='1') REBUILD; No rows affected >>> ALTER INDEX src_union_2_key_idx ON src_union_2 PARTITION (ds='2', part_1='2') REBUILD; No rows affected >>> >>> INSERT OVERWRITE TABLE src_union_3 PARTITION (ds='3', part_1='1', part_2='2:3+4') SELECT * FROM src; '_col0','_col1' No rows selected >>> INSERT OVERWRITE TABLE src_union_3 PARTITION (ds='3', part_1='2', part_2='2:3+4') SELECT * FROM src; '_col0','_col1' No rows selected >>> ALTER INDEX src_union_3_key_idx ON src_union_3 PARTITION (ds='3', part_1='1', part_2='2:3+4') REBUILD; No rows affected >>> ALTER INDEX src_union_3_key_idx ON src_union_3 PARTITION (ds='3', part_1='2', part_2='2:3+4') REBUILD; No rows affected >>> >>> EXPLAIN SELECT key, value, ds FROM src_union_1 WHERE key=86 and ds='1'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_1))) (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_SELEXPR (TOK_TABLE_OR_COL ds))) (TOK_WHERE (and (= (TOK_TABLE_OR_COL key) 86) (= (TOK_TABLE_OR_COL ds) '1')))))' '' 'STAGE DEPENDENCIES:' ' Stage-3 is a root stage' ' Stage-2 depends on stages: Stage-3' ' Stage-1 depends on stages: Stage-2' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-3' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_1_src_union_1_key_idx__ ' ' TableScan' ' alias: union_view__src_union_1_src_union_1_key_idx__' ' filterExpr:' ' expr: ((key = 86) and (ds = '1'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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-2' ' Move Operator' ' files:' ' hdfs directory: true' ' destination: file:!!{hive.exec.scratchdir}!!' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: ((key = 86) and (ds = '1'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' 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' '' '' 77 rows selected >>> EXPLAIN SELECT key, value, ds FROM src_union_2 WHERE key=86 and ds='2'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_2))) (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_SELEXPR (TOK_TABLE_OR_COL ds))) (TOK_WHERE (and (= (TOK_TABLE_OR_COL key) 86) (= (TOK_TABLE_OR_COL ds) '2')))))' '' 'STAGE DEPENDENCIES:' ' Stage-3 is a root stage' ' Stage-2 depends on stages: Stage-3' ' Stage-1 depends on stages: Stage-2' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-3' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_2_src_union_2_key_idx__ ' ' TableScan' ' alias: union_view__src_union_2_src_union_2_key_idx__' ' filterExpr:' ' expr: ((key = 86) and (ds = '2'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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-2' ' Move Operator' ' files:' ' hdfs directory: true' ' destination: file:!!{hive.exec.scratchdir}!!' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: ((key = 86) and (ds = '2'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' 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' '' '' 77 rows selected >>> EXPLAIN SELECT key, value, ds FROM src_union_3 WHERE key=86 and ds='3'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_3))) (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_SELEXPR (TOK_TABLE_OR_COL ds))) (TOK_WHERE (and (= (TOK_TABLE_OR_COL key) 86) (= (TOK_TABLE_OR_COL ds) '3')))))' '' 'STAGE DEPENDENCIES:' ' Stage-3 is a root stage' ' Stage-2 depends on stages: Stage-3' ' Stage-1 depends on stages: Stage-2' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-3' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_3_src_union_3_key_idx__ ' ' TableScan' ' alias: union_view__src_union_3_src_union_3_key_idx__' ' filterExpr:' ' expr: ((key = 86) and (ds = '3'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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-2' ' Move Operator' ' files:' ' hdfs directory: true' ' destination: file:!!{hive.exec.scratchdir}!!' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: ((key = 86) and (ds = '3'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' 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' '' '' 77 rows selected >>> >>> SELECT key, value, ds FROM src_union_1 WHERE key=86 AND ds ='1'; 'key','value','ds' '86','val_86','1' 1 row selected >>> SELECT key, value, ds FROM src_union_2 WHERE key=86 AND ds ='2'; 'key','value','ds' '86','val_86','2' '86','val_86','2' 2 rows selected >>> SELECT key, value, ds FROM src_union_3 WHERE key=86 AND ds ='3'; 'key','value','ds' '86','val_86','3' '86','val_86','3' 2 rows selected >>> >>> EXPLAIN SELECT count(1) from src_union_1 WHERE ds ='1'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_1))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_WHERE (= (TOK_TABLE_OR_COL ds) '1'))))' '' 'STAGE DEPENDENCIES:' ' Stage-3 is a root stage' ' Stage-2 depends on stages: Stage-3' ' Stage-1 depends on stages: Stage-2' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-3' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_1_src_union_1_key_idx__ ' ' TableScan' ' alias: union_view__src_union_1_src_union_1_key_idx__' ' filterExpr:' ' expr: (ds = '1')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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-2' ' Move Operator' ' files:' ' hdfs directory: true' ' destination: file:!!{hive.exec.scratchdir}!!' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: (ds = '1')' ' type: boolean' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: count(VALUE._col0)' ' bucketGroup: false' ' mode: mergepartial' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: bigint' ' outputColumnNames: _col0' ' 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' '' '' 85 rows selected >>> EXPLAIN SELECT count(1) from src_union_2 WHERE ds ='2'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_2))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_WHERE (= (TOK_TABLE_OR_COL ds) '2'))))' '' 'STAGE DEPENDENCIES:' ' Stage-3 is a root stage' ' Stage-2 depends on stages: Stage-3' ' Stage-1 depends on stages: Stage-2' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-3' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_2_src_union_2_key_idx__ ' ' TableScan' ' alias: union_view__src_union_2_src_union_2_key_idx__' ' filterExpr:' ' expr: (ds = '2')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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-2' ' Move Operator' ' files:' ' hdfs directory: true' ' destination: file:!!{hive.exec.scratchdir}!!' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: (ds = '2')' ' type: boolean' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: count(VALUE._col0)' ' bucketGroup: false' ' mode: mergepartial' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: bigint' ' outputColumnNames: _col0' ' 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' '' '' 85 rows selected >>> EXPLAIN SELECT count(1) from src_union_3 WHERE ds ='3'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_3))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_WHERE (= (TOK_TABLE_OR_COL ds) '3'))))' '' 'STAGE DEPENDENCIES:' ' Stage-3 is a root stage' ' Stage-2 depends on stages: Stage-3' ' Stage-1 depends on stages: Stage-2' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-3' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_3_src_union_3_key_idx__ ' ' TableScan' ' alias: union_view__src_union_3_src_union_3_key_idx__' ' filterExpr:' ' expr: (ds = '3')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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-2' ' Move Operator' ' files:' ' hdfs directory: true' ' destination: file:!!{hive.exec.scratchdir}!!' '' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: (ds = '3')' ' type: boolean' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: count(VALUE._col0)' ' bucketGroup: false' ' mode: mergepartial' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: bigint' ' outputColumnNames: _col0' ' 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' '' '' 85 rows selected >>> >>> SELECT count(1) from src_union_1 WHERE ds ='1'; '_c0' '500' 1 row selected >>> SELECT count(1) from src_union_2 WHERE ds ='2'; '_c0' '1000' 1 row selected >>> SELECT count(1) from src_union_3 WHERE ds ='3'; '_c0' '1000' 1 row selected >>> >>> CREATE VIEW src_union_view PARTITIONED ON (ds) as SELECT key, value, ds FROM ( SELECT key, value, ds FROM src_union_1 UNION ALL SELECT key, value, ds FROM src_union_2 UNION ALL SELECT key, value, ds FROM src_union_3 ) subq; 'key','value','ds' No rows selected >>> >>> EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='1'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_view))) (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_SELEXPR (TOK_TABLE_OR_COL ds))) (TOK_WHERE (AND (= (TOK_TABLE_OR_COL key) 86) (= (TOK_TABLE_OR_COL ds) '1')))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-4 depends on stages: Stage-5' ' Stage-1 depends on stages: Stage-4' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_1_src_union_1_key_idx__ ' ' TableScan' ' alias: union_view__src_union_1_src_union_1_key_idx__' ' filterExpr:' ' expr: ((key = 86) and (ds = '1'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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:' ' src_union_view-subquery1-subquery1:subq-subquery1-subquery1:src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: ((key = 86) and (ds = '1'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' ' src_union_view-subquery1-subquery2:subq-subquery1-subquery2:src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: ((key = 86) and (ds = '1'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key = 86) and (ds = '1'))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' ' src_union_view-subquery2:subq-subquery2:src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: ((key = 86) and (ds = '1'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key = 86) and (ds = '1'))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' '' '' 184 rows selected >>> EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='2'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_view))) (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_SELEXPR (TOK_TABLE_OR_COL ds))) (TOK_WHERE (AND (= (TOK_TABLE_OR_COL key) 86) (= (TOK_TABLE_OR_COL ds) '2')))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-4 depends on stages: Stage-5' ' Stage-1 depends on stages: Stage-4' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_2_src_union_2_key_idx__ ' ' TableScan' ' alias: union_view__src_union_2_src_union_2_key_idx__' ' filterExpr:' ' expr: ((key = 86) and (ds = '2'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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:' ' src_union_view-subquery1-subquery1:subq-subquery1-subquery1:src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: ((key = 86) and (ds = '2'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key = 86) and (ds = '2'))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' ' src_union_view-subquery1-subquery2:subq-subquery1-subquery2:src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: ((key = 86) and (ds = '2'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' ' src_union_view-subquery2:subq-subquery2:src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: ((key = 86) and (ds = '2'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key = 86) and (ds = '2'))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' '' '' 184 rows selected >>> EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='3'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_view))) (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_SELEXPR (TOK_TABLE_OR_COL ds))) (TOK_WHERE (AND (= (TOK_TABLE_OR_COL key) 86) (= (TOK_TABLE_OR_COL ds) '3')))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-4 depends on stages: Stage-5' ' Stage-1 depends on stages: Stage-4' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_3_src_union_3_key_idx__ ' ' TableScan' ' alias: union_view__src_union_3_src_union_3_key_idx__' ' filterExpr:' ' expr: ((key = 86) and (ds = '3'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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:' ' src_union_view-subquery1-subquery1:subq-subquery1-subquery1:src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: ((key = 86) and (ds = '3'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key = 86) and (ds = '3'))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' ' src_union_view-subquery1-subquery2:subq-subquery1-subquery2:src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: ((key = 86) and (ds = '3'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key = 86) and (ds = '3'))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' ' src_union_view-subquery2:subq-subquery2:src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: ((key = 86) and (ds = '3'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' '' '' 184 rows selected >>> EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds IS NOT NULL order by ds; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_view))) (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_SELEXPR (TOK_TABLE_OR_COL ds))) (TOK_WHERE (AND (= (TOK_TABLE_OR_COL key) 86) (TOK_FUNCTION TOK_ISNOTNULL (TOK_TABLE_OR_COL ds)))) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (TOK_TABLE_OR_COL ds)))))' '' '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-8' ' Stage-7 is a root stage' ' Stage-6 depends on stages: Stage-7' ' Stage-9 is a root stage' ' Stage-8 depends on stages: Stage-9' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_2_src_union_2_key_idx__ ' ' TableScan' ' alias: union_view__src_union_2_src_union_2_key_idx__' ' filterExpr:' ' expr: (key = 86)' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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:' ' src_union_view-subquery1-subquery1:subq-subquery1-subquery1:src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: ((key = 86) and ds is not null)' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Reduce Output Operator' ' key expressions:' ' expr: _col2' ' type: string' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' src_union_view-subquery1-subquery2:subq-subquery1-subquery2:src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: ((key = 86) and ds is not null)' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Reduce Output Operator' ' key expressions:' ' expr: _col2' ' type: string' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' src_union_view-subquery2:subq-subquery2:src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: ((key = 86) and ds is not null)' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Reduce Output Operator' ' key expressions:' ' expr: _col2' ' type: string' ' sort order: +' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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:' ' union_view__src_union_1_src_union_1_key_idx__ ' ' TableScan' ' alias: union_view__src_union_1_src_union_1_key_idx__' ' filterExpr:' ' expr: (key = 86)' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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-9' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_3_src_union_3_key_idx__ ' ' TableScan' ' alias: union_view__src_union_3_src_union_3_key_idx__' ' filterExpr:' ' expr: (key = 86)' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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-8' ' Move Operator' ' files:' ' hdfs directory: true' ' destination: file:!!{hive.exec.scratchdir}!!' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 283 rows selected >>> >>> SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='1'; 'key','value','ds' '86','val_86','1' 1 row selected >>> SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='2'; 'key','value','ds' '86','val_86','2' '86','val_86','2' 2 rows selected >>> SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='3'; 'key','value','ds' '86','val_86','3' '86','val_86','3' 2 rows selected >>> SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds IS NOT NULL order by ds; 'key','value','ds' '86','val_86','1' '86','val_86','2' '86','val_86','2' '86','val_86','3' '86','val_86','3' 5 rows selected >>> >>> EXPLAIN SELECT count(1) from src_union_view WHERE ds ='1'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_view))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_WHERE (= (TOK_TABLE_OR_COL ds) '1'))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-4 depends on stages: Stage-5' ' Stage-1 depends on stages: Stage-4' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_1_src_union_1_key_idx__ ' ' TableScan' ' alias: union_view__src_union_1_src_union_1_key_idx__' ' filterExpr:' ' expr: (ds = '1')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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:' ' src_union_view-subquery1-subquery1:subq-subquery1-subquery1:src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: (ds = '1')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' src_union_view-subquery1-subquery2:subq-subquery1-subquery2:src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: (ds = '1')' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (ds = '1')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' src_union_view-subquery2:subq-subquery2:src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: (ds = '1')' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (ds = '1')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: count(VALUE._col0)' ' bucketGroup: false' ' mode: mergepartial' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: bigint' ' outputColumnNames: _col0' ' 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' '' '' 176 rows selected >>> EXPLAIN SELECT count(1) from src_union_view WHERE ds ='2'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_view))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_WHERE (= (TOK_TABLE_OR_COL ds) '2'))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-4 depends on stages: Stage-5' ' Stage-1 depends on stages: Stage-4' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_2_src_union_2_key_idx__ ' ' TableScan' ' alias: union_view__src_union_2_src_union_2_key_idx__' ' filterExpr:' ' expr: (ds = '2')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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:' ' src_union_view-subquery1-subquery1:subq-subquery1-subquery1:src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: (ds = '2')' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (ds = '2')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' src_union_view-subquery1-subquery2:subq-subquery1-subquery2:src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: (ds = '2')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' src_union_view-subquery2:subq-subquery2:src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: (ds = '2')' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (ds = '2')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: count(VALUE._col0)' ' bucketGroup: false' ' mode: mergepartial' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: bigint' ' outputColumnNames: _col0' ' 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' '' '' 176 rows selected >>> EXPLAIN SELECT count(1) from src_union_view WHERE ds ='3'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_view))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_WHERE (= (TOK_TABLE_OR_COL ds) '3'))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-4 depends on stages: Stage-5' ' Stage-1 depends on stages: Stage-4' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_3_src_union_3_key_idx__ ' ' TableScan' ' alias: union_view__src_union_3_src_union_3_key_idx__' ' filterExpr:' ' expr: (ds = '3')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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:' ' src_union_view-subquery1-subquery1:subq-subquery1-subquery1:src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: (ds = '3')' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (ds = '3')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' src_union_view-subquery1-subquery2:subq-subquery1-subquery2:src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: (ds = '3')' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (ds = '3')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' src_union_view-subquery2:subq-subquery2:src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: (ds = '3')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: count(VALUE._col0)' ' bucketGroup: false' ' mode: mergepartial' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: bigint' ' outputColumnNames: _col0' ' 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' '' '' 176 rows selected >>> >>> SELECT count(1) from src_union_view WHERE ds ='1'; '_c0' '500' 1 row selected >>> SELECT count(1) from src_union_view WHERE ds ='2'; '_c0' '1000' 1 row selected >>> SELECT count(1) from src_union_view WHERE ds ='3'; '_c0' '1000' 1 row selected >>> >>> INSERT OVERWRITE TABLE src_union_3 PARTITION (ds='4', part_1='1', part_2='2:3+4') SELECT * FROM src; '_col0','_col1' No rows selected >>> ALTER INDEX src_union_3_key_idx ON src_union_3 PARTITION (ds='4', part_1='1', part_2='2:3+4') REBUILD; No rows affected >>> >>> EXPLAIN SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='4'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_view))) (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_SELEXPR (TOK_TABLE_OR_COL ds))) (TOK_WHERE (AND (= (TOK_TABLE_OR_COL key) 86) (= (TOK_TABLE_OR_COL ds) '4')))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-4 depends on stages: Stage-5' ' Stage-1 depends on stages: Stage-4' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_3_src_union_3_key_idx__ ' ' TableScan' ' alias: union_view__src_union_3_src_union_3_key_idx__' ' filterExpr:' ' expr: ((key = 86) and (ds = '4'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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:' ' src_union_view-subquery1-subquery1:subq-subquery1-subquery1:src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: ((key = 86) and (ds = '4'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key = 86) and (ds = '4'))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' ' src_union_view-subquery1-subquery2:subq-subquery1-subquery2:src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: ((key = 86) and (ds = '4'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: ((key = 86) and (ds = '4'))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' ' src_union_view-subquery2:subq-subquery2:src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: ((key = 86) and (ds = '4'))' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (key = 86)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Select Operator' ' expressions:' ' expr: _col0' ' type: int' ' expr: _col1' ' type: string' ' expr: _col2' ' 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' '' '' 184 rows selected >>> SELECT key, value, ds FROM src_union_view WHERE key=86 AND ds ='4'; 'key','value','ds' '86','val_86','4' 1 row selected >>> >>> EXPLAIN SELECT count(1) from src_union_view WHERE ds ='4'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_union_view))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_WHERE (= (TOK_TABLE_OR_COL ds) '4'))))' '' 'STAGE DEPENDENCIES:' ' Stage-5 is a root stage' ' Stage-4 depends on stages: Stage-5' ' Stage-1 depends on stages: Stage-4' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-5' ' Map Reduce' ' Alias -> Map Operator Tree:' ' union_view__src_union_3_src_union_3_key_idx__ ' ' TableScan' ' alias: union_view__src_union_3_src_union_3_key_idx__' ' filterExpr:' ' expr: (ds = '4')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _bucketname' ' type: string' ' expr: _offsets' ' 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:' ' src_union_view-subquery1-subquery1:subq-subquery1-subquery1:src_union_1 ' ' TableScan' ' alias: src_union_1' ' filterExpr:' ' expr: (ds = '4')' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (ds = '4')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' src_union_view-subquery1-subquery2:subq-subquery1-subquery2:src_union_2 ' ' TableScan' ' alias: src_union_2' ' filterExpr:' ' expr: (ds = '4')' ' type: boolean' ' Filter Operator' ' predicate:' ' expr: (ds = '4')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' src_union_view-subquery2:subq-subquery2:src_union_3 ' ' TableScan' ' alias: src_union_3' ' filterExpr:' ' expr: (ds = '4')' ' type: boolean' ' Select Operator' ' expressions:' ' expr: key' ' type: int' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' outputColumnNames: _col0, _col1, _col2' ' Union' ' Select Operator' ' expressions:' ' expr: _col2' ' type: string' ' outputColumnNames: _col2' ' Select Operator' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' mode: hash' ' outputColumnNames: _col0' ' Reduce Output Operator' ' sort order: ' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: bigint' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: count(VALUE._col0)' ' bucketGroup: false' ' mode: mergepartial' ' outputColumnNames: _col0' ' Select Operator' ' expressions:' ' expr: _col0' ' type: bigint' ' outputColumnNames: _col0' ' 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' '' '' 176 rows selected >>> SELECT count(1) from src_union_view WHERE ds ='4'; '_c0' '500' 1 row selected >>> !record