test_class.declarator: util
test_class.modifier: private static
test_class.original_string: private static TajoTestingCluster util;
test_class.type: TajoTestingCluster
test_class.var_name: util
test_class.declarator: catalog
test_class.modifier: private static
test_class.original_string: private static CatalogService catalog;
test_class.type: CatalogService
test_class.var_name: catalog
test_class.declarator: sqlAnalyzer
test_class.modifier: private static
test_class.original_string: private static SQLAnalyzer sqlAnalyzer;
test_class.type: SQLAnalyzer
test_class.var_name: sqlAnalyzer
test_class.declarator: planner
test_class.modifier: private static
test_class.original_string: private static LogicalPlanner planner;
test_class.type: LogicalPlanner
test_class.var_name: planner
test_class.declarator: optimizer
test_class.modifier: private static
test_class.original_string: private static LogicalOptimizer optimizer;
test_class.type: LogicalOptimizer
test_class.var_name: optimizer
test_class.declarator: session = LocalTajoTestingUtility.createDummySession()
test_class.modifier: private static
test_class.original_string: private static Session session = LocalTajoTestingUtility.createDummySession();
test_class.type: Session
test_class.var_name: session
test_class.declarator: QUERIES = {
      "select name, manager from employee as e, dept as dp where e.deptName = dp.deptName", // 0
      "select name, empId, deptName from employee where empId > 500", // 1
      "select name from employee where empId = 100", // 2
      "select name, max(empId) as final from employee where empId > 50 group by name", // 3
      "select name, score from employee natural join score", // 4
      "select name, score from employee join score on employee.deptName = score.deptName", // 5
    }
test_class.modifier: static
test_class.original_string: static String[] QUERIES = {
      "select name, manager from employee as e, dept as dp where e.deptName = dp.deptName", // 0
      "select name, empId, deptName from employee where empId > 500", // 1
      "select name from employee where empId = 100", // 2
      "select name, max(empId) as final from employee where empId > 50 group by name", // 3
      "select name, score from employee natural join score", // 4
      "select name, score from employee join score on employee.deptName = score.deptName", // 5
    };
test_class.type: String[]
test_class.var_name: QUERIES
test_class.file: tajo-core/src/test/java/org/apache/tajo/engine/planner/TestLogicalOptimizer.java
test_class.identifier: TestLogicalOptimizer
test_case.body: @Test
    public final void testProjectionPushWithNaturalJoin() throws PlanningException, CloneNotSupportedException {
      // two relations
      Expr expr = sqlAnalyzer.parse(QUERIES[4]);
      LogicalPlan newPlan = planner.createPlan(session, 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.JOIN, projNode.getChild().getType());
      JoinNode joinNode = projNode.getChild();
      assertEquals(NodeType.SCAN, joinNode.getLeftChild().getType());
      assertEquals(NodeType.SCAN, joinNode.getRightChild().getType());
      
      LogicalNode optimized = optimizer.optimize(newPlan);
  
      assertEquals(NodeType.ROOT, optimized.getType());
      root = (LogicalRootNode) optimized;
      TestLogicalNode.testCloneLogicalNode(root);
      assertEquals(NodeType.JOIN, root.getChild().getType());
      joinNode = root.getChild();
      assertEquals(NodeType.SCAN, joinNode.getLeftChild().getType());
      assertEquals(NodeType.SCAN, joinNode.getRightChild().getType());
    }
test_case.class_method_signature: TestLogicalOptimizer.testProjectionPushWithNaturalJoin()
test_case.full_signature: @Test public final void testProjectionPushWithNaturalJoin()
test_case.identifier: testProjectionPushWithNaturalJoin
test_case.invocations: parse createPlan getRoot getRootBlock assertEquals getType testCloneLogicalNode assertEquals getType getChild getChild assertEquals getType getChild getChild assertEquals getType getLeftChild assertEquals getType getRightChild optimize assertEquals getType testCloneLogicalNode assertEquals getType getChild getChild assertEquals getType getLeftChild assertEquals getType getRightChild
test_case.modifiers: @Test public final
test_case.parameters: ()
test_case.return: void
test_case.signature: void testProjectionPushWithNaturalJoin()
focal_class.declarator: rulesBeforeJoinOpt
focal_class.modifier: private
focal_class.original_string: private BasicQueryRewriteEngine rulesBeforeJoinOpt;
focal_class.type: BasicQueryRewriteEngine
focal_class.var_name: rulesBeforeJoinOpt
focal_class.declarator: rulesAfterToJoinOpt
focal_class.modifier: private
focal_class.original_string: private BasicQueryRewriteEngine rulesAfterToJoinOpt;
focal_class.type: BasicQueryRewriteEngine
focal_class.var_name: rulesAfterToJoinOpt
focal_class.declarator: joinOrderAlgorithm = new GreedyHeuristicJoinOrderAlgorithm()
focal_class.modifier: private
focal_class.original_string: private JoinOrderAlgorithm joinOrderAlgorithm = new GreedyHeuristicJoinOrderAlgorithm();
focal_class.type: JoinOrderAlgorithm
focal_class.var_name: joinOrderAlgorithm
focal_class.file: tajo-core/src/main/java/org/apache/tajo/engine/planner/LogicalOptimizer.java
focal_class.identifier: LogicalOptimizer
focal_class.class_method_signature: LogicalOptimizer.LogicalOptimizer(TajoConf systemConf)
focal_class.full_signature: public  LogicalOptimizer(TajoConf systemConf)
focal_class.identifier: LogicalOptimizer
focal_class.modifiers: public
focal_class.parameters: (TajoConf systemConf)
focal_class.signature:  LogicalOptimizer(TajoConf systemConf)
focal_class.class_method_signature: LogicalOptimizer.optimize(LogicalPlan plan)
focal_class.full_signature: public LogicalNode optimize(LogicalPlan plan)
focal_class.identifier: optimize
focal_class.modifiers: public
focal_class.parameters: (LogicalPlan plan)
focal_class.return: LogicalNode
focal_class.signature: LogicalNode optimize(LogicalPlan plan)
focal_class.class_method_signature: LogicalOptimizer.optimizeJoinOrder(LogicalPlan plan, String blockName)
focal_class.full_signature: private void optimizeJoinOrder(LogicalPlan plan, String blockName)
focal_class.identifier: optimizeJoinOrder
focal_class.modifiers: private
focal_class.parameters: (LogicalPlan plan, String blockName)
focal_class.return: void
focal_class.signature: void optimizeJoinOrder(LogicalPlan plan, String blockName)
focal_method.body: 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();
    }
focal_method.class_method_signature: LogicalOptimizer.optimize(LogicalPlan plan)
focal_method.full_signature: public LogicalNode optimize(LogicalPlan plan)
focal_method.identifier: optimize
focal_method.invocations: rewrite getQueryBlockGraph getName getRootBlock hasNext optimizeJoinOrder nextBlock rewrite getRoot getRootBlock
focal_method.modifiers: public
focal_method.parameters: (LogicalPlan plan)
focal_method.return: LogicalNode
focal_method.signature: LogicalNode optimize(LogicalPlan plan)