nus-yam/ex-repair huggingface dataset:
Program: 31313
Project: 31313
Buggy source:
@Test @Ignore public void testSelect() throws Exception {
  assertThat("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Test public void testSelect() throws Exception {
  final String expected="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  assertThat(expected,"String_Node_Str");
}
Program: 31314
Project: 31314
Buggy source:
@Override public void toSink(CharSink sink){
}

Fixed version (ground truth):
@Override public void toSink(CharSink sink){
  sink.put('{');
  sink.putQuoted("String_Node_Str").put(':').putQuoted("String_Node_Str").put(',');
  sink.putQuoted("String_Node_Str").put(':').put(functions.size()).put(',');
  sink.putQuoted("String_Node_Str").put(':').put(parentSource);
  sink.put('}');
}
Program: 31315
Project: 31315
Buggy source:
@Override public int getInt(){
  if (nextNull) {
    if (valueColumn.getType() == ColumnType.SYMBOL) {
      return SymbolTable.VALUE_IS_NULL;
    }
    return Numbers.INT_NaN;
  }
  return valueColumn.getInt(getParentRecord());
}

Fixed version (ground truth):
@Override public int getInt(){
  return nextNull ? Numbers.INT_NaN : valueColumn.getInt(getParentRecord());
}
Program: 31316
Project: 31316
Buggy source:
public static int compare(CharSequence l,CharSequence r){
  if (l == r) {
    return 0;
  }
  int ll=l.length();
  int rl=r.length();
  for (int i=0, n=ll < rl ? ll : rl; i < n; i++) {
    int k=l.charAt(i) - r.charAt(i);
    if (k != 0) {
      return k;
    }
  }
  return ll < rl ? -1 : ll == rl ? 0 : 1;
}

Fixed version (ground truth):
public static int compare(CharSequence l,CharSequence r){
  if (l == r) {
    return 0;
  }
  if (l == null) {
    return -1;
  }
  if (r == null) {
    return 1;
  }
  int ll=l.length();
  int rl=r.length();
  if (ll < rl) {
    return -1;
  }
  if (ll > rl) {
    return 1;
  }
  for (int i=0, n=ll < rl ? ll : rl; i < n; i++) {
    int k=l.charAt(i) - r.charAt(i);
    if (k != 0) {
      return k;
    }
  }
  return 0;
}
Program: 31317
Project: 31317
Buggy source:
public void setStorageFacade(StorageFacade storageFacade){
  record.setStorageFacade(storageFacade);
}

Fixed version (ground truth):
public void setStorageFacade(StorageFacade storageFacade){
  record.setStorageFacade(this.storageFacade=storageFacade);
}
Program: 31318
Project: 31318
Buggy source:
@Override public StorageFacade getStorageFacade(){
  return null;
}

Fixed version (ground truth):
@Override public StorageFacade getStorageFacade(){
  return storageFacade;
}
Program: 31319
Project: 31319
Buggy source:
@Override public StorageFacade getStorageFacade(){
  return parentCursor.getStorageFacade();
}

Fixed version (ground truth):
@Override public StorageFacade getStorageFacade(){
  return storageFacade;
}
Program: 31320
Project: 31320
Buggy source:
@Override public RecordCursor prepareCursor(JournalReaderFactory factory,CancellationHandler cancellationHandler) throws JournalException {
  this.parentCursor=this.parentSource.prepareCursor(factory,cancellationHandler);
  final StorageFacade storageFacade=parentCursor.getStorageFacade();
  int n=functions.size();
  for (int i=0; i < n; i++) {
    functions.getQuick(i).setStorageFacade(storageFacade);
  }
  return this;
}

Fixed version (ground truth):
@Override public RecordCursor prepareCursor(JournalReaderFactory factory,CancellationHandler cancellationHandler) throws JournalException {
  this.parentCursor=this.parentSource.prepareCursor(factory,cancellationHandler);
  final StorageFacade storageFacade=parentCursor.getStorageFacade();
  this.storageFacade.prepare(factory,storageFacade);
  int n=functions.size();
  for (int i=0; i < n; i++) {
    functions.getQuick(i).setStorageFacade(storageFacade);
  }
  return this;
}
Program: 31321
Project: 31321
Buggy source:
public AnalyticRecordSource(RecordSource parentSource,ObjList<AnalyticFunction> functions){
  this.parentSource=parentSource;
  this.functions=functions;
  CollectionRecordMetadata funcMetadata=new CollectionRecordMetadata();
  for (int i=0; i < functions.size(); i++) {
    funcMetadata.add(functions.getQuick(i).getMetadata());
  }
  this.metadata=new SplitRecordMetadata(parentSource.getMetadata(),funcMetadata);
  this.record=new AnalyticRecord(this.metadata,parentSource.getMetadata().getColumnCount(),functions);
}

Fixed version (ground truth):
public AnalyticRecordSource(RecordSource parentSource,ObjList<AnalyticFunction> functions){
  this.parentSource=parentSource;
  this.functions=functions;
  CollectionRecordMetadata funcMetadata=new CollectionRecordMetadata();
  for (int i=0; i < functions.size(); i++) {
    funcMetadata.add(functions.getQuick(i).getMetadata());
  }
  this.metadata=new SplitRecordMetadata(parentSource.getMetadata(),funcMetadata);
  int split=parentSource.getMetadata().getColumnCount();
  this.record=new AnalyticRecord(this.metadata,split,functions);
  this.storageFacade=new AnalyticRecordStorageFacade(this.metadata,split,functions);
}
Program: 31322
Project: 31322
Buggy source:
@Override public StorageFacade getStorageFacade(){
  return records.getStorageFacade();
}

Fixed version (ground truth):
@Override public StorageFacade getStorageFacade(){
  return storageFacade;
}
Program: 31323
Project: 31323
Buggy source:
@Override public RecordCursor prepareCursor(JournalReaderFactory factory,CancellationHandler cancellationHandler) throws JournalException {
  RecordCursor cursor=this.parentSource.prepareCursor(factory,cancellationHandler);
  final StorageFacade storageFacade=cursor.getStorageFacade();
  records.setStorageFacade(storageFacade);
  int n=functions.size();
  for (int i=0; i < n; i++) {
    functions.getQuick(i).setStorageFacade(storageFacade);
  }
  long rowid=-1;
  while (cursor.hasNext()) {
    Record record=cursor.next();
    rowid=records.append(record,rowid);
    for (int i=0; i < n; i++) {
      AnalyticFunction f=functions.getQuick(i);
      if (f instanceof TwoPassAnalyticFunction) {
        ((TwoPassAnalyticFunction)f).addRecord(record,rowid);
      }
    }
  }
  for (int i=0; i < n; i++) {
    AnalyticFunction f=functions.getQuick(i);
    if (f instanceof TwoPassAnalyticFunction) {
      ((TwoPassAnalyticFunction)f).prepare(records);
    }
  }
  records.toTop();
  return this;
}

Fixed version (ground truth):
@Override public RecordCursor prepareCursor(JournalReaderFactory factory,CancellationHandler cancellationHandler) throws JournalException {
  RecordCursor cursor=this.parentSource.prepareCursor(factory,cancellationHandler);
  final StorageFacade storageFacade=cursor.getStorageFacade();
  records.setStorageFacade(storageFacade);
  this.storageFacade.prepare(factory,storageFacade);
  int n=functions.size();
  for (int i=0; i < n; i++) {
    functions.getQuick(i).setStorageFacade(storageFacade);
  }
  long rowid=-1;
  while (cursor.hasNext()) {
    Record record=cursor.next();
    rowid=records.append(record,rowid);
    for (int i=0; i < n; i++) {
      AnalyticFunction f=functions.getQuick(i);
      if (f instanceof TwoPassAnalyticFunction) {
        ((TwoPassAnalyticFunction)f).addRecord(record,rowid);
      }
    }
  }
  for (int i=0; i < n; i++) {
    AnalyticFunction f=functions.getQuick(i);
    if (f instanceof TwoPassAnalyticFunction) {
      ((TwoPassAnalyticFunction)f).prepare(records);
    }
  }
  records.toTop();
  return this;
}
Program: 31324
Project: 31324
Buggy source:
@Override public boolean supportsRowIdAccess(){
  return true;
}

Fixed version (ground truth):
@Override public boolean supportsRowIdAccess(){
  return false;
}
Program: 31325
Project: 31325
Buggy source:
@Override public Record getByRowId(long rowId){
  return records.getByRowId(rowId);
}

Fixed version (ground truth):
@Override public Record getByRowId(long rowId){
  return null;
}
Program: 31326
Project: 31326
Buggy source:
public CachingAnalyticRecordSource(int pageSize,RecordSource parentSource,ObjList<AnalyticFunction> functions){
  this.parentSource=parentSource;
  this.records=new RecordList(parentSource.getMetadata(),pageSize);
  this.functions=functions;
  CollectionRecordMetadata funcMetadata=new CollectionRecordMetadata();
  for (int i=0; i < functions.size(); i++) {
    funcMetadata.add(functions.getQuick(i).getMetadata());
  }
  this.metadata=new SplitRecordMetadata(parentSource.getMetadata(),funcMetadata);
  this.record=new AnalyticRecord(this.metadata,parentSource.getMetadata().getColumnCount(),functions);
}

Fixed version (ground truth):
public CachingAnalyticRecordSource(int pageSize,RecordSource parentSource,ObjList<AnalyticFunction> functions){
  this.parentSource=parentSource;
  this.records=new RecordList(parentSource.getMetadata(),pageSize);
  this.functions=functions;
  CollectionRecordMetadata funcMetadata=new CollectionRecordMetadata();
  for (int i=0; i < functions.size(); i++) {
    funcMetadata.add(functions.getQuick(i).getMetadata());
  }
  this.metadata=new SplitRecordMetadata(parentSource.getMetadata(),funcMetadata);
  int split=parentSource.getMetadata().getColumnCount();
  this.record=new AnalyticRecord(this.metadata,split,functions);
  this.storageFacade=new AnalyticRecordStorageFacade(metadata,split,functions);
}
Program: 31327
Project: 31327
Buggy source:
@Override public int getInt(){
  return next.getInt(columnIndex);
}

Fixed version (ground truth):
@Override public int getInt(){
  return next == NullRecord.INSTANCE && metadata.getType() == ColumnType.SYMBOL ? SymbolTable.VALUE_IS_NULL : next.getInt(columnIndex);
}
Program: 31328
Project: 31328
Buggy source:
@Override public int getInt(){
  return nextNull ? Numbers.INT_NaN : Unsafe.getUnsafe().getInt(bufPtr);
}

Fixed version (ground truth):
@Override public int getInt(){
  return nextNull ? (valueType == ColumnType.SYMBOL ? SymbolTable.VALUE_IS_NULL : Numbers.INT_NaN) : Unsafe.getUnsafe().getInt(bufPtr);
}
Program: 31329
Project: 31329
Buggy source:
public AbstractNextRowAnalyticFunction(int pageSize,RecordMetadata parentMetadata,String columnName){
  this.pages=new MemoryPages(pageSize);
  this.columnIndex=parentMetadata.getColumnIndex(columnName);
  this.metadata=new RecordColumnMetadataImpl(columnName,parentMetadata.getColumnQuick(this.columnIndex).getType());
}

Fixed version (ground truth):
public AbstractNextRowAnalyticFunction(int pageSize,RecordMetadata parentMetadata,String columnName,String alias){
  this.pages=new MemoryPages(pageSize);
  this.columnIndex=parentMetadata.getColumnIndex(columnName);
  this.metadata=new RecordColumnMetadataImpl(alias == null ? columnName : alias,parentMetadata.getColumnQuick(this.columnIndex).getType());
}
Program: 31330
Project: 31330
Buggy source:
public NextRowAnalyticFunction(int pageSize,RecordMetadata parentMetadata,@Transient ObjHashSet<String> partitionBy,String columnName){
  super(pageSize,parentMetadata,columnName);
  this.map=new MultiMap(pageSize,parentMetadata,partitionBy,valueColumn,null);
  this.indices=new IntList(partitionBy.size());
  this.types=new ObjList<>(partitionBy.size());
  for (int i=0, n=partitionBy.size(); i < n; i++) {
    int index=parentMetadata.getColumnIndexQuiet(partitionBy.get(i));
    indices.add(index);
    types.add(parentMetadata.getColumn(index).getType());
  }
}

Fixed version (ground truth):
public NextRowAnalyticFunction(int pageSize,RecordMetadata parentMetadata,@Transient ObjHashSet<String> partitionBy,String columnName,String alias){
  super(pageSize,parentMetadata,columnName,alias);
  this.map=new MultiMap(pageSize,parentMetadata,partitionBy,valueColumn,null);
  this.indices=new IntList(partitionBy.size());
  this.types=new ObjList<>(partitionBy.size());
  for (int i=0, n=partitionBy.size(); i < n; i++) {
    int index=parentMetadata.getColumnIndexQuiet(partitionBy.get(i));
    indices.add(index);
    types.add(parentMetadata.getColumn(index).getType());
  }
}
Program: 31331
Project: 31331
Buggy source:
@Override public AnalyticFunction newInstance(ServerConfiguration configuration,RecordMetadata metadata,AnalyticColumn column) throws ParserException {
  ExprNode ast=column.getAst();
  if (ast.paramCount > 1) {
    throw QueryError.$(ast.position,"String_Node_Str");
  }
  if (ast.paramCount < 1) {
    throw QueryError.$(ast.position,"String_Node_Str");
  }
  if (metadata.getColumnIndexQuiet(ast.rhs.token) == -1) {
    throw QueryError.invalidColumn(ast.rhs.position,ast.rhs.token);
  }
  ObjList<ExprNode> pby=column.getPartitionBy();
  int n=pby.size();
  if (n > 0) {
    ObjHashSet<String> partitionBy=AnalyticUtils.HASH_SET.get();
    partitionBy.clear();
    for (int i=0; i < n; i++) {
      ExprNode node=pby.getQuick(i);
      if (node.type != ExprNode.NodeType.LITERAL) {
        throw QueryError.$(node.position,"String_Node_Str");
      }
      if (metadata.getColumnIndexQuiet(node.token) == -1) {
        throw QueryError.invalidColumn(node.position,node.token);
      }
      partitionBy.add(node.token);
    }
    return new NextRowAnalyticFunction(configuration.getDbAnalyticFuncPage(),metadata,partitionBy,ast.rhs.token);
  }
 else {
    return new NextRowNonPartAnalyticFunction(configuration.getDbAnalyticFuncPage(),metadata,ast.rhs.token);
  }
}

Fixed version (ground truth):
@Override public AnalyticFunction newInstance(ServerConfiguration configuration,RecordMetadata metadata,AnalyticColumn column) throws ParserException {
  ExprNode ast=column.getAst();
  if (ast.paramCount > 1) {
    throw QueryError.$(ast.position,"String_Node_Str");
  }
  if (ast.paramCount < 1) {
    throw QueryError.$(ast.position,"String_Node_Str");
  }
  if (metadata.getColumnIndexQuiet(ast.rhs.token) == -1) {
    throw QueryError.invalidColumn(ast.rhs.position,ast.rhs.token);
  }
  ObjList<ExprNode> pby=column.getPartitionBy();
  int n=pby.size();
  if (n > 0) {
    ObjHashSet<String> partitionBy=AnalyticUtils.HASH_SET.get();
    partitionBy.clear();
    for (int i=0; i < n; i++) {
      ExprNode node=pby.getQuick(i);
      if (node.type != ExprNode.NodeType.LITERAL) {
        throw QueryError.$(node.position,"String_Node_Str");
      }
      if (metadata.getColumnIndexQuiet(node.token) == -1) {
        throw QueryError.invalidColumn(node.position,node.token);
      }
      partitionBy.add(node.token);
    }
    return new NextRowAnalyticFunction(configuration.getDbAnalyticFuncPage(),metadata,partitionBy,ast.rhs.token,column.getAlias());
  }
 else {
    return new NextRowNonPartAnalyticFunction(configuration.getDbAnalyticFuncPage(),metadata,ast.rhs.token,column.getAlias());
  }
}
Program: 31332
Project: 31332
Buggy source:
public NextRowNonPartAnalyticFunction(int pageSize,RecordMetadata parentMetadata,String columnName){
  super(pageSize,parentMetadata,columnName);
}

Fixed version (ground truth):
public NextRowNonPartAnalyticFunction(int pageSize,RecordMetadata parentMetadata,String columnName,String alias){
  super(pageSize,parentMetadata,columnName,alias);
}
Program: 31333
Project: 31333
Buggy source:
@Override public CharSequence getFlyweightStrB(){
  return null;
}

Fixed version (ground truth):
@Override public CharSequence getFlyweightStrB(){
  throw new UnsupportedOperationException();
}
Program: 31334
Project: 31334
Buggy source:
@Override public long getBinLen(){
  return 0;
}

Fixed version (ground truth):
@Override public long getBinLen(){
  throw new UnsupportedOperationException();
}
Program: 31335
Project: 31335
Buggy source:
public AbstractPrevRowAnalyticFunction(int pageSize,RecordMetadata parentMetadata,@Transient ObjHashSet<String> partitionBy,String columnName){
  this.valueIndex=parentMetadata.getColumnIndex(columnName);
  RecordColumnMetadata m=parentMetadata.getColumn(columnName);
  this.valueType=m.getType();
  ObjList<RecordColumnMetadata> valueColumns=new ObjList<>(1);
  valueColumns.add(m);
  this.map=new MultiMap(pageSize,parentMetadata,partitionBy,valueColumns,null);
  this.indices=new IntList(partitionBy.size());
  this.types=new ObjList<>(partitionBy.size());
  for (int i=0, n=partitionBy.size(); i < n; i++) {
    int index=parentMetadata.getColumnIndexQuiet(partitionBy.get(i));
    indices.add(index);
    types.add(parentMetadata.getColumn(index).getType());
  }
  this.bufPtr=Unsafe.getUnsafe().allocateMemory(8);
  this.valueMetadata=new RecordColumnMetadataImpl(columnName,valueType);
}

Fixed version (ground truth):
public AbstractPrevRowAnalyticFunction(RecordMetadata parentMetadata,String columnName,String alias){
  this.valueIndex=parentMetadata.getColumnIndex(columnName);
  RecordColumnMetadata m=parentMetadata.getColumn(columnName);
  this.valueType=m.getType();
  this.bufPtr=Unsafe.getUnsafe().allocateMemory(8);
  this.valueMetadata=new RecordColumnMetadataImpl(alias == null ? columnName : alias,valueType);
}
Program: 31336
Project: 31336
Buggy source:
@Override public CharSequence getFlyweightStr(){
  return null;
}

Fixed version (ground truth):
@Override public CharSequence getFlyweightStr(){
  throw new UnsupportedOperationException();
}
Program: 31337
Project: 31337
Buggy source:
@Override public CharSequence getStr(){
  return null;
}

Fixed version (ground truth):
@Override public CharSequence getStr(){
  throw new UnsupportedOperationException();
}
Program: 31338
Project: 31338
Buggy source:
@Override public int getStrLen(){
  return 0;
}

Fixed version (ground truth):
@Override public int getStrLen(){
  throw new UnsupportedOperationException();
}
Program: 31339
Project: 31339
Buggy source:
@Override public DirectInputStream getBin(){
  return null;
}

Fixed version (ground truth):
@Override public DirectInputStream getBin(){
  throw new UnsupportedOperationException();
}
Program: 31340
Project: 31340
Buggy source:
@Override public void reset(){
  map.clear();
  nextNull=true;
}

Fixed version (ground truth):
@Override public void reset(){
  nextNull=true;
}
Program: 31341
Project: 31341
Buggy source:
@Override public void close() throws IOException {
  if (closed) {
    return;
  }
  Unsafe.getUnsafe().freeMemory(bufPtr);
  Misc.free(map);
  closed=true;
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  if (closed) {
    return;
  }
  Unsafe.getUnsafe().freeMemory(bufPtr);
  closed=true;
}
Program: 31342
Project: 31342
Buggy source:
@Override public void close(){
  if (open.compareAndSet(true,false)) {
    Misc.free(channel);
    Misc.free(request);
    Misc.free(response);
    Misc.free(map);
  }
}

Fixed version (ground truth):
@Override public void close(){
  if (open.compareAndSet(true,false)) {
    Misc.free(map);
    Misc.free(channel);
    Misc.free(request);
    Misc.free(response);
  }
}
Program: 31343
Project: 31343
Buggy source:
public void parse(){
  map.clear();
  Misc.urlDecode(address,wptr,map,csPool);
  for (int i=0, n=map.size(); i < n; i++) {
    map.keys().getQuick(i);
    ImportedColumnMetadata m=mPool.next();
    m.name=map.keys().getQuick(i);
    m.type=ImportedColumnType.valueOf(map.get(m.name).toString());
    metadata.add(m);
  }
}

Fixed version (ground truth):
public void parse(){
  map.clear();
  Misc.urlDecode(address,wptr,map,csPool);
  for (int i=0, n=map.size(); i < n; i++) {
    map.keys().getQuick(i);
    CharSequence name=map.keys().getQuick(i);
    int ordinal=ImportedColumnTypeUtil.LOOKUP.get(map.get(name));
    if (ordinal > -1) {
      ImportedColumnMetadata m=mPool.next();
      m.name=name;
      m.type=ImportedColumnType.values()[ordinal];
      metadata.add(m);
    }
  }
}
Program: 31344
Project: 31344
Buggy source:
RecordCursor prepareCursor(JournalReaderFactory factory,CancellationHandler cancellationHandler) throws JournalException ;

Fixed version (ground truth):
RecordCursor prepareCursor(JournalReaderFactory factory) throws JournalException ;
Program: 31345
Project: 31345
Buggy source:
@Test public void testConcurrentImport() throws Exception {
  HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  final CyclicBarrier barrier=new CyclicBarrier(2);
  final CountDownLatch latch=new CountDownLatch(2);
  try {
    new Thread(new Runnable(){
      @Override public void run(){
        try {
          barrier.await();
          Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null));
          latch.countDown();
        }
 catch (        Exception e) {
          Assert.fail(e.getMessage());
        }
      }
    }
).start();
    new Thread(new Runnable(){
      @Override public void run(){
        try {
          barrier.await();
          Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null));
          latch.countDown();
        }
 catch (        Exception e) {
          Assert.fail(e.getMessage());
        }
      }
    }
).start();
    latch.await();
    try (Journal r=factory.reader("String_Node_Str")){
      Assert.assertEquals("String_Node_Str",129,r.size());
    }
     try (Journal r=factory.reader("String_Node_Str")){
      Assert.assertEquals("String_Node_Str",129,r.size());
    }
   }
  finally {
    server.halt();
  }
}

