use of org.apache.calcite.rel.logical.LogicalAggregate in project flink by apache.
the class WrapJsonAggFunctionArgumentsRule method onMatch.
@Override
public void onMatch(RelOptRuleCall call) {
final LogicalAggregate aggregate = call.rel(0);
final AggregateCall aggCall = aggregate.getAggCallList().get(0);
final RelNode aggInput = aggregate.getInput();
final RelBuilder relBuilder = call.builder().push(aggInput);
final List<Integer> affectedArgs = getAffectedArgs(aggCall);
addProjections(aggregate.getCluster(), relBuilder, affectedArgs);
final TargetMapping argsMapping = getAggArgsMapping(aggInput.getRowType().getFieldCount(), affectedArgs);
final AggregateCall newAggregateCall = aggCall.transform(argsMapping);
final LogicalAggregate newAggregate = aggregate.copy(aggregate.getTraitSet(), relBuilder.build(), aggregate.getGroupSet(), aggregate.getGroupSets(), Collections.singletonList(newAggregateCall));
call.transformTo(newAggregate.withHints(Collections.singletonList(MARKER_HINT)));
}
Aggregations