private MutableCalc(MutableRel input, RexProgram program) { super(MutableRelType.CALC, program.getOutputRowType(), input); this.program = program; }
private MutableCalc(MutableRel input, RexProgram program) { super(MutableRelType.CALC, program.getOutputRowType(), input); this.program = program; }
public JdbcCalc(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RexProgram program) { super(cluster, traitSet, input); assert getConvention() instanceof JdbcConvention; this.program = program; this.rowType = program.getOutputRowType(); }
public JdbcCalc(RelOptCluster cluster, RelTraitSet traitSet, RelNode input, RexProgram program) { super(cluster, traitSet, input); assert getConvention() instanceof JdbcConvention; this.program = program; this.rowType = program.getOutputRowType(); }
/** * Creates a Calc. * * @param cluster Cluster * @param traits Traits * @param child Input relation * @param program Calc program */ protected Calc( RelOptCluster cluster, RelTraitSet traits, RelNode child, RexProgram program) { super(cluster, traits, child); this.rowType = program.getOutputRowType(); this.program = program; assert isValid(Litmus.THROW, null); }
/** * Creates a Calc. * * @param cluster Cluster * @param traits Traits * @param child Input relation * @param program Calc program */ protected Calc( RelOptCluster cluster, RelTraitSet traits, RelNode child, RexProgram program) { super(cluster, traits, child); this.rowType = program.getOutputRowType(); this.program = program; assert isValid(Litmus.THROW, null); }
public RexProgram copyOf(RexProgram program) { return new RexProgram( copyOf(program.getInputRowType()), copyRexNodes(program.getExprList()), Lists.transform(program.getProjectList(), COPY_REX_LOCAL_REF), (RexLocalRef) copyOf(program.getCondition()), copyOf(program.getOutputRowType()) ); }
final RelDataType outputRowType = topProgram.getOutputRowType(); for (Pair<RexLocalRef, String> pair : Pair.zip(projectRefList, outputRowType.getFieldNames(), true)) { assert mergedProg.getOutputRowType() == topProgram.getOutputRowType(); return mergedProg;
final RelDataType outputRowType = topProgram.getOutputRowType(); for (Pair<RexLocalRef, String> pair : Pair.zip(projectRefList, outputRowType.getFieldNames(), true)) { assert mergedProg.getOutputRowType() == topProgram.getOutputRowType(); return mergedProg;
final RexLocalRef conditionRef = program.getCondition(); final List<RexNode> exprs = program.getExprList(); final RelDataType outputRowType = program.getOutputRowType(); return create( rexBuilder,
final RexLocalRef conditionRef = program.getCondition(); final List<RexNode> exprs = program.getExprList(); final RelDataType outputRowType = program.getOutputRowType(); return create( rexBuilder,
bottomCalc.getProgram(), topCalc.getCluster().getRexBuilder()); assert mergedProgram.getOutputRowType() == topProgram.getOutputRowType(); final Calc newCalc = topCalc.copy(
bottomCalc.getProgram(), topCalc.getCluster().getRexBuilder()); assert mergedProgram.getOutputRowType() == topProgram.getOutputRowType(); final Calc newCalc = topCalc.copy(
builder.addProject( list.get(index).getIndex(), program.getOutputRowType().getFieldNames().get(k++));
builder.addProject( list.get(index).getIndex(), program.getOutputRowType().getFieldNames().get(k++));
final RelDataType outputRowType; if (level == (levelCount - 1)) { outputRowType = program.getOutputRowType(); projectExprOrdinals = new int[projectRefList.size()]; for (int i = 0; i < projectExprOrdinals.length; i++) {
public RelNode accept(RexShuttle shuttle) { List<RexNode> oldExprs = program.getExprList(); List<RexNode> exprs = shuttle.apply(oldExprs); List<RexLocalRef> oldProjects = program.getProjectList(); List<RexLocalRef> projects = shuttle.apply(oldProjects); RexLocalRef oldCondition = program.getCondition(); RexNode condition; if (oldCondition != null) { condition = shuttle.apply(oldCondition); assert condition instanceof RexLocalRef : "Invalid condition after rewrite. Expected RexLocalRef, got " + condition; } else { condition = null; } if (exprs == oldExprs && projects == oldProjects && condition == oldCondition) { return this; } return copy(traitSet, getInput(), new RexProgram(program.getInputRowType(), exprs, projects, (RexLocalRef) condition, program.getOutputRowType())); } }
public RelNode accept(RexShuttle shuttle) { List<RexNode> oldExprs = program.getExprList(); List<RexNode> exprs = shuttle.apply(oldExprs); List<RexLocalRef> oldProjects = program.getProjectList(); List<RexLocalRef> projects = shuttle.apply(oldProjects); RexLocalRef oldCondition = program.getCondition(); RexNode condition; if (oldCondition != null) { condition = shuttle.apply(oldCondition); assert condition instanceof RexLocalRef : "Invalid condition after rewrite. Expected RexLocalRef, got " + condition; } else { condition = null; } if (exprs == oldExprs && projects == oldProjects && condition == oldCondition) { return this; } return copy(traitSet, getInput(), new RexProgram(program.getInputRowType(), exprs, projects, (RexLocalRef) condition, program.getOutputRowType())); } }
public void onMatch(RelOptRuleCall call) { LogicalCalc calc = call.rel(0); // Expand decimals in every expression in this program. If no // expression changes, don't apply the rule. final RexProgram program = calc.getProgram(); if (!RexUtil.requiresDecimalExpansion(program, true)) { return; } final RexBuilder rexBuilder = calc.getCluster().getRexBuilder(); final RexShuttle shuttle = new DecimalShuttle(rexBuilder); RexProgramBuilder programBuilder = RexProgramBuilder.create( rexBuilder, calc.getInput().getRowType(), program.getExprList(), program.getProjectList(), program.getCondition(), program.getOutputRowType(), shuttle, true); final RexProgram newProgram = programBuilder.getProgram(); LogicalCalc newCalc = LogicalCalc.create(calc.getInput(), newProgram); call.transformTo(newCalc); }
public void onMatch(RelOptRuleCall call) { LogicalCalc calc = call.rel(0); // Expand decimals in every expression in this program. If no // expression changes, don't apply the rule. final RexProgram program = calc.getProgram(); if (!RexUtil.requiresDecimalExpansion(program, true)) { return; } final RexBuilder rexBuilder = calc.getCluster().getRexBuilder(); final RexShuttle shuttle = new DecimalShuttle(rexBuilder); RexProgramBuilder programBuilder = RexProgramBuilder.create( rexBuilder, calc.getInput().getRowType(), program.getExprList(), program.getProjectList(), program.getCondition(), program.getOutputRowType(), shuttle, true); final RexProgram newProgram = programBuilder.getProgram(); LogicalCalc newCalc = LogicalCalc.create(calc.getInput(), newProgram); call.transformTo(newCalc); }