Fixed version (ground truth):
@Test public void testConcurrentImport() throws Exception {
  HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  final CyclicBarrier barrier=new CyclicBarrier(2);
  final CountDownLatch latch=new CountDownLatch(2);
  try {
    new Thread(new Runnable(){
      @Override public void run(){
        try {
          barrier.await();
          Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,null));
          latch.countDown();
        }
 catch (        Exception e) {
          Assert.fail(e.getMessage());
        }
      }
    }
).start();
    new Thread(new Runnable(){
      @Override public void run(){
        try {
          barrier.await();
          Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,null));
          latch.countDown();
        }
 catch (        Exception e) {
          Assert.fail(e.getMessage());
        }
      }
    }
).start();
    latch.await();
    try (Journal r=factory.reader("String_Node_Str")){
      Assert.assertEquals("String_Node_Str",129,r.size());
    }
     try (Journal r=factory.reader("String_Node_Str")){
      Assert.assertEquals("String_Node_Str",129,r.size());
    }
   }
  finally {
    server.halt();
  }
}
Program: 31346
Project: 31346
Buggy source:
@Test public void testImportUnknownFormat() throws Exception {
  HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  StringBuilder response=new StringBuilder();
  try {
    Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",response));
    TestUtils.assertEquals("String_Node_Str",response);
  }
  finally {
    server.halt();
  }
}

