PREHOOK: query: -- This is to test the union->selectstar->filesink optimization -- Union of 2 map-reduce subqueries is performed followed by select star and a file sink -- and the results are written to a table using dynamic partitions. -- There is no need for this optimization, since the query is a map-only query. -- It does not matter, whether the output is merged or not. In this case, merging is turned -- off -- INCLUDE_HADOOP_MAJOR_VERSIONS(0.23) -- Since this test creates sub-directories for the output table outputTbl1, it might be easier -- to run the test only on hadoop 23 create table inputTbl1(key string, val string) stored as textfile PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@inputTbl1 POSTHOOK: query: -- This is to test the union->selectstar->filesink optimization -- Union of 2 map-reduce subqueries is performed followed by select star and a file sink -- and the results are written to a table using dynamic partitions. -- There is no need for this optimization, since the query is a map-only query. -- It does not matter, whether the output is merged or not. In this case, merging is turned -- off -- INCLUDE_HADOOP_MAJOR_VERSIONS(0.23) -- Since this test creates sub-directories for the output table outputTbl1, it might be easier -- to run the test only on hadoop 23 create table inputTbl1(key string, val string) stored as textfile POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@inputTbl1 PREHOOK: query: create table outputTbl1(key string, values bigint) partitioned by (ds string) stored as rcfile PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@outputTbl1 POSTHOOK: query: create table outputTbl1(key string, values bigint) partitioned by (ds string) stored as rcfile POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@outputTbl1 PREHOOK: query: load data local inpath '../../data/files/T1.txt' into table inputTbl1 PREHOOK: type: LOAD #### A masked pattern was here #### PREHOOK: Output: default@inputtbl1 POSTHOOK: query: load data local inpath '../../data/files/T1.txt' into table inputTbl1 POSTHOOK: type: LOAD #### A masked pattern was here #### POSTHOOK: Output: default@inputtbl1 PREHOOK: query: explain insert overwrite table outputTbl1 partition (ds) SELECT * FROM ( SELECT key, 1 as values, '1' as ds from inputTbl1 UNION ALL SELECT key, 2 as values, '2' as ds from inputTbl1 ) a PREHOOK: type: QUERY POSTHOOK: query: explain insert overwrite table outputTbl1 partition (ds) SELECT * FROM ( SELECT key, 1 as values, '1' as ds from inputTbl1 UNION ALL SELECT key, 2 as values, '2' as ds from inputTbl1 ) a POSTHOOK: type: QUERY STAGE DEPENDENCIES: Stage-1 is a root stage Stage-0 depends on stages: Stage-1 STAGE PLANS: Stage: Stage-1 Map Reduce Map Operator Tree: TableScan alias: inputtbl1 Statistics: Num rows: 0 Data size: 30 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: key (type: string), 1 (type: int), '1' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 0 Data size: 30 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 0 Data size: 60 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: _col0 (type: string), UDFToLong(_col1) (type: bigint), _col2 (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 0 Data size: 60 Basic stats: PARTIAL Column stats: NONE File Output Operator compressed: false Statistics: Num rows: 0 Data size: 60 Basic stats: PARTIAL Column stats: NONE table: input format: org.apache.hadoop.hive.ql.io.RCFileInputFormat output format: org.apache.hadoop.hive.ql.io.RCFileOutputFormat serde: org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe name: default.outputtbl1 TableScan alias: inputtbl1 Statistics: Num rows: 0 Data size: 30 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: key (type: string), 2 (type: int), '2' (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 0 Data size: 30 Basic stats: PARTIAL Column stats: NONE Union Statistics: Num rows: 0 Data size: 60 Basic stats: PARTIAL Column stats: NONE Select Operator expressions: _col0 (type: string), UDFToLong(_col1) (type: bigint), _col2 (type: string) outputColumnNames: _col0, _col1, _col2 Statistics: Num rows: 0 Data size: 60 Basic stats: PARTIAL Column stats: NONE File Output Operator compressed: false Statistics: Num rows: 0 Data size: 60 Basic stats: PARTIAL Column stats: NONE table: input format: org.apache.hadoop.hive.ql.io.RCFileInputFormat output format: org.apache.hadoop.hive.ql.io.RCFileOutputFormat serde: org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe name: default.outputtbl1 Stage: Stage-0 Move Operator tables: partition: ds replace: true table: input format: org.apache.hadoop.hive.ql.io.RCFileInputFormat output format: org.apache.hadoop.hive.ql.io.RCFileOutputFormat serde: org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe name: default.outputtbl1 PREHOOK: query: insert overwrite table outputTbl1 partition (ds) SELECT * FROM ( SELECT key, 1 as values, '1' as ds from inputTbl1 UNION ALL SELECT key, 2 as values, '2' as ds from inputTbl1 ) a PREHOOK: type: QUERY PREHOOK: Input: default@inputtbl1 PREHOOK: Output: default@outputtbl1 POSTHOOK: query: insert overwrite table outputTbl1 partition (ds) SELECT * FROM ( SELECT key, 1 as values, '1' as ds from inputTbl1 UNION ALL SELECT key, 2 as values, '2' as ds from inputTbl1 ) a POSTHOOK: type: QUERY POSTHOOK: Input: default@inputtbl1 POSTHOOK: Output: default@outputtbl1@ds=1 POSTHOOK: Output: default@outputtbl1@ds=2 POSTHOOK: Lineage: outputtbl1 PARTITION(ds=1).key EXPRESSION [(inputtbl1)inputtbl1.FieldSchema(name:key, type:string, comment:null), (inputtbl1)inputtbl1.FieldSchema(name:key, type:string, comment:null), ] POSTHOOK: Lineage: outputtbl1 PARTITION(ds=1).values EXPRESSION [] POSTHOOK: Lineage: outputtbl1 PARTITION(ds=2).key EXPRESSION [(inputtbl1)inputtbl1.FieldSchema(name:key, type:string, comment:null), (inputtbl1)inputtbl1.FieldSchema(name:key, type:string, comment:null), ] POSTHOOK: Lineage: outputtbl1 PARTITION(ds=2).values EXPRESSION [] PREHOOK: query: desc formatted outputTbl1 PREHOOK: type: DESCTABLE PREHOOK: Input: default@outputtbl1 POSTHOOK: query: desc formatted outputTbl1 POSTHOOK: type: DESCTABLE POSTHOOK: Input: default@outputtbl1 # col_name data_type comment key string values bigint # Partition Information # col_name data_type comment ds string # Detailed Table Information Database: default #### A masked pattern was here #### Protect Mode: None Retention: 0 #### A masked pattern was here #### Table Type: MANAGED_TABLE Table Parameters: #### A masked pattern was here #### # Storage Information SerDe Library: org.apache.hadoop.hive.serde2.columnar.ColumnarSerDe InputFormat: org.apache.hadoop.hive.ql.io.RCFileInputFormat OutputFormat: org.apache.hadoop.hive.ql.io.RCFileOutputFormat Compressed: No Num Buckets: -1 Bucket Columns: [] Sort Columns: [] Storage Desc Params: serialization.format 1 PREHOOK: query: show partitions outputTbl1 PREHOOK: type: SHOWPARTITIONS PREHOOK: Input: default@outputtbl1 POSTHOOK: query: show partitions outputTbl1 POSTHOOK: type: SHOWPARTITIONS POSTHOOK: Input: default@outputtbl1 ds=1 ds=2 PREHOOK: query: select * from outputTbl1 where ds = '1' order by key, values PREHOOK: type: QUERY PREHOOK: Input: default@outputtbl1 PREHOOK: Input: default@outputtbl1@ds=1 #### A masked pattern was here #### POSTHOOK: query: select * from outputTbl1 where ds = '1' order by key, values POSTHOOK: type: QUERY POSTHOOK: Input: default@outputtbl1 POSTHOOK: Input: default@outputtbl1@ds=1 #### A masked pattern was here #### 1 1 1 2 1 1 3 1 1 7 1 1 8 1 1 8 1 1 PREHOOK: query: select * from outputTbl1 where ds = '2' order by key, values PREHOOK: type: QUERY PREHOOK: Input: default@outputtbl1 PREHOOK: Input: default@outputtbl1@ds=2 #### A masked pattern was here #### POSTHOOK: query: select * from outputTbl1 where ds = '2' order by key, values POSTHOOK: type: QUERY POSTHOOK: Input: default@outputtbl1 POSTHOOK: Input: default@outputtbl1@ds=2 #### A masked pattern was here #### 1 2 2 2 2 2 3 2 2 7 2 2 8 2 2 8 2 2