Package org.apache.tajo.engine.planner

Examples of org.apache.tajo.engine.planner.LogicalPlan


            "r_name, p_type, p_size " +
            "from region join nation on n_regionkey = r_regionkey and r_name = 'AMERICA' " +
            "join supplier on s_nationkey = n_nationkey " +
            "join partsupp on s_suppkey = ps_suppkey " +
            "join part on p_partkey = ps_partkey and p_type like '%BRASS' and p_size = 15");
    LogicalPlan logicalPlan = logicalPlanner.createPlan(context);
    optimizer.optimize(logicalPlan);
    QueryContext queryContext = new QueryContext();
    MasterPlan plan = new MasterPlan(LocalTajoTestingUtility.newQueryId(), queryContext, logicalPlan);
    planner.build(plan);
View Full Code Here


        StorageManagerFactory.getStorageManager(util.getConfiguration()));
  }

  private MasterPlan buildPlan(String sql) throws PlanningException, IOException {
    Expr expr = sqlAnalyzer.parse(sql);
    LogicalPlan plan = planner.createPlan(expr);
    optimizer.optimize(plan);
    QueryContext context = new QueryContext();
    MasterPlan masterPlan = new MasterPlan(LocalTajoTestingUtility.newQueryId(), context, plan);
    globalPlanner.build(masterPlan);
    return masterPlan;
View Full Code Here

      "select name from people where NOT (20 > 30)", // 5
  };

  public static Target[] getRawTargets(String query) throws PlanningException {
    Expr expr = analyzer.parse(query);
    LogicalPlan plan = planner.createPlan(expr);
    Target [] targets = plan.getRootBlock().getTargetListManager().getUnresolvedTargets();
    for (Target t : targets) {
      assertJsonSerDer(t.getEvalTree());
    }
    return targets;
  }
View Full Code Here

    return targets;
  }

  public static EvalNode getRootSelection(String query) {
    Expr block = analyzer.parse(query);
    LogicalPlan plan = null;
    try {
      plan = planner.createPlan(block);
    } catch (PlanningException e) {
      e.printStackTrace();
    }
    EvalNode qual = plan.getRootBlock().getSelectionNode().getQual();
    assertJsonSerDer(qual);
    return qual;
  }
View Full Code Here

    Fragment[] frags = StorageManager.splitNG(conf, "employee", meta, tablePath, Integer.MAX_VALUE);
    Path workDir = CommonTestingUtil.getTestDir("target/test-data/testEqual");
    TaskAttemptContext ctx = new TaskAttemptContext(conf,
        LocalTajoTestingUtility.newQueryUnitAttemptId(), new Fragment[] { frags[0] }, workDir);
    Expr expr = analyzer.parse(QUERY);
    LogicalPlan plan = planner.createPlan(expr);
    LogicalNode rootNode = optimizer.optimize(plan);

    TmpPlanner phyPlanner = new TmpPlanner(conf, sm);
    PhysicalExec exec = phyPlanner.createPlan(ctx, rootNode);
View Full Code Here

    assertEquals(expr, fromJson);
  }

  private static Target[] getRawTargets(String query) throws PlanningException {
    Expr expr = analyzer.parse(query);
    LogicalPlan plan = planner.createPlan(expr);
    Target [] targets = plan.getRootBlock().getTargetListManager().getUnresolvedTargets();
    if (targets == null) {
      throw new PlanningException("Wrong query statement or query plan: " + query);
    }
    for (Target t : targets) {
      assertJsonSerDer(t.getEvalTree());
View Full Code Here

    util.shutdownCatalogCluster();
  }

  public static Target [] getRawTargets(String query) {
    Expr expr = analyzer.parse(query);
    LogicalPlan plan = null;
    try {
      plan = planner.createPlan(expr);
    } catch (PlanningException e) {
      e.printStackTrace();
    }
    if (plan.getRootBlock().getRoot().getType() == NodeType.EXPRS) {
      return ((EvalExprNode)plan.getRootBlock().getRoot()).getExprs();
    } else {
      return plan.getRootBlock().getTargetListManager().getUnresolvedTargets();
    }
  }
View Full Code Here

    }
  }

  public static EvalNode getRootSelection(String query) {
    Expr block = analyzer.parse(query);
    LogicalPlan plan = null;
    try {
      plan = planner.createPlan(block);
    } catch (PlanningException e) {
      e.printStackTrace();
    }
    return plan.getRootBlock().getSelectionNode().getQual();
  }
View Full Code Here

  }
 
  @Test
  public final void testGetContainExprs() throws CloneNotSupportedException, PlanningException {
    Expr expr = analyzer.parse(QUERIES[1]);
    LogicalPlan plan = planner.createPlan(expr);
    Target [] targets = plan.getRootBlock().getTargetListManager().getUnresolvedTargets();
    Column col1 = new Column("people.score", TajoDataTypes.Type.INT4);
    Collection<EvalNode> exprs =
        EvalTreeUtil.getContainExpr(targets[0].getEvalTree(), col1);
    EvalNode node = exprs.iterator().next();
    assertEquals(EvalType.LTH, node.getType());
View Full Code Here

    nodeCtx = node.newContext();
    node.eval(nodeCtx, null, null);
    assertTrue(7.0d == node.terminate(nodeCtx).asFloat8());

    Expr expr = analyzer.parse(QUERIES[1]);
    LogicalPlan plan = planner.createPlan(expr);
    targets = plan.getRootBlock().getTargetListManager().getUnresolvedTargets();
    Column col1 = new Column("people.score", TajoDataTypes.Type.INT4);
    Collection<EvalNode> exprs =
        EvalTreeUtil.getContainExpr(targets[0].getEvalTree(), col1);
    node = exprs.iterator().next();
  }
View Full Code Here

TOP

Related Classes of org.apache.tajo.engine.planner.LogicalPlan

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.