Fixed version (ground truth):
@Test public void testImportUnknownFormat() throws Exception {
  HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  StringBuilder response=new StringBuilder();
  try {
    Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,response));
    TestUtils.assertEquals("String_Node_Str",response);
  }
  finally {
    server.halt();
  }
}
Program: 31347
Project: 31347
Buggy source:
@Test public void testImportIntoBusyJournal2() throws Exception {
  JournalFactory f=new JournalFactory(factory.getConfiguration().getJournalBase().getAbsolutePath());
  try (JournalWriter w=f.writer(new JournalStructure("String_Node_Str").$int("String_Node_Str").$int("String_Node_Str").$())){
    JournalEntryWriter ew=w.entryWriter();
    ew.putInt(0,3);
    ew.putInt(1,30);
    ew.append();
    w.commit();
    HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
        put("String_Node_Str",new ImportHandler(factory));
      }
    }
);
    server.start();
    StringBuilder response=new StringBuilder();
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",response));
      Assert.assertTrue(Chars.startsWith(response,"String_Node_Str"));
    }
  finally {
      server.halt();
    }
  }
 }

Fixed version (ground truth):
@Test public void testImportIntoBusyJournal2() throws Exception {
  JournalFactory f=new JournalFactory(factory.getConfiguration().getJournalBase().getAbsolutePath());
  try (JournalWriter w=f.writer(new JournalStructure("String_Node_Str").$int("String_Node_Str").$int("String_Node_Str").$())){
    JournalEntryWriter ew=w.entryWriter();
    ew.putInt(0,3);
    ew.putInt(1,30);
    ew.append();
    w.commit();
    HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
        put("String_Node_Str",new ImportHandler(factory));
      }
    }
);
    server.start();
    StringBuilder response=new StringBuilder();
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,response));
      Assert.assertTrue(Chars.startsWith(response,"String_Node_Str"));
    }
  finally {
      server.halt();
    }
  }
 }
