Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion ql/src/java/org/apache/hadoop/hive/ql/parse/GenTezUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ public static void removeUnionOperators(GenTezProcContext context, BaseWork work
operators.addAll(newRoots);

Set<Operator<?>> seen = new HashSet<Operator<?>>();
Set<Operator<?>> removedParents = new HashSet<Operator<?>>();

Set<FileStatus> fileStatusesToFetch = null;
if(context.parseContext.getFetchTask() != null) {
Expand Down Expand Up @@ -468,7 +469,12 @@ public static void removeUnionOperators(GenTezProcContext context, BaseWork work
// root operator is union (can happen in reducers)
replacementMap.put(current, current.getChildOperators().get(0));
} else {
parent.removeChildAndAdoptItsChildren(current);
// For complex queries, there is a UNION with the same parent.
// In that case, the parent UNION that has already been removed will not be removed.
if (!removedParents.contains(parent)) {
parent.removeChildAndAdoptItsChildren(current);
removedParents.add(parent);
}
operators.remove(current);
}
}
Expand Down
32 changes: 18 additions & 14 deletions ql/src/test/results/clientpositive/llap/cte_mat_10.q.out
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,16 @@ STAGE PLANS:
expressions: concat('b2 <- ', id) (type: string)
outputColumnNames: _col0
Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
File Output Operator
compressed: false
Union
Statistics: Num rows: 6 Data size: 1005 Basic stats: COMPLETE Column stats: PARTIAL
table:
input format: org.apache.hadoop.mapred.SequenceFileInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
Execution mode: vectorized, llap
File Output Operator
compressed: false
Statistics: Num rows: 6 Data size: 1005 Basic stats: COMPLETE Column stats: PARTIAL
table:
input format: org.apache.hadoop.mapred.SequenceFileInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
Execution mode: llap
LLAP IO: all inputs
Map 4
Map Operator Tree:
Expand Down Expand Up @@ -229,14 +231,16 @@ STAGE PLANS:
expressions: concat('b2 <- ', id) (type: string)
outputColumnNames: _col0
Statistics: Num rows: 1 Data size: 184 Basic stats: COMPLETE Column stats: NONE
File Output Operator
compressed: false
Union
Statistics: Num rows: 6 Data size: 1005 Basic stats: COMPLETE Column stats: PARTIAL
table:
input format: org.apache.hadoop.mapred.SequenceFileInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
Execution mode: vectorized, llap
File Output Operator
compressed: false
Statistics: Num rows: 6 Data size: 1005 Basic stats: COMPLETE Column stats: PARTIAL
table:
input format: org.apache.hadoop.mapred.SequenceFileInputFormat
output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
Execution mode: llap
LLAP IO: all inputs
Union 5
Vertex: Union 5
Expand Down