/** * Returns whether a relational expression can be implemented solely in a * given {@link RelType}. * * @param rel Calculation relational expression * @param relTypeName Name of a {@link RelType} * * @return Whether relational expression can be implemented */ protected boolean canImplement(CalcRel rel, String relTypeName) { for (int i = 0; i < relTypes.length; i++) { RelType relType = relTypes[i]; if (relType.name.equals(relTypeName)) { return relType.canImplement(rel.getProgram()); } } throw Util.newInternal("unknown reltype " + relTypeName); }
/** * Returns whether a relational expression can be implemented solely in a * given {@link RelType}. * * @param rel Calculation relational expression * @param relTypeName Name of a {@link RelType} * @return Whether relational expression can be implemented */ protected boolean canImplement(CalcRel rel, String relTypeName) { for (RelType relType : relTypes) { if (relType.name.equals(relTypeName)) { return relType.canImplement(rel.getProgram()); } } throw Util.newInternal("unknown reltype " + relTypeName); }
builder.addIdentity(); builder.addCondition(condition); final RexProgram program = builder.getProgram(); return new CalcRel( cluster,
@Override public RelNode convert( RelNode rel ) { // stolen from JavaRules.EnumerableAggregateRule final CalcRel calc = (CalcRel) rel; final RelNode convertedChild = convert( calc.getChild(), calc.getTraitSet().replace( Cascading.CONVENTION ) ); if( convertedChild == null ) return null; // We can't convert the child, so we can't convert rel. // If there's a multiset, let FarragoMultisetSplitter work on it // first. if( RexMultisetUtil.containsMultiset( calc.getProgram() ) ) return null; return new CascadingCalcRel( rel.getCluster(), rel.getTraitSet(), convertedChild, rel.getRowType(), calc.getProgram(), Collections.<RelCollation>emptyList() ); } }
public RelNode convert(RelNode rel) { final CalcRel calc = (CalcRel) rel; // If there's a multiset, let FarragoMultisetSplitter work on it // first. if (RexMultisetUtil.containsMultiset(calc.getProgram())) { return null; } return new JdbcCalcRel(rel.getCluster(), rel.getTraitSet().replace(out), convert(calc.getChild(), calc.getTraitSet().replace(out)), calc.getProgram(), ProjectRelBase.Flags.BOXED); } }
public RelNode convert(RelNode rel) { final CalcRel calc = (CalcRel) rel; // If there's a multiset, let FarragoMultisetSplitter work on it // first. if (RexMultisetUtil.containsMultiset(calc.getProgram())) { return null; } return new JdbcCalcRel(rel.getCluster(), rel.getTraitSet().replace(out), convert(calc.getChild(), calc.getTraitSet().replace(out)), calc.getProgram(), ProjectRelBase.Flags.Boxed); } }
public void onMatch(RelOptRuleCall call) { CalcRel calc = call.rel(0); if (!RexOver.containsOver(calc.getProgram())) { return; } CalcRelSplitter transform = new WindowedAggRelSplitter(calc); RelNode newRel = transform.execute(); call.transformTo(newRel); }
/** * Constructs a CalcRelSplitter. * * @param calc CalcRel to split * @param relTypes Array of rel types, e.g. {Java, Fennel}. Must be * distinct. */ CalcRelSplitter(CalcRel calc, RelType [] relTypes) { for (int i = 0; i < relTypes.length; i++) { assert relTypes[i] != null; for (int j = 0; j < i; j++) { assert relTypes[i] != relTypes[j] : "Rel types must be distinct"; } } this.program = calc.getProgram(); this.cluster = calc.getCluster(); this.traits = calc.getTraitSet(); this.typeFactory = calc.getCluster().getTypeFactory(); this.child = calc.getChild(); this.relTypes = relTypes; }
RexProgram program = topCalc.getProgram(); if (RexOver.containsOver(program)) { return; topCalc.getProgram(), bottomCalc.getProgram(), topCalc.getCluster().getRexBuilder()); final CalcRel newCalc =
public void onMatch(RelOptRuleCall call) { CalcRel calc = call.rel(0); RexProgram program = calc.getProgram(); if (!program.isTrivial()) { return; } RelNode child = calc.getInput(0); child = call.getPlanner().register(child, calc); call.transformTo( convert( child, calc.getTraitSet())); } }
public void onMatch(RelOptRuleCall call) { CalcRel calc = call.rel(0); RexProgram program = calc.getProgram(); if (!program.isTrivial()) { return; } RelNode child = calc.getInput(0); child = call.getPlanner().register(child, calc); call.transformTo( convert( child, calc.getTraitSet())); } }
if (calc.getProgram().containsAggs()) { return; progBuilder.addCondition(filter.getCondition()); RexProgram topProgram = progBuilder.getProgram(); RexProgram bottomProgram = calc.getProgram();
if (calc.getProgram().containsAggs()) { return; progBuilder.addCondition(filter.getCondition()); RexProgram topProgram = progBuilder.getProgram(); RexProgram bottomProgram = calc.getProgram();
public void onMatch(RelOptRuleCall call) { CalcRel calc = call.rel(0); RexProgram program = calc.getProgram(); final List<RexNode> exprList = program.getExprList();
public RelNode convert(RelNode rel) { final CalcRel calc = (CalcRel) rel; // If there's a multiset, let FarragoMultisetSplitter work on it // first. final RexProgram program = calc.getProgram(); if (RexMultisetUtil.containsMultiset(program) || program.containsAggs()) { return null; } return new EnumerableCalcRel( rel.getCluster(), rel.getTraitSet().replace(EnumerableConvention.INSTANCE), convert( calc.getChild(), calc.getChild().getTraitSet() .replace(EnumerableConvention.INSTANCE)), program, ProjectRelBase.Flags.Boxed); } }
final RexProgram program = rel.getProgram(); for (RexNode expr : program.getExprList()) { programBuilder.registerInput(
public RelNode convert(RelNode rel) { final CalcRel calc = (CalcRel) rel; // If there's a multiset, let FarragoMultisetSplitter work on it // first. final RexProgram program = calc.getProgram(); if (B && RexMultisetUtil.containsMultiset(program) || program.containsAggs()) { return null; } return new EnumerableCalcRel( rel.getCluster(), rel.getTraitSet().replace(EnumerableConvention.INSTANCE), convert( calc.getChild(), calc.getChild().getTraitSet() .replace(EnumerableConvention.INSTANCE)), calc.getRowType(), program, calc.getCollationList()); } }
final RexProgram program = rel.getProgram(); for (RexNode expr : program.getExprList()) { programBuilder.registerInput(
final RexProgram program = calcRel.getProgram(); if (!RexUtil.requiresDecimalExpansion(program, true)) { return;
final RexProgram program = calcRel.getProgram(); if (!RexUtil.requiresDecimalExpansion(program, true)) { return;