Program: 31348
Project: 31348
Buggy source:
@Test public void testImportIntoBusyJournal() throws Exception {
  try (JournalWriter w=factory.writer(new JournalStructure("String_Node_Str").$int("String_Node_Str").$())){
    HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
        put("String_Node_Str",new ImportHandler(factory));
      }
    }
);
    server.start();
    StringBuilder response=new StringBuilder();
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",response));
      TestUtils.assertEquals("String_Node_Str",response);
    }
  finally {
      server.halt();
    }
  }
 }

Fixed version (ground truth):
@Test public void testImportIntoBusyJournal() throws Exception {
  try (JournalWriter w=factory.writer(new JournalStructure("String_Node_Str").$int("String_Node_Str").$())){
    HttpServer server=new HttpServer(new ServerConfiguration(),new SimpleUrlMatcher(){
{
        put("String_Node_Str",new ImportHandler(factory));
      }
    }
);
    server.start();
    StringBuilder response=new StringBuilder();
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,response));
      TestUtils.assertEquals("String_Node_Str",response);
    }
  finally {
      server.halt();
    }
  }
 }
Program: 31349
Project: 31349
Buggy source:
private void assertRanges(ServerConfiguration configuration,HttpServer server) throws IOException {
  server.start();
  try {
    HttpTestUtils.upload("String_Node_Str","String_Node_Str",null);
    File out=new File(temp.getRoot(),"String_Node_Str");
    HttpGet get=new HttpGet("String_Node_Str");
    get.addHeader("String_Node_Str","String_Node_Str");
    try (CloseableHttpClient client=HttpClients.createDefault()){
      try (CloseableHttpResponse r=client.execute(get)){
        Assert.assertEquals(416,r.getStatusLine().getStatusCode());
      }
       File f=resourceFile("String_Node_Str");
      long size;
      try (FileInputStream is=new FileInputStream(f)){
        size=is.available();
      }
       long part=size / 2;
      try (FileOutputStream fos=new FileOutputStream(out)){
        get.addHeader("String_Node_Str","String_Node_Str" + part);
        try (CloseableHttpResponse r=client.execute(get)){
          HttpTestUtils.copy(r.getEntity().getContent(),fos);
          Assert.assertEquals(206,r.getStatusLine().getStatusCode());
        }
         get.addHeader("String_Node_Str","String_Node_Str" + part + "String_Node_Str");
        try (CloseableHttpResponse r=client.execute(get)){
          HttpTestUtils.copy(r.getEntity().getContent(),fos);
          Assert.assertEquals(206,r.getStatusLine().getStatusCode());
        }
       }
       TestUtils.assertEquals(f,out);
    }
   }
  finally {
    server.halt();
    new MimeTypes(configuration.getMimeTypes()).close();
  }
}

