Program: 87835
Project: 87835
Buggy source:
/** 
 * Private utility method that generates a candidate Match node, given fixed shipping strategies and a fixed local strategy.
 * @param target The list to put the alternatives in.
 * @param preds1 The predecessor node for the first input.
 * @param preds2 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 ls The local strategy.
 * @param outGp The global properties of the data that goes to the user function.
 * @param outLp The local properties of the data that goes to the user function.
 * @param estimator The cost estimator.
 */
private void createMatchAlternative(List<OptimizerNode> target,List<OptimizerNode> preds1,List<OptimizerNode> preds2,ShipStrategy ss1,ShipStrategy ss2,LocalStrategy ls,Order order,boolean grouped,LocalProperties outLpp,CostEstimator estimator){
  GlobalProperties gp1;
  GlobalProperties gp2;
  if (preds1.size() == 1) {
    gp1=PactConnection.getGlobalPropertiesAfterConnection(preds1.get(0),this,ss1);
  }
 else {
    gp1=new GlobalProperties();
  }
  if (preds2.size() == 1) {
    gp2=PactConnection.getGlobalPropertiesAfterConnection(preds2.get(0),this,ss2);
  }
 else {
    gp2=new GlobalProperties();
  }
  int[] keyPositions1=null;
  int[] keyPositions2=null;
  if (ss1 == ShipStrategy.FORWARD && ss2 == ShipStrategy.PARTITION_HASH) {
    keyPositions2=this.input1.get(0).getPartitionedFields();
  }
  if (ss2 == ShipStrategy.FORWARD && ss1 == ShipStrategy.PARTITION_HASH) {
    keyPositions1=this.input2.get(0).getPartitionedFields();
  }
  LocalProperties outLp=outLpp;
  GlobalProperties outGp=new GlobalProperties();
  outGp.setPartitioning(gp1.getPartitioning(),gp1.getPartitionedFields());
  outGp.setOrdering(gp1.getOrdering());
  if (outLpp == null) {
    int[] keyColumns=getPactContract().getKeyColumnNumbers(0);
    outLp=new LocalProperties();
    if (order != Order.NONE) {
      Ordering ordering=new Ordering();
      for (      int keyColumn : keyColumns) {
        ordering.appendOrdering(keyColumn,order);
      }
      outLp.setOrdering(ordering);
    }
 else {
      outLp.setOrdering(null);
    }
    outLp.setGrouped(grouped,new FieldSet(keyColumns));
  }
  MatchNode n=new MatchNode(this,preds1,preds2,this.input1,this.input2,outGp,outLp);
  for (  PactConnection c : n.input1) {
    c.setShipStrategy(ss1);
    c.setPartitionedFields(keyPositions1);
  }
  for (  PactConnection c : n.input2) {
    c.setShipStrategy(ss2);
    c.setPartitionedFields(keyPositions2);
  }
  n.setLocalStrategy(ls);
  n.getGlobalProperties().filterByNodesConstantSet(this,0);
  n.getLocalProperties().filterByNodesConstantSet(this,0);
  estimator.costOperator(n);
  target.add(n);
  outGp=new GlobalProperties();
  outGp.setPartitioning(gp2.getPartitioning(),gp2.getPartitionedFields());
  outGp.setOrdering(gp2.getOrdering());
  if (outLpp == null) {
    int[] keyColumns=getPactContract().getKeyColumnNumbers(1);
    outLp=new LocalProperties();
    if (order != Order.NONE) {
      Ordering ordering=new Ordering();
      for (      int keyColumn : keyColumns) {
        ordering.appendOrdering(keyColumn,order);
      }
      outLp.setOrdering(ordering);
    }
 else {
      outLp.setOrdering(null);
    }
    outLp.setGrouped(grouped,new FieldSet(keyColumns));
  }
  n=new MatchNode(this,preds1,preds2,input1,input2,outGp,outLp);
  for (  PactConnection c : n.input1) {
    c.setShipStrategy(ss1);
    c.setPartitionedFields(keyPositions1);
  }
  for (  PactConnection c : n.input2) {
    c.setShipStrategy(ss2);
    c.setPartitionedFields(keyPositions2);
  }
  n.setLocalStrategy(ls);
  n.getGlobalProperties().filterByNodesConstantSet(this,1);
  n.getLocalProperties().filterByNodesConstantSet(this,1);
  estimator.costOperator(n);
  target.add(n);
}

