Github user jihoonson commented on a diff in the pull request:
https://github.com/apache/tajo/pull/24#discussion_r13266983
--- Diff:
tajo-core/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
---
@@ -1195,10 +1192,59 @@ public LogicalNode
visitTableSubQuery(GlobalPlanContext context, LogicalPlan pla
ExecutionBlock currentBlock =
context.execBlockMap.remove(child.getPID());
if (child.getType() == NodeType.UNION) {
+ List<TableSubQueryNode> addedTableSubQueries = new
ArrayList<TableSubQueryNode>();
+ TableSubQueryNode leftMostUnionNode = null;
for (ExecutionBlock childBlock :
context.plan.getChilds(currentBlock.getId())) {
TableSubQueryNode copy = PlannerUtil.clone(plan, node);
copy.setSubQuery(childBlock.getPlan());
childBlock.setPlan(copy);
+ addedTableSubQueries.add(copy);
+
+ //Find a SubQueryNode which contains all columns in InputSchema
matched with Target and OutputSchema's column
+ if
(copy.getInSchema().containsAll(copy.getOutSchema().getColumns())) {
+ for (Target eachTarget : copy.getTargets()) {
+ Set<Column> columns =
EvalTreeUtil.findUniqueColumns(eachTarget.getEvalTree());
+ if (copy.getInSchema().containsAll(columns)) {
+ leftMostUnionNode = copy;
--- End diff --
Did you intend to find TableSubQuery node which contains at least one
target? If you did, 'break' may be required.
But, do we need to find TableSubQuery which contains all the targets?
---
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.
---