Fixed version (ground truth):
private void assertRanges(ServerConfiguration configuration,HttpServer server) throws IOException {
  server.start();
  try {
    HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,null);
    File out=new File(temp.getRoot(),"String_Node_Str");
    HttpGet get=new HttpGet("String_Node_Str");
    get.addHeader("String_Node_Str","String_Node_Str");
    try (CloseableHttpClient client=HttpClients.createDefault()){
      try (CloseableHttpResponse r=client.execute(get)){
        Assert.assertEquals(416,r.getStatusLine().getStatusCode());
      }
       File f=resourceFile("String_Node_Str");
      long size;
      try (FileInputStream is=new FileInputStream(f)){
        size=is.available();
      }
       long part=size / 2;
      try (FileOutputStream fos=new FileOutputStream(out)){
        get.addHeader("String_Node_Str","String_Node_Str" + part);
        try (CloseableHttpResponse r=client.execute(get)){
          HttpTestUtils.copy(r.getEntity().getContent(),fos);
          Assert.assertEquals(206,r.getStatusLine().getStatusCode());
        }
         get.addHeader("String_Node_Str","String_Node_Str" + part + "String_Node_Str");
        try (CloseableHttpResponse r=client.execute(get)){
          HttpTestUtils.copy(r.getEntity().getContent(),fos);
          Assert.assertEquals(206,r.getStatusLine().getStatusCode());
        }
       }
       TestUtils.assertEquals(f,out);
    }
   }
  finally {
    server.halt();
    new MimeTypes(configuration.getMimeTypes()).close();
  }
}
Program: 31350
Project: 31350
Buggy source:
@Test public void testImportAppend() throws Exception {
  final ServerConfiguration configuration=new ServerConfiguration();
  HttpServer server=new HttpServer(configuration,new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  try (JournalCachingFactory f=new JournalCachingFactory(factory.getConfiguration())){
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null));
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null));
      StringSink sink=new StringSink();
      RecordSourcePrinter printer=new RecordSourcePrinter(sink);
      QueryCompiler qc=new QueryCompiler(configuration);
      printer.printCursor(qc.compile(f,"String_Node_Str"));
      TestUtils.assertEquals("String_Node_Str",sink);
    }
  finally {
      server.halt();
    }
  }
 }