Fixed version (ground truth):
/** 
 * Private utility method that generates a candidate Match node, given fixed shipping strategies and a fixed local strategy.
 * @param target The list to put the alternatives in.
 * @param preds1 The predecessor node for the first input.
 * @param preds2 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 ls The local strategy.
 * @param outGp The global properties of the data that goes to the user function.
 * @param outLp The local properties of the data that goes to the user function.
 * @param estimator The cost estimator.
 */
private void createMatchAlternative(List<OptimizerNode> target,List<OptimizerNode> preds1,List<OptimizerNode> preds2,ShipStrategy ss1,ShipStrategy ss2,LocalStrategy ls,Order order,boolean grouped,LocalProperties outLpp,CostEstimator estimator){
  GlobalProperties gp1;
  GlobalProperties gp2;
  if (preds1.size() == 1) {
    gp1=PactConnection.getGlobalPropertiesAfterConnection(preds1.get(0),this,ss1);
  }
 else {
    gp1=new GlobalProperties();
  }
  if (preds2 != null && preds2.size() == 1) {
    gp2=PactConnection.getGlobalPropertiesAfterConnection(preds2.get(0),this,ss2);
  }
 else {
    gp2=new GlobalProperties();
  }
  int[] keyPositions1=null;
  int[] keyPositions2=null;
  if (ss1 == ShipStrategy.FORWARD && ss2 == ShipStrategy.PARTITION_HASH) {
    keyPositions2=this.input1.get(0).getPartitionedFields();
  }
  if (ss2 == ShipStrategy.FORWARD && ss1 == ShipStrategy.PARTITION_HASH) {
    keyPositions1=this.input2.get(0).getPartitionedFields();
  }
  LocalProperties outLp=outLpp;
  GlobalProperties outGp=new GlobalProperties();
  outGp.setPartitioning(gp1.getPartitioning(),gp1.getPartitionedFields());
  outGp.setOrdering(gp1.getOrdering());
  if (outLpp == null) {
    int[] keyColumns=getPactContract().getKeyColumnNumbers(0);
    outLp=new LocalProperties();
    if (order != Order.NONE) {
      Ordering ordering=new Ordering();
      for (      int keyColumn : keyColumns) {
        ordering.appendOrdering(keyColumn,order);
      }
      outLp.setOrdering(ordering);
    }
 else {
      outLp.setOrdering(null);
    }
    outLp.setGrouped(grouped,new FieldSet(keyColumns));
  }
  MatchNode n=new MatchNode(this,preds1,preds2,this.input1,this.input2,outGp,outLp);
  for (  PactConnection c : n.input1) {
    c.setShipStrategy(ss1);
    c.setPartitionedFields(keyPositions1);
  }
  for (  PactConnection c : n.input2) {
    c.setShipStrategy(ss2);
    c.setPartitionedFields(keyPositions2);
  }
  n.setLocalStrategy(ls);
  n.getGlobalProperties().filterByNodesConstantSet(this,0);
  n.getLocalProperties().filterByNodesConstantSet(this,0);
  estimator.costOperator(n);
  target.add(n);
  outGp=new GlobalProperties();
  outGp.setPartitioning(gp2.getPartitioning(),gp2.getPartitionedFields());
  outGp.setOrdering(gp2.getOrdering());
  if (outLpp == null) {
    int[] keyColumns=getPactContract().getKeyColumnNumbers(1);
    outLp=new LocalProperties();
    if (order != Order.NONE) {
      Ordering ordering=new Ordering();
      for (      int keyColumn : keyColumns) {
        ordering.appendOrdering(keyColumn,order);
      }
      outLp.setOrdering(ordering);
    }
 else {
      outLp.setOrdering(null);
    }
    outLp.setGrouped(grouped,new FieldSet(keyColumns));
  }
  n=new MatchNode(this,preds1,preds2,input1,input2,outGp,outLp);
  for (  PactConnection c : n.input1) {
    c.setShipStrategy(ss1);
    c.setPartitionedFields(keyPositions1);
  }
  for (  PactConnection c : n.input2) {
    c.setShipStrategy(ss2);
    c.setPartitionedFields(keyPositions2);
  }
  n.setLocalStrategy(ls);
  n.getGlobalProperties().filterByNodesConstantSet(this,1);
  n.getLocalProperties().filterByNodesConstantSet(this,1);
  estimator.costOperator(n);
  target.add(n);
}