@Test public final void testPushable() throws CloneNotSupportedException, PlanningException { Expr expr = sqlAnalyzer.parse(QUERIES[0]); 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.JOIN, selNode.getChild().getType()); JoinNode joinNode = selNode.getChild(); assertFalse(joinNode.hasJoinQual()); assertTrue(LogicalPlanner.checkIfBeEvaluatedAtJoin(newPlan.getRootBlock(), selNode.getQual(), joinNode, false)); LogicalNode optimized = optimizer.optimize(newPlan); assertEquals(NodeType.ROOT, optimized.getType()); root = (LogicalRootNode) optimized; assertEquals(NodeType.JOIN, root.getChild().getType()); joinNode = root.getChild(); assertTrue(joinNode.hasJoinQual()); expr = sqlAnalyzer.parse(QUERIES[1]); newPlan = planner.createPlan(expr); plan = newPlan.getRootBlock().getRoot(); assertEquals(NodeType.ROOT, plan.getType()); root = (LogicalRootNode) plan; TestLogicalNode.testCloneLogicalNode(root); assertEquals(NodeType.PROJECTION, root.getChild().getType()); projNode = root.getChild(); assertEquals(NodeType.SELECTION, projNode.getChild().getType()); selNode = projNode.getChild(); assertEquals(NodeType.SCAN, selNode.getChild().getType()); ScanNode scanNode = selNode.getChild(); assertTrue(LogicalPlanner.checkIfBeEvaluatedAtRelation(newPlan.getRootBlock(), selNode.getQual(), scanNode)); }
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);  }