Fixed version (ground truth):
@Test public void testImportAppend() throws Exception {
  final ServerConfiguration configuration=new ServerConfiguration();
  HttpServer server=new HttpServer(configuration,new SimpleUrlMatcher(){
{
      put("String_Node_Str",new ImportHandler(factory));
    }
  }
);
  server.start();
  try (JournalCachingFactory f=new JournalCachingFactory(factory.getConfiguration())){
    try {
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,null));
      Assert.assertEquals(200,HttpTestUtils.upload("String_Node_Str","String_Node_Str",null,null));
      StringSink sink=new StringSink();
      RecordSourcePrinter printer=new RecordSourcePrinter(sink);
      QueryCompiler qc=new QueryCompiler(configuration);
      printer.printCursor(qc.compile(f,"String_Node_Str"));
      TestUtils.assertEquals("String_Node_Str",sink);
    }
  finally {
      server.halt();
    }
  }
 }
Program: 31351
Project: 31351
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public RecordCursor prepareCursor(JournalReaderFactory factory,CancellationHandler cancellationHandler) throws JournalException {
  return delegate.prepareCursor(factory,cancellationHandler);
}

Fixed version (ground truth):
@Override public RecordCursor prepareCursor(JournalReaderFactory factory) throws JournalException {
  return delegate.prepareCursor(factory);
}
Program: 31352
Project: 31352
Buggy source:
private static int upload(File file,String url,StringBuilder response) throws IOException {
  HttpPost post=new HttpPost(url);
  try (CloseableHttpClient client=HttpClients.createDefault()){
    MultipartEntityBuilder b=MultipartEntityBuilder.create();
    b.addPart("String_Node_Str",new FileBody(file));
    post.setEntity(b.build());
    HttpResponse r=client.execute(post);
    if (response != null) {
      InputStream is=r.getEntity().getContent();
      int n;
      while ((n=is.read()) > 0) {
        response.append((char)n);
      }
      is.close();
    }
    return r.getStatusLine().getStatusCode();
  }
 }

Fixed version (ground truth):
private static int upload(File file,String url,String schema,StringBuilder response) throws IOException {
  HttpPost post=new HttpPost(url);
  try (CloseableHttpClient client=HttpClients.createDefault()){
    MultipartEntityBuilder b=MultipartEntityBuilder.create();
    if (schema != null) {
      b.addPart("String_Node_Str",new StringBody(schema,ContentType.TEXT_PLAIN));
    }
    b.addPart("String_Node_Str",new FileBody(file));
    post.setEntity(b.build());
    HttpResponse r=client.execute(post);
    if (response != null) {
      InputStream is=r.getEntity().getContent();
      int n;
      while ((n=is.read()) > 0) {
        response.append((char)n);
      }
      is.close();
    }
    return r.getStatusLine().getStatusCode();
  }
 }
Program: 31353
Project: 31353
Buggy source:
public void of(CharSequence that){
  this.underlying=that;
  int dot=Chars.indexOf(that,'.');
  if (dot == -1) {
    alias.of(null,0,0);
    name.of(that,0,that.length());
  }
 else {
    alias.of(that,0,dot);
    name.of(that,dot + 1,that.length() - dot - 1);
  }
}

Fixed version (ground truth):
private void of(CharSequence that){
  this.underlying=that;
  int dot=Chars.indexOf(that,'.');
  if (dot == -1) {
    alias.of(null,0,0);
    name.of(that,0,that.length());
  }
 else {
    alias.of(that,0,dot);
    name.of(that,dot + 1,that.length() - dot - 1);
  }
}
Program: 31354
Project: 31354
Buggy source:
@Override public int getColumnIndexQuiet(CharSequence name){
  int index=columnIndexLookup.get(name);
  if (index > -1) {
    return index;
  }
  if (getAlias() == null) {
    return -1;
  }
  columnName.of(name);
  if (columnName.alias().length() == 0) {
    return -1;
  }
  if (Chars.equals(columnName.alias(),getAlias())) {
    return columnIndexLookup.get(columnName.name());
  }
  return -1;
}

Fixed version (ground truth):
@Override public int getColumnIndexQuiet(CharSequence name){
  int index=columnIndexLookup.get(name);
  if (index > -1) {
    return index;
  }
  if (getAlias() == null) {
    return -1;
  }
  ColumnName columnName=ColumnName.singleton(name);
  if (columnName.alias().length() == 0) {
    return -1;
  }
  if (Chars.equals(columnName.alias(),getAlias())) {
    return columnIndexLookup.get(columnName.name());
  }
  return -1;
}
Program: 31355
Project: 31355
Buggy source:
@Override public void toSink(CharSink sink){
  sink.put('{');
  sink.putQuoted("String_Node_Str").put(':').putQuoted("String_Node_Str").put(',');
  sink.putQuoted("String_Node_Str").put(':').put('"').put(filterNode).put('"');
  sink.put('}');
}

