use of org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalPythonOverAggregate in project flink by apache.
the class StreamPhysicalPythonOverAggregateRule method convert.
@Override
public RelNode convert(RelNode rel) {
FlinkLogicalOverAggregate logicWindow = (FlinkLogicalOverAggregate) rel;
if (logicWindow.groups.size() > 1) {
throw new TableException("Over Agg: Unsupported use of OVER windows. " + "All aggregates must be computed on the same window. " + "please re-check the over window statement.");
}
ImmutableBitSet keys = logicWindow.groups.get(0).keys;
FlinkRelDistribution requiredDistribution;
if (!keys.isEmpty()) {
requiredDistribution = FlinkRelDistribution.hash(keys.asList(), true);
} else {
requiredDistribution = FlinkRelDistribution.SINGLETON();
}
RelNode input = logicWindow.getInput();
RelTraitSet requiredTraitSet = input.getTraitSet().replace(FlinkConventions.STREAM_PHYSICAL()).replace(requiredDistribution);
RelTraitSet providedTraitSet = rel.getTraitSet().replace(FlinkConventions.STREAM_PHYSICAL());
RelNode newInput = RelOptRule.convert(input, requiredTraitSet);
return new StreamPhysicalPythonOverAggregate(rel.getCluster(), providedTraitSet, newInput, rel.getRowType(), logicWindow);
}
Aggregations