@Deprecated // to be removed before 2.0 public static RexProgramBuilder create( RexBuilder rexBuilder, final RelDataType inputRowType, final List<RexNode> exprList, final List<? extends RexNode> projectList, final RexNode condition, final RelDataType outputRowType, boolean normalize) { return create(rexBuilder, inputRowType, exprList, projectList, condition, outputRowType, normalize, null); }
@Deprecated // to be removed before 2.0 public static RexProgramBuilder create( RexBuilder rexBuilder, final RelDataType inputRowType, final List<RexNode> exprList, final List<? extends RexNode> projectList, final RexNode condition, final RelDataType outputRowType, boolean normalize) { return create(rexBuilder, inputRowType, exprList, projectList, condition, outputRowType, normalize, null); }
/** * Creates a simplified/normalized copy of this program. * * @param rexBuilder Rex builder * @param simplify Simplifier to simplify (in addition to normalizing), * or null to not simplify * @return Normalized program */ public RexProgram normalize(RexBuilder rexBuilder, RexSimplify simplify) { // Normalize program by creating program builder from the program, then // converting to a program. getProgram does not need to normalize // because the builder was normalized on creation. assert isValid(Litmus.THROW, null); final RexProgramBuilder builder = RexProgramBuilder.create(rexBuilder, inputRowType, exprs, projects, condition, outputRowType, true, simplify); return builder.getProgram(false); }
/** * Creates a simplified/normalized copy of this program. * * @param rexBuilder Rex builder * @param simplify Simplifier to simplify (in addition to normalizing), * or null to not simplify * @return Normalized program */ public RexProgram normalize(RexBuilder rexBuilder, RexSimplify simplify) { // Normalize program by creating program builder from the program, then // converting to a program. getProgram does not need to normalize // because the builder was normalized on creation. assert isValid(Litmus.THROW, null); final RexProgramBuilder builder = RexProgramBuilder.create(rexBuilder, inputRowType, exprs, projects, condition, outputRowType, true, simplify); return builder.getProgram(false); }
return create( rexBuilder, inputRowType,
return create( rexBuilder, inputRowType,
final List<RexNode> exprs = program.getExprList(); final RelDataType outputRowType = program.getOutputRowType(); return create( rexBuilder, inputRowType,
final List<RexNode> exprs = program.getExprList(); final RelDataType outputRowType = program.getOutputRowType(); return create( rexBuilder, inputRowType,
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); }