Program: 87562
Project: 87562
Buggy source:
@Override protected void computeValidPlanAlternatives(List<? extends OptimizerNode> altSubPlans,CostEstimator estimator,List<OptimizerNode> outputPlans){
  FieldSet keySet=new FieldSet(getPactContract().getKeyColumnNumbers(0));
  ShipStrategy ss=ShipStrategy.NONE;
  ShipStrategy hintSS=this.inConn.getShipStrategy();
  if (hintSS == ShipStrategy.BROADCAST || hintSS == ShipStrategy.SFR)   return;
 else   ss=hintSS;
  for (  OptimizerNode subPlan : altSubPlans) {
    GlobalProperties gp;
    LocalProperties lp;
    if (ss == ShipStrategy.NONE) {
      gp=subPlan.getGlobalProperties();
      lp=subPlan.getLocalProperties();
      if ((partitioningIsOnRightFields(gp) && gp.getPartitioning().isPartitioned()) || isFieldSetUnique(keySet,0)) {
        ss=ShipStrategy.FORWARD;
      }
 else {
        ss=ShipStrategy.PARTITION_HASH;
      }
      gp=PactConnection.getGlobalPropertiesAfterConnection(subPlan,this,ss);
      lp=PactConnection.getLocalPropertiesAfterConnection(subPlan,this,ss);
    }
 else {
      gp=PactConnection.getGlobalPropertiesAfterConnection(subPlan,this,ss);
      lp=PactConnection.getLocalPropertiesAfterConnection(subPlan,this,ss);
      if (!((partitioningIsOnRightFields(gp) && gp.getPartitioning().isPartitioned()) || isFieldSetUnique(keySet,0))) {
        continue;
      }
    }
    boolean localStrategyNeeded=false;
    if (lp.getOrdering() == null || lp.getOrdering().groupsFieldSet(keySet) == false) {
      localStrategyNeeded=true;
    }
    if (localStrategyNeeded && lp.isGrouped() == true) {
      localStrategyNeeded=!lp.getGroupedFields().equals(keySet);
    }
    if (localStrategyNeeded) {
      localStrategyNeeded=!isFieldSetUnique(keySet,0);
    }
    LocalStrategy ls=getLocalStrategy();
    if (localStrategyNeeded) {
      if (ls != LocalStrategy.NONE) {
        if (ls != LocalStrategy.COMBININGSORT && ls != LocalStrategy.SORT) {
          continue;
        }
      }
 else {
        ls=isCombineable() ? LocalStrategy.COMBININGSORT : LocalStrategy.SORT;
      }
    }
    if (ls == LocalStrategy.COMBININGSORT || ls == LocalStrategy.SORT) {
      Ordering ordering=new Ordering();
      for (      Integer index : keySet) {
        ordering.appendOrdering(index,null,Order.ASCENDING);
      }
      lp.setOrdering(ordering);
      lp.setGrouped(true,keySet);
    }
    OptimizerNode reducePred=subPlan;
    if (isCombineable() && ss != ShipStrategy.FORWARD) {
      OptimizerNode combiner=new CombinerNode(getPactContract(),subPlan,this.combinerReducingFactor);
      combiner.setDegreeOfParallelism(subPlan.getDegreeOfParallelism());
      estimator.costOperator(combiner);
      reducePred=combiner;
    }
    ReduceNode n=new ReduceNode(this,reducePred,this.inConn,gp,lp);
    n.inConn.setShipStrategy(ss);
    n.setLocalStrategy(ls);
    n.getGlobalProperties().filterByNodesConstantSet(this,0);
    n.getLocalProperties().filterByNodesConstantSet(this,0);
    estimator.costOperator(n);
    outputPlans.add(n);
  }
}

Fixed version (ground truth):
@Override protected void computeValidPlanAlternatives(List<? extends OptimizerNode> altSubPlans,CostEstimator estimator,List<OptimizerNode> outputPlans){
  FieldSet keySet=new FieldSet(getPactContract().getKeyColumnNumbers(0));
  ShipStrategy ss=ShipStrategy.NONE;
  ShipStrategy hintSS=this.inConn.getShipStrategy();
  if (hintSS == ShipStrategy.BROADCAST || hintSS == ShipStrategy.SFR)   return;
 else   ss=hintSS;
  for (  OptimizerNode subPlan : altSubPlans) {
    GlobalProperties gp;
    LocalProperties lp;
    if (ss == ShipStrategy.NONE) {
      gp=subPlan.getGlobalProperties();
      lp=subPlan.getLocalProperties();
      if ((partitioningIsOnRightFields(gp) && gp.getPartitioning().isPartitioned()) || isFieldSetUnique(keySet,0)) {
        ss=ShipStrategy.FORWARD;
      }
 else {
        ss=ShipStrategy.PARTITION_HASH;
      }
      gp=PactConnection.getGlobalPropertiesAfterConnection(subPlan,this,0,ss);
      lp=PactConnection.getLocalPropertiesAfterConnection(subPlan,this,ss);
    }
 else {
      gp=PactConnection.getGlobalPropertiesAfterConnection(subPlan,this,0,ss);
      lp=PactConnection.getLocalPropertiesAfterConnection(subPlan,this,ss);
      if (!((partitioningIsOnRightFields(gp) && gp.getPartitioning().isPartitioned()) || isFieldSetUnique(keySet,0))) {
        continue;
      }
    }
    boolean localStrategyNeeded=false;
    if (lp.getOrdering() == null || lp.getOrdering().groupsFieldSet(keySet) == false) {
      localStrategyNeeded=true;
    }
    if (localStrategyNeeded && lp.isGrouped() == true) {
      localStrategyNeeded=!lp.getGroupedFields().equals(keySet);
    }
    if (localStrategyNeeded) {
      localStrategyNeeded=!isFieldSetUnique(keySet,0);
    }
    LocalStrategy ls=getLocalStrategy();
    if (localStrategyNeeded) {
      if (ls != LocalStrategy.NONE) {
        if (ls != LocalStrategy.COMBININGSORT && ls != LocalStrategy.SORT) {
          continue;
        }
      }
 else {
        ls=isCombineable() ? LocalStrategy.COMBININGSORT : LocalStrategy.SORT;
      }
    }
    if (ls == LocalStrategy.COMBININGSORT || ls == LocalStrategy.SORT) {
      Ordering ordering=new Ordering();
      for (      Integer index : keySet) {
        ordering.appendOrdering(index,null,Order.ASCENDING);
      }
      lp.setOrdering(ordering);
      lp.setGrouped(true,keySet);
    }
    OptimizerNode reducePred=subPlan;
    if (isCombineable() && ss != ShipStrategy.FORWARD) {
      OptimizerNode combiner=new CombinerNode(getPactContract(),subPlan,this.combinerReducingFactor);
      combiner.setDegreeOfParallelism(subPlan.getDegreeOfParallelism());
      estimator.costOperator(combiner);
      reducePred=combiner;
    }
    ReduceNode n=new ReduceNode(this,reducePred,this.inConn,gp,lp);
    n.inConn.setShipStrategy(ss);
    n.setLocalStrategy(ls);
    n.getGlobalProperties().filterByNodesConstantSet(this,0);
    n.getLocalProperties().filterByNodesConstantSet(this,0);
    estimator.costOperator(n);
    outputPlans.add(n);
  }
}