Program: 31937
Project: 31937
Buggy source:
/** 
 * Mapper implementation includes: 1. Invalid data purifier 2. Column statistics update.
 */
@Override protected void map(LongWritable key,Text value,Context context) throws IOException, InterruptedException {
  String valueStr=value.toString();
  if (valueStr == null || valueStr.length() == 0 || valueStr.trim().length() == 0) {
    LOG.warn("String_Node_Str");
    return;
  }
  context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
  if (!this.dataPurifier.isFilterOut(valueStr)) {
    context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
    return;
  }
  String[] units=CommonUtils.split(valueStr,this.dataSetDelimiter);
  String tag=units[this.tagColumnNum];
  if (modelConfig.isRegression()) {
    if (tag == null || (!posTags.contains(tag) && !negTags.contains(tag))) {
      context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
      return;
    }
  }
 else {
    if (tag == null || (!tags.contains(tag))) {
      context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
      return;
    }
  }
  Double weight=1.0;
  try {
    weight=(this.weightedColumnNum == -1 ? 1.0d : Double.valueOf(units[this.weightedColumnNum]));
  }
 catch (  Exception e) {
    weightExceptions+=1;
    if (weightExceptions > 500) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  boolean isMissingValue=false;
  boolean isInvalidValue=false;
  for (int i=0; i < units.length; i++) {
    ColumnConfig columnConfig=this.columnConfigList.get(i);
    if (columnConfig.isMeta() || columnConfig.isTarget()) {
      continue;
    }
    isMissingValue=false;
    isInvalidValue=false;
    BinningInfoWritable binningInfoWritable=this.columnBinningInfo.get(i);
    if (binningInfoWritable == null) {
      continue;
    }
    binningInfoWritable.setTotalCount(binningInfoWritable.getTotalCount() + 1L);
    if (columnConfig.isCategorical()) {
      int lastBinIndex=binningInfoWritable.getBinCategories().size();
      int binNum=0;
      if (units[i] == null || missingOrInvalidValues.contains(units[i].toLowerCase())) {
        isMissingValue=true;
      }
 else {
        String str=StringUtils.trim(units[i]);
        binNum=quickLocateCategoricalBin(this.categoricalBinMap.get(i),str);
        if (binNum < 0) {
          isInvalidValue=true;
        }
      }
      if (isInvalidValue || isMissingValue) {
        binningInfoWritable.setMissingCount(binningInfoWritable.getMissingCount() + 1L);
        binNum=lastBinIndex;
      }
      if (modelConfig.isRegression()) {
        if (posTags.contains(tag)) {
          binningInfoWritable.getBinCountPos()[binNum]+=1L;
          binningInfoWritable.getBinWeightPos()[binNum]+=weight;
        }
 else         if (negTags.contains(tag)) {
          binningInfoWritable.getBinCountNeg()[binNum]+=1L;
          binningInfoWritable.getBinWeightNeg()[binNum]+=weight;
        }
      }
 else {
        binningInfoWritable.getBinCountPos()[binNum]+=1L;
        binningInfoWritable.getBinWeightPos()[binNum]+=weight;
      }
    }
 else     if (columnConfig.isNumerical()) {
      int lastBinIndex=binningInfoWritable.getBinBoundaries().size();
      double douVal=0.0;
      if (units[i] == null || units[i].length() == 0) {
        isMissingValue=true;
      }
 else {
        try {
          douVal=Double.parseDouble(units[i].trim());
        }
 catch (        Exception e) {
          isInvalidValue=true;
        }
      }
      if (Double.compare(douVal,modelConfig.getNumericalValueThreshold()) > 0) {
        isInvalidValue=true;
      }
      if (isInvalidValue || isMissingValue) {
        binningInfoWritable.setMissingCount(binningInfoWritable.getMissingCount() + 1L);
        if (modelConfig.isRegression()) {
          if (posTags.contains(tag)) {
            binningInfoWritable.getBinCountPos()[lastBinIndex]+=1L;
            binningInfoWritable.getBinWeightPos()[lastBinIndex]+=weight;
          }
 else           if (negTags.contains(tag)) {
            binningInfoWritable.getBinCountNeg()[lastBinIndex]+=1L;
            binningInfoWritable.getBinWeightNeg()[lastBinIndex]+=weight;
          }
        }
      }
 else {
        int binNum=getBinNum(binningInfoWritable.getBinBoundaries(),units[i]);
        if (binNum == -1) {
          throw new RuntimeException("String_Node_Str");
        }
        if (modelConfig.isRegression()) {
          if (posTags.contains(tag)) {
            binningInfoWritable.getBinCountPos()[binNum]+=1L;
            binningInfoWritable.getBinWeightPos()[binNum]+=weight;
          }
 else           if (negTags.contains(tag)) {
            binningInfoWritable.getBinCountNeg()[binNum]+=1L;
            binningInfoWritable.getBinWeightNeg()[binNum]+=weight;
          }
        }
        binningInfoWritable.setSum(binningInfoWritable.getSum() + douVal);
        double squaredVal=douVal * douVal;
        binningInfoWritable.setSquaredSum(binningInfoWritable.getSquaredSum() + squaredVal);
        binningInfoWritable.setTripleSum(binningInfoWritable.getTripleSum() + squaredVal * douVal);
        binningInfoWritable.setQuarticSum(binningInfoWritable.getQuarticSum() + squaredVal * squaredVal);
        if (Double.compare(binningInfoWritable.getMax(),douVal) < 0) {
          binningInfoWritable.setMax(douVal);
        }
        if (Double.compare(binningInfoWritable.getMin(),douVal) > 0) {
          binningInfoWritable.setMin(douVal);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Mapper implementation includes: 1. Invalid data purifier 2. Column statistics update.
 */
@Override protected void map(LongWritable key,Text value,Context context) throws IOException, InterruptedException {
  String valueStr=value.toString();
  if (valueStr == null || valueStr.length() == 0 || valueStr.trim().length() == 0) {
    LOG.warn("String_Node_Str");
    return;
  }
  context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
  if (!this.dataPurifier.isFilterOut(valueStr)) {
    context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
    return;
  }
  String[] units=CommonUtils.split(valueStr,this.dataSetDelimiter);
  String tag=units[this.tagColumnNum];
  if (modelConfig.isRegression()) {
    if (tag == null || (!posTags.contains(tag) && !negTags.contains(tag))) {
      context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
      return;
    }
  }
 else {
    if (tag == null || (!tags.contains(tag))) {
      context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
      return;
    }
  }
  Double weight=1.0;
  try {
    weight=(this.weightedColumnNum == -1 ? 1.0d : Double.valueOf(units[this.weightedColumnNum]));
  }
 catch (  Exception e) {
    weightExceptions+=1;
    context.getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1L);
    if (weightExceptions > 5000 && this.isThrowforWeightException) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  boolean isMissingValue=false;
  boolean isInvalidValue=false;
  for (int i=0; i < units.length; i++) {
    ColumnConfig columnConfig=this.columnConfigList.get(i);
    if (columnConfig.isMeta() || columnConfig.isTarget()) {
      continue;
    }
    isMissingValue=false;
    isInvalidValue=false;
    BinningInfoWritable binningInfoWritable=this.columnBinningInfo.get(i);
    if (binningInfoWritable == null) {
      continue;
    }
    binningInfoWritable.setTotalCount(binningInfoWritable.getTotalCount() + 1L);
    if (columnConfig.isCategorical()) {
      int lastBinIndex=binningInfoWritable.getBinCategories().size();
      int binNum=0;
      if (units[i] == null || missingOrInvalidValues.contains(units[i].toLowerCase())) {
        isMissingValue=true;
      }
 else {
        String str=StringUtils.trim(units[i]);
        binNum=quickLocateCategoricalBin(this.categoricalBinMap.get(i),str);
        if (binNum < 0) {
          isInvalidValue=true;
        }
      }
      if (isInvalidValue || isMissingValue) {
        binningInfoWritable.setMissingCount(binningInfoWritable.getMissingCount() + 1L);
        binNum=lastBinIndex;
      }
      if (modelConfig.isRegression()) {
        if (posTags.contains(tag)) {
          binningInfoWritable.getBinCountPos()[binNum]+=1L;
          binningInfoWritable.getBinWeightPos()[binNum]+=weight;
        }
 else         if (negTags.contains(tag)) {
          binningInfoWritable.getBinCountNeg()[binNum]+=1L;
          binningInfoWritable.getBinWeightNeg()[binNum]+=weight;
        }
      }
 else {
        binningInfoWritable.getBinCountPos()[binNum]+=1L;
        binningInfoWritable.getBinWeightPos()[binNum]+=weight;
      }
    }
 else     if (columnConfig.isNumerical()) {
      int lastBinIndex=binningInfoWritable.getBinBoundaries().size();
      double douVal=0.0;
      if (units[i] == null || units[i].length() == 0) {
        isMissingValue=true;
      }
 else {
        try {
          douVal=Double.parseDouble(units[i].trim());
        }
 catch (        Exception e) {
          isInvalidValue=true;
        }
      }
      if (Double.compare(douVal,modelConfig.getNumericalValueThreshold()) > 0) {
        isInvalidValue=true;
      }
      if (isInvalidValue || isMissingValue) {
        binningInfoWritable.setMissingCount(binningInfoWritable.getMissingCount() + 1L);
        if (modelConfig.isRegression()) {
          if (posTags.contains(tag)) {
            binningInfoWritable.getBinCountPos()[lastBinIndex]+=1L;
            binningInfoWritable.getBinWeightPos()[lastBinIndex]+=weight;
          }
 else           if (negTags.contains(tag)) {
            binningInfoWritable.getBinCountNeg()[lastBinIndex]+=1L;
            binningInfoWritable.getBinWeightNeg()[lastBinIndex]+=weight;
          }
        }
      }
 else {
        int binNum=getBinNum(binningInfoWritable.getBinBoundaries(),units[i]);
        if (binNum == -1) {
          throw new RuntimeException("String_Node_Str");
        }
        if (modelConfig.isRegression()) {
          if (posTags.contains(tag)) {
            binningInfoWritable.getBinCountPos()[binNum]+=1L;
            binningInfoWritable.getBinWeightPos()[binNum]+=weight;
          }
 else           if (negTags.contains(tag)) {
            binningInfoWritable.getBinCountNeg()[binNum]+=1L;
            binningInfoWritable.getBinWeightNeg()[binNum]+=weight;
          }
        }
        binningInfoWritable.setSum(binningInfoWritable.getSum() + douVal);
        double squaredVal=douVal * douVal;
        binningInfoWritable.setSquaredSum(binningInfoWritable.getSquaredSum() + squaredVal);
        binningInfoWritable.setTripleSum(binningInfoWritable.getTripleSum() + squaredVal * douVal);
        binningInfoWritable.setQuarticSum(binningInfoWritable.getQuarticSum() + squaredVal * squaredVal);
        if (Double.compare(binningInfoWritable.getMax(),douVal) < 0) {
          binningInfoWritable.setMax(douVal);
        }
        if (Double.compare(binningInfoWritable.getMin(),douVal) > 0) {
          binningInfoWritable.setMin(douVal);
        }
      }
    }
  }
}