Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1553#discussion_r55208210
  
    --- Diff: 
flink-optimizer/src/main/java/org/apache/flink/optimizer/operators/GroupReduceWithCombineProperties.java
 ---
    @@ -126,12 +117,66 @@ public SingleInputPlanNode instantiate(Channel in, 
SingleInputNode node) {
                        }
                        toReducer.setLocalStrategy(LocalStrategy.COMBININGSORT, 
in.getLocalStrategyKeys(),
                                                                                
in.getLocalStrategySortOrder());
    -
                        return new SingleInputPlanNode(node, "Reduce 
("+node.getOperator().getName()+")",
                                                                                
        toReducer, DriverStrategy.SORTED_GROUP_REDUCE, this.keyList);
                }
        }
     
    +   private SingleInputPlanNode injectCombinerBeforPartitioner(Channel in, 
SingleInputNode node) {
    +           // Inject a combiner before the partition node
    +           Channel channelWithPartitionSrc = new Channel(in.getSource());
    +           GroupReduceNode combinerNode = ((GroupReduceNode) 
node).getCombinerUtilityNode();
    +           combinerNode.setParallelism(in.getSource().getParallelism());
    +           if(in.getSource().getInputs().iterator().hasNext()) {
    +                   Channel oldChannelToPartitioner = 
channelWithPartitionSrc.getSource().getInputs().iterator().next();
    +                   Channel toCombiner = new 
Channel(oldChannelToPartitioner.getSource());
    +            // A combiner plan node is created with the channel as input 
that has the partitioner as the target
    +                   toCombiner.setShipStrategy(ShipStrategyType.FORWARD, 
DataExchangeMode.PIPELINED);
    +            SingleInputPlanNode combiner = new 
SingleInputPlanNode(combinerNode, "Combine("+node.getOperator()
    +                .getName()+")", toCombiner, 
DriverStrategy.SORTED_GROUP_COMBINE);
    +            setCombinerProperties(in, oldChannelToPartitioner, combiner);
    +
    +                   Channel toPartitioner = new Channel(combiner);
    +                   // Set the actual partitioner node's strategy key and 
strategy order
    +                   
toPartitioner.setShipStrategy(oldChannelToPartitioner.getShipStrategy(), 
oldChannelToPartitioner.getShipStrategyKeys(),
    +                           
oldChannelToPartitioner.getShipStrategySortOrder(), 
oldChannelToPartitioner.getDataExchangeMode());
    +            // Create the partition single input plan node from the 
existing partition node
    +            PlanNode partitionplanNode = in.getSource().getPlanNode();
    +            SingleInputPlanNode partition = new 
SingleInputPlanNode(in.getSource().getOptimizerNode(), 
partitionplanNode.getNodeName(),
    +                toPartitioner, partitionplanNode.getDriverStrategy());
    +            partition.setCosts(partitionplanNode.getNodeCosts());
    +            
partition.initProperties(partitionplanNode.getGlobalProperties(), 
partitionplanNode.getLocalProperties());
    +            // Create a reducer such that the input of the reducer is the 
partition node
    +            Channel toReducer = new Channel(partition);
    +            toReducer.setShipStrategy(in.getShipStrategy(), 
in.getShipStrategyKeys(),
    +                in.getShipStrategySortOrder(), in.getDataExchangeMode());
    +            return getReducerSingleInputPlanNode(toReducer, node);
    +        } else {
    +            return getReducerSingleInputPlanNode(in, node);
    +        }
    +   }
    +
    +   private void setCombinerProperties(Channel in, Channel 
oldChannelToPartitioner, SingleInputPlanNode combiner) {
    --- End diff --
    
    please use meaningful parameter names for `in` and 
`oldChannelToPartitioner`. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to