Search in sources :

Example 1 with PlanUnwrappingReduceGroupOperator

use of org.apache.flink.api.java.operators.translation.PlanUnwrappingReduceGroupOperator in project flink by apache.

the class JavaApiPostPass method traverseChannel.

private void traverseChannel(Channel channel) {
    PlanNode source = channel.getSource();
    Operator<?> javaOp = source.getProgramOperator();
    // if (!(javaOp instanceof BulkIteration) && !(javaOp instanceof JavaPlanNode)) {
    // throw new RuntimeException("Wrong operator type found in post pass: " + javaOp);
    // }
    TypeInformation<?> type = javaOp.getOperatorInfo().getOutputType();
    if (javaOp instanceof GroupReduceOperatorBase && (source.getDriverStrategy() == DriverStrategy.SORTED_GROUP_COMBINE || source.getDriverStrategy() == DriverStrategy.ALL_GROUP_REDUCE_COMBINE)) {
        GroupReduceOperatorBase<?, ?, ?> groupNode = (GroupReduceOperatorBase<?, ?, ?>) javaOp;
        type = groupNode.getInput().getOperatorInfo().getOutputType();
    } else if (javaOp instanceof PlanUnwrappingReduceGroupOperator && source.getDriverStrategy().equals(DriverStrategy.SORTED_GROUP_COMBINE)) {
        PlanUnwrappingReduceGroupOperator<?, ?, ?> groupNode = (PlanUnwrappingReduceGroupOperator<?, ?, ?>) javaOp;
        type = groupNode.getInput().getOperatorInfo().getOutputType();
    }
    // the serializer always exists
    channel.setSerializer(createSerializer(type));
    // parameterize the ship strategy
    if (channel.getShipStrategy().requiresComparator()) {
        channel.setShipStrategyComparator(createComparator(type, channel.getShipStrategyKeys(), getSortOrders(channel.getShipStrategyKeys(), channel.getShipStrategySortOrder())));
    }
    // parameterize the local strategy
    if (channel.getLocalStrategy().requiresComparator()) {
        channel.setLocalStrategyComparator(createComparator(type, channel.getLocalStrategyKeys(), getSortOrders(channel.getLocalStrategyKeys(), channel.getLocalStrategySortOrder())));
    }
    // descend to the channel's source
    traverse(channel.getSource());
}
Also used : WorksetIterationPlanNode(org.apache.flink.optimizer.plan.WorksetIterationPlanNode) SolutionSetPlanNode(org.apache.flink.optimizer.plan.SolutionSetPlanNode) SourcePlanNode(org.apache.flink.optimizer.plan.SourcePlanNode) BulkIterationPlanNode(org.apache.flink.optimizer.plan.BulkIterationPlanNode) BulkPartialSolutionPlanNode(org.apache.flink.optimizer.plan.BulkPartialSolutionPlanNode) WorksetPlanNode(org.apache.flink.optimizer.plan.WorksetPlanNode) DualInputPlanNode(org.apache.flink.optimizer.plan.DualInputPlanNode) PlanNode(org.apache.flink.optimizer.plan.PlanNode) SinkPlanNode(org.apache.flink.optimizer.plan.SinkPlanNode) SingleInputPlanNode(org.apache.flink.optimizer.plan.SingleInputPlanNode) NAryUnionPlanNode(org.apache.flink.optimizer.plan.NAryUnionPlanNode) PlanUnwrappingReduceGroupOperator(org.apache.flink.api.java.operators.translation.PlanUnwrappingReduceGroupOperator) GroupReduceOperatorBase(org.apache.flink.api.common.operators.base.GroupReduceOperatorBase)

Aggregations

GroupReduceOperatorBase (org.apache.flink.api.common.operators.base.GroupReduceOperatorBase)1 PlanUnwrappingReduceGroupOperator (org.apache.flink.api.java.operators.translation.PlanUnwrappingReduceGroupOperator)1 BulkIterationPlanNode (org.apache.flink.optimizer.plan.BulkIterationPlanNode)1 BulkPartialSolutionPlanNode (org.apache.flink.optimizer.plan.BulkPartialSolutionPlanNode)1 DualInputPlanNode (org.apache.flink.optimizer.plan.DualInputPlanNode)1 NAryUnionPlanNode (org.apache.flink.optimizer.plan.NAryUnionPlanNode)1 PlanNode (org.apache.flink.optimizer.plan.PlanNode)1 SingleInputPlanNode (org.apache.flink.optimizer.plan.SingleInputPlanNode)1 SinkPlanNode (org.apache.flink.optimizer.plan.SinkPlanNode)1 SolutionSetPlanNode (org.apache.flink.optimizer.plan.SolutionSetPlanNode)1 SourcePlanNode (org.apache.flink.optimizer.plan.SourcePlanNode)1 WorksetIterationPlanNode (org.apache.flink.optimizer.plan.WorksetIterationPlanNode)1 WorksetPlanNode (org.apache.flink.optimizer.plan.WorksetPlanNode)1