Search in sources :

Example 1 with StreamPhysicalPythonGroupAggregate

use of org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalPythonGroupAggregate in project flink by apache.

the class StreamPhysicalPythonGroupAggregateRule method convert.

@Override
public RelNode convert(RelNode rel) {
    FlinkLogicalAggregate agg = (FlinkLogicalAggregate) rel;
    FlinkRelDistribution requiredDistribution;
    if (agg.getGroupCount() != 0) {
        requiredDistribution = FlinkRelDistribution.hash(agg.getGroupSet().asList(), true);
    } else {
        requiredDistribution = FlinkRelDistribution.SINGLETON();
    }
    RelTraitSet requiredTraitSet = rel.getCluster().getPlanner().emptyTraitSet().replace(requiredDistribution).replace(FlinkConventions.STREAM_PHYSICAL());
    RelTraitSet providedTraitSet = rel.getTraitSet().replace(FlinkConventions.STREAM_PHYSICAL());
    RelNode newInput = RelOptRule.convert(agg.getInput(), requiredTraitSet);
    return new StreamPhysicalPythonGroupAggregate(rel.getCluster(), providedTraitSet, newInput, rel.getRowType(), agg.getGroupSet().toArray(), JavaScalaConversionUtil.toScala(agg.getAggCallList()));
}
Also used : FlinkRelDistribution(org.apache.flink.table.planner.plan.trait.FlinkRelDistribution) RelNode(org.apache.calcite.rel.RelNode) FlinkLogicalAggregate(org.apache.flink.table.planner.plan.nodes.logical.FlinkLogicalAggregate) RelTraitSet(org.apache.calcite.plan.RelTraitSet) StreamPhysicalPythonGroupAggregate(org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalPythonGroupAggregate)

Aggregations

RelTraitSet (org.apache.calcite.plan.RelTraitSet)1 RelNode (org.apache.calcite.rel.RelNode)1 FlinkLogicalAggregate (org.apache.flink.table.planner.plan.nodes.logical.FlinkLogicalAggregate)1 StreamPhysicalPythonGroupAggregate (org.apache.flink.table.planner.plan.nodes.physical.stream.StreamPhysicalPythonGroupAggregate)1 FlinkRelDistribution (org.apache.flink.table.planner.plan.trait.FlinkRelDistribution)1