Program: 32078
Project: 32078
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 (!this.dataPurifier.isFilterOut(valueStr)) {
    return;
  }
  if (valueStr == null || valueStr.length() == 0 || valueStr.trim().length() == 0) {
    LOG.warn("String_Node_Str");
    return;
  }
  String[] units=CommonUtils.split(valueStr,this.dataSetDelimiter);
  String tag=units[this.tagColumnNum];
  if (modelConfig.isBinaryClassification()) {
    if (tag == null || (!posTags.contains(tag) && !negTags.contains(tag))) {
      return;
    }
  }
 else {
    if (tag == null || (!tags.contains(tag))) {
      return;
    }
  }
  Double weight=this.weightedColumnNum == -1 ? 1.0d : Double.valueOf(units[this.weightedColumnNum]);
  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=quickLocateCategorialBin(this.categoricalBinMap.get(i),str);
        if (binNum < 0) {
          isInvalidValue=true;
        }
      }
      if (isInvalidValue || isMissingValue) {
        binningInfoWritable.setMissingCount(binningInfoWritable.getMissingCount() + 1L);
        binNum=lastBinIndex;
      }
      if (modelConfig.isBinaryClassification()) {
        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     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.isBinaryClassification()) {
          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.isBinaryClassification()) {
          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;
  }
  if (!this.dataPurifier.isFilterOut(valueStr)) {
    return;
  }
  String[] units=CommonUtils.split(valueStr,this.dataSetDelimiter);
  String tag=units[this.tagColumnNum];
  if (modelConfig.isBinaryClassification()) {
    if (tag == null || (!posTags.contains(tag) && !negTags.contains(tag))) {
      return;
    }
  }
 else {
    if (tag == null || (!tags.contains(tag))) {
      return;
    }
  }
  Double weight=this.weightedColumnNum == -1 ? 1.0d : Double.valueOf(units[this.weightedColumnNum]);
  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=quickLocateCategorialBin(this.categoricalBinMap.get(i),str);
        if (binNum < 0) {
          isInvalidValue=true;
        }
      }
      if (isInvalidValue || isMissingValue) {
        binningInfoWritable.setMissingCount(binningInfoWritable.getMissingCount() + 1L);
        binNum=lastBinIndex;
      }
      if (modelConfig.isBinaryClassification()) {
        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     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.isBinaryClassification()) {
          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.isBinaryClassification()) {
          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);
        }
      }
    }
  }
}