nus-yam/ex-repair huggingface dataset:
Program: 30733
Project: 30733
Buggy source:
private ExprNode replaceLiteral(@Transient ExprNode node,QueryModel translatingModel,QueryModel innerModel,QueryModel validatingModel) throws ParserException {
  if (node != null && node.type == ExprNode.LITERAL) {
    final CharSequenceObjHashMap<String> map=translatingModel.getColumnToAliasMap();
    int index=map.keyIndex(node.token);
    if (index > -1) {
      String alias=createColumnAlias(node,translatingModel);
      QueryColumn column=queryColumnPool.next().of(alias,node.position,node);
      addColumnToTranslatingModel(column,translatingModel,validatingModel);
      if (innerModel != null) {
        innerModel.addColumn(column);
      }
      return exprNodePool.next().of(ExprNode.LITERAL,alias,0,node.position);
    }
    return exprNodePool.next().of(ExprNode.LITERAL,map.valueAt(index),0,node.position);
  }
  return node;
}

Fixed version (ground truth):
private ExprNode replaceLiteral(@Transient ExprNode node,QueryModel translatingModel,QueryModel innerModel,QueryModel validatingModel) throws ParserException {
  if (node != null && node.type == ExprNode.LITERAL) {
    final CharSequenceObjHashMap<String> map=translatingModel.getColumnToAliasMap();
    int index=map.keyIndex(node.token);
    if (index > -1) {
      String alias=createColumnAlias(node,translatingModel);
      QueryColumn column=queryColumnPool.next().of(alias,node);
      addColumnToTranslatingModel(column,translatingModel,validatingModel);
      if (innerModel != null) {
        innerModel.addColumn(column);
      }
      return exprNodePool.next().of(ExprNode.LITERAL,alias,0,node.position);
    }
    return exprNodePool.next().of(ExprNode.LITERAL,map.valueAt(index),0,node.position);
  }
  return node;
}
Program: 30734
Project: 30734
Buggy source:
private void createSelectColumn(String columnName,ExprNode columnAst,QueryModel validatingModel,QueryModel translatingModel,QueryModel innerModel,QueryModel groupByModel,QueryModel analyticModel,QueryModel outerModel) throws ParserException {
  final String alias=createColumnAlias(columnName,translatingModel);
  addColumnToTranslatingModel(queryColumnPool.next().of(alias,0,columnAst),translatingModel,validatingModel);
  final QueryColumn translatedColumn=queryColumnPool.next().of(alias,0,exprNodePool.next().of(ExprNode.LITERAL,alias,0,0));
  innerModel.addColumn(translatedColumn);
  groupByModel.addColumn(translatedColumn);
  analyticModel.addColumn(translatedColumn);
  outerModel.addColumn(translatedColumn);
}

Fixed version (ground truth):
private void createSelectColumn(String columnName,ExprNode columnAst,QueryModel validatingModel,QueryModel translatingModel,QueryModel innerModel,QueryModel groupByModel,QueryModel analyticModel,QueryModel outerModel) throws ParserException {
  final String alias=createColumnAlias(columnName,translatingModel);
  addColumnToTranslatingModel(queryColumnPool.next().of(alias,columnAst),translatingModel,validatingModel);
  final QueryColumn translatedColumn=queryColumnPool.next().of(alias,exprNodePool.next().of(ExprNode.LITERAL,alias,0,0));
  innerModel.addColumn(translatedColumn);
  groupByModel.addColumn(translatedColumn);
  analyticModel.addColumn(translatedColumn);
  outerModel.addColumn(translatedColumn);
}
Program: 30735
Project: 30735
Buggy source:
private ExprNode replaceIfAggregate(@Transient ExprNode node,QueryModel model){
  if (node != null && FunctionFactories.isAggregate(node.token)) {
    QueryColumn c=queryColumnPool.next().of(createColumnAlias(node,model),node.position,node);
    model.addColumn(c);
    return exprNodePool.next().of(ExprNode.LITERAL,c.getAlias(),0,0);
  }
  return node;
}

Fixed version (ground truth):
private ExprNode replaceIfAggregate(@Transient ExprNode node,QueryModel model){
  if (node != null && FunctionFactories.isAggregate(node.token)) {
    QueryColumn c=queryColumnPool.next().of(createColumnAlias(node,model),node);
    model.addColumn(c);
    return exprNodePool.next().of(ExprNode.LITERAL,c.getAlias(),0,0);
  }
  return node;
}
Program: 30736
Project: 30736
Buggy source:
public void enumerateTableColumns(QueryModel model) throws ParserException {
  final ObjList<QueryModel> jm=model.getJoinModels();
  if (model.getTableName() != null) {
    RecordMetadata m=model.getTableMetadata(engine);
    for (int i=0, k=m.getColumnCount(); i < k; i++) {
      model.addField(createColumnAlias(m.getColumnName(i),model));
    }
    ExprNode timestamp=model.getTimestamp();
    if (timestamp == null) {
      if (m.getTimestampIndex() != -1) {
        model.setTimestamp(exprNodePool.next().of(ExprNode.LITERAL,m.getColumnQuick(m.getTimestampIndex()).getName(),0,0));
      }
    }
 else {
      int index=m.getColumnIndexQuiet(timestamp.token);
      if (index == -1) {
        throw ParserException.invalidColumn(timestamp.position,timestamp.token);
      }
 else       if (m.getColumnQuick(index).getType() != ColumnType.TIMESTAMP) {
        throw ParserException.$(timestamp.position,"String_Node_Str");
      }
    }
  }
 else {
    if (model.getNestedModel() != null) {
      enumerateTableColumns(model.getNestedModel());
      model.copyColumnsFrom(model.getNestedModel());
    }
  }
  for (int i=1, n=jm.size(); i < n; i++) {
    enumerateTableColumns(jm.getQuick(i));
  }
}

Fixed version (ground truth):
public void enumerateTableColumns(QueryModel model) throws ParserException {
  final ObjList<QueryModel> jm=model.getJoinModels();
  if (model.getTableName() != null) {
    RecordMetadata m=model.getTableMetadata(engine,csPool.next());
    for (int i=0, k=m.getColumnCount(); i < k; i++) {
      model.addField(createColumnAlias(m.getColumnName(i),model));
    }
    ExprNode timestamp=model.getTimestamp();
    if (timestamp == null) {
      if (m.getTimestampIndex() != -1) {
        model.setTimestamp(exprNodePool.next().of(ExprNode.LITERAL,m.getColumnQuick(m.getTimestampIndex()).getName(),0,0));
      }
    }
 else {
      int index=m.getColumnIndexQuiet(timestamp.token);
      if (index == -1) {
        throw ParserException.invalidColumn(timestamp.position,timestamp.token);
      }
 else       if (m.getColumnQuick(index).getType() != ColumnType.TIMESTAMP) {
        throw ParserException.$(timestamp.position,"String_Node_Str");
      }
    }
  }
 else {
    if (model.getNestedModel() != null) {
      enumerateTableColumns(model.getNestedModel());
      model.copyColumnsFrom(model.getNestedModel());
    }
  }
  for (int i=1, n=jm.size(); i < n; i++) {
    enumerateTableColumns(jm.getQuick(i));
  }
}
Program: 30737
Project: 30737
Buggy source:
@Override public AnalyticColumn of(String alias,int aliasPosition,ExprNode ast){
  return (AnalyticColumn)super.of(alias,aliasPosition,ast);
}

