@Override public RelNode convert(RelNode rel) { final Window window = (Window) rel; final RelTraitSet traitSet = window.getTraitSet().replace(OLAPRel.CONVENTION); final RelNode input = window.getInput(); return new OLAPWindowRel(rel.getCluster(), traitSet, convert(input, input.getTraitSet().replace(OLAPRel.CONVENTION)), window.constants, window.getRowType(), window.groups); } }
/** * Presents a view of the {@link RexWinAggCall} list as a list of * {@link AggregateCall}. */ public List<AggregateCall> getAggregateCalls(Window windowRel) { final List<String> fieldNames = Util.skip(windowRel.getRowType().getFieldNames(), windowRel.getInput().getRowType().getFieldCount()); return new AbstractList<AggregateCall>() { public int size() { return aggCalls.size(); } public AggregateCall get(int index) { final RexWinAggCall aggCall = aggCalls.get(index); final SqlAggFunction op = (SqlAggFunction) aggCall.getOperator(); return AggregateCall.create(op, aggCall.distinct, false, getProjectOrdinals(aggCall.getOperands()), -1, aggCall.getType(), fieldNames.get(aggCall.ordinal)); } }; } }
/** * Presents a view of the {@link RexWinAggCall} list as a list of * {@link AggregateCall}. */ public List<AggregateCall> getAggregateCalls(Window windowRel) { final List<String> fieldNames = Util.skip(windowRel.getRowType().getFieldNames(), windowRel.getInput().getRowType().getFieldCount()); return new AbstractList<AggregateCall>() { public int size() { return aggCalls.size(); } public AggregateCall get(int index) { final RexWinAggCall aggCall = aggCalls.get(index); final SqlAggFunction op = (SqlAggFunction) aggCall.getOperator(); return AggregateCall.create(op, aggCall.distinct, false, getProjectOrdinals(aggCall.getOperands()), -1, RelCollations.EMPTY, aggCall.getType(), fieldNames.get(aggCall.ordinal)); } }; } }
@Override public RelNode convert(RelNode rel) { final Window window = (Window) rel; final RelTraitSet traitSet = window.getTraitSet().replace(OLAPRel.CONVENTION); final RelNode input = window.getInput(); return new OLAPWindowRel(rel.getCluster(), traitSet, convert(input, input.getTraitSet().replace(OLAPRel.CONVENTION)), window.constants, window.getRowType(), window.groups); } }
@Override public void onMatch(RelOptRuleCall call) { final Window window = call.rel(0); final RelNode input = call.rel(1); final RelTraitSet traits = window.getTraitSet().plus(Rel.LOGICAL); final RelNode convertedInput = convert(input, traits.simplify()); call.transformTo( new WindowRel( window.getCluster(), traits, convertedInput, window.constants, window.getRowType(), window.groups)); } }
@Override public void onMatch(RelOptRuleCall call) { final Window window = call.rel(0); final RelNode input = call.rel(1); final RelTraitSet traits = window.getTraitSet().plus(DrillRel.DRILL_LOGICAL).simplify(); final RelNode convertedInput = convert(input, traits); call.transformTo( new DrillWindowRel( window.getCluster(), traits, convertedInput, window.constants, window.getRowType(), window.groups)); } }
final Window window = (Window) rel; final MutableRel input = toMutable(window.getInput()); return MutableWindow.of(window.getRowType(), input, window.groups, window.getConstants());
final Window window = (Window) rel; final MutableRel input = toMutable(window.getInput()); return MutableWindow.of(window.getRowType(), input, window.groups, window.getConstants());