You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tajo.apache.org by ji...@apache.org on 2013/12/31 09:51:01 UTC

[09/10] git commit: DAG-execplan

DAG-execplan


Project: http://git-wip-us.apache.org/repos/asf/incubator-tajo/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tajo/commit/34456a45
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tajo/tree/34456a45
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tajo/diff/34456a45

Branch: refs/heads/DAG-execplan
Commit: 34456a4505859eb4e4f72523dc9cb8058c3fa0ff
Parents: 9190c2d
Author: Jihoon Son <ji...@apache.org>
Authored: Mon Dec 30 18:49:08 2013 +0900
Committer: Jihoon Son <ji...@apache.org>
Committed: Mon Dec 30 18:49:08 2013 +0900

----------------------------------------------------------------------
 .../engine/planner/PhysicalPlannerImpl.java     |  2 +-
 .../apache/tajo/engine/planner/PlannerUtil.java | 20 ++++++++++----------
 .../engine/planner/global/ExecutionPlan.java    |  7 ++++---
 .../engine/planner/global/GlobalPlanner.java    | 10 +++++-----
 .../planner/logical/TableSubQueryNode.java      |  4 ++++
 5 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/34456a45/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
index 0103975..1e4fba9 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PhysicalPlannerImpl.java
@@ -197,7 +197,7 @@ public class PhysicalPlannerImpl implements PhysicalPlanner {
 
       case TABLE_SUBQUERY: {
         TableSubQueryNode subQueryNode = (TableSubQueryNode) logicalNode;
-        leftExec = createPlanRecursive(ctx, plan, subQueryNode.getSubQuery());
+        leftExec = createPlanRecursive(ctx, plan, plan.getChild(subQueryNode, 0));
         if (plan.getParentCount(logicalNode) > 1) {
           return new MultiOutputExec(ctx, leftExec.getSchema(), leftExec, plan.getParentCount(logicalNode));
         } else {

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/34456a45/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java
index 5164b65..5936253 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/PlannerUtil.java
@@ -492,18 +492,18 @@ public class PlannerUtil {
     Preconditions.checkNotNull(executionPlan);
     Preconditions.checkNotNull(type);
 
-    if (executionPlan.hasPlanGroup()) {
-      return findTopNode(executionPlan.getFirstPlanGroup().toLinkedLogicalNode(), type);
-    } else {
-      return null;
-    }
-//    LogicalNodeFinderForExecPlan finder = new LogicalNodeFinderForExecPlan(type, executionPlan);
-//    finder.find();
-//
-//    if (finder.getFoundNodes().size() == 0) {
+//    if (executionPlan.hasPlanGroup()) {
+//      return findTopNode(executionPlan.getFirstPlanGroup().toLinkedLogicalNode(), type);
+//    } else {
 //      return null;
 //    }
-//    return (T) finder.getFoundNodes().get(0);
+    LogicalNodeFinderForExecPlan finder = new LogicalNodeFinderForExecPlan(type, executionPlan);
+    finder.find();
+
+    if (finder.getFoundNodes().size() == 0) {
+      return null;
+    }
+    return (T) finder.getFoundNodes().get(0);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/34456a45/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/ExecutionPlan.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/ExecutionPlan.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/ExecutionPlan.java
index a6c3bcd..84780c6 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/ExecutionPlan.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/ExecutionPlan.java
@@ -495,7 +495,7 @@ public class ExecutionPlan implements GsonObject {
       if (node.getChild() != null) {
         LogicalNode child = node.getChild();
         plan.add(child, node, edgeType);
-//        node.setChild(null);
+        node.setChild(null);
         visit(child, edgeType);
       }
     }
@@ -512,13 +512,13 @@ public class ExecutionPlan implements GsonObject {
       if (node.getLeftChild() != null) {
         child = node.getLeftChild();
         plan.add(child, node, EdgeType.LEFT);
-//        node.setLeftChild(null);
+        node.setLeftChild(null);
         visit(child, EdgeType.LEFT);
       }
       if (node.getRightChild() != null) {
         child = node.getRightChild();
         plan.add(child, node, EdgeType.RIGHT);
-//        node.setRightChild(null);
+        node.setRightChild(null);
         visit(child, EdgeType.RIGHT);
       }
     }
@@ -526,6 +526,7 @@ public class ExecutionPlan implements GsonObject {
     private void visitTableSubQuery(TableSubQueryNode node, EdgeType edgeType) throws PlanningException {
       LogicalNode child = node.getSubQuery();
       plan.add(child, node, edgeType);
+      node.nullifySubQuery();
       visit(child, edgeType);
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/34456a45/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
index b9206a1..fe7d177 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/global/GlobalPlanner.java
@@ -579,11 +579,11 @@ public class GlobalPlanner {
 
     private LogicalNode handleUnaryNode(GlobalPlanContext context, LogicalNode child, LogicalNode node) {
       ExecutionBlock execBlock = context.execBlockMap.remove(child.getPID());
-//      if (node instanceof UnaryNode) {
-//        ((UnaryNode)node).setChild(execBlock.getPlan().getFirstPlanGroup().toLinkedLogicalNode());
-//      } else if (node instanceof TableSubQueryNode) {
-//        ((TableSubQueryNode) node).setSubQuery(execBlock.getPlan().getFirstPlanGroup().toLinkedLogicalNode());
-//      }
+      if (node instanceof UnaryNode) {
+        ((UnaryNode)node).setChild(execBlock.getPlan().getFirstPlanGroup().toLinkedLogicalNode());
+      } else if (node instanceof TableSubQueryNode) {
+        ((TableSubQueryNode) node).setSubQuery(execBlock.getPlan().getFirstPlanGroup().toLinkedLogicalNode());
+      }
       execBlock.setPlan(node);
       context.execBlockMap.put(node.getPID(), execBlock);
 

http://git-wip-us.apache.org/repos/asf/incubator-tajo/blob/34456a45/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java
----------------------------------------------------------------------
diff --git a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java
index 335d12f..49a4b68 100644
--- a/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java
+++ b/tajo-core/tajo-core-backend/src/main/java/org/apache/tajo/engine/planner/logical/TableSubQueryNode.java
@@ -58,6 +58,10 @@ public class TableSubQueryNode extends RelationNode implements Projectable {
     setInSchema(subQuery.getInSchema());
   }
 
+  public void nullifySubQuery() {
+    this.subQuery = null;
+  }
+
   public LogicalNode getSubQuery() {
     return subQuery;
   }