Fixed version (ground truth):
@Override public void toSink(CharSink sink){
  sink.put('{');
  sink.putQuoted("String_Node_Str").put(':').putQuoted("String_Node_Str").put(',');
  sink.putQuoted("String_Node_Str").put(':').put(delegate).put(',');
  sink.putQuoted("String_Node_Str").put(':').put('"').put(filterNode).put('"');
  sink.put('}');
}
Program: 31356
Project: 31356
Buggy source:
@Override public int getColumnIndexQuiet(CharSequence name){
  return nameIndex.get(name);
}

Fixed version (ground truth):
@Override public int getColumnIndexQuiet(CharSequence name){
  int index=nameIndex.get(name);
  if (index != -1) {
    return index;
  }
  String alias=getAlias();
  if (alias == null) {
    return -1;
  }
  ColumnName columnName=ColumnName.singleton(name);
  if (Chars.equalsNc(alias,columnName.alias())) {
    return nameIndex.get(columnName.name());
  }
  return -1;
}
Program: 31357
Project: 31357
Buggy source:
@Override public void visit(ExprNode node) throws ParserException {
  if (node.type == ExprNode.NodeType.LITERAL) {
    match=match && names.contains(node.token);
  }
}

Fixed version (ground truth):
@Override public void visit(ExprNode node) throws ParserException {
  if (node.type == ExprNode.NodeType.LITERAL) {
    if (match) {
      if (names.contains(node.token)) {
        return;
      }
      if (alias == null) {
        match=false;
        return;
      }
      ColumnName columnName=ColumnName.singleton(node.token);
      if (columnName.alias() == null) {
        match=false;
        return;
      }
      if (Chars.equals(columnName.alias(),alias) && names.contains(columnName.name())) {
        node.token=columnName.name().toString();
        return;
      }
      match=false;
    }
  }
}
Program: 31358
Project: 31358
Buggy source:
@Override public void toSink(CharSink sink){
  sink.put('{');
  sink.putQuoted("String_Node_Str").put(':').putQuoted("String_Node_Str").put(',');
  sink.putQuoted("String_Node_Str").put(':').put(master).put(',');
  sink.putQuoted("String_Node_Str").put(':').put(slave).put(',');
  sink.putQuoted("String_Node_Str").put(':');
  sink.put('[');
  for (int i=0, n=masterColumns.size(); i < n; i++) {
    if (i > 0) {
      sink.put(',');
    }
    sink.put(masterColumns.getQuick(i).getName());
  }
  sink.put(']').put(',');
  sink.put('[');
  for (int i=0, n=slaveColumns.size(); i < n; i++) {
    if (i > 0) {
      sink.put(',');
    }
    sink.put(slaveColumns.getQuick(i).getName());
  }
  sink.put(']');
  sink.put('}');
}

Fixed version (ground truth):
@Override public void toSink(CharSink sink){
  sink.put('{');
  sink.putQuoted("String_Node_Str").put(':').putQuoted("String_Node_Str").put(',');
  sink.putQuoted("String_Node_Str").put(':').put(master).put(',');
  sink.putQuoted("String_Node_Str").put(':').put(slave).put(',');
  sink.putQuoted("String_Node_Str").put(':').put('[');
  sink.put('[');
  for (int i=0, n=masterColumns.size(); i < n; i++) {
    if (i > 0) {
      sink.put(',');
    }
    sink.putQuoted(masterColumns.getQuick(i).getName());
  }
  sink.put(']').put(',');
  sink.put('[');
  for (int i=0, n=slaveColumns.size(); i < n; i++) {
    if (i > 0) {
      sink.put(',');
    }
    sink.putQuoted(slaveColumns.getQuick(i).getName());
  }
  sink.put("String_Node_Str");
}
Program: 31359
Project: 31359
Buggy source:
private RecordSource compile(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  RecordSource rs;
  if (model.getJoinModels().size() > 1) {
    optimiseJoins(model,factory);
    rs=compileJoins(model,factory);
  }
 else {
    rs=compileSingleOrSubQuery(model,factory);
  }
  return limit(order(selectColumns(rs,model),model),model);
}

Fixed version (ground truth):
private RecordSource compile(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  RecordSource rs;
  if (model.getJoinModels().size() > 1) {
    rs=compileJoins(model,factory);
  }
 else   if (model.getJournalName() != null) {
    rs=compileJournal(model,factory);
  }
 else {
    rs=compileSubQuery(model,factory);
  }
  return limit(order(selectColumns(rs,model),model),model);
}
Program: 31360
Project: 31360
Buggy source:
private RecordSource order(RecordSource rs,QueryModel model) throws ParserException {
  ObjList<ExprNode> orderBy=model.getOrderBy();
  IntList orderByDirection=model.getOrderByDirection();
  IntList indices=model.getOrderColumnIndices();
  int n=orderBy.size();
  if (n > 0) {
    RecordMetadata m=rs.getMetadata();
    for (int i=0; i < n; i++) {
      ExprNode tok=orderBy.getQuick(i);
      int index=m.getColumnIndexQuiet(tok.token);
      if (index == -1) {
        throw QueryError.invalidColumn(tok.position,tok.token);
      }
      index++;
      if (orderByDirection.getQuick(i) == QueryModel.ORDER_DIRECTION_DESCENDING) {
        index=-index;
      }
      indices.add(index);
    }
    return new RBTreeSortedRecordSource(rs,cc.compile(RBTreeSortedRecordSource.class,m,indices));
  }
 else {
    return rs;
  }
}

