本文整理汇总了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);
}
示例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());
}
示例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());
}
示例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;
}