Program: 13224
Project: 13224
Buggy source:
public SourceIndexWriterProjection(String tableName,Reference rawSourceReference,List<ColumnIdent> primaryKeys,List<ColumnIdent> partitionedBy,List<BytesRef> partitionValues,@Nullable ColumnIdent clusteredByColumn,int clusteredByIdx,Settings settings,@Nullable String[] includes,@Nullable String[] excludes,boolean autoCreateIndices){
  super(tableName,primaryKeys,clusteredByColumn,settings,autoCreateIndices);
  this.rawSourceReference=rawSourceReference;
  this.includes=includes;
  this.excludes=excludes;
  int currentInputIndex=primaryKeys.size();
  idSymbols=new ArrayList<>(primaryKeys.size());
  for (int i=0; i < primaryKeys.size(); i++) {
    idSymbols.add(new InputColumn(i,null));
  }
  partitionedBySymbols=new ArrayList<>(partitionedBy.size());
  for (int i=0, length=partitionedBy.size(); i < length; i++) {
    int idx=primaryKeys.indexOf(partitionedBy.get(i));
    Symbol partitionSymbol;
    if (partitionValues.size() > i) {
      if (idx > -1) {
        idSymbols.set(idx,Literal.newLiteral(partitionValues.get(i)));
      }
      continue;
    }
    if (idx == -1) {
      partitionSymbol=new InputColumn(currentInputIndex++,null);
    }
 else {
      partitionSymbol=idSymbols.get(idx);
    }
    partitionedBySymbols.add(partitionSymbol);
  }
  if (clusteredByIdx == -1) {
    clusteredBySymbol=new InputColumn(currentInputIndex++,null);
  }
  overwriteDuplicates=settings.getAsBoolean(OVERWRITE_DUPLICATES,OVERWRITE_DUPLICATES_DEFAULT);
  rawSourceSymbol=new InputColumn(currentInputIndex,DataTypes.STRING);
}

Fixed version (ground truth):
public SourceIndexWriterProjection(String tableName,Reference rawSourceReference,List<ColumnIdent> primaryKeys,List<ColumnIdent> partitionedBy,List<BytesRef> partitionValues,@Nullable ColumnIdent clusteredByColumn,int clusteredByIdx,Settings settings,@Nullable String[] includes,@Nullable String[] excludes,boolean autoCreateIndices){
  super(tableName,primaryKeys,clusteredByColumn,settings,autoCreateIndices);
  this.rawSourceReference=rawSourceReference;
  this.includes=includes;
  this.excludes=excludes;
  int currentInputIndex=primaryKeys.size();
  idSymbols=new ArrayList<>(primaryKeys.size());
  for (int i=0; i < primaryKeys.size(); i++) {
    InputColumn ic=new InputColumn(i,null);
    idSymbols.add(ic);
    if (i == clusteredByIdx) {
      clusteredBySymbol=ic;
    }
  }
  partitionedBySymbols=new ArrayList<>(partitionedBy.size());
  for (int i=0, length=partitionedBy.size(); i < length; i++) {
    int idx=primaryKeys.indexOf(partitionedBy.get(i));
    Symbol partitionSymbol;
    if (partitionValues.size() > i) {
      if (idx > -1) {
        idSymbols.set(idx,Literal.newLiteral(partitionValues.get(i)));
      }
      continue;
    }
    if (idx == -1) {
      partitionSymbol=new InputColumn(currentInputIndex++,null);
    }
 else {
      partitionSymbol=idSymbols.get(idx);
    }
    partitionedBySymbols.add(partitionSymbol);
  }
  if (clusteredByIdx == -1) {
    clusteredBySymbol=new InputColumn(currentInputIndex++,null);
  }
  overwriteDuplicates=settings.getAsBoolean(OVERWRITE_DUPLICATES,OVERWRITE_DUPLICATES_DEFAULT);
  rawSourceSymbol=new InputColumn(currentInputIndex,DataTypes.STRING);
}