public void markAsEvaluated(Target target) { int refId = nameToIdBiMap.get(target.getCanonicalName()); EvalNode evalNode = target.getEvalTree(); if (!idToNamesMap.containsKey(refId)) { throw new RuntimeException("No such eval: " + evalNode); } evaluationStateMap.put(refId, true); }
public void markAsEvaluated(Target target) { int refId = nameToIdBiMap.get(target.getCanonicalName()); EvalNode evalNode = target.getEvalTree(); if (!idToNamesMap.containsKey(refId)) { throw new RuntimeException("No such eval: " + evalNode); } evaluationStateMap.put(refId, true); }
@Override public String apply(@Nullable Target t) { StringBuilder sb = new StringBuilder(sqlExprGen.generate(t.getEvalTree())); if (t.hasAlias()) { sb.append(" AS ").append(t.getAlias()); } return sb.toString(); } });
public String addExpr(Target target) throws DuplicateColumnException { String reference = targetListMgr.add(target); addNecessaryReferences(target.getEvalTree()); return reference; }
public String addExpr(Target target) throws DuplicateColumnException { String reference = targetListMgr.add(target); addNecessaryReferences(target.getEvalTree()); return reference; }
@Override public Column apply(@javax.annotation.Nullable Target target) { return new Column(target.hasAlias() ? target.getAlias() : target.getEvalTree().getName(), getDomainByExpr(inputSchema, target.getEvalTree())); } }).build();
public static Schema getSchemaByTargets(Schema inputSchema, Target[] targets) { Schema schema = new Schema(); for (Target target : targets) { schema.addColumn( target.hasAlias() ? target.getAlias() : target.getEvalTree().getName(), getDomainByExpr(inputSchema, target.getEvalTree())); } return schema; }
@Override public LogicalNode visitProjection(Context state, LogicalPlan plan, LogicalPlan.QueryBlock block, ProjectionNode node, Stack<LogicalNode> stack) throws TajoException { super.visitProjection(state, plan, block, node, stack); for (Target target : node.getTargets()) { ExprsVerifier.verify(state.state, node, target.getEvalTree()); } verifyProjectableOutputSchema(state, node); return node; }
public static void prohibitNestedRecordProjection(Projectable projectable) throws TajoException { for (Target t : projectable.getTargets()) { if (t.getEvalTree().getValueType().getType() == TajoDataTypes.Type.RECORD) { throw new NotImplementedException("record field projection"); } } }
@Override public void init() throws IOException { super.init(); progress = 0.0f; for (Target target : plan.getTargets()) { target.getEvalTree().bind(context.getEvalContext(), inSchema); } }
@Override public void init() throws IOException { super.init(); progress = 0.0f; for (Target target : plan.getTargets()) { target.getEvalTree().bind(context.getEvalContext(), inSchema); } }
public static void prohibitNestedRecordProjection(Projectable projectable) throws TajoException { for (Target t : projectable.getTargets()) { if (t.getEvalTree().getValueType().isStruct()) { throw new NotImplementedException("record field projection"); } } }
private static void compileProjectableNode(CompilationContext context, Schema schema, Projectable node) { List<Target> targets; if (node.hasTargets()) { targets = node.getTargets(); } else { targets = PlannerUtil.schemaToTargets(node.getOutSchema()); } for (Target target : targets) { compileIfAbsent(context, schema, target.getEvalTree()); } }
public static void verifyIfTargetsCanBeEvaluated(Schema baseSchema, Projectable projectable) throws TajoException { for (Target target : projectable.getTargets()) { Set<Column> columns = EvalTreeUtil.findUniqueColumns(target.getEvalTree()); for (Column c : columns) { if (!baseSchema.contains(c)) { throwCannotEvaluateException(projectable, c.getQualifiedName()); } } } }
@Override public LogicalNode visitTableSubQuery(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, TableSubQueryNode node, Stack<LogicalNode> stack) throws TajoException { super.visitTableSubQuery(context, plan, block, node, stack); if (node.hasTargets()) { for (Target target : node.getTargets()) { ExprsVerifier.verify(context.state, node, target.getEvalTree()); } } verifyProjectableOutputSchema(context, node); return node; }
public static void verifyIfTargetsCanBeEvaluated(Schema baseSchema, Projectable projectable) throws TajoException { for (Target target : projectable.getTargets()) { Set<Column> columns = EvalTreeUtil.findUniqueColumns(target.getEvalTree()); for (Column c : columns) { if (!baseSchema.contains(c)) { throwCannotEvaluateException(projectable, c.getQualifiedName()); } } } }
@Override public LogicalNode visitTableSubQuery(Context context, LogicalPlan plan, LogicalPlan.QueryBlock block, TableSubQueryNode node, Stack<LogicalNode> stack) throws TajoException { super.visitTableSubQuery(context, plan, block, node, stack); if (node.hasTargets()) { for (Target target : node.getTargets()) { ExprsVerifier.verify(context.state, node, target.getEvalTree()); } } verifyProjectableOutputSchema(context, node); return node; }
private static void compileProjectableNode(CompilationContext context, Schema schema, Projectable node) { Target[] targets; if (node.hasTargets()) { targets = node.getTargets(); } else { targets = PlannerUtil.schemaToTargets(node.getOutSchema()); } for (Target target : targets) { compileIfAbsent(context, schema, target.getEvalTree()); } }
public static PlanProto.Target convertTarget(Target target) { PlanProto.Target.Builder targetBuilder = PlanProto.Target.newBuilder(); targetBuilder.setExpr(EvalNodeSerializer.serialize((EvalNode) target.getEvalTree())); if (target.hasAlias()) { targetBuilder.setAlias(target.getAlias()); } return targetBuilder.build(); }
public static PlanProto.Target convertTarget(Target target) { PlanProto.Target.Builder targetBuilder = PlanProto.Target.newBuilder(); targetBuilder.setExpr(EvalNodeSerializer.serialize(target.getEvalTree())); if (target.hasAlias()) { targetBuilder.setAlias(target.getAlias()); } return targetBuilder.build(); }