@Test public final void testProjectionPush() throws CloneNotSupportedException, PlanningException { Expr expr = sqlAnalyzer.parse(QUERIES[2]); LogicalPlan newPlan = planner.createPlan(expr); LogicalNode plan = newPlan.getRootBlock().getRoot(); assertEquals(NodeType.ROOT, plan.getType()); LogicalRootNode root = (LogicalRootNode) plan; TestLogicalNode.testCloneLogicalNode(root); assertEquals(NodeType.PROJECTION, root.getChild().getType()); ProjectionNode projNode = root.getChild(); assertEquals(NodeType.SELECTION, projNode.getChild().getType()); SelectionNode selNode = projNode.getChild(); assertEquals(NodeType.SCAN, selNode.getChild().getType()); LogicalNode optimized = optimizer.optimize(newPlan); assertEquals(NodeType.ROOT, optimized.getType()); root = (LogicalRootNode) optimized; TestLogicalNode.testCloneLogicalNode(root); assertEquals(NodeType.SCAN, root.getChild().getType()); }
public LogicalNode optimize(LogicalPlan plan) throws PlanningException { rulesBeforeJoinOpt.rewrite(plan); DirectedGraphCursor<String, BlockEdge> blockCursor = new DirectedGraphCursor<String, BlockEdge>(plan.getQueryBlockGraph(), plan.getRootBlock().getName()); while(blockCursor.hasNext()) { optimizeJoinOrder(plan, blockCursor.nextBlock()); } rulesAfterToJoinOpt.rewrite(plan); return plan.getRootBlock().getRoot(); }
LogicalOptimizer { public LogicalNode optimize(LogicalPlan plan) throws PlanningException { rulesBeforeJoinOpt.rewrite(plan); DirectedGraphCursor<String, BlockEdge> blockCursor = new DirectedGraphCursor<String, BlockEdge>(plan.getQueryBlockGraph(), plan.getRootBlock().getName()); while(blockCursor.hasNext()) { optimizeJoinOrder(plan, blockCursor.nextBlock()); } rulesAfterToJoinOpt.rewrite(plan); return plan.getRootBlock().getRoot(); } }
LogicalOptimizer { public LogicalNode optimize(LogicalPlan plan) throws PlanningException { rulesBeforeJoinOpt.rewrite(plan); DirectedGraphCursor<String, BlockEdge> blockCursor = new DirectedGraphCursor<String, BlockEdge>(plan.getQueryBlockGraph(), plan.getRootBlock().getName()); while(blockCursor.hasNext()) { optimizeJoinOrder(plan, blockCursor.nextBlock()); } rulesAfterToJoinOpt.rewrite(plan); return plan.getRootBlock().getRoot(); } LogicalOptimizer(TajoConf systemConf); }
LogicalOptimizer { public LogicalNode optimize(LogicalPlan plan) throws PlanningException { rulesBeforeJoinOpt.rewrite(plan); DirectedGraphCursor<String, BlockEdge> blockCursor = new DirectedGraphCursor<String, BlockEdge>(plan.getQueryBlockGraph(), plan.getRootBlock().getName()); while(blockCursor.hasNext()) { optimizeJoinOrder(plan, blockCursor.nextBlock()); } rulesAfterToJoinOpt.rewrite(plan); return plan.getRootBlock().getRoot(); } LogicalOptimizer(TajoConf systemConf); LogicalNode optimize(LogicalPlan plan); }
LogicalOptimizer { public LogicalNode optimize(LogicalPlan plan) throws PlanningException { rulesBeforeJoinOpt.rewrite(plan); DirectedGraphCursor<String, BlockEdge> blockCursor = new DirectedGraphCursor<String, BlockEdge>(plan.getQueryBlockGraph(), plan.getRootBlock().getName()); while(blockCursor.hasNext()) { optimizeJoinOrder(plan, blockCursor.nextBlock()); } rulesAfterToJoinOpt.rewrite(plan); return plan.getRootBlock().getRoot(); } LogicalOptimizer(TajoConf systemConf); LogicalNode optimize(LogicalPlan plan);  }