当前位置: 首页>>代码示例>>Java>>正文


Java EvalType类代码示例

本文整理汇总了Java中org.apache.tajo.engine.eval.EvalType的典型用法代码示例。如果您正苦于以下问题:Java EvalType类的具体用法?Java EvalType怎么用?Java EvalType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EvalType类属于org.apache.tajo.engine.eval包,在下文中一共展示了EvalType类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserialize

import org.apache.tajo.engine.eval.EvalType; //导入依赖的package包/类
@Override
public EvalNode deserialize(JsonElement json, Type type,
                            JsonDeserializationContext ctx) throws JsonParseException {
  JsonObject jsonObject = json.getAsJsonObject();
  String nodeName = jsonObject.get("type").getAsString();
  Class clazz = EvalType.valueOf(nodeName).getBaseClass();
  return ctx.deserialize(jsonObject.get("body"), clazz);
}
 
开发者ID:gruter,项目名称:tajo-cdh,代码行数:9,代码来源:EvalNodeAdapter.java

示例2: testInnerJoinPlan

import org.apache.tajo.engine.eval.EvalType; //导入依赖的package包/类
@Test
public final void testInnerJoinPlan() throws PlanningException {
  // two relations
  Expr expr = sqlAnalyzer.parse(JOINS[1]);
  LogicalPlan plan = planner.createPlan(expr);
  LogicalNode root = plan.getRootBlock().getRoot();
  testJsonSerDerObject(root);
  assertSchema(expectedJoinSchema, root.getOutSchema());

  assertEquals(NodeType.ROOT, root.getType());
  assertEquals(NodeType.PROJECTION, ((LogicalRootNode)root).getChild().getType());
  ProjectionNode proj = ((LogicalRootNode)root).getChild();
  assertEquals(NodeType.JOIN, proj.getChild().getType());
  JoinNode join = proj.getChild();
  assertEquals(JoinType.INNER, join.getJoinType());
  assertEquals(NodeType.SCAN, join.getRightChild().getType());
  ScanNode scan = join.getRightChild();
  assertEquals("score", scan.getTableName());

  assertEquals(NodeType.JOIN, join.getLeftChild().getType());
  join = join.getLeftChild();
  assertEquals(JoinType.INNER, join.getJoinType());
  assertEquals(NodeType.SCAN, join.getLeftChild().getType());
  ScanNode outer = join.getLeftChild();
  assertEquals("employee", outer.getTableName());
  assertEquals(NodeType.SCAN, join.getRightChild().getType());
  ScanNode inner = join.getRightChild();
  assertEquals("dept", inner.getTableName());
  assertTrue(join.hasJoinQual());
  assertEquals(EvalType.EQUAL, join.getJoinQual().getType());
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:32,代码来源:TestLogicalPlanner.java

示例3: testOuterJoinPlan

import org.apache.tajo.engine.eval.EvalType; //导入依赖的package包/类
@Test
public final void testOuterJoinPlan() throws PlanningException {
  // two relations
  Expr expr = sqlAnalyzer.parse(JOINS[2]);
  LogicalNode plan = planner.createPlan(expr).getRootBlock().getRoot();
  testJsonSerDerObject(plan);
  assertSchema(expectedJoinSchema, plan.getOutSchema());

  assertEquals(NodeType.ROOT, plan.getType());
  LogicalRootNode root = (LogicalRootNode) plan;
  assertEquals(NodeType.PROJECTION, root.getChild().getType());
  ProjectionNode proj = root.getChild();
  assertEquals(NodeType.JOIN, proj.getChild().getType());
  JoinNode join = proj.getChild();
  assertEquals(JoinType.RIGHT_OUTER, join.getJoinType());
  assertEquals(NodeType.SCAN, join.getRightChild().getType());
  ScanNode scan = join.getRightChild();
  assertEquals("score", scan.getTableName());

  assertEquals(NodeType.JOIN, join.getLeftChild().getType());
  join = join.getLeftChild();
  assertEquals(JoinType.LEFT_OUTER, join.getJoinType());
  assertEquals(NodeType.SCAN, join.getLeftChild().getType());
  ScanNode outer = join.getLeftChild();
  assertEquals("employee", outer.getTableName());
  assertEquals(NodeType.SCAN, join.getRightChild().getType());
  ScanNode inner = join.getRightChild();
  assertEquals("dept", inner.getTableName());
  assertTrue(join.hasJoinQual());
  assertEquals(EvalType.EQUAL, join.getJoinQual().getType());
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:32,代码来源:TestLogicalPlanner.java

示例4: visitProjection

import org.apache.tajo.engine.eval.EvalType; //导入依赖的package包/类
@Override
public LogicalNode visitProjection(PreprocessContext ctx, Stack<Expr> stack, Projection expr) throws PlanningException {
  // If Non-from statement, it immediately returns.
  if (!expr.hasChild()) {
    return ctx.plan.createNode(EvalExprNode.class);
  }

  stack.push(expr); // <--- push
  LogicalNode child = visit(ctx, stack, expr.getChild());

  // Resolve the asterisk expression
  if (hasAsterisk(expr)) {
    List<NamedExpr> rewrittenTargets = TUtil.newList();
    for (NamedExpr originTarget : expr.getNamedExprs()) {
      if (originTarget.getExpr().getType() == OpType.Asterisk) {
        // rewrite targets
        rewrittenTargets.addAll(resolveAsterisk(ctx, (QualifiedAsteriskExpr) originTarget.getExpr()));
      } else {
        rewrittenTargets.add(originTarget);
      }
    }
    expr.setNamedExprs(rewrittenTargets.toArray(new NamedExpr[rewrittenTargets.size()]));
  }

  NamedExpr[] projectTargetExprs = expr.getNamedExprs();

  Target [] targets;
  targets = new Target[projectTargetExprs.length];

  for (int i = 0; i < expr.getNamedExprs().length; i++) {
    NamedExpr namedExpr = expr.getNamedExprs()[i];
    EvalNode evalNode = annotator.createEvalNode(ctx.plan, ctx.currentBlock, namedExpr.getExpr());

    if (namedExpr.hasAlias()) {
      targets[i] = new Target(evalNode, namedExpr.getAlias());
    } else if (evalNode.getType() == EvalType.FIELD) {
      targets[i] = new Target((FieldEval) evalNode);
    } else {
      String generatedName = ctx.plan.generateUniqueColumnName(namedExpr.getExpr());
      targets[i] = new Target(evalNode, generatedName);
      namedExpr.setAlias(generatedName);
    }
  }
  stack.pop(); // <--- Pop

  ProjectionNode projectionNode = ctx.plan.createNode(ProjectionNode.class);
  projectionNode.setInSchema(child.getOutSchema());
  projectionNode.setOutSchema(PlannerUtil.targetToSchema(targets));
  return projectionNode;
}
 
开发者ID:apache,项目名称:incubator-tajo,代码行数:51,代码来源:LogicalPlanPreprocessor.java


注:本文中的org.apache.tajo.engine.eval.EvalType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。