Fixed version (ground truth):
private RecordSource order(RecordSource rs,QueryModel model) throws ParserException {
  ObjList<ExprNode> orderBy=model.getOrderBy();
  int n=orderBy.size();
  if (n > 0) {
    IntList orderByDirection=model.getOrderByDirection();
    IntList indices=model.getOrderColumnIndices();
    RecordMetadata m=rs.getMetadata();
    for (int i=0; i < n; i++) {
      ExprNode tok=orderBy.getQuick(i);
      int index=m.getColumnIndexQuiet(tok.token);
      if (index == -1) {
        throw QueryError.invalidColumn(tok.position,tok.token);
      }
      index++;
      if (orderByDirection.getQuick(i) == QueryModel.ORDER_DIRECTION_DESCENDING) {
        index=-index;
      }
      indices.add(index);
    }
    return new RBTreeSortedRecordSource(rs,cc.compile(RBTreeSortedRecordSource.class,m,indices));
  }
 else {
    return rs;
  }
}
Program: 31361
Project: 31361
Buggy source:
private RecordSource compileJoins(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  ObjList<QueryModel> joinModels=model.getJoinModels();
  IntList ordered=model.getOrderedJoinModels();
  RecordSource master=null;
  boolean collectColumnNameFrequency=model.getColumns().size() > 0;
  for (int i=0, n=ordered.size(); i < n; i++) {
    int index=ordered.getQuick(i);
    QueryModel m=joinModels.getQuick(index);
    RecordSource slave=m.getRecordSource();
    if (slave == null) {
      slave=compileSingleOrSubQuery(m,factory);
      if (m.getAlias() != null) {
        slave.getMetadata().setAlias(m.getAlias().token);
      }
    }
    if (collectColumnNameFrequency) {
      collectColumnNameFrequency(model,slave);
    }
    if (master == null) {
      master=slave;
    }
 else {
switch (m.getJoinType()) {
case CROSS:
        master=new CrossJoinRecordSource(master,slave);
      break;
case ASOF:
    master=createAsOfJoin(model.getTimestamp(),m,master,slave);
  break;
default :
master=createHashJoin(m,master,slave);
break;
}
}
ExprNode filter=m.getPostJoinWhereClause();
if (filter != null) {
master=new FilteredJournalRecordSource(master,virtualColumnBuilder.createVirtualColumn(model,filter,master.getMetadata()),filter);
}
}
if (joinModelIsFalse(model)) {
return new NoOpJournalRecordSource(master);
}
return master;
}

Fixed version (ground truth):
private RecordSource compileJoins(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  optimiseJoins(model,factory);
  ObjList<QueryModel> joinModels=model.getJoinModels();
  IntList ordered=model.getOrderedJoinModels();
  RecordSource master=null;
  boolean collectColumnNameFrequency=model.getColumns().size() > 0;
  for (int i=0, n=ordered.size(); i < n; i++) {
    int index=ordered.getQuick(i);
    QueryModel m=joinModels.getQuick(index);
    RecordSource slave=m.getRecordSource();
    if (slave == null) {
      slave=compileJournal(m,factory);
      if (m.getAlias() != null) {
        slave.getMetadata().setAlias(m.getAlias().token);
      }
    }
    if (collectColumnNameFrequency) {
      collectColumnNameFrequency(model,slave);
    }
    if (master == null) {
      master=slave;
    }
 else {
switch (m.getJoinType()) {
case CROSS:
        master=new CrossJoinRecordSource(master,slave);
      break;
case ASOF:
    master=createAsOfJoin(model.getTimestamp(),m,master,slave);
  break;
default :
master=createHashJoin(m,master,slave);
break;
}
}
ExprNode filter=m.getPostJoinWhereClause();
if (filter != null) {
master=new FilteredJournalRecordSource(master,virtualColumnBuilder.createVirtualColumn(model,filter,master.getMetadata()),filter);
}
}
if (joinModelIsFalse(model)) {
return new NoOpJournalRecordSource(master);
}
return master;
}
Program: 31362
Project: 31362
Buggy source:
private RecordSource compileSubQuery(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  RecordSource rs=compile(model.getNestedModel(),factory);
  if (model.getWhereClause() == null) {
    return rs;
  }
  RecordMetadata m=rs.getMetadata();
  if (model.getAlias() != null) {
    m.setAlias(model.getAlias().token);
  }
  IntrinsicModel im=queryFilterAnalyser.extract(model.getWhereClause(),m,null);
switch (im.intrinsicValue) {
case FALSE:
    return new NoOpJournalRecordSource(rs);
default :
  if (im.intervalSource != null) {
    rs=new IntervalRecordSource(rs,im.intervalSource);
  }
if (im.filter != null) {
  VirtualColumn vc=virtualColumnBuilder.createVirtualColumn(model,im.filter,m);
  if (vc.isConstant()) {
    if (vc.getBool(null)) {
      return rs;
    }
 else {
      return new NoOpJournalRecordSource(rs);
    }
  }
  return new FilteredJournalRecordSource(rs,vc,im.filter);
}
 else {
  return rs;
}
}
}

Fixed version (ground truth):
private RecordSource compileSubQuery(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  applyLimit(model);
  optimiseSubQueries(model,factory);
  RecordSource rs=compile(model.getNestedModel(),factory);
  if (model.getWhereClause() == null) {
    return rs;
  }
  RecordMetadata m=rs.getMetadata();
  if (model.getAlias() != null) {
    m.setAlias(model.getAlias().token);
  }
  IntrinsicModel im=queryFilterAnalyser.extract(model.getWhereClause(),m,null);
switch (im.intrinsicValue) {
case FALSE:
    return new NoOpJournalRecordSource(rs);
default :
  if (im.intervalSource != null) {
    rs=new IntervalRecordSource(rs,im.intervalSource);
  }
if (im.filter != null) {
  VirtualColumn vc=virtualColumnBuilder.createVirtualColumn(model,im.filter,m);
  if (vc.isConstant()) {
    if (vc.getBool(null)) {
      return rs;
    }
 else {
      return new NoOpJournalRecordSource(rs);
    }
  }
  return new FilteredJournalRecordSource(rs,vc,im.filter);
}
 else {
  return rs;
}
}
}
Program: 31363
Project: 31363
Buggy source:
private RecordSource compile(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  return limit(order(selectColumns(model.getJoinModels().size() > 1 ? optimise(model,factory).compileJoins(model,factory) : optimise(model,factory).compileSingleOrSubQuery(model,factory),model),model),model);
}

Fixed version (ground truth):
private RecordSource compile(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  return limit(order(selectColumns(model.getJoinModels().size() > 1 ? optimise(model,factory).compileJoins(model,factory) : compileSingleOrSubQuery(model,factory),model),model),model);
}