diff --git ql/src/java/org/apache/hadoop/hive/ql/parse/AppMasterEventProcessor.java ql/src/java/org/apache/hadoop/hive/ql/parse/AppMasterEventProcessor.java index e442f06..9ef0dd7 100644 --- ql/src/java/org/apache/hadoop/hive/ql/parse/AppMasterEventProcessor.java +++ ql/src/java/org/apache/hadoop/hive/ql/parse/AppMasterEventProcessor.java @@ -56,6 +56,7 @@ public Object process(Node nd, Stack stack, NodeProcessorCtx procCtx, Obje } else { events = new ArrayList(); } + events.add(event); context.tsToEventMap.put(desc.getTableScan(), events); return true; } diff --git ql/src/test/queries/clientpositive/dynamic_partition_pruning_2.q ql/src/test/queries/clientpositive/dynamic_partition_pruning_2.q index ffda43f..67c5249 100644 --- ql/src/test/queries/clientpositive/dynamic_partition_pruning_2.q +++ ql/src/test/queries/clientpositive/dynamic_partition_pruning_2.q @@ -39,3 +39,12 @@ and d1.label in ('foo', 'bar') GROUP BY d1.label ORDER BY d1.label; + +EXPLAIN +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'foo' +UNION ALL +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'bar'; + +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'foo' +UNION ALL +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'bar'; \ No newline at end of file diff --git ql/src/test/results/clientpositive/tez/dynamic_partition_pruning_2.q.out ql/src/test/results/clientpositive/tez/dynamic_partition_pruning_2.q.out index dc02a1f..80967ec 100644 --- ql/src/test/results/clientpositive/tez/dynamic_partition_pruning_2.q.out +++ ql/src/test/results/clientpositive/tez/dynamic_partition_pruning_2.q.out @@ -267,3 +267,176 @@ POSTHOOK: Input: default@dim_shops #### A masked pattern was here #### bar 3 15 foo 3 6 +PREHOOK: query: EXPLAIN +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'foo' +UNION ALL +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'bar' +PREHOOK: type: QUERY +POSTHOOK: query: EXPLAIN +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'foo' +UNION ALL +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'bar' +POSTHOOK: type: QUERY +STAGE DEPENDENCIES: + Stage-1 is a root stage + Stage-0 depends on stages: Stage-1 + +STAGE PLANS: + Stage: Stage-1 + Tez + Edges: + Map 3 <- Map 1 (BROADCAST_EDGE), Union 4 (CONTAINS) + Map 5 <- Map 2 (BROADCAST_EDGE), Union 4 (CONTAINS) +#### A masked pattern was here #### + Vertices: + Map 1 + Map Operator Tree: + TableScan + alias: dim_shops + filterExpr: (id is not null and (label = 'bar')) (type: boolean) + Statistics: Num rows: 2 Data size: 18 Basic stats: COMPLETE Column stats: NONE + Filter Operator + predicate: (id is not null and (label = 'bar')) (type: boolean) + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Reduce Output Operator + key expressions: id (type: int) + sort order: + + Map-reduce partition columns: id (type: int) + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Select Operator + expressions: id (type: int) + outputColumnNames: _col0 + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Group By Operator + keys: _col0 (type: int) + mode: hash + outputColumnNames: _col0 + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Dynamic Partitioning Event Operator + Target Input: agg_01 + Partition key expr: dim_shops_id + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Target column: dim_shops_id + Target Vertex: Map 3 + Map 2 + Map Operator Tree: + TableScan + alias: dim_shops + filterExpr: (id is not null and (label = 'foo')) (type: boolean) + Statistics: Num rows: 2 Data size: 18 Basic stats: COMPLETE Column stats: NONE + Filter Operator + predicate: (id is not null and (label = 'foo')) (type: boolean) + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Reduce Output Operator + key expressions: id (type: int) + sort order: + + Map-reduce partition columns: id (type: int) + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Select Operator + expressions: id (type: int) + outputColumnNames: _col0 + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Group By Operator + keys: _col0 (type: int) + mode: hash + outputColumnNames: _col0 + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Dynamic Partitioning Event Operator + Target Input: agg_01 + Partition key expr: dim_shops_id + Statistics: Num rows: 0 Data size: 0 Basic stats: NONE Column stats: NONE + Target column: dim_shops_id + Target Vertex: Map 5 + Map 3 + Map Operator Tree: + TableScan + alias: agg_01 + filterExpr: dim_shops_id is not null (type: boolean) + Map Join Operator + condition map: + Inner Join 0 to 1 + condition expressions: + 0 {amount} {dim_shops_id} + 1 {id} + keys: + 0 dim_shops_id (type: int) + 1 id (type: int) + outputColumnNames: _col0, _col1, _col5 + Filter Operator + predicate: (_col1 = _col5) (type: boolean) + Select Operator + expressions: _col0 (type: decimal(10,0)) + outputColumnNames: _col0 + Select Operator + expressions: _col0 (type: decimal(10,0)) + outputColumnNames: _col0 + File Output Operator + compressed: false + 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 + Map 5 + Map Operator Tree: + TableScan + alias: agg_01 + filterExpr: dim_shops_id is not null (type: boolean) + Map Join Operator + condition map: + Inner Join 0 to 1 + condition expressions: + 0 {amount} {dim_shops_id} + 1 {id} + keys: + 0 dim_shops_id (type: int) + 1 id (type: int) + outputColumnNames: _col0, _col1, _col5 + Filter Operator + predicate: (_col1 = _col5) (type: boolean) + Select Operator + expressions: _col0 (type: decimal(10,0)) + outputColumnNames: _col0 + Select Operator + expressions: _col0 (type: decimal(10,0)) + outputColumnNames: _col0 + File Output Operator + compressed: false + 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 + Union 4 + Vertex: Union 4 + + Stage: Stage-0 + Fetch Operator + limit: -1 + Processor Tree: + ListSink + +PREHOOK: query: SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'foo' +UNION ALL +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'bar' +PREHOOK: type: QUERY +PREHOOK: Input: default@agg_01 +PREHOOK: Input: default@agg_01@dim_shops_id=1 +PREHOOK: Input: default@agg_01@dim_shops_id=2 +PREHOOK: Input: default@agg_01@dim_shops_id=3 +PREHOOK: Input: default@dim_shops +#### A masked pattern was here #### +POSTHOOK: query: SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'foo' +UNION ALL +SELECT amount FROM agg_01, dim_shops WHERE dim_shops_id = id AND label = 'bar' +POSTHOOK: type: QUERY +POSTHOOK: Input: default@agg_01 +POSTHOOK: Input: default@agg_01@dim_shops_id=1 +POSTHOOK: Input: default@agg_01@dim_shops_id=2 +POSTHOOK: Input: default@agg_01@dim_shops_id=3 +POSTHOOK: Input: default@dim_shops +#### A masked pattern was here #### +4 +5 +6 +1 +2 +3