Program: 31710
Project: 31710
Buggy source:
@SuppressWarnings("String_Node_Str") public Tuple exec(Tuple input) throws IOException {
  if (input == null || input.size() == 0) {
    return null;
  }
  if (isPigEnabled(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str")) {
    PigStatusReporter.getInstance().getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1);
  }
  final String rawTag=CommonUtils.trimTag(input.get(tagColumnNum).toString());
  if (!super.tagSet.contains(rawTag)) {
    if (isPigEnabled(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str")) {
      PigStatusReporter.getInstance().getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1);
    }
    return null;
  }
  if (!this.isForClean) {
    boolean isNotSampled=DataSampler.isNotSampled(modelConfig.isRegression(),super.tagSet,super.posTagSet,super.negTagSet,modelConfig.getNormalizeSampleRate(),modelConfig.isNormalizeSampleNegOnly(),rawTag);
    if (isNotSampled) {
      return null;
    }
  }
  Tuple tuple=TupleFactory.getInstance().newTuple();
  final NormType normType=modelConfig.getNormalizeType();
  for (int i=0; i < input.size(); i++) {
    ColumnConfig config=columnConfigList.get(i);
    String val=(input.get(i) == null) ? "String_Node_Str" : input.get(i).toString().trim();
    if (weightExpr != null) {
      weightContext.set(new NSColumn(config.getColumnName()).getSimpleName(),val);
    }
    if (tagColumnNum == i) {
      if (modelConfig.isRegression()) {
        int type=0;
        if (super.posTagSet.contains(rawTag)) {
          type=1;
        }
 else         if (super.negTagSet.contains(rawTag)) {
          type=0;
        }
 else {
          log.error("String_Node_Str" + rawTag);
          warn("String_Node_Str" + rawTag,WarnInNormalizeUDF.INVALID_TAG);
          return null;
        }
        tuple.append(type);
      }
 else {
        int index=-1;
        for (int j=0; j < tags.size(); j++) {
          Set<String> tagSet=tags.get(j);
          if (tagSet.contains(rawTag)) {
            index=j;
            break;
          }
        }
        if (index == -1) {
          log.error("String_Node_Str" + rawTag);
          return null;
        }
        tuple.append(index);
      }
      continue;
    }
    if (this.isForClean) {
      if (config.isCategorical()) {
        Map<String,Integer> map=this.categoricalIndexMap.get(config.getColumnNum());
        if ((map.get(val) == null || map.get(val) == -1)) {
          tuple.append(config.getBinCategory().size());
        }
 else {
          tuple.append(map.get(val));
        }
      }
 else {
        Double normVal=0d;
        try {
          normVal=Double.parseDouble(val);
        }
 catch (        Exception e) {
          log.debug("String_Node_Str" + val + "String_Node_Str");
          normVal=Normalizer.defaultMissingValue(config);
        }
        tuple.append(df.format(normVal));
      }
    }
 else {
      if (CommonUtils.isGoodCandidate(modelConfig.isRegression(),config)) {
        Double normVal=Normalizer.normalize(config,val,cutoff,normType,this.categoryMissingNormType);
        tuple.append(df.format(normVal));
      }
 else {
        tuple.append(config.isMeta() ? val : null);
      }
    }
  }
  double weight=evaluateWeight(weightExpr,weightContext);
  tuple.append(weight);
  return tuple;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Tuple exec(Tuple input) throws IOException {
  if (input == null || input.size() == 0) {
    return null;
  }
  if (isPigEnabled(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str")) {
    PigStatusReporter.getInstance().getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1);
  }
  final String rawTag=CommonUtils.trimTag(input.get(tagColumnNum).toString());
  if (!super.tagSet.contains(rawTag)) {
    if (isPigEnabled(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str")) {
      PigStatusReporter.getInstance().getCounter(Constants.SHIFU_GROUP_COUNTER,"String_Node_Str").increment(1);
    }
    return null;
  }
  if (!this.isForClean) {
    boolean isNotSampled=DataSampler.isNotSampled(modelConfig.isRegression(),super.tagSet,super.posTagSet,super.negTagSet,modelConfig.getNormalizeSampleRate(),modelConfig.isNormalizeSampleNegOnly(),rawTag);
    if (isNotSampled) {
      return null;
    }
  }
  Tuple tuple=TupleFactory.getInstance().newTuple();
  final NormType normType=modelConfig.getNormalizeType();
  for (int i=0; i < input.size(); i++) {
    ColumnConfig config=columnConfigList.get(i);
    String val=(input.get(i) == null) ? "String_Node_Str" : input.get(i).toString().trim();
    if (weightExpr != null) {
      weightContext.set(new NSColumn(config.getColumnName()).getSimpleName(),val);
    }
    if (tagColumnNum == i) {
      if (modelConfig.isRegression()) {
        int type=0;
        if (super.posTagSet.contains(rawTag)) {
          type=1;
        }
 else         if (super.negTagSet.contains(rawTag)) {
          type=0;
        }
 else {
          log.error("String_Node_Str" + rawTag);
          warn("String_Node_Str" + rawTag,WarnInNormalizeUDF.INVALID_TAG);
          return null;
        }
        tuple.append(type);
      }
 else {
        int index=-1;
        for (int j=0; j < tags.size(); j++) {
          Set<String> tagSet=tags.get(j);
          if (tagSet.contains(rawTag)) {
            index=j;
            break;
          }
        }
        if (index == -1) {
          log.error("String_Node_Str" + rawTag);
          return null;
        }
        tuple.append(index);
      }
      continue;
    }
    if (this.isForClean) {
      if (config.isCategorical()) {
        Map<String,Integer> map=this.categoricalIndexMap.get(config.getColumnNum());
        tuple.append(((map.get(val) == null || map.get(val) == -1)) ? "String_Node_Str" : val);
      }
 else {
        Double normVal=0d;
        try {
          normVal=Double.parseDouble(val);
        }
 catch (        Exception e) {
          log.debug("String_Node_Str" + val + "String_Node_Str");
          normVal=Normalizer.defaultMissingValue(config);
        }
        tuple.append(df.format(normVal));
      }
    }
 else {
      if (CommonUtils.isGoodCandidate(modelConfig.isRegression(),config)) {
        Double normVal=Normalizer.normalize(config,val,cutoff,normType,this.categoryMissingNormType);
        tuple.append(df.format(normVal));
      }
 else {
        tuple.append(config.isMeta() ? val : null);
      }
    }
  }
  double weight=evaluateWeight(weightExpr,weightContext);
  tuple.append(weight);
  return tuple;
}