PREHOOK: query: -- Tests in this file are used to make sure Correlation Optimizer -- can correctly handle tables with partitions CREATE TABLE part_table(key string, value string) PARTITIONED BY (partitionId int) PREHOOK: type: CREATETABLE PREHOOK: Output: database:default PREHOOK: Output: default@part_table POSTHOOK: query: -- Tests in this file are used to make sure Correlation Optimizer -- can correctly handle tables with partitions CREATE TABLE part_table(key string, value string) PARTITIONED BY (partitionId int) POSTHOOK: type: CREATETABLE POSTHOOK: Output: database:default POSTHOOK: Output: default@part_table PREHOOK: query: INSERT OVERWRITE TABLE part_table PARTITION (partitionId=1) SELECT key, value FROM src ORDER BY key, value LIMIT 100 PREHOOK: type: QUERY PREHOOK: Input: default@src PREHOOK: Output: default@part_table@partitionid=1 POSTHOOK: query: INSERT OVERWRITE TABLE part_table PARTITION (partitionId=1) SELECT key, value FROM src ORDER BY key, value LIMIT 100 POSTHOOK: type: QUERY POSTHOOK: Input: default@src POSTHOOK: Output: default@part_table@partitionid=1 POSTHOOK: Lineage: part_table PARTITION(partitionid=1).key SIMPLE [(src)src.FieldSchema(name:key, type:string, comment:default), ] POSTHOOK: Lineage: part_table PARTITION(partitionid=1).value SIMPLE [(src)src.FieldSchema(name:value, type:string, comment:default), ] PREHOOK: query: INSERT OVERWRITE TABLE part_table PARTITION (partitionId=2) SELECT key, value FROM src1 ORDER BY key, value PREHOOK: type: QUERY PREHOOK: Input: default@src1 PREHOOK: Output: default@part_table@partitionid=2 POSTHOOK: query: INSERT OVERWRITE TABLE part_table PARTITION (partitionId=2) SELECT key, value FROM src1 ORDER BY key, value POSTHOOK: type: QUERY POSTHOOK: Input: default@src1 POSTHOOK: Output: default@part_table@partitionid=2 POSTHOOK: Lineage: part_table PARTITION(partitionid=2).key SIMPLE [(src1)src1.FieldSchema(name:key, type:string, comment:default), ] POSTHOOK: Lineage: part_table PARTITION(partitionid=2).value SIMPLE [(src1)src1.FieldSchema(name:value, type:string, comment:default), ] PREHOOK: query: -- In this case, we should not do shared scan on part_table -- because left and right tables of JOIN use different partitions -- of part_table. With Correlation Optimizer we will generate -- 1 MR job. EXPLAIN SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 1 AND y.partitionId = 2 GROUP BY x.key PREHOOK: type: QUERY POSTHOOK: query: -- In this case, we should not do shared scan on part_table -- because left and right tables of JOIN use different partitions -- of part_table. With Correlation Optimizer we will generate -- 1 MR job. EXPLAIN SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 1 AND y.partitionId = 2 GROUP BY x.key POSTHOOK: type: QUERY STAGE DEPENDENCIES: Stage-1 is a root stage Stage-2 depends on stages: Stage-1 Stage-0 depends on stages: Stage-2 STAGE PLANS: Stage: Stage-1 Map Reduce Map Operator Tree: TableScan alias: x Statistics: Num rows: 100 Data size: 1070 Basic stats: COMPLETE Column stats: NONE Filter Operator predicate: key is not null (type: boolean) Statistics: Num rows: 50 Data size: 535 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator key expressions: key (type: string) sort order: + Map-reduce partition columns: key (type: string) Statistics: Num rows: 50 Data size: 535 Basic stats: COMPLETE Column stats: NONE TableScan alias: y Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE Filter Operator predicate: key is not null (type: boolean) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator key expressions: key (type: string) sort order: + Map-reduce partition columns: key (type: string) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Operator Tree: Join Operator condition map: Inner Join 0 to 1 keys: 0 key (type: string) 1 key (type: string) outputColumnNames: _col0 Statistics: Num rows: 55 Data size: 588 Basic stats: COMPLETE Column stats: NONE Group By Operator aggregations: count(1) keys: _col0 (type: string) mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 55 Data size: 588 Basic stats: COMPLETE Column stats: NONE File Output Operator compressed: false table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe Stage: Stage-2 Map Reduce Map Operator Tree: TableScan Reduce Output Operator key expressions: _col0 (type: string) sort order: + Map-reduce partition columns: _col0 (type: string) Statistics: Num rows: 55 Data size: 588 Basic stats: COMPLETE Column stats: NONE value expressions: _col1 (type: bigint) Reduce Operator Tree: Group By Operator aggregations: count(VALUE._col0) keys: KEY._col0 (type: string) mode: mergepartial outputColumnNames: _col0, _col1 Statistics: Num rows: 27 Data size: 288 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: _col0 (type: string), _col1 (type: bigint) outputColumnNames: _col0, _col1 Statistics: Num rows: 27 Data size: 288 Basic stats: COMPLETE Column stats: NONE File Output Operator compressed: false Statistics: Num rows: 27 Data size: 288 Basic stats: COMPLETE Column stats: NONE table: input format: org.apache.hadoop.mapred.TextInputFormat output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe Stage: Stage-0 Fetch Operator limit: -1 Processor Tree: ListSink PREHOOK: query: SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 1 AND y.partitionId = 2 GROUP BY x.key PREHOOK: type: QUERY PREHOOK: Input: default@part_table PREHOOK: Input: default@part_table@partitionid=1 PREHOOK: Input: default@part_table@partitionid=2 #### A masked pattern was here #### POSTHOOK: query: SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 1 AND y.partitionId = 2 GROUP BY x.key POSTHOOK: type: QUERY POSTHOOK: Input: default@part_table POSTHOOK: Input: default@part_table@partitionid=1 POSTHOOK: Input: default@part_table@partitionid=2 #### A masked pattern was here #### 128 3 146 2 150 1 PREHOOK: query: EXPLAIN SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 1 AND y.partitionId = 2 GROUP BY x.key PREHOOK: type: QUERY POSTHOOK: query: EXPLAIN SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 1 AND y.partitionId = 2 GROUP BY x.key 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: x Statistics: Num rows: 100 Data size: 1070 Basic stats: COMPLETE Column stats: NONE Filter Operator predicate: key is not null (type: boolean) Statistics: Num rows: 50 Data size: 535 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator key expressions: key (type: string) sort order: + Map-reduce partition columns: key (type: string) Statistics: Num rows: 50 Data size: 535 Basic stats: COMPLETE Column stats: NONE TableScan alias: y Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE Filter Operator predicate: key is not null (type: boolean) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator key expressions: key (type: string) sort order: + Map-reduce partition columns: key (type: string) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Operator Tree: Demux Operator Statistics: Num rows: 63 Data size: 634 Basic stats: COMPLETE Column stats: NONE Join Operator condition map: Inner Join 0 to 1 keys: 0 key (type: string) 1 key (type: string) outputColumnNames: _col0 Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE Mux Operator Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE Group By Operator aggregations: count(1) keys: _col0 (type: string) mode: complete outputColumnNames: _col0, _col1 Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE Select Operator expressions: _col0 (type: string), _col1 (type: bigint) outputColumnNames: _col0, _col1 Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE File Output Operator compressed: false Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE table: input format: org.apache.hadoop.mapred.TextInputFormat output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe Stage: Stage-0 Fetch Operator limit: -1 Processor Tree: ListSink PREHOOK: query: SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 1 AND y.partitionId = 2 GROUP BY x.key PREHOOK: type: QUERY PREHOOK: Input: default@part_table PREHOOK: Input: default@part_table@partitionid=1 PREHOOK: Input: default@part_table@partitionid=2 #### A masked pattern was here #### POSTHOOK: query: SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 1 AND y.partitionId = 2 GROUP BY x.key POSTHOOK: type: QUERY POSTHOOK: Input: default@part_table POSTHOOK: Input: default@part_table@partitionid=1 POSTHOOK: Input: default@part_table@partitionid=2 #### A masked pattern was here #### 128 3 146 2 150 1 PREHOOK: query: -- In this case, we should do shared scan on part_table -- because left and right tables of JOIN use the same partition -- of part_table. With Correlation Optimizer we will generate -- 1 MR job. EXPLAIN SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 2 AND y.partitionId = 2 GROUP BY x.key PREHOOK: type: QUERY POSTHOOK: query: -- In this case, we should do shared scan on part_table -- because left and right tables of JOIN use the same partition -- of part_table. With Correlation Optimizer we will generate -- 1 MR job. EXPLAIN SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 2 AND y.partitionId = 2 GROUP BY x.key POSTHOOK: type: QUERY STAGE DEPENDENCIES: Stage-1 is a root stage Stage-2 depends on stages: Stage-1 Stage-0 depends on stages: Stage-2 STAGE PLANS: Stage: Stage-1 Map Reduce Map Operator Tree: TableScan alias: x Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE Filter Operator predicate: key is not null (type: boolean) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator key expressions: key (type: string) sort order: + Map-reduce partition columns: key (type: string) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE TableScan alias: y Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE Filter Operator predicate: key is not null (type: boolean) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator key expressions: key (type: string) sort order: + Map-reduce partition columns: key (type: string) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Operator Tree: Join Operator condition map: Inner Join 0 to 1 keys: 0 key (type: string) 1 key (type: string) outputColumnNames: _col0 Statistics: Num rows: 14 Data size: 108 Basic stats: COMPLETE Column stats: NONE Group By Operator aggregations: count(1) keys: _col0 (type: string) mode: hash outputColumnNames: _col0, _col1 Statistics: Num rows: 14 Data size: 108 Basic stats: COMPLETE Column stats: NONE File Output Operator compressed: false table: input format: org.apache.hadoop.mapred.SequenceFileInputFormat output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat serde: org.apache.hadoop.hive.serde2.lazybinary.LazyBinarySerDe Stage: Stage-2 Map Reduce Map Operator Tree: TableScan Reduce Output Operator key expressions: _col0 (type: string) sort order: + Map-reduce partition columns: _col0 (type: string) Statistics: Num rows: 14 Data size: 108 Basic stats: COMPLETE Column stats: NONE value expressions: _col1 (type: bigint) Reduce Operator Tree: Group By Operator aggregations: count(VALUE._col0) keys: KEY._col0 (type: string) mode: mergepartial outputColumnNames: _col0, _col1 Statistics: Num rows: 7 Data size: 54 Basic stats: COMPLETE Column stats: NONE Select Operator expressions: _col0 (type: string), _col1 (type: bigint) outputColumnNames: _col0, _col1 Statistics: Num rows: 7 Data size: 54 Basic stats: COMPLETE Column stats: NONE File Output Operator compressed: false Statistics: Num rows: 7 Data size: 54 Basic stats: COMPLETE Column stats: NONE table: input format: org.apache.hadoop.mapred.TextInputFormat output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe Stage: Stage-0 Fetch Operator limit: -1 Processor Tree: ListSink PREHOOK: query: SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 2 AND y.partitionId = 2 GROUP BY x.key PREHOOK: type: QUERY PREHOOK: Input: default@part_table PREHOOK: Input: default@part_table@partitionid=2 #### A masked pattern was here #### POSTHOOK: query: SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 2 AND y.partitionId = 2 GROUP BY x.key POSTHOOK: type: QUERY POSTHOOK: Input: default@part_table POSTHOOK: Input: default@part_table@partitionid=2 #### A masked pattern was here #### 100 128 1 146 1 150 1 213 1 224 1 238 1 255 1 273 1 278 1 311 1 369 1 401 1 406 1 66 1 98 1 PREHOOK: query: EXPLAIN SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 2 AND y.partitionId = 2 GROUP BY x.key PREHOOK: type: QUERY POSTHOOK: query: EXPLAIN SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 2 AND y.partitionId = 2 GROUP BY x.key 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: x Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE Filter Operator predicate: key is not null (type: boolean) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator key expressions: key (type: string) sort order: + Map-reduce partition columns: key (type: string) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE TableScan alias: y Statistics: Num rows: 25 Data size: 191 Basic stats: COMPLETE Column stats: NONE Filter Operator predicate: key is not null (type: boolean) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Output Operator key expressions: key (type: string) sort order: + Map-reduce partition columns: key (type: string) Statistics: Num rows: 13 Data size: 99 Basic stats: COMPLETE Column stats: NONE Reduce Operator Tree: Demux Operator Statistics: Num rows: 26 Data size: 198 Basic stats: COMPLETE Column stats: NONE Join Operator condition map: Inner Join 0 to 1 keys: 0 key (type: string) 1 key (type: string) outputColumnNames: _col0 Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE Mux Operator Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE Group By Operator aggregations: count(1) keys: _col0 (type: string) mode: complete outputColumnNames: _col0, _col1 Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE Select Operator expressions: _col0 (type: string), _col1 (type: bigint) outputColumnNames: _col0, _col1 Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE File Output Operator compressed: false Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE table: input format: org.apache.hadoop.mapred.TextInputFormat output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe Stage: Stage-0 Fetch Operator limit: -1 Processor Tree: ListSink PREHOOK: query: SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 2 AND y.partitionId = 2 GROUP BY x.key PREHOOK: type: QUERY PREHOOK: Input: default@part_table PREHOOK: Input: default@part_table@partitionid=2 #### A masked pattern was here #### POSTHOOK: query: SELECT x.key AS key, count(1) AS cnt FROM part_table x JOIN part_table y ON (x.key = y.key) WHERE x.partitionId = 2 AND y.partitionId = 2 GROUP BY x.key POSTHOOK: type: QUERY POSTHOOK: Input: default@part_table POSTHOOK: Input: default@part_table@partitionid=2 #### A masked pattern was here #### 100 128 1 146 1 150 1 213 1 224 1 238 1 255 1 273 1 278 1 311 1 369 1 401 1 406 1 66 1 98 1