Program: 56113
Project: 56113
Buggy source:
/** 
 * Private utility method that generates the alternative CoGroup nodes, given fixed shipping strategies for the inputs.
 * @param target The list to put the alternatives in.
 * @param pred1 The predecessor node for the first input.
 * @param pred2 The predecessor node for the second input.
 * @param ss1 The shipping strategy for the first input.
 * @param ss2 The shipping strategy for the second input.
 * @param estimator The cost estimator.
 */
private void createCoGroupAlternative(List<CoGroupNode> target,OptimizerNode pred1,OptimizerNode pred2,ShipStrategy ss1,ShipStrategy ss2,CostEstimator estimator){
  GlobalProperties gp1=PactConnection.getGlobalPropertiesAfterConnection(pred1,ss1);
  LocalProperties lp1=PactConnection.getLocalPropertiesAfterConnection(pred1,ss1);
  LocalProperties lp2=PactConnection.getLocalPropertiesAfterConnection(pred2,ss2);
  GlobalProperties outGp=new GlobalProperties();
  outGp.setPartitioning(gp1.getPartitioning());
  LocalProperties outLp=new LocalProperties();
  outLp.setKeyOrder(lp1.getKeyOrder().isOrdered() && lp1.getKeyOrder() == lp2.getKeyOrder() ? lp1.getKeyOrder() : Order.NONE);
  outLp.setKeysGrouped(outLp.getKeyOrder().isOrdered());
  CoGroupNode n=new CoGroupNode(this,pred1,pred2,input1,input2,outGp,outLp);
  n.input1.setShipStrategy(ss1);
  n.input2.setShipStrategy(ss2);
  if (outLp.getKeyOrder().isOrdered()) {
    n.setLocalStrategy(LocalStrategy.NONE);
  }
 else {
    n.setLocalStrategy(LocalStrategy.SORTMERGE);
    n.getLocalProperties().setKeyOrder(Order.ASCENDING);
    n.getLocalProperties().setKeysGrouped(true);
  }
  n.getGlobalProperties().getPreservedAfterContract(getOutputContract());
  n.getLocalProperties().getPreservedAfterContract(getOutputContract());
  estimator.costOperator(n);
  target.add(n);
}

Fixed version (ground truth):
/** 
 * Private utility method that generates the alternative CoGroup nodes, given fixed shipping strategies for the inputs.
 * @param target The list to put the alternatives in.
 * @param pred1 The predecessor node for the first input.
 * @param pred2 The predecessor node for the second input.
 * @param ss1 The shipping strategy for the first input.
 * @param ss2 The shipping strategy for the second input.
 * @param estimator The cost estimator.
 */
private void createCoGroupAlternative(List<CoGroupNode> target,OptimizerNode pred1,OptimizerNode pred2,ShipStrategy ss1,ShipStrategy ss2,CostEstimator estimator){
  GlobalProperties gp1=PactConnection.getGlobalPropertiesAfterConnection(pred1,this,ss1);
  LocalProperties lp1=PactConnection.getLocalPropertiesAfterConnection(pred1,this,ss1);
  LocalProperties lp2=PactConnection.getLocalPropertiesAfterConnection(pred2,this,ss2);
  GlobalProperties outGp=new GlobalProperties();
  outGp.setPartitioning(gp1.getPartitioning());
  LocalProperties outLp=new LocalProperties();
  outLp.setKeyOrder(lp1.getKeyOrder().isOrdered() && lp1.getKeyOrder() == lp2.getKeyOrder() ? lp1.getKeyOrder() : Order.NONE);
  outLp.setKeysGrouped(outLp.getKeyOrder().isOrdered());
  CoGroupNode n=new CoGroupNode(this,pred1,pred2,input1,input2,outGp,outLp);
  n.input1.setShipStrategy(ss1);
  n.input2.setShipStrategy(ss2);
  if (outLp.getKeyOrder().isOrdered()) {
    n.setLocalStrategy(LocalStrategy.NONE);
  }
 else {
    n.setLocalStrategy(LocalStrategy.SORTMERGE);
    n.getLocalProperties().setKeyOrder(Order.ASCENDING);
    n.getLocalProperties().setKeysGrouped(true);
  }
  n.getGlobalProperties().getPreservedAfterContract(getOutputContract());
  n.getLocalProperties().getPreservedAfterContract(getOutputContract());
  estimator.costOperator(n);
  target.add(n);
}