Fixed version (ground truth):
@Override public AnalyticColumn of(String alias,ExprNode ast){
  return (AnalyticColumn)super.of(alias,ast);
}
Program: 30738
Project: 30738
Buggy source:
public QueryColumn of(String alias,int aliasPosition,ExprNode ast){
  this.alias=alias;
  this.aliasPosition=aliasPosition;
  this.ast=ast;
  return this;
}

Fixed version (ground truth):
public QueryColumn of(String alias,ExprNode ast){
  this.alias=alias;
  this.ast=ast;
  return this;
}
Program: 30740
Project: 30740
Buggy source:
private ParsedModel parseCreateStatement() throws ParserException {
  CharSequence tok=tok();
  if (Chars.equals(tok,"String_Node_Str")) {
    return parseCreateJournal();
  }
  throw err("String_Node_Str");
}

Fixed version (ground truth):
private ParsedModel parseCreateStatement() throws ParserException {
  CharSequence tok=tok();
  if (Chars.equals(tok,"String_Node_Str")) {
    return parseCreateTable();
  }
  throw err("String_Node_Str");
}
Program: 30742
Project: 30742
Buggy source:
private ParsedModel parseRenameStatement() throws ParserException {
  expectTok(tok(),"String_Node_Str");
  RenameJournalModel model=renameJournalModelPool.next();
  ExprNode e=expectExpr();
  if (e.type != ExprNode.LITERAL && e.type != ExprNode.CONSTANT) {
    throw ParserException.$(e.position,"String_Node_Str");
  }
  model.setFrom(e);
  expectTok(tok(),"String_Node_Str");
  e=expectExpr();
  if (e.type != ExprNode.LITERAL && e.type != ExprNode.CONSTANT) {
    throw ParserException.$(e.position,"String_Node_Str");
  }
  model.setTo(e);
  return model;
}

Fixed version (ground truth):
private ParsedModel parseRenameStatement() throws ParserException {
  expectTok("String_Node_Str");
  RenameJournalModel model=renameJournalModelPool.next();
  ExprNode e=expectExpr();
  if (e.type != ExprNode.LITERAL && e.type != ExprNode.CONSTANT) {
    throw ParserException.$(e.position,"String_Node_Str");
  }
  model.setFrom(e);
  expectTok("String_Node_Str");
  e=expectExpr();
  if (e.type != ExprNode.LITERAL && e.type != ExprNode.CONSTANT) {
    throw ParserException.$(e.position,"String_Node_Str");
  }
  model.setTo(e);
  return model;
}
Program: 30743
Project: 30743
Buggy source:
private ExprNode parseRecordHint(CharSequence tok) throws ParserException {
  if (Chars.equalsNc("String_Node_Str",tok)) {
    expectTok(tok(),"String_Node_Str");
    ExprNode hint=expectExpr();
    if (hint.type != ExprNode.CONSTANT) {
      throw ParserException.$(hint.position,"String_Node_Str");
    }
    return hint;
  }
  return null;
}

Fixed version (ground truth):
private ExprNode parseRecordHint(CharSequence tok) throws ParserException {
  if (Chars.equalsNc("String_Node_Str",tok)) {
    expectTok("String_Node_Str");
    ExprNode hint=expectExpr();
    if (hint.type != ExprNode.CONSTANT) {
      throw ParserException.$(hint.position,"String_Node_Str");
    }
    return hint;
  }
  return null;
}
Program: 30745
Project: 30745
Buggy source:
private void parseWithClauses(QueryModel model) throws ParserException {
  do {
    ExprNode name=expectLiteral();
    if (model.getWithClause(name.token) != null) {
      throw ParserException.$(name.position,"String_Node_Str");
    }
    expectTok(tok(),"String_Node_Str");
    expectTok('(');
    int lo, hi;
    lo=lexer.position();
    QueryModel m=parseQuery(true);
    hi=lexer.position();
    WithClauseModel wcm=withClauseModelPool.next();
    wcm.of(lo + 1,hi,m);
    expectTok(')');
    model.addWithClause(name.token,wcm);
    CharSequence tok=lexer.optionTok();
    if (tok == null || !Chars.equals(tok,',')) {
      lexer.unparse();
      break;
    }
  }
 while (true);
}

Fixed version (ground truth):
private void parseWithClauses(QueryModel model) throws ParserException {
  do {
    ExprNode name=expectLiteral();
    if (model.getWithClause(name.token) != null) {
      throw ParserException.$(name.position,"String_Node_Str");
    }
    expectTok("String_Node_Str");
    expectTok('(');
    int lo, hi;
    lo=lexer.position();
    QueryModel m=parseQuery(true);
    hi=lexer.position();
    WithClauseModel wcm=withClauseModelPool.next();
    wcm.of(lo + 1,hi,m);
    expectTok(')');
    model.addWithClause(name.token,wcm);
    CharSequence tok=lexer.optionTok();
    if (tok == null || !Chars.equals(tok,',')) {
      lexer.unparse();
      break;
    }
  }
 while (true);
}
Program: 30746
Project: 30746
Buggy source:
private void parseLatestBy(QueryModel model) throws ParserException {
  expectTok(tok(),"String_Node_Str");
  model.setLatestBy(expr());
}

Fixed version (ground truth):
private void parseLatestBy(QueryModel model) throws ParserException {
  expectTok("String_Node_Str");
  model.setLatestBy(expr());
}
Program: 30747
Project: 30747
Buggy source:
private void clear(){
  queryModelPool.clear();
  queryColumnPool.clear();
  exprNodePool.clear();
  analyticColumnPool.clear();
  createJournalModelPool.clear();
  columnIndexModelPool.clear();
  columnCastModelPool.clear();
  renameJournalModelPool.clear();
  withClauseModelPool.clear();
}

