Github user ykrips commented on a diff in the pull request:
https://github.com/apache/tajo/pull/402#discussion_r26272910
--- Diff:
tajo-core/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
---
@@ -1371,32 +1373,57 @@ public LogicalNode visitUnion(GlobalPlanContext
context, LogicalPlan plan, Logic
LogicalPlan.QueryBlock rightQueryBlock =
plan.getBlock(node.getRightChild());
LogicalNode rightChild = visit(context, plan, rightQueryBlock,
rightQueryBlock.getRoot(), stack);
stack.pop();
+
+ MasterPlan masterPlan = context.getPlan();
List<ExecutionBlock> unionBlocks = Lists.newArrayList();
List<ExecutionBlock> queryBlockBlocks = Lists.newArrayList();
ExecutionBlock leftBlock =
context.execBlockMap.remove(leftChild.getPID());
ExecutionBlock rightBlock =
context.execBlockMap.remove(rightChild.getPID());
+
+ boolean leftUnion = (leftChild.getType() == NodeType.TABLE_SUBQUERY)
&&
+ (((TableSubQueryNode)leftChild).getSubQuery().getType() ==
NodeType.UNION);
+ boolean rightUnion = (rightChild.getType() ==
NodeType.TABLE_SUBQUERY) &&
+ (((TableSubQueryNode)rightChild).getSubQuery().getType() ==
NodeType.UNION);
if (leftChild.getType() == NodeType.UNION) {
unionBlocks.add(leftBlock);
} else {
- queryBlockBlocks.add(leftBlock);
+ if (leftUnion) {
+ node.setLeftChild(
+ createScanNodeWithTableSubQuery(masterPlan,
--- End diff --
You're right. First of all, I eliminated these child subqueries, but plan
threw exceptions that plan does not have sufficient data channels. I feel that
it would be better to change the implementation. therefore, I have created
these even unnecessary data operations exist.
I agree with your thought, and I will try again for this optimization work.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---