Program: 32064
Project: 32064
Buggy source:
@Override public Tuple exec(Tuple input) throws IOException {
  if (input == null || input.size() < 2) {
    return null;
  }
  Integer columnId=(Integer)input.get(0);
  DataBag databag=(DataBag)input.get(1);
  ColumnConfig columnConfig=this.columnConfigList.get(columnId);
  List<Integer> negativeBin=columnConfig.getBinCountNeg();
  List<Integer> positiveBin=columnConfig.getBinCountPos();
  List<Double> expected=new ArrayList<Double>(negativeBin.size());
  for (int i=0; i < columnConfig.getBinCountNeg().size(); i++) {
    if (columnConfig.getTotalCount() == 0) {
      expected.add(0D);
    }
 else {
      expected.add(((double)negativeBin.get(i) + (double)positiveBin.get(i)) / columnConfig.getTotalCount());
    }
  }
  Iterator<Tuple> iter=databag.iterator();
  Double psi=0D;
  while (iter.hasNext()) {
    Tuple tuple=iter.next();
    if (tuple != null && tuple.size() != 0) {
      String subBinStr=(String)tuple.get(1);
      String[] subBinArr=StringUtils.split(subBinStr,CalculateStatsUDF.CATEGORY_VAL_SEPARATOR);
      List<Double> subCounter=new ArrayList<Double>();
      Double total=0D;
      for (      String binningElement : subBinArr) {
        Double dVal=Double.valueOf(binningElement);
        subCounter.add(dVal);
        total+=dVal;
      }
      int i=0;
      for (      Double sub : subCounter) {
        if (total == 0) {
          continue;
        }
 else         if (expected.get(i) == 0) {
          continue;
        }
 else {
          double logNum=(sub / total) / expected.get(i);
          if (logNum <= 0) {
            continue;
          }
 else {
            psi=psi + ((sub / total - expected.get(i)) * Math.log((sub / total) / expected.get(i)));
          }
        }
        i++;
      }
    }
  }
  Tuple output=TupleFactory.getInstance().newTuple(2);
  output.set(0,columnId);
  output.set(1,psi);
  return output;
}

Fixed version (ground truth):
@Override public Tuple exec(Tuple input) throws IOException {
  if (input == null || input.size() < 2) {
    return null;
  }
  Integer columnId=(Integer)input.get(0);
  DataBag databag=(DataBag)input.get(1);
  ColumnConfig columnConfig=this.columnConfigList.get(columnId);
  List<Integer> negativeBin=columnConfig.getBinCountNeg();
  List<Integer> positiveBin=columnConfig.getBinCountPos();
  List<Double> expected=new ArrayList<Double>(negativeBin.size());
  for (int i=0; i < columnConfig.getBinCountNeg().size(); i++) {
    if (columnConfig.getTotalCount() == 0) {
      expected.add(0D);
    }
 else {
      expected.add(((double)negativeBin.get(i) + (double)positiveBin.get(i)) / columnConfig.getTotalCount());
    }
  }
  Iterator<Tuple> iter=databag.iterator();
  Double psi=0D;
  List<String> unitStats=new ArrayList<String>();
  while (iter.hasNext()) {
    Tuple tuple=iter.next();
    if (tuple != null && tuple.size() != 0) {
      String subBinStr=(String)tuple.get(1);
      String[] subBinArr=StringUtils.split(subBinStr,CalculateStatsUDF.CATEGORY_VAL_SEPARATOR);
      List<Double> subCounter=new ArrayList<Double>();
      Double total=0D;
      for (      String binningElement : subBinArr) {
        Double dVal=Double.valueOf(binningElement);
        subCounter.add(dVal);
        total+=dVal;
      }
      int i=0;
      for (      Double sub : subCounter) {
        if (total == 0) {
          continue;
        }
 else         if (expected.get(i) == 0) {
          continue;
        }
 else {
          double logNum=(sub / total) / expected.get(i);
          if (logNum <= 0) {
            continue;
          }
 else {
            psi=psi + ((sub / total - expected.get(i)) * Math.log((sub / total) / expected.get(i)));
          }
        }
        i++;
      }
      unitStats.add((String)tuple.get(2));
    }
  }
  Collections.sort(unitStats);
  Tuple output=TupleFactory.getInstance().newTuple(3);
  output.set(0,columnId);
  output.set(1,psi);
  output.set(2,StringUtils.join(unitStats,CalculateStatsUDF.CATEGORY_VAL_SEPARATOR));
  return output;
}