Fixed version (ground truth):
private void clear(){
  queryModelPool.clear();
  queryColumnPool.clear();
  exprNodePool.clear();
  analyticColumnPool.clear();
  createJournalModelPool.clear();
  columnCastModelPool.clear();
  renameJournalModelPool.clear();
  withClauseModelPool.clear();
}
Program: 30748
Project: 30748
Buggy source:
private CharSequence parseIndexDefinition(GenericIndexedBuilder builder) throws ParserException {
  CharSequence tok=tok();
  if (isFieldTerm(tok)) {
    return tok;
  }
  expectTok(tok,"String_Node_Str");
  builder.index();
  if (isFieldTerm(tok=tok())) {
    return tok;
  }
  expectTok(tok,"String_Node_Str");
  try {
    builder.buckets(Numbers.parseInt(tok()));
  }
 catch (  NumericException e) {
    throw err("String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
private CharSequence parseIndexDefinition(CreateTableModel model) throws ParserException {
  CharSequence tok=tok();
  if (isFieldTerm(tok)) {
    return tok;
  }
  expectTok(tok,lexer.position(),"String_Node_Str");
  if (isFieldTerm(tok=tok())) {
    model.setIndexFlags(true,1024);
    return tok;
  }
  expectTok(tok,lexer.position(),"String_Node_Str");
  expectTok("String_Node_Str");
  try {
    model.setIndexFlags(true,Numbers.parseInt(tok()));
  }
 catch (  NumericException e) {
    throw err("String_Node_Str");
  }
  return null;
}
Program: 30749
Project: 30749
Buggy source:
private ExprNode parsePartitionBy(CharSequence tok) throws ParserException {
  if (Chars.equalsNc("String_Node_Str",tok)) {
    expectTok(tok(),"String_Node_Str");
    return expectLiteral();
  }
  return null;
}

Fixed version (ground truth):
private ExprNode parsePartitionBy(CharSequence tok) throws ParserException {
  if (Chars.equalsNc("String_Node_Str",tok)) {
    expectTok("String_Node_Str");
    return expectLiteral();
  }
  return null;
}
Program: 30750
Project: 30750
Buggy source:
private void reloadColumnAt(Path path,ObjList<ReadOnlyColumn> columns,LongList columnTops,int columnIndex,int columnBase,long partitionRowCount){
  int plen=path.length();
  try {
    String name=metadata.getColumnName(columnIndex);
    ReadOnlyMemory mem1=(ReadOnlyMemory)columns.getQuick(getPrimaryColumnIndex(columnBase,columnIndex));
    ReadOnlyMemory mem2=(ReadOnlyMemory)columns.getQuick(getSecondaryColumnIndex(columnBase,columnIndex));
    if (ff.exists(TableUtils.dFile(path.trimTo(plen),name))) {
      int type=metadata.getColumnQuick(columnIndex).getType();
      mem1.of(ff,path,ff.getMapPageSize(),0);
      long columnTop=TableUtils.readColumnTop(ff,path.trimTo(plen),name,plen,tempMem8b);
switch (type) {
case ColumnType.BINARY:
case ColumnType.STRING:
        mem2.of(ff,TableUtils.iFile(path.trimTo(plen),name),ff.getMapPageSize(),0);
      columns.setQuick(getPrimaryColumnIndex(columnBase,columnIndex),mem1);
    columns.setQuick(getSecondaryColumnIndex(columnBase,columnIndex),mem2);
  growColumn(mem1,mem2,type,partitionRowCount - columnTop);
break;
default :
columns.setQuick(getPrimaryColumnIndex(columnBase,columnIndex),mem1);
growColumn(mem1,null,type,partitionRowCount - columnTop);
break;
}
columnTops.setQuick(columnBase / 2 + columnIndex,columnTop);
}
 else {
Misc.free(mem1);
Misc.free(mem2);
columns.setQuick(getPrimaryColumnIndex(columnBase,columnIndex),NullColumn.INSTANCE);
columns.setQuick(getSecondaryColumnIndex(columnBase,columnIndex),NullColumn.INSTANCE);
}
}
  finally {
path.trimTo(plen);
}
}

Fixed version (ground truth):
private void reloadColumnAt(Path path,ObjList<ReadOnlyColumn> columns,LongList columnTops,int columnIndex,int columnBase,long partitionRowCount){
  int plen=path.length();
  try {
    String name=metadata.getColumnName(columnIndex);
    ReadOnlyMemory mem1=(ReadOnlyMemory)columns.getQuick(getPrimaryColumnIndex(columnBase,columnIndex));
    ReadOnlyMemory mem2=(ReadOnlyMemory)columns.getQuick(getSecondaryColumnIndex(columnBase,columnIndex));
    if (ff.exists(TableUtils.dFile(path.trimTo(plen),name))) {
      int type=metadata.getColumnQuick(columnIndex).getType();
      mem1.of(ff,path,ff.getMapPageSize(),0);
      long columnTop=TableUtils.readColumnTop(ff,path.trimTo(plen),name,plen,tempMem8b);
switch (type) {
case ColumnType.BINARY:
case ColumnType.STRING:
        mem2.of(ff,TableUtils.iFile(path.trimTo(plen),name),ff.getMapPageSize(),0);
      growColumn(mem1,mem2,type,partitionRowCount - columnTop);
    break;
default :
  growColumn(mem1,null,type,partitionRowCount - columnTop);
break;
}
columnTops.setQuick(columnBase / 2 + columnIndex,columnTop);
}
 else {
Misc.free(mem1);
Misc.free(mem2);
columns.setQuick(getPrimaryColumnIndex(columnBase,columnIndex),NullColumn.INSTANCE);
columns.setQuick(getSecondaryColumnIndex(columnBase,columnIndex),NullColumn.INSTANCE);
}
}
  finally {
path.trimTo(plen);
}
}
Program: 30751
Project: 30751
Buggy source:
/** 
 * Closed column files. Similarly to   {@link #closeColumnForRemove(CharSequence)} closed reader column files beforecolumn can be removed. This method takes column index usually resolved from column name by #TableReaderMetadata. Bounds checking is performed via assertion.
 * @param columnIndex column index
 */
public void closeColumnForRemove(int columnIndex){
}

Fixed version (ground truth):
/** 
 * Closes column files. This method should be used before call to TableWriter.removeColumn() on Windows OS.
 * @param columnName name of column to be closed.
 * @throws NoSuchColumnException when column is not found.
 */
public void closeColumnForRemove(CharSequence columnName){
  closeColumnForRemove(metadata.getColumnIndex(columnName));
}
Program: 30752
Project: 30752
Buggy source:
private void doReloadStruct(){
  long pTransitionIndex=metadata.createTransitionIndex();
  try {
    metadata.applyTransitionIndex(pTransitionIndex);
    final int columnCount=Unsafe.getUnsafe().getInt(pTransitionIndex + 4);
    int columnCountBits=getColumnBits(columnCount);
    if (columnCountBits > this.columnCountBits) {
      createNewColumnList(columnCount,pTransitionIndex,columnCountBits);
    }
 else {
      reshuffleExistingColumnList(columnCount,pTransitionIndex);
    }
    applyTransitionIndexToSymbolMapReaders(pTransitionIndex);
    this.columnCount=columnCount;
  }
  finally {
    TableReaderMetadata.freeTransitionIndex(pTransitionIndex);
  }
}

Fixed version (ground truth):
private void doReloadStruct(){
  long pTransitionIndex=metadata.createTransitionIndex();
  try {
    metadata.applyTransitionIndex(pTransitionIndex);
    final int columnCount=Unsafe.getUnsafe().getInt(pTransitionIndex + 4);
    int columnCountBits=getColumnBits(columnCount);
    if (columnCountBits > this.columnCountBits) {
      createNewColumnList(columnCount,pTransitionIndex,columnCountBits);
    }
 else {
      reshuffleColumns(columnCount,pTransitionIndex);
    }
    reshuffleSymbolMapReaders(pTransitionIndex);
    this.columnCount=columnCount;
  }
  finally {
    TableReaderMetadata.freeTransitionIndex(pTransitionIndex);
  }
}
Program: 30753
Project: 30753
Buggy source:
private SymbolMapReader copyOrRenewSymbolMapReader(SymbolMapReader reader,int columnIndex){
  if (reader != null && reader.isDeleted()) {
    reader=newSymbolMapReaderInstance(columnIndex,reader);
  }
  reader=symbolMapReaders.getAndSetQuick(columnIndex,reader);
  return reader;
}

Fixed version (ground truth):
private SymbolMapReader copyOrRenewSymbolMapReader(SymbolMapReader reader,int columnIndex){
  if (reader != null && reader.isDeleted()) {
    reader=reloadSymbolMapReader(columnIndex,reader);
  }
  return symbolMapReaders.getAndSetQuick(columnIndex,reader);
}
Program: 30754
Project: 30754
Buggy source:
@Override public BitmapIndexCursor getCursor(int key,long maxValue){
  if (key >= keyCount) {
    updateKeyCount();
  }
  if (key == 0 && unindexedNullCount > 0) {
    nullCursor.nullCount=unindexedNullCount + 1;
    nullCursor.of(key,maxValue);
    return nullCursor;
  }
  if (key < keyCount) {
    cursor.of(key,maxValue);
    return cursor;
  }
  return BitmapIndexEmptyCursor.INSTANCE;
}

Fixed version (ground truth):
@Override public BitmapIndexCursor getCursor(int key,long maxValue){
  if (key >= keyCount) {
    updateKeyCount();
  }
  if (key == 0 && unindexedNullCount > 0) {
    nullCursor.nullCount=unindexedNullCount;
    nullCursor.of(key,maxValue);
    return nullCursor;
  }
  if (key < keyCount) {
    cursor.of(key,maxValue);
    return cursor;
  }
  return BitmapIndexEmptyCursor.INSTANCE;
}
Program: 30756
Project: 30756
Buggy source:
private boolean readTxn(){
  while (true) {
    long txn=txMem.getLong(TableUtils.TX_OFFSET_TXN);
    if (txn == this.txn) {
      return false;
    }
    Unsafe.getUnsafe().loadFence();
    long transientRowCount=txMem.getLong(TableUtils.TX_OFFSET_TRANSIENT_ROW_COUNT);
    long fixedRowCount=txMem.getLong(TableUtils.TX_OFFSET_FIXED_ROW_COUNT);
    long maxTimestamp=txMem.getLong(TableUtils.TX_OFFSET_MAX_TIMESTAMP);
    long structVersion=txMem.getLong(TableUtils.TX_OFFSET_STRUCT_VERSION);
    this.symbolCountSnapshot.clear();
    int symbolMapCount=txMem.getInt(TableUtils.TX_OFFSET_MAP_WRITER_COUNT);
    if (symbolMapCount > 0) {
      txMem.grow(TableUtils.TX_OFFSET_MAP_WRITER_COUNT + 4 + symbolMapCount * 4);
      for (int i=0; i < symbolMapCount; i++) {
        symbolCountSnapshot.add(txMem.getInt(TableUtils.TX_OFFSET_MAP_WRITER_COUNT + 4 + i * 4));
      }
    }
    Unsafe.getUnsafe().loadFence();
    if (txn == txMem.getLong(TableUtils.TX_OFFSET_TXN_CHECK)) {
      this.txn=txn;
      this.transientRowCount=transientRowCount;
      this.rowCount=fixedRowCount + transientRowCount;
      this.maxTimestamp=maxTimestamp;
      this.structVersion=structVersion;
      break;
    }
    LockSupport.parkNanos(1);
  }
  return true;
}

Fixed version (ground truth):
private boolean readTxn(){
  int count=0;
  while (true) {
    long txn=txMem.getLong(TableUtils.TX_OFFSET_TXN);
    if (txn == this.txn) {
      return false;
    }
    Unsafe.getUnsafe().loadFence();
    long checkTxn;
    while ((checkTxn=txMem.getLong(TableUtils.TX_OFFSET_TXN_CHECK)) < txn) {
      LockSupport.parkNanos(1);
    }
    if (txn == checkTxn) {
      Unsafe.getUnsafe().loadFence();
      final long transientRowCount=txMem.getLong(TableUtils.TX_OFFSET_TRANSIENT_ROW_COUNT);
      final long fixedRowCount=txMem.getLong(TableUtils.TX_OFFSET_FIXED_ROW_COUNT);
      final long maxTimestamp=txMem.getLong(TableUtils.TX_OFFSET_MAX_TIMESTAMP);
      final long structVersion=txMem.getLong(TableUtils.TX_OFFSET_STRUCT_VERSION);
      this.symbolCountSnapshot.clear();
      int symbolMapCount=txMem.getInt(TableUtils.TX_OFFSET_MAP_WRITER_COUNT);
      if (symbolMapCount > 0) {
        txMem.grow(TableUtils.TX_OFFSET_MAP_WRITER_COUNT + 4 + symbolMapCount * 4);
        for (int i=0; i < symbolMapCount; i++) {
          symbolCountSnapshot.add(txMem.getInt(TableUtils.TX_OFFSET_MAP_WRITER_COUNT + 4 + i * 4));
        }
      }
      Unsafe.getUnsafe().loadFence();
      if (txn == txMem.getLong(TableUtils.TX_OFFSET_TXN)) {
        this.txn=txn;
        this.transientRowCount=transientRowCount;
        this.rowCount=fixedRowCount + transientRowCount;
        this.maxTimestamp=maxTimestamp;
        this.structVersion=structVersion;
        LOG.info().$("String_Node_Str").$(txn).$("String_Node_Str").$(transientRowCount).$("String_Node_Str").$(fixedRowCount).$("String_Node_Str").$(maxTimestamp).$("String_Node_Str").$(count).$(']').$();
        break;
      }
      count++;
      LockSupport.parkNanos(1);
    }
  }
  return true;
}
Program: 30757
Project: 30757
Buggy source:
private long openPartition0(int partitionIndex){
  try {
    Path path=partitionPathGenerator.generate(this,partitionIndex);
    if (ff.exists(path)) {
      path.chopZ();
      final long partitionSize=partitionIndex == partitionCount - 1 ? transientRowCount : readPartitionSize(ff,path,tempMem8b);
      LOG.info().$("String_Node_Str").utf8(path.$()).$("String_Node_Str").$(partitionSize).$("String_Node_Str").$(transientRowCount).$("String_Node_Str").$(partitionIndex).$("String_Node_Str").$(partitionCount).$();
      if (partitionSize > 0) {
        openPartitionColumns(path,getColumnBase(partitionIndex),partitionSize);
        partitionRowCounts.setQuick(partitionIndex,partitionSize);
        if (maxTimestamp != Numbers.LONG_NaN) {
          if (reloadMethod == FIRST_TIME_PARTITIONED_RELOAD_METHOD) {
            reloadMethod=PARTITIONED_RELOAD_METHOD;
          }
 else           if (reloadMethod == FIRST_TIME_NON_PARTITIONED_RELOAD_METHOD) {
            reloadMethod=NON_PARTITIONED_RELOAD_METHOD;
          }
        }
      }
      return partitionSize;
    }
    return -1;
  }
  finally {
    path.trimTo(rootLen);
  }
}

Fixed version (ground truth):
private long openPartition0(int partitionIndex){
  try {
    Path path=partitionPathGenerator.generate(this,partitionIndex);
    if (ff.exists(path)) {
      path.chopZ();
      final long partitionSize=partitionIndex == partitionCount - 1 ? transientRowCount : readPartitionSize(ff,path,tempMem8b);
      LOG.info().$("String_Node_Str").utf8(path.$()).$("String_Node_Str").$(partitionSize).$("String_Node_Str").$(transientRowCount).$("String_Node_Str").$(partitionIndex).$("String_Node_Str").$(partitionCount).$(']').$();
      if (partitionSize > 0) {
        openPartitionColumns(path,getColumnBase(partitionIndex),partitionSize);
        partitionRowCounts.setQuick(partitionIndex,partitionSize);
        if (maxTimestamp != Numbers.LONG_NaN) {
          if (reloadMethod == FIRST_TIME_PARTITIONED_RELOAD_METHOD) {
            reloadMethod=PARTITIONED_RELOAD_METHOD;
          }
 else           if (reloadMethod == FIRST_TIME_NON_PARTITIONED_RELOAD_METHOD) {
            reloadMethod=NON_PARTITIONED_RELOAD_METHOD;
          }
        }
      }
      return partitionSize;
    }
    return -1;
  }
  finally {
    path.trimTo(rootLen);
  }
}
Program: 30758
Project: 30758
Buggy source:
public static void resetTxn(VirtualMemory txMem,int symbolMapCount){
  txMem.jumpTo(TX_OFFSET_TXN);
  txMem.putLong(0);
  Unsafe.getUnsafe().storeFence();
  txMem.putLong(0);
  txMem.putLong(0);
  txMem.putLong(Long.MIN_VALUE);
  txMem.putLong(0);
  txMem.skip(8);
  txMem.putInt(symbolMapCount);
  for (int i=0; i < symbolMapCount; i++) {
    txMem.putLong(0);
  }
  long offset=txMem.getAppendOffset();
  txMem.jumpTo(TX_OFFSET_TXN_CHECK);
  Unsafe.getUnsafe().storeFence();
  txMem.putLong(0);
  txMem.jumpTo(offset);
}

Fixed version (ground truth):
public static void resetTxn(VirtualMemory txMem,int symbolMapCount){
  txMem.jumpTo(TX_OFFSET_TXN);
  txMem.putLong(INITIAL_TXN);
  Unsafe.getUnsafe().storeFence();
  txMem.putLong(0);
  txMem.putLong(0);
  txMem.putLong(Long.MIN_VALUE);
  txMem.putLong(0);
  txMem.skip(8);
  txMem.putInt(symbolMapCount);
  for (int i=0; i < symbolMapCount; i++) {
    txMem.putLong(0);
  }
  long offset=txMem.getAppendOffset();
  txMem.jumpTo(TX_OFFSET_TXN_CHECK);
  Unsafe.getUnsafe().storeFence();
  txMem.putLong(INITIAL_TXN);
  txMem.jumpTo(offset);
}
Program: 30759
Project: 30759
Buggy source:
private void cacheWriter(CacheEntry entry,CachedCharSequence tableName){
  try {
    entry.writer=pool.get(tableName);
    this.tableName=tableName.getCacheAddress();
    createState(entry);
  }
 catch (  CairoException ex) {
    LOG.error().$((Sinkable)ex).$();
    switchModeToSkipLine();
  }
}

Fixed version (ground truth):
private void cacheWriter(CacheEntry entry,CachedCharSequence tableName){
  try {
    entry.writer=pool.get(tableName);
    this.tableName=tableName.getCacheAddress();
    createState(entry);
    LOG.info().$("String_Node_Str").$(tableName).$(']').$();
  }
 catch (  CairoException ex) {
    LOG.error().$((Sinkable)ex).$();
    switchModeToSkipLine();
  }
}
Program: 30760
Project: 30760
Buggy source:
@Override public void close(){
  if (keyMem != null) {
    if (keyMem.isOpen() && keyCount > -1) {
      keyMem.jumpTo(keyMemSize());
    }
    Misc.free(keyMem);
  }
  if (valueMem != null) {
    if (valueMem.isOpen()) {
      valueMem.jumpTo(valueMemSize);
    }
    Misc.free(valueMem);
  }
}

Fixed version (ground truth):
@Override public void close(){
  if (keyMem != null) {
    if (keyMem.isOpen() && keyCount > -1) {
      keyMem.jumpTo(keyMemSize());
    }
    Misc.free(keyMem);
  }
  if (valueMem != null) {
    if (valueMem.isOpen() && valueMemSize > -1) {
      valueMem.jumpTo(valueMemSize);
    }
    Misc.free(valueMem);
  }
}
Program: 30761
Project: 30761
Buggy source:
public CairoError(Throwable cause){
  super(cause);
}

Fixed version (ground truth):
public CairoError(String message){
  super(message);
}
Program: 30762
Project: 30762
Buggy source:
@Override public void of(CairoConfiguration configuration,Path path,CharSequence name,AppendMemory mem1,AppendMemory mem2,long columnTop){
  this.columnTop=columnTop;
  this.writer.of(configuration,path,name);
  this.mem.of(mem1);
}

Fixed version (ground truth):
@Override public void of(CairoConfiguration configuration,Path path,CharSequence name,AppendMemory mem1,AppendMemory mem2,long columnTop){
  this.columnTop=columnTop;
  try {
    this.writer.of(configuration,path,name);
    this.mem.of(mem1);
  }
 catch (  CairoException e) {
    this.close();
    throw e;
  }
}
Program: 30764
Project: 30764
Buggy source:
public static long lock(FilesFacade ff,Path path){
  long fd=ff.openRW(path.put("String_Node_Str").$());
  if (fd == -1) {
    LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$(ff.errno()).$(']').$();
    return -1L;
  }
  if (ff.lock(fd) != 0) {
    LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$(ff.errno()).$("String_Node_Str").$(fd).$(']').$();
    ff.close(fd);
    return -1L;
  }
  return fd;
}

Fixed version (ground truth):
public static long lock(FilesFacade ff,Path path){
  long fd=ff.openRW(path);
  if (fd == -1) {
    LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$(ff.errno()).$(']').$();
    return -1L;
  }
  if (ff.lock(fd) != 0) {
    LOG.error().$("String_Node_Str").$(path).$("String_Node_Str").$(ff.errno()).$("String_Node_Str").$(fd).$(']').$();
    ff.close(fd);
    return -1L;
  }
  return fd;
}
Program: 30765
Project: 30765
Buggy source:
private long openPartition0(int partitionIndex){
  try {
    Path path=partitionPathGenerator.generate(this,partitionIndex);
    if (ff.exists(path)) {
      if (reloadMethod == FIRST_TIME_PARTITIONED_RELOAD_METHOD) {
        reloadMethod=PARTITIONED_RELOAD_METHOD;
      }
 else       if (reloadMethod == FIRST_TIME_NON_PARTITIONED_RELOAD_METHOD) {
        reloadMethod=NON_PARTITIONED_RELOAD_METHOD;
      }
      path.chopZ();
      final long partitionSize=partitionIndex == partitionCount - 1 ? transientRowCount : readPartitionSize(ff,path,tempMem8b);
      LOG.info().$("String_Node_Str").utf8(path.$()).$("String_Node_Str").$(partitionSize).$("String_Node_Str").$(transientRowCount).$("String_Node_Str").$(partitionIndex).$("String_Node_Str").$(partitionCount).$();
      if (partitionSize > 0) {
        openPartitionColumns(path,getColumnBase(partitionIndex),partitionSize);
        partitionRowCounts.setQuick(partitionIndex,partitionSize);
      }
      return partitionSize;
    }
    return -1;
  }
  finally {
    path.trimTo(rootLen);
  }
}

Fixed version (ground truth):
private long openPartition0(int partitionIndex){
  try {
    Path path=partitionPathGenerator.generate(this,partitionIndex);
    if (ff.exists(path)) {
      path.chopZ();
      final long partitionSize=partitionIndex == partitionCount - 1 ? transientRowCount : readPartitionSize(ff,path,tempMem8b);
      LOG.info().$("String_Node_Str").utf8(path.$()).$("String_Node_Str").$(partitionSize).$("String_Node_Str").$(transientRowCount).$("String_Node_Str").$(partitionIndex).$("String_Node_Str").$(partitionCount).$();
      if (partitionSize > 0) {
        openPartitionColumns(path,getColumnBase(partitionIndex),partitionSize);
        partitionRowCounts.setQuick(partitionIndex,partitionSize);
        if (reloadMethod == FIRST_TIME_PARTITIONED_RELOAD_METHOD) {
          reloadMethod=PARTITIONED_RELOAD_METHOD;
        }
 else         if (reloadMethod == FIRST_TIME_NON_PARTITIONED_RELOAD_METHOD && maxTimestamp != Numbers.LONG_NaN) {
          reloadMethod=NON_PARTITIONED_RELOAD_METHOD;
        }
      }
      return partitionSize;
    }
    return -1;
  }
  finally {
    path.trimTo(rootLen);
  }
}
Program: 30766
Project: 30766
Buggy source:
private void removeColumnFiles(CharSequence name,RemoveFileLambda removeLambda){
  try {
    ff.iterateDir(path.$(),(file,type) -> {
      nativeLPSZ.of(file);
      if (type == Files.DT_DIR && !IGNORED_FILES.contains(nativeLPSZ)) {
        path.trimTo(rootLen);
        path.concat(nativeLPSZ);
        int plen=path.length();
        removeLambda.remove(ff,TableUtils.dFile(path,name));
        removeLambda.remove(ff,TableUtils.iFile(path.trimTo(plen),name));
        removeLambda.remove(ff,TableUtils.topFile(path.trimTo(plen),name));
      }
    }
);
  }
  finally {
    path.trimTo(rootLen);
  }
}

Fixed version (ground truth):
private void removeColumnFiles(CharSequence columnName,int columnType,RemoveFileLambda removeLambda){
  try {
    ff.iterateDir(path.$(),(file,type) -> {
      nativeLPSZ.of(file);
      if (type == Files.DT_DIR && !IGNORED_FILES.contains(nativeLPSZ)) {
        path.trimTo(rootLen);
        path.concat(nativeLPSZ);
        int plen=path.length();
        removeLambda.remove(ff,TableUtils.dFile(path,columnName));
        removeLambda.remove(ff,TableUtils.iFile(path.trimTo(plen),columnName));
        removeLambda.remove(ff,TableUtils.topFile(path.trimTo(plen),columnName));
      }
    }
);
    if (columnType == ColumnType.SYMBOL) {
      removeLambda.remove(ff,SymbolMapWriter.offsetFileName(path.trimTo(rootLen),columnName));
      removeLambda.remove(ff,SymbolMapWriter.charFileName(path.trimTo(rootLen),columnName));
      removeLambda.remove(ff,BitmapIndexUtils.keyFileName(path.trimTo(rootLen),columnName));
      removeLambda.remove(ff,BitmapIndexUtils.valueFileName(path.trimTo(rootLen),columnName));
    }
  }
  finally {
    path.trimTo(rootLen);
  }
}
Program: 30768
Project: 30768
Buggy source:
public BitmapIndexBackwardReader(CairoConfiguration configuration,Path path,CharSequence name){
  final int plen=path.length();
  final long pageSize=configuration.getFilesFacade().getMapPageSize();
  this.spinLockTimeoutUs=configuration.getSpinLockTimeoutUs();
  try {
    this.keyMem=new ReadOnlyMemory(configuration.getFilesFacade(),BitmapIndexUtils.keyFileName(path,name),pageSize,0);
    this.keyMem.grow(configuration.getFilesFacade().length(this.keyMem.getFd()));
    this.clock=configuration.getClock();
    long keyMemSize=this.keyMem.size();
    if (keyMemSize < BitmapIndexUtils.KEY_FILE_RESERVED) {
      LOG.error().$("String_Node_Str").$(path).$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    if (this.keyMem.getByte(BitmapIndexUtils.KEY_RESERVED_OFFSET_SIGNATURE) != BitmapIndexUtils.SIGNATURE) {
      LOG.error().$("String_Node_Str").$(path).$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    int blockValueCountMod;
    int keyCount;
    long timestamp=clock.getTicks();
    while (true) {
      long seq=this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE);
      Unsafe.getUnsafe().loadFence();
      blockValueCountMod=this.keyMem.getInt(BitmapIndexUtils.KEY_RESERVED_OFFSET_BLOCK_VALUE_COUNT) - 1;
      keyCount=this.keyMem.getInt(BitmapIndexUtils.KEY_RESERVED_OFFSET_KEY_COUNT);
      Unsafe.getUnsafe().loadFence();
      if (this.keyMem.getLong(BitmapIndexUtils.KEY_RESERVED_OFFSET_SEQUENCE_CHECK) == seq) {
        break;
      }
      if (clock.getTicks() - timestamp > spinLockTimeoutUs) {
        LOG.error().$("String_Node_Str").$(spinLockTimeoutUs).utf8("String_Node_Str").$();
        throw CairoException.instance(0).put("String_Node_Str");
      }
    }
    this.blockValueCountMod=blockValueCountMod;
    this.blockCapacity=(blockValueCountMod + 1) * 8 + BitmapIndexUtils.VALUE_BLOCK_FILE_RESERVED;
    this.keyCount=keyCount;
    this.valueMem=new ReadOnlyMemory(configuration.getFilesFacade(),BitmapIndexUtils.valueFileName(path.trimTo(plen),name),pageSize,0);
    this.valueMem.grow(configuration.getFilesFacade().length(this.valueMem.getFd()));
  }
 catch (  CairoException e) {
    close();
    throw e;
  }
 finally {
    path.trimTo(plen);
  }
}

Fixed version (ground truth):
public BitmapIndexBackwardReader(CairoConfiguration configuration,Path path,CharSequence name){
  of(configuration,path,name);
}
Program: 30769
Project: 30769
Buggy source:
public SymbolMapReaderImpl(CairoConfiguration configuration,Path path,CharSequence name,int symbolCount){
  this.ff=configuration.getFilesFacade();
  this.symbolCount=symbolCount;
  this.maxOffset=SymbolMapWriter.keyToOffset(symbolCount - 1);
  final int plen=path.length();
  try {
    final long mapPageSize=configuration.getFilesFacade().getMapPageSize();
    offsetFileName(path.trimTo(plen),name);
    if (!ff.exists(path)) {
      LOG.error().$(path).$("String_Node_Str").$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    long len=ff.length(path);
    if (len < SymbolMapWriter.HEADER_SIZE) {
      LOG.error().$(path).$("String_Node_Str").$(len).$(']').$();
      throw CairoException.instance(0).put("String_Node_Str").put(path);
    }
    this.offsetMem=new ReadOnlyMemory(ff,path,mapPageSize,keyToOffset(symbolCount));
    final int symbolCapacity=offsetMem.getInt(0);
    final boolean useCache=offsetMem.getBool(4);
    this.offsetMem.grow(maxOffset);
    this.indexReader=new BitmapIndexBackwardReader(configuration,path.trimTo(plen),name);
    this.charMem=new ReadOnlyMemory(ff,charFileName(path.trimTo(plen),name),mapPageSize,0);
    growCharMemToSymbolCount(symbolCount);
    this.maxHash=Numbers.ceilPow2(symbolCapacity / 2) - 1;
    if (useCache) {
      this.cache=new ObjList<>(symbolCapacity);
      this.cache.setPos(symbolCapacity);
    }
 else {
      this.cache=null;
    }
    LOG.info().$("String_Node_Str").$(path.trimTo(plen).concat(name).$()).$("String_Node_Str").$(this.offsetMem.getFd()).$("String_Node_Str").$(symbolCapacity).$(']').$();
  }
 catch (  CairoException e) {
    close();
    throw e;
  }
 finally {
    path.trimTo(plen);
  }
}

Fixed version (ground truth):
public SymbolMapReaderImpl(CairoConfiguration configuration,Path path,CharSequence name,int symbolCount){
  of(configuration,path,name,symbolCount);
}
Program: 30770
Project: 30770
Buggy source:
@Override public void close(){
  Misc.free(indexReader);
  Misc.free(charMem);
  if (this.offsetMem != null) {
    long fd=this.offsetMem.getFd();
    Misc.free(offsetMem);
    LOG.info().$("String_Node_Str").$(fd).$(']').$();
  }
}

Fixed version (ground truth):
@Override public void close(){
  Misc.free(indexReader);
  Misc.free(charMem);
  this.cache.clear();
  if (this.offsetMem != null) {
    long fd=this.offsetMem.getFd();
    Misc.free(offsetMem);
    LOG.info().$("String_Node_Str").$(fd).$(']').$();
  }
}
Program: 30771
Project: 30771
Buggy source:
@Override public CharSequence value(int key){
  if (key > -1 && key < symbolCount) {
    if (cache != null) {
      return cachedValue(key);
    }
    return uncachedValue(key);
  }
  return null;
}

Fixed version (ground truth):
@Override public CharSequence value(int key){
  if (key > -1 && key < symbolCount) {
    if (cached) {
      return cachedValue(key);
    }
    return uncachedValue(key);
  }
  return null;
}
Program: 30772
Project: 30772
Buggy source:
boolean isCached(){
  return cache != null;
}

Fixed version (ground truth):
boolean isCached(){
  return cached;
}
Program: 30775
Project: 30775
Buggy source:
private SymbolMapReader copyOrRenewSymbolMapReader(SymbolMapReader reader,int columnIndex){
  if (reader != null && reader.isDeleted()) {
    Misc.free(reader);
    reader=newSymbolMapReaderInstance(columnIndex);
  }
  reader=symbolMapReaders.getAndSetQuick(columnIndex,reader);
  return reader;
}

Fixed version (ground truth):
private SymbolMapReader copyOrRenewSymbolMapReader(SymbolMapReader reader,int columnIndex){
  if (reader != null && reader.isDeleted()) {
    reader=newSymbolMapReaderInstance(columnIndex,reader);
  }
  reader=symbolMapReaders.getAndSetQuick(columnIndex,reader);
  return reader;
}
Program: 30776
Project: 30776
Buggy source:
private SymbolMapReader newSymbolMapReaderInstance(int columnIndex){
  RecordColumnMetadata m=metadata.getColumnQuick(columnIndex);
  if (m.getType() == ColumnType.SYMBOL) {
    return new SymbolMapReaderImpl(configuration,path,m.getName(),0);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
private SymbolMapReader newSymbolMapReaderInstance(int columnIndex,SymbolMapReader reader){
  RecordColumnMetadata m=metadata.getColumnQuick(columnIndex);
  if (m.getType() == ColumnType.SYMBOL) {
    if (reader instanceof SymbolMapReaderImpl) {
      ((SymbolMapReaderImpl)reader).of(configuration,path,m.getName(),0);
      return reader;
    }
    return new SymbolMapReaderImpl(configuration,path,m.getName(),0);
  }
 else {
    return null;
  }
}
Program: 30777
Project: 30777
Buggy source:
private void copyColumnsTo(ObjList<ReadOnlyColumn> columns,LongList columnTops,ObjList<BitmapIndexReader> indexReaders,int columnBase,int columnIndex,long partitionRowCount){
  boolean reload=tempCopyStruct.mem1 instanceof ReadOnlyMemory && tempCopyStruct.mem1.isDeleted();
  tempCopyStruct.mem1=columns.getAndSetQuick(getPrimaryColumnIndex(columnBase,columnIndex),tempCopyStruct.mem1);
  tempCopyStruct.mem2=columns.getAndSetQuick(getSecondaryColumnIndex(columnBase,columnIndex),tempCopyStruct.mem2);
  tempCopyStruct.top=columnTops.getAndSetQuick(columnBase / 2 + columnIndex,tempCopyStruct.top);
  tempCopyStruct.bitmapIndexReader=indexReaders.getAndSetQuick(columnBase / 2 + columnIndex,tempCopyStruct.bitmapIndexReader);
  if (reload) {
    reloadColumnAt(path,columns,columnTops,indexReaders,columnBase,columnIndex,partitionRowCount);
  }
}

Fixed version (ground truth):
private void copyColumnsTo(ObjList<ReadOnlyColumn> columns,LongList columnTops,ObjList<BitmapIndexReader> indexReaders,int columnBase,int columnIndex,long partitionRowCount){
  ReadOnlyColumn mem1=tempCopyStruct.mem1;
  boolean reload=(mem1 instanceof ReadOnlyMemory || mem1 instanceof ForceNullColumn) && mem1.isDeleted();
  tempCopyStruct.mem1=columns.getAndSetQuick(getPrimaryColumnIndex(columnBase,columnIndex),mem1);
  tempCopyStruct.mem2=columns.getAndSetQuick(getSecondaryColumnIndex(columnBase,columnIndex),tempCopyStruct.mem2);
  tempCopyStruct.top=columnTops.getAndSetQuick(columnBase / 2 + columnIndex,tempCopyStruct.top);
  tempCopyStruct.bitmapIndexReader=indexReaders.getAndSetQuick(columnBase / 2 + columnIndex,tempCopyStruct.bitmapIndexReader);
  if (reload) {
    reloadColumnAt(path,columns,columnTops,indexReaders,columnBase,columnIndex,partitionRowCount);
  }
}
Program: 30778
Project: 30778
Buggy source:
@Test public void testReplaceIndexedWithUnindexedByMonth() throws Exception {
  testReplaceIndexedColWithUnindexed(PartitionBy.MONTH,1000000 * 60 * 5* 24L,2);
}

Fixed version (ground truth):
@Test public void testReplaceIndexedWithUnindexedByMonth() throws Exception {
  testReplaceIndexedColWithUnindexed(PartitionBy.MONTH,1000000 * 60 * 5* 24L,2,false);
}
Program: 30780
Project: 30780
Buggy source:
@Test public void testReplaceIndexedWithUnindexedByByNone() throws Exception {
  testReplaceIndexedColWithUnindexed(PartitionBy.NONE,1000000 * 60 * 5,0);
}

Fixed version (ground truth):
@Test public void testReplaceIndexedWithUnindexedByByNone() throws Exception {
  testReplaceIndexedColWithUnindexed(PartitionBy.NONE,1000000 * 60 * 5,0,false);
}
Program: 30781
Project: 30781
Buggy source:
private void assertNoIndex(TableReaderDataFrameCursor cursor,int columnIndex){
  while (cursor.hasNext()) {
    DataFrame frame=cursor.next();
    try {
      frame.getBitmapIndexReader(columnIndex);
      Assert.fail();
    }
 catch (    CairoException e) {
      Assert.assertTrue(Chars.contains(e.getMessage(),"String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
private void assertNoIndex(TableReaderDataFrameCursor cursor){
  while (cursor.hasNext()) {
    DataFrame frame=cursor.next();
    try {
      frame.getBitmapIndexReader(4);
      Assert.fail();
    }
 catch (    CairoException e) {
      Assert.assertTrue(Chars.contains(e.getMessage(),"String_Node_Str"));
    }
  }
}
Program: 30782
Project: 30782
Buggy source:
@Test public void testReplaceIndexedWithUnindexedByByDay() throws Exception {
  testReplaceIndexedColWithUnindexed(PartitionBy.DAY,1000000 * 60 * 5,3);
}

Fixed version (ground truth):
@Test public void testReplaceIndexedWithUnindexedByByDay() throws Exception {
  testReplaceIndexedColWithUnindexed(PartitionBy.DAY,1000000 * 60 * 5,3,false);
}
Program: 30783
Project: 30783
Buggy source:
@Test public void testReplaceIndexedWithUnindexedByByYear() throws Exception {
  testReplaceIndexedColWithUnindexed(PartitionBy.YEAR,1000000 * 60 * 5* 24L* 10L,2);
}

Fixed version (ground truth):
@Test public void testReplaceIndexedWithUnindexedByByYear() throws Exception {
  testReplaceIndexedColWithUnindexed(PartitionBy.YEAR,1000000 * 60 * 5* 24L* 10L,2,false);
}
Program: 30785
Project: 30785
Buggy source:
public void of(FilesFacade ff,LPSZ name,long pageSize,long size){
  close();
  this.ff=ff;
  boolean exists=ff.exists(name);
  if (!exists) {
    throw CairoException.instance(0).put("String_Node_Str").put(name);
  }
  fd=ff.openRO(name);
  if (fd == -1) {
    throw CairoException.instance(ff.errno()).put("String_Node_Str").put(name);
  }
  this.pageSize=pageSize;
  grow(size);
  LOG.info().$("String_Node_Str").$(name).$("String_Node_Str").$(fd).$(']').$();
}

Fixed version (ground truth):
public void of(FilesFacade ff,LPSZ name,long pageSize,long size){
  close();
  this.ff=ff;
  boolean exists=ff.exists(name);
  if (!exists) {
    throw CairoException.instance(0).put("String_Node_Str").put(name);
  }
  fd=ff.openRO(name);
  if (fd == -1) {
    throw CairoException.instance(ff.errno()).put("String_Node_Str").put(name);
  }
  this.pageSize=pageSize;
  grow(size);
  LOG.info().$("String_Node_Str").$(name).$("String_Node_Str").$(fd).$("String_Node_Str").$(this.size).$(']').$();
}
Program: 30786
Project: 30786
Buggy source:
@Override public void close(){
  super.close();
  if (fd != -1) {
    ff.close(fd);
    LOG.info().$("String_Node_Str").$(fd).$(']').$();
    fd=-1;
  }
}

Fixed version (ground truth):
@Override public void close(){
  super.close();
  if (fd != -1) {
    ff.close(fd);
    LOG.info().$("String_Node_Str").$(fd).$(']').$();
    fd=-1;
    this.size=0;
  }
}