Program: 55364
Project: 55364
Buggy source:
@Override protected void computeValidPlanAlternatives(List<? extends OptimizerNode> altSubPlans1,List<? extends OptimizerNode> altSubPlans2,CostEstimator estimator,List<OptimizerNode> outputPlans){
  for (  OptimizerNode subPlan1 : altSubPlans1) {
    for (    OptimizerNode subPlan2 : altSubPlans2) {
      if (!areBranchCompatible(subPlan1,subPlan2)) {
        continue;
      }
      ShipStrategy ss1=this.input1.getShipStrategy();
      ShipStrategy ss2=this.input2.getShipStrategy();
      GlobalProperties gp1;
      GlobalProperties gp2;
      if (ss1 == ShipStrategy.NONE) {
        gp1=subPlan1.getGlobalProperties();
        if (ss2 == ShipStrategy.NONE) {
          gp2=subPlan2.getGlobalProperties();
          if (partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning().isComputablyPartitioned()) {
            ss1=ShipStrategy.FORWARD;
          }
          if (partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning().isComputablyPartitioned()) {
            if (!partitioningIsOnRightFields(gp1,0) || !gp1.getPartitioning().isComputablyPartitioned()) {
              ss2=ShipStrategy.FORWARD;
            }
 else {
              if (gp1.getPartitioning() == gp2.getPartitioning() && partitioningIsOnSameSubkey(gp1.getPartitionedFields(),gp2.getPartitionedFields())) {
                ss2=ShipStrategy.FORWARD;
              }
 else {
                if (gp1.getPartitioning() == PartitionProperty.HASH_PARTITIONED && gp2.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
                  createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.FORWARD,ShipStrategy.PARTITION_HASH,estimator);
                  createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_RANGE,ShipStrategy.FORWARD,estimator);
                }
 else                 if (gp1.getPartitioning() == PartitionProperty.RANGE_PARTITIONED && gp2.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
                  createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.FORWARD,ShipStrategy.PARTITION_RANGE,estimator);
                  createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ShipStrategy.FORWARD,estimator);
                }
                continue;
              }
            }
          }
          if (ss1 == ShipStrategy.FORWARD) {
            if (ss2 == ShipStrategy.FORWARD) {
              createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ss2,estimator);
              if (gp1.getPartitioning() != PartitionProperty.RANGE_PARTITIONED) {
              }
            }
 else {
              if (partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
                createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ShipStrategy.PARTITION_HASH,estimator);
              }
 else               if (partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
                createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ShipStrategy.PARTITION_RANGE,estimator);
                createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ShipStrategy.PARTITION_HASH,estimator);
              }
 else {
                throw new CompilerException("String_Node_Str" + getPactContract().getName() + "String_Node_Str");
              }
            }
          }
 else           if (ss2 == ShipStrategy.FORWARD) {
            if (partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
              createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ss2,estimator);
            }
 else             if (partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
              createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_RANGE,ss2,estimator);
              createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ShipStrategy.PARTITION_HASH,estimator);
            }
 else {
              throw new CompilerException("String_Node_Str" + getPactContract().getName() + "String_Node_Str");
            }
          }
 else {
            createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ShipStrategy.PARTITION_HASH,estimator);
          }
        }
 else {
          gp2=PactConnection.getGlobalPropertiesAfterConnection(subPlan1,this,ss2);
switch (ss2) {
case FORWARD:
            if (partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning().isPartitioned()) {
              if (gp2.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
                ss1=ShipStrategy.PARTITION_HASH;
              }
 else               if (gp2.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
                ss1=ShipStrategy.PARTITION_RANGE;
              }
 else {
                throw new CompilerException();
              }
            }
 else {
              continue;
            }
          break;
case PARTITION_HASH:
        ss1=(partitioningIsOnSameSubkey(gp1.getPartitionedFields(),this.keySet2) && gp1.getPartitioning() == PartitionProperty.HASH_PARTITIONED) ? ShipStrategy.FORWARD : ShipStrategy.PARTITION_HASH;
      break;
case PARTITION_RANGE:
    ss1=(partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) ? ShipStrategy.FORWARD : ShipStrategy.PARTITION_RANGE;
  break;
default :
throw new CompilerException("String_Node_Str" + ss2.name() + "String_Node_Str"+ getPactContract().getName()+ "String_Node_Str");
}
createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ss2,estimator);
}
}
 else if (ss2 == ShipStrategy.NONE) {
gp1=PactConnection.getGlobalPropertiesAfterConnection(subPlan1,this,ss1);
gp2=subPlan2.getGlobalProperties();
switch (ss1) {
case FORWARD:
if (partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning().isPartitioned()) {
if (gp1.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
ss2=ShipStrategy.PARTITION_HASH;
}
 else if (gp1.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
ss2=ShipStrategy.PARTITION_RANGE;
}
 else {
throw new CompilerException();
}
}
 else {
continue;
}
break;
case PARTITION_HASH:
ss2=(partitioningIsOnSameSubkey(this.keySet1,gp2.getPartitionedFields()) && gp2.getPartitioning() == PartitionProperty.HASH_PARTITIONED) ? ShipStrategy.FORWARD : ShipStrategy.PARTITION_HASH;
break;
case PARTITION_RANGE:
ss2=(partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) ? ShipStrategy.FORWARD : ShipStrategy.PARTITION_RANGE;
break;
default :
throw new CompilerException("String_Node_Str" + ss1.name() + "String_Node_Str"+ getPactContract().getName()+ "String_Node_Str");
}
createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ss2,estimator);
}
 else {
gp1=PactConnection.getGlobalPropertiesAfterConnection(subPlan1,this,ss1);
gp2=PactConnection.getGlobalPropertiesAfterConnection(subPlan2,this,ss2);
if (gp1.getPartitioning().isComputablyPartitioned() && gp1.getPartitioning() == gp2.getPartitioning() && partitioningIsOnSameSubkey(gp1.getPartitionedFields(),gp2.getPartitionedFields())) {
createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ss2,estimator);
}
 else {
continue;
}
}
}
}
}

Fixed version (ground truth):
@Override protected void computeValidPlanAlternatives(List<? extends OptimizerNode> altSubPlans1,List<? extends OptimizerNode> altSubPlans2,CostEstimator estimator,List<OptimizerNode> outputPlans){
  for (  OptimizerNode subPlan1 : altSubPlans1) {
    for (    OptimizerNode subPlan2 : altSubPlans2) {
      if (!areBranchCompatible(subPlan1,subPlan2)) {
        continue;
      }
      ShipStrategy ss1=this.input1.getShipStrategy();
      ShipStrategy ss2=this.input2.getShipStrategy();
      GlobalProperties gp1;
      GlobalProperties gp2;
      if (ss1 == ShipStrategy.NONE) {
        gp1=subPlan1.getGlobalProperties();
        if (ss2 == ShipStrategy.NONE) {
          gp2=subPlan2.getGlobalProperties();
          if (partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning().isComputablyPartitioned()) {
            ss1=ShipStrategy.FORWARD;
          }
          if (partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning().isComputablyPartitioned()) {
            if (!partitioningIsOnRightFields(gp1,0) || !gp1.getPartitioning().isComputablyPartitioned()) {
              ss2=ShipStrategy.FORWARD;
            }
 else {
              if (gp1.getPartitioning() == gp2.getPartitioning() && partitioningIsOnSameSubkey(gp1.getPartitionedFields(),gp2.getPartitionedFields())) {
                ss2=ShipStrategy.FORWARD;
              }
 else {
                if (gp1.getPartitioning() == PartitionProperty.HASH_PARTITIONED && gp2.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
                  createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.FORWARD,ShipStrategy.PARTITION_HASH,estimator);
                  createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_RANGE,ShipStrategy.FORWARD,estimator);
                }
 else                 if (gp1.getPartitioning() == PartitionProperty.RANGE_PARTITIONED && gp2.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
                  createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.FORWARD,ShipStrategy.PARTITION_RANGE,estimator);
                  createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ShipStrategy.FORWARD,estimator);
                }
                continue;
              }
            }
          }
          if (ss1 == ShipStrategy.FORWARD) {
            if (ss2 == ShipStrategy.FORWARD) {
              createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ss2,estimator);
              if (gp1.getPartitioning() != PartitionProperty.RANGE_PARTITIONED) {
              }
            }
 else {
              if (partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
                createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ShipStrategy.PARTITION_HASH,estimator);
              }
 else               if (partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
                createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ShipStrategy.PARTITION_RANGE,estimator);
                createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ShipStrategy.PARTITION_HASH,estimator);
              }
 else {
                throw new CompilerException("String_Node_Str" + getPactContract().getName() + "String_Node_Str");
              }
            }
          }
 else           if (ss2 == ShipStrategy.FORWARD) {
            if (partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
              createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ss2,estimator);
            }
 else             if (partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
              createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_RANGE,ss2,estimator);
              createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ShipStrategy.PARTITION_HASH,estimator);
            }
 else {
              throw new CompilerException("String_Node_Str" + getPactContract().getName() + "String_Node_Str");
            }
          }
 else {
            createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ShipStrategy.PARTITION_HASH,ShipStrategy.PARTITION_HASH,estimator);
          }
        }
 else {
          gp2=PactConnection.getGlobalPropertiesAfterConnection(subPlan2,this,1,ss2);
switch (ss2) {
case FORWARD:
            if (partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning().isPartitioned()) {
              if (gp2.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
                ss1=ShipStrategy.PARTITION_HASH;
              }
 else               if (gp2.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
                ss1=ShipStrategy.PARTITION_RANGE;
              }
 else {
                throw new CompilerException();
              }
            }
 else {
              continue;
            }
          break;
case PARTITION_HASH:
        ss1=(partitioningIsOnSameSubkey(gp1.getPartitionedFields(),this.keySet2) && gp1.getPartitioning() == PartitionProperty.HASH_PARTITIONED) ? ShipStrategy.FORWARD : ShipStrategy.PARTITION_HASH;
      break;
case PARTITION_RANGE:
    ss1=(partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) ? ShipStrategy.FORWARD : ShipStrategy.PARTITION_RANGE;
  break;
default :
throw new CompilerException("String_Node_Str" + ss2.name() + "String_Node_Str"+ getPactContract().getName()+ "String_Node_Str");
}
createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ss2,estimator);
}
}
 else if (ss2 == ShipStrategy.NONE) {
gp1=PactConnection.getGlobalPropertiesAfterConnection(subPlan1,this,0,ss1);
gp2=subPlan2.getGlobalProperties();
switch (ss1) {
case FORWARD:
if (partitioningIsOnRightFields(gp1,0) && gp1.getPartitioning().isPartitioned()) {
if (gp1.getPartitioning() == PartitionProperty.HASH_PARTITIONED) {
ss2=ShipStrategy.PARTITION_HASH;
}
 else if (gp1.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) {
ss2=ShipStrategy.PARTITION_RANGE;
}
 else {
throw new CompilerException();
}
}
 else {
continue;
}
break;
case PARTITION_HASH:
ss2=(partitioningIsOnSameSubkey(this.keySet1,gp2.getPartitionedFields()) && gp2.getPartitioning() == PartitionProperty.HASH_PARTITIONED) ? ShipStrategy.FORWARD : ShipStrategy.PARTITION_HASH;
break;
case PARTITION_RANGE:
ss2=(partitioningIsOnRightFields(gp2,1) && gp2.getPartitioning() == PartitionProperty.RANGE_PARTITIONED) ? ShipStrategy.FORWARD : ShipStrategy.PARTITION_RANGE;
break;
default :
throw new CompilerException("String_Node_Str" + ss1.name() + "String_Node_Str"+ getPactContract().getName()+ "String_Node_Str");
}
createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ss2,estimator);
}
 else {
gp1=PactConnection.getGlobalPropertiesAfterConnection(subPlan1,this,0,ss1);
gp2=PactConnection.getGlobalPropertiesAfterConnection(subPlan2,this,1,ss2);
if (gp1.getPartitioning().isComputablyPartitioned() && gp1.getPartitioning() == gp2.getPartitioning() && partitioningIsOnSameSubkey(gp1.getPartitionedFields(),gp2.getPartitionedFields())) {
createCoGroupAlternative(outputPlans,subPlan1,subPlan2,ss1,ss2,estimator);
}
 else {
continue;
}
}
}
}
}