nus-yam/ex-repair huggingface dataset:
Program: 112048
Project: 112048
Buggy source:
public static void main(String[] args) throws Exception {
  String pigSchema=pigSchema(false,false);
  String pigSchemaProjected=pigSchema(true,false);
  String pigSchemaNoString=pigSchema(true,true);
  MessageType schema=new PigSchemaConverter().convert(Utils.getSchemaFromString(pigSchema));
  MemPageStore memPageStore=new MemPageStore(0);
  ColumnWriteStoreImpl columns=new ColumnWriteStoreImpl(memPageStore,50 * 1024 * 1024,50 * 1024 * 1024,false);
  write(memPageStore,columns,schema,pigSchema);
  columns.flush();
  read(memPageStore,pigSchema,pigSchemaProjected,pigSchemaNoString);
  System.out.println(columns.memSize() + "String_Node_Str");
  System.out.println("String_Node_Str" + columns.maxColMemSize() + "String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  String pigSchema=pigSchema(false,false);
  String pigSchemaProjected=pigSchema(true,false);
  String pigSchemaNoString=pigSchema(true,true);
  MessageType schema=new PigSchemaConverter().convert(Utils.getSchemaFromString(pigSchema));
  MemPageStore memPageStore=new MemPageStore(0);
  ColumnWriteStoreImpl columns=new ColumnWriteStoreImpl(memPageStore,50 * 1024 * 1024,50 * 1024 * 1024,50 * 1024 * 1024,false);
  write(memPageStore,columns,schema,pigSchema);
  columns.flush();
  read(memPageStore,pigSchema,pigSchemaProjected,pigSchemaNoString);
  System.out.println(columns.memSize() + "String_Node_Str");
  System.out.println("String_Node_Str" + columns.maxColMemSize() + "String_Node_Str");
}
Program: 112049
Project: 112049
Buggy source:
/** 
 * @param thriftReader the class responsible for instantiating the final object and read from the protocol
 * @param name the name of that type ( the thrift class simple name)
 * @param requestedParquetSchema the schema for the incoming columnar events
 * @param thriftType the thrift type descriptor
 */
public ThriftRecordConverter(ThriftReader<T> thriftReader,String name,MessageType requestedParquetSchema,ThriftType.StructType thriftType){
  super();
  this.thriftReader=thriftReader;
  this.protocol=new ParquetReadProtocol();
  this.structConverter=new StructConverter(rootEvents,requestedParquetSchema,new ThriftField(name,(short)0,Requirement.REQUIRED,thriftType));
}

Fixed version (ground truth):
/** 
 * @param thriftReader the class responsible for instantiating the final object and read from the protocol
 * @param name the name of that type ( the thrift class simple name)
 * @param requestedParquetSchema the schema for the incoming columnar events
 * @param thriftType the thrift type descriptor
 */
public ThriftRecordConverter(ThriftReader<T> thriftReader,String name,MessageType requestedParquetSchema,ThriftType.StructType thriftType){
  super();
  this.thriftReader=thriftReader;
  this.protocol=new ParquetReadProtocol();
  this.thriftType=thriftType;
  this.structConverter=new StructConverter(rootEvents,requestedParquetSchema,new ThriftField(name,(short)0,Requirement.REQUIRED,thriftType));
}
Program: 112050
Project: 112050
Buggy source:
/** 
 * {@inheritDoc}
 * @see parquet.io.api.RecordMaterializer#getCurrentRecord()
 */
@Override public T getCurrentRecord(){
  try {
    protocol.addAll(rootEvents);
    rootEvents.clear();
    return thriftReader.readOneRecord(protocol);
  }
 catch (  TException e) {
    throw new ParquetDecodingException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see parquet.io.api.RecordMaterializer#getCurrentRecord()
 */
@Override public T getCurrentRecord(){
  try {
    rootEvents=new ProtocolEventsAmender(rootEvents).amendMissingRequiredFields(thriftType);
    protocol.addAll(rootEvents);
    rootEvents.clear();
    return thriftReader.readOneRecord(protocol);
  }
 catch (  TException e) {
    throw new ParquetDecodingException("String_Node_Str",e);
  }
}
Program: 112052
Project: 112052
Buggy source:
@Override public int initFromPage(long valueCount,byte[] page,int offset) throws IOException {
  if (DEBUG)   LOG.debug("String_Node_Str" + offset + "String_Node_Str"+ (page.length - offset));
  this.in=new ByteArrayInputStream(page,offset,page.length - offset);
  int bitWidth=BytesUtils.readIntLittleEndianOnOneByte(in);
  if (DEBUG)   LOG.debug("String_Node_Str" + bitWidth);
  decoder=new RunLengthBitPackingHybridDecoder(bitWidth,in);
  return page.length;
}

Fixed version (ground truth):
@Override public int initFromPage(long valueCount,byte[] page,int offset) throws IOException {
  if (DEBUG)   LOG.debug("String_Node_Str" + offset + "String_Node_Str"+ (page.length - offset));
  this.in=new ByteArrayInputStream(page,offset,page.length - offset);
  int bitWidth=BytesUtils.readIntLittleEndianOnOneByte(in);
  if (DEBUG)   LOG.debug("String_Node_Str" + bitWidth);
  decoder=new RunLengthBitPackingHybridDecoder((int)valueCount,bitWidth,in);
  return page.length;
}
Program: 112053
Project: 112053
Buggy source:
public RunLengthBitPackingHybridDecoder(int bitWidth,InputStream in){
  if (DEBUG)   LOG.debug("String_Node_Str" + bitWidth);
  Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32,"String_Node_Str");
  this.bitWidth=bitWidth;
  this.packer=Packer.LITTLE_ENDIAN.newBytePacker(bitWidth);
  this.in=in;
}

Fixed version (ground truth):
public RunLengthBitPackingHybridDecoder(int numValues,int bitWidth,InputStream in){
  if (DEBUG)   LOG.debug("String_Node_Str" + bitWidth);
  Preconditions.checkArgument(bitWidth >= 0 && bitWidth <= 32,"String_Node_Str");
  this.bitWidth=bitWidth;
  this.packer=Packer.LITTLE_ENDIAN.newBytePacker(bitWidth);
  this.in=in;
  this.valuesRemaining=numValues;
}
Program: 112054
Project: 112054
Buggy source:
public int readInt() throws IOException {
  if (currentCount == 0) {
    readNext();
  }
  --currentCount;
  int result;
switch (mode) {
case RLE:
    result=currentValue;
  break;
case PACKED:
result=currentBuffer[currentBuffer.length - 1 - currentCount];
break;
default :
throw new ParquetDecodingException("String_Node_Str" + mode);
}
return result;
}

Fixed version (ground truth):
public int readInt() throws IOException {
  Preconditions.checkArgument(valuesRemaining > 0,"String_Node_Str");
  if (currentCount == 0) {
    readNext();
  }
  --currentCount;
  --valuesRemaining;
  int result;
switch (mode) {
case RLE:
    result=currentValue;
  break;
case PACKED:
result=currentBuffer[currentBuffer.length - 1 - currentCount];
break;
default :
throw new ParquetDecodingException("String_Node_Str" + mode);
}
return result;
}
Program: 112055
Project: 112055
Buggy source:
private void readNext() throws IOException {
  final int header=BytesUtils.readUnsignedVarInt(in);
  mode=(header & 1) == 0 ? MODE.RLE : MODE.PACKED;
switch (mode) {
case RLE:
    currentCount=header >>> 1;
  if (DEBUG)   LOG.debug("String_Node_Str" + currentCount + "String_Node_Str");
currentValue=BytesUtils.readIntLittleEndianPaddedOnBitWidth(in,bitWidth);
break;
case PACKED:
int numGroups=header >>> 1;
currentCount=numGroups * 8;
if (DEBUG) LOG.debug("String_Node_Str" + currentCount + "String_Node_Str");
currentBuffer=new int[currentCount];
byte[] bytes=new byte[numGroups * bitWidth];
new DataInputStream(in).readFully(bytes);
for (int valueIndex=0, byteIndex=0; valueIndex < currentCount; valueIndex+=8, byteIndex+=bitWidth) {
packer.unpack8Values(bytes,byteIndex,currentBuffer,valueIndex);
}
break;
default :
throw new ParquetDecodingException("String_Node_Str" + mode);
}
}

Fixed version (ground truth):
private void readNext() throws IOException {
  final int header=BytesUtils.readUnsignedVarInt(in);
  mode=(header & 1) == 0 ? MODE.RLE : MODE.PACKED;
switch (mode) {
case RLE:
    currentCount=header >>> 1;
  if (DEBUG)   LOG.debug("String_Node_Str" + currentCount + "String_Node_Str");
currentValue=BytesUtils.readIntLittleEndianPaddedOnBitWidth(in,bitWidth);
break;
case PACKED:
int numGroups=header >>> 1;
currentCount=numGroups * 8;
if (DEBUG) LOG.debug("String_Node_Str" + currentCount + "String_Node_Str");
currentBuffer=new int[currentCount];
byte[] bytes=new byte[numGroups * bitWidth];
int valuesLeft=Math.min(currentCount,valuesRemaining);
new DataInputStream(in).readFully(bytes,0,(int)Math.ceil(valuesLeft * bitWidth / 8.0));
for (int valueIndex=0, byteIndex=0; valueIndex < currentCount; valueIndex+=8, byteIndex+=bitWidth) {
packer.unpack8Values(bytes,byteIndex,currentBuffer,valueIndex);
}
break;
default :
throw new ParquetDecodingException("String_Node_Str" + mode);
}
}
Program: 112056
Project: 112056
Buggy source:
@Override public int initFromPage(long valueCountL,byte[] page,int offset) throws IOException {
  int valueCount=Ints.checkedCast(valueCountL);
  if (valueCount <= 0) {
    return offset;
  }
  ByteArrayInputStream in=new ByteArrayInputStream(page,offset,page.length);
  int length=BytesUtils.readIntLittleEndian(in);
  decoder=new RunLengthBitPackingHybridDecoder(bitWidth,in);
  return offset + length + 4;
}

Fixed version (ground truth):
@Override public int initFromPage(long valueCountL,byte[] page,int offset) throws IOException {
  int valueCount=Ints.checkedCast(valueCountL);
  if (valueCount <= 0) {
    return offset;
  }
  ByteArrayInputStream in=new ByteArrayInputStream(page,offset,page.length);
  int length=BytesUtils.readIntLittleEndian(in);
  decoder=new RunLengthBitPackingHybridDecoder(valueCount,bitWidth,in);
  return offset + length + 4;
}
Program: 112057
Project: 112057
Buggy source:
private void doIntegrationTest(int bitWidth) throws Exception {
  long modValue=1L << bitWidth;
  RunLengthBitPackingHybridEncoder encoder=new RunLengthBitPackingHybridEncoder(bitWidth,1000);
  for (int i=0; i < 100; i++) {
    encoder.writeInt((int)(i % modValue));
  }
  for (int i=0; i < 100; i++) {
    encoder.writeInt((int)(77 % modValue));
  }
  for (int i=0; i < 100; i++) {
    encoder.writeInt((int)(88 % modValue));
  }
  for (int i=0; i < 1000; i++) {
    encoder.writeInt((int)(i % modValue));
    encoder.writeInt((int)(i % modValue));
    encoder.writeInt((int)(i % modValue));
  }
  for (int i=0; i < 1000; i++) {
    encoder.writeInt((int)(17 % modValue));
  }
  InputStream in=new ByteArrayInputStream(encoder.toBytes().toByteArray());
  RunLengthBitPackingHybridDecoder decoder=new RunLengthBitPackingHybridDecoder(bitWidth,in);
  for (int i=0; i < 100; i++) {
    assertEquals(i % modValue,decoder.readInt());
  }
  for (int i=0; i < 100; i++) {
    assertEquals(77 % modValue,decoder.readInt());
  }
  for (int i=0; i < 100; i++) {
    assertEquals(88 % modValue,decoder.readInt());
  }
  for (int i=0; i < 1000; i++) {
    assertEquals(i % modValue,decoder.readInt());
    assertEquals(i % modValue,decoder.readInt());
    assertEquals(i % modValue,decoder.readInt());
  }
  for (int i=0; i < 1000; i++) {
    assertEquals(17 % modValue,decoder.readInt());
  }
}

Fixed version (ground truth):
private void doIntegrationTest(int bitWidth) throws Exception {
  long modValue=1L << bitWidth;
  RunLengthBitPackingHybridEncoder encoder=new RunLengthBitPackingHybridEncoder(bitWidth,1000);
  int numValues=0;
  for (int i=0; i < 100; i++) {
    encoder.writeInt((int)(i % modValue));
  }
  numValues+=100;
  for (int i=0; i < 100; i++) {
    encoder.writeInt((int)(77 % modValue));
  }
  numValues+=100;
  for (int i=0; i < 100; i++) {
    encoder.writeInt((int)(88 % modValue));
  }
  numValues+=100;
  for (int i=0; i < 1000; i++) {
    encoder.writeInt((int)(i % modValue));
    encoder.writeInt((int)(i % modValue));
    encoder.writeInt((int)(i % modValue));
  }
  numValues+=3000;
  for (int i=0; i < 1000; i++) {
    encoder.writeInt((int)(17 % modValue));
  }
  numValues+=1000;
  InputStream in=new ByteArrayInputStream(encoder.toBytes().toByteArray());
  RunLengthBitPackingHybridDecoder decoder=new RunLengthBitPackingHybridDecoder(numValues,bitWidth,in);
  for (int i=0; i < 100; i++) {
    assertEquals(i % modValue,decoder.readInt());
  }
  for (int i=0; i < 100; i++) {
    assertEquals(77 % modValue,decoder.readInt());
  }
  for (int i=0; i < 100; i++) {
    assertEquals(88 % modValue,decoder.readInt());
  }
  for (int i=0; i < 1000; i++) {
    assertEquals(i % modValue,decoder.readInt());
    assertEquals(i % modValue,decoder.readInt());
    assertEquals(i % modValue,decoder.readInt());
  }
  for (int i=0; i < 1000; i++) {
    assertEquals(17 % modValue,decoder.readInt());
  }
}
Program: 112058
Project: 112058
Buggy source:
@Override public org.apache.hadoop.mapred.RecordReader<Void,MapWritable> getRecordReader(final org.apache.hadoop.mapred.InputSplit split,final org.apache.hadoop.mapred.JobConf job,final org.apache.hadoop.mapred.Reporter reporter) throws IOException {
  return (RecordReader<Void,MapWritable>)new RecordReaderWrapper(realInput,split,job,reporter);
}

Fixed version (ground truth):
@Override public org.apache.hadoop.mapred.RecordReader<Void,MapWritable> getRecordReader(final org.apache.hadoop.mapred.InputSplit split,final org.apache.hadoop.mapred.JobConf job,final org.apache.hadoop.mapred.Reporter reporter) throws IOException {
  try {
    return (RecordReader<Void,MapWritable>)new RecordReaderWrapper(realInput,split,job,reporter);
  }
 catch (  final InterruptedException e) {
    e.printStackTrace();
    return null;
  }
}
Program: 112060
Project: 112060
Buggy source:
private ParquetInputFormat<Tuple> getParquetInputFormat() throws ParserException {
  checkSetLocationHasBeenCalled();
  if (parquetInputFormat == null) {
    parquetInputFormat=inputFormatCache.get(location);
    if (parquetInputFormat == null) {
      parquetInputFormat=new ParquetInputFormat<Tuple>(TupleReadSupport.class){
        @Override public RecordReader<Void,Tuple> createRecordReader(        InputSplit inputSplit,        TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException {
          inputFormatCache.remove(location);
          return super.createRecordReader(inputSplit,taskAttemptContext);
        }
      }
;
      inputFormatCache.put(location,parquetInputFormat);
    }
  }
  return parquetInputFormat;
}

Fixed version (ground truth):
private ParquetInputFormat<Tuple> getParquetInputFormat() throws ParserException {
  checkSetLocationHasBeenCalled();
  if (parquetInputFormat == null) {
    parquetInputFormat=inputFormatCache.get(location);
    if (parquetInputFormat == null) {
      parquetInputFormat=new UnregisteringParquetInputFormat(location);
      inputFormatCache.put(location,parquetInputFormat);
    }
  }
  return parquetInputFormat;
}
Program: 112062
Project: 112062
Buggy source:
/** 
 * {@inheritDoc}
 * @see parquet.column.ColumnReader#isFullyConsumed()
 */
@Override public boolean isFullyConsumed(){
  return readValues >= totalValueCount;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 * @see parquet.column.ColumnReader#isFullyConsumed()
 */
@Override public boolean isFullyConsumed(){
  return readValues > totalValueCount || (readValues == totalValueCount && consumed);
}
Program: 112063
Project: 112063
Buggy source:
/** 
 * Factory method for record filter which applies the supplied predicate to the specified column.
 * @param columnPath Dot separated path specifier, e.g. "engine.capacity"
 * @param predicate Should call getBinary etc. and check the value
 */
public static final UnboundRecordFilter column(final String columnPath,final Predicate<ColumnReader> predicate){
  checkNotNull(columnPath,"String_Node_Str");
  checkNotNull(predicate,"String_Node_Str");
  return new UnboundRecordFilter(){
    final String[] filterPath=toArray(Splitter.on('.').split(columnPath),String.class);
    @Override public RecordFilter bind(    Iterable<ColumnReader> readers){
      for (      ColumnReader reader : readers) {
        if (Arrays.equals(reader.getDescriptor().getPath(),filterPath)) {
          return new ColumnRecordFilter(reader,predicate);
        }
      }
      throw new IllegalArgumentException("String_Node_Str" + columnPath + "String_Node_Str");
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Factory method for record filter which applies the supplied predicate to the specified column. Note that if searching for a repeated sub-attribute it will only ever match against the first instance of it in the object.
 * @param columnPath Dot separated path specifier, e.g. "engine.capacity"
 * @param predicate Should call getBinary etc. and check the value
 */
public static final UnboundRecordFilter column(final String columnPath,final Predicate<ColumnReader> predicate){
  checkNotNull(columnPath,"String_Node_Str");
  checkNotNull(predicate,"String_Node_Str");
  return new UnboundRecordFilter(){
    final String[] filterPath=toArray(Splitter.on('.').split(columnPath),String.class);
    @Override public RecordFilter bind(    Iterable<ColumnReader> readers){
      for (      ColumnReader reader : readers) {
        if (Arrays.equals(reader.getDescriptor().getPath(),filterPath)) {
          return new ColumnRecordFilter(reader,predicate);
        }
      }
      throw new IllegalArgumentException("String_Node_Str" + columnPath + "String_Node_Str");
    }
  }
;
}
Program: 112065
Project: 112065
Buggy source:
/** 
 * @see parquet.io.RecordReader#read()
 */
@Override public T read(){
  while (!recordFilter.isFullyConsumed()) {
    int currentLevel=0;
    State currentState=states[0];
    boolean materializeRecord=recordFilter.isMatch();
    if (materializeRecord) {
      recordConsumer.start();
    }
    do {
      ColumnReader columnReader=currentState.column;
      int d=columnReader.getCurrentDefinitionLevel();
      if (materializeRecord) {
        int depth=currentState.definitionLevelToDepth[d];
        for (; currentLevel <= depth; ++currentLevel) {
          currentState.groupConverterPath[currentLevel].start();
        }
      }
      if (d >= currentState.maxDefinitionLevel) {
        if (materializeRecord) {
          columnReader.writeCurrentValueToConverter();
        }
 else {
          columnReader.skip();
        }
      }
      columnReader.consume();
      int nextR=currentState.maxRepetitionLevel == 0 ? 0 : columnReader.getCurrentRepetitionLevel();
      int next=currentState.nextLevel[nextR];
      if (materializeRecord) {
        for (; currentLevel > next; currentLevel--) {
          currentState.groupConverterPath[currentLevel - 1].end();
        }
      }
      currentState=currentState.nextState[nextR];
    }
 while (currentState != null);
    if (materializeRecord) {
      recordConsumer.end();
      return recordMaterializer.getCurrentRecord();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @see parquet.io.RecordReader#read()
 */
@Override public T read(){
  if (!skipToMatch()) {
    return null;
  }
  int currentLevel=0;
  State currentState=states[0];
  recordConsumer.start();
  do {
    ColumnReader columnReader=currentState.column;
    int d=columnReader.getCurrentDefinitionLevel();
    int depth=currentState.definitionLevelToDepth[d];
    for (; currentLevel <= depth; ++currentLevel) {
      currentState.groupConverterPath[currentLevel].start();
    }
    if (d >= currentState.maxDefinitionLevel) {
      columnReader.writeCurrentValueToConverter();
    }
    columnReader.consume();
    int nextR=currentState.maxRepetitionLevel == 0 ? 0 : columnReader.getCurrentRepetitionLevel();
    int next=currentState.nextLevel[nextR];
    for (; currentLevel > next; currentLevel--) {
      currentState.groupConverterPath[currentLevel - 1].end();
    }
    currentState=currentState.nextState[nextR];
  }
 while (currentState != null);
  recordConsumer.end();
  return recordMaterializer.getCurrentRecord();
}
Program: 112066
Project: 112066
Buggy source:
/** 
 * Not yet working.
 */
@Ignore public void testFilterOnString(){
  MemPageStore memPageStore=new MemPageStore();
  MessageColumnIO columnIO=new ColumnIOFactory(true).getColumnIO(schema);
  writeTestRecords(memPageStore,columnIO,1);
  RecordMaterializer<Group> recordConverter=new GroupRecordConverter(schema);
  RecordReaderImplementation<Group> recordReader=(RecordReaderImplementation<Group>)columnIO.getRecordReader(memPageStore,recordConverter,column("String_Node_Str",equalTo("String_Node_Str")));
  Group actual2=recordReader.read();
  assertNull("String_Node_Str",recordReader.read());
  assertEquals("String_Node_Str",r2.toString(),actual2.toString());
}

Fixed version (ground truth):
@Test public void testFilterOnString(){
  MemPageStore memPageStore=new MemPageStore();
  MessageColumnIO columnIO=new ColumnIOFactory(true).getColumnIO(schema);
  writeTestRecords(memPageStore,columnIO,1);
  RecordMaterializer<Group> recordConverter=new GroupRecordConverter(schema);
  RecordReaderImplementation<Group> recordReader=(RecordReaderImplementation<Group>)columnIO.getRecordReader(memPageStore,recordConverter,column("String_Node_Str",equalTo("String_Node_Str")));
  Group actual1=recordReader.read();
  assertNull("String_Node_Str",recordReader.read());
  assertEquals("String_Node_Str",r1.toString(),actual1.toString());
  recordReader=(RecordReaderImplementation<Group>)columnIO.getRecordReader(memPageStore,recordConverter,column("String_Node_Str",equalTo("String_Node_Str")));
  assertNull("String_Node_Str",recordReader.read());
  recordReader=(RecordReaderImplementation<Group>)columnIO.getRecordReader(memPageStore,recordConverter,column("String_Node_Str",equalTo("String_Node_Str")));
  Group actual2=recordReader.read();
  assertNull("String_Node_Str",recordReader.read());
  assertEquals("String_Node_Str",r2.toString(),actual2.toString());
}
Program: 112067
Project: 112067
Buggy source:
/** 
 * writes an int using the requested number of bits. accepts only value < 2^bitWidth
 * @param value the value to write
 * @throws IOException
 */
public void writeInt(int value) throws IOException {
  input[inputSize]=value;
  ++inputSize;
  if (inputSize == VALUES_WRITTEN_AT_A_TIME) {
    pack();
    if (packedPosition == SLAB_SIZE) {
      slabs.add(BytesInput.from(packed));
      initPackedSlab();
    }
  }
}

Fixed version (ground truth):
/** 
 * writes an int using the requested number of bits. accepts only value < 2^bitWidth
 * @param value the value to write
 * @throws IOException
 */
public void writeInt(int value) throws IOException {
  input[inputSize]=value;
  ++inputSize;
  if (inputSize == VALUES_WRITTEN_AT_A_TIME) {
    pack();
    if (packedPosition == slabSize) {
      slabs.add(BytesInput.from(packed));
      initPackedSlab();
    }
  }
}
Program: 112068
Project: 112068
Buggy source:
private void initPackedSlab(){
  packed=new byte[SLAB_SIZE];
  packedPosition=0;
}

Fixed version (ground truth):
private void initPackedSlab(){
  packed=new byte[slabSize];
  packedPosition=0;
}
Program: 112069
Project: 112069
Buggy source:
/** 
 * @return the bytes representing the packed values
 * @throws IOException
 */
public BytesInput toBytes() throws IOException {
  int packedByteLength=packedPosition + BytesUtils.paddedByteCountFromBits(inputSize * bitWidth);
  if (DEBUG)   LOG.debug("String_Node_Str" + (slabs.size() * SLAB_SIZE + packedByteLength) + "String_Node_Str");
  if (inputSize > 0) {
    for (int i=inputSize; i < input.length; i++) {
      input[i]=0;
    }
    pack();
  }
  return concat(concat(slabs),BytesInput.from(packed,0,packedByteLength));
}

Fixed version (ground truth):
/** 
 * @return the bytes representing the packed values
 * @throws IOException
 */
public BytesInput toBytes() throws IOException {
  int packedByteLength=packedPosition + BytesUtils.paddedByteCountFromBits(inputSize * bitWidth);
  if (DEBUG)   LOG.debug("String_Node_Str" + (slabs.size() * slabSize + packedByteLength) + "String_Node_Str");
  if (inputSize > 0) {
    for (int i=inputSize; i < input.length; i++) {
      input[i]=0;
    }
    pack();
  }
  return concat(concat(slabs),BytesInput.from(packed,0,packedByteLength));
}
Program: 112070
Project: 112070
Buggy source:
/** 
 * @param bitWidth the number of bits used to encode an int
 */
public ByteBasedBitPackingEncoder(int bitWidth,Packer packer){
  this.bitWidth=bitWidth;
  this.inputSize=0;
  initPackedSlab();
  this.packer=packer.newBytePacker(bitWidth);
}

Fixed version (ground truth):
/** 
 * @param bitWidth the number of bits used to encode an int
 */
public ByteBasedBitPackingEncoder(int bitWidth,Packer packer){
  this.bitWidth=bitWidth;
  this.inputSize=0;
  this.slabSize=bitWidth * 64 * 1024;
  initPackedSlab();
  this.packer=packer.newBytePacker(bitWidth);
}
Program: 112071
Project: 112071
Buggy source:
/** 
 * @return total memory allocated
 */
public long getAllocatedSize(){
  return (slabs.size() * SLAB_SIZE) + packed.length + input.length * 4;
}

Fixed version (ground truth):
/** 
 * @return total memory allocated
 */
public long getAllocatedSize(){
  return (slabs.size() * slabSize) + packed.length + input.length * 4;
}
Program: 112072
Project: 112072
Buggy source:
@Override public BytesInput getBytes(){
  if (!dictionaryTooBig && dict.size() > 0) {
    lastUsedDictionarySize=dict.size();
    lastUsedDictionaryByteSize=dictionaryByteSize;
    int maxDicId=dict.size() - 1;
    if (DEBUG)     LOG.debug("String_Node_Str" + maxDicId);
    int bitWidth=BytesUtils.getWidthFromMaxInt(maxDicId);
    final RunLengthBitPackingHybridEncoder encoder=new RunLengthBitPackingHybridEncoder(BytesUtils.getWidthFromMaxInt(maxDicId),64 * 1024);
    IntIterator iterator=out.iterator();
    try {
      while (iterator.hasNext()) {
        encoder.writeInt(iterator.next());
      }
      byte[] bytesHeader=new byte[]{(byte)(bitWidth & 0xFF)};
      BytesInput rleEncodedBytes=encoder.toBytes();
      if (DEBUG)       LOG.debug("String_Node_Str" + rleEncodedBytes.size());
      return concat(BytesInput.from(bytesHeader),rleEncodedBytes);
    }
 catch (    IOException e) {
      throw new ParquetEncodingException("String_Node_Str",e);
    }
  }
  return plainValuesWriter.getBytes();
}

Fixed version (ground truth):
@Override public BytesInput getBytes(){
  if (!dictionaryTooBig && dict.size() > 0) {
    lastUsedDictionarySize=dict.size();
    lastUsedDictionaryByteSize=dictionaryByteSize;
    int maxDicId=dict.size() - 1;
    if (DEBUG)     LOG.debug("String_Node_Str" + maxDicId);
    int bitWidth=BytesUtils.getWidthFromMaxInt(maxDicId);
    final RunLengthBitPackingHybridEncoder encoder=new RunLengthBitPackingHybridEncoder(BytesUtils.getWidthFromMaxInt(maxDicId),64 * 1024);
    IntIterator iterator=out.iterator();
    try {
      while (iterator.hasNext()) {
        encoder.writeInt(iterator.next());
      }
      byte[] bytesHeader=new byte[]{(byte)bitWidth};
      BytesInput rleEncodedBytes=encoder.toBytes();
      if (DEBUG)       LOG.debug("String_Node_Str" + rleEncodedBytes.size());
      return concat(BytesInput.from(bytesHeader),rleEncodedBytes);
    }
 catch (    IOException e) {
      throw new ParquetEncodingException("String_Node_Str",e);
    }
  }
  return plainValuesWriter.getBytes();
}
Program: 112073
Project: 112073
Buggy source:
/** 
 * writes an int using the requested number of bits. accepts only value < 2^bitWidth
 * @param value the value to write
 * @throws IOException
 */
public void writeInt(int value) throws IOException {
  input[inputSize]=value;
  ++inputSize;
  if (inputSize == VALUES_WRITTEN_AT_A_TIME) {
    pack();
    if (packedPosition == SLAB_SIZE) {
      slabs.add(BytesInput.from(packed));
      initPackedSlab();
    }
  }
}

Fixed version (ground truth):
/** 
 * writes an int using the requested number of bits. accepts only value < 2^bitWidth
 * @param value the value to write
 * @throws IOException
 */
public void writeInt(int value) throws IOException {
  input[inputSize]=value;
  ++inputSize;
  if (inputSize == VALUES_WRITTEN_AT_A_TIME) {
    pack();
    if (packedPosition == slabSize) {
      slabs.add(BytesInput.from(packed));
      initPackedSlab();
    }
  }
}
Program: 112074
Project: 112074
Buggy source:
private void initPackedSlab(){
  packed=new byte[SLAB_SIZE];
  packedPosition=0;
}

Fixed version (ground truth):
private void initPackedSlab(){
  packed=new byte[slabSize];
  packedPosition=0;
}
Program: 112075
Project: 112075
Buggy source:
/** 
 * @return the bytes representing the packed values
 * @throws IOException
 */
public BytesInput toBytes() throws IOException {
  int packedByteLength=packedPosition + BytesUtils.paddedByteCountFromBits(inputSize * bitWidth);
  if (DEBUG)   LOG.debug("String_Node_Str" + (slabs.size() * SLAB_SIZE + packedByteLength) + "String_Node_Str");
  if (inputSize > 0) {
    for (int i=inputSize; i < input.length; i++) {
      input[i]=0;
    }
    pack();
  }
  return concat(concat(slabs),BytesInput.from(packed,0,packedByteLength));
}

Fixed version (ground truth):
/** 
 * @return the bytes representing the packed values
 * @throws IOException
 */
public BytesInput toBytes() throws IOException {
  int packedByteLength=packedPosition + BytesUtils.paddedByteCountFromBits(inputSize * bitWidth);
  if (DEBUG)   LOG.debug("String_Node_Str" + (slabs.size() * slabSize + packedByteLength) + "String_Node_Str");
  if (inputSize > 0) {
    for (int i=inputSize; i < input.length; i++) {
      input[i]=0;
    }
    pack();
  }
  return concat(concat(slabs),BytesInput.from(packed,0,packedByteLength));
}
Program: 112076
Project: 112076
Buggy source:
/** 
 * @param bitWidth the number of bits used to encode an int
 */
public ByteBasedBitPackingEncoder(int bitWidth,Packer packer){
  this.bitWidth=bitWidth;
  this.inputSize=0;
  initPackedSlab();
  this.packer=packer.newBytePacker(bitWidth);
}

Fixed version (ground truth):
/** 
 * @param bitWidth the number of bits used to encode an int
 */
public ByteBasedBitPackingEncoder(int bitWidth,Packer packer){
  this.bitWidth=bitWidth;
  this.inputSize=0;
  this.slabSize=bitWidth * 64 * 1024;
  initPackedSlab();
  this.packer=packer.newBytePacker(bitWidth);
}
Program: 112077
Project: 112077
Buggy source:
/** 
 * @return total memory allocated
 */
public long getAllocatedSize(){
  return (slabs.size() * SLAB_SIZE) + packed.length + input.length * 4;
}

Fixed version (ground truth):
/** 
 * @return total memory allocated
 */
public long getAllocatedSize(){
  return (slabs.size() * slabSize) + packed.length + input.length * 4;
}
Program: 112078
Project: 112078
Buggy source:
@Override public BytesInput getBytes(){
  if (!dictionaryTooBig && dict.size() > 0) {
    lastUsedDictionarySize=dict.size();
    lastUsedDictionaryByteSize=dictionaryByteSize;
    int maxDicId=dict.size() - 1;
    if (DEBUG)     LOG.debug("String_Node_Str" + maxDicId);
    int bitWidth=BytesUtils.getWidthFromMaxInt(maxDicId);
    RLESimpleEncoder rleSimpleEncoder=new RLESimpleEncoder(bitWidth);
    IntIterator iterator=out.iterator();
    try {
      while (iterator.hasNext()) {
        rleSimpleEncoder.writeInt(iterator.next());
      }
      byte[] bytesHeader=new byte[]{(byte)(bitWidth & 0xFF)};
      BytesInput rleEncodedBytes=rleSimpleEncoder.toBytes();
      if (DEBUG)       LOG.debug("String_Node_Str" + rleEncodedBytes.size());
      return concat(BytesInput.from(bytesHeader),rleEncodedBytes);
    }
 catch (    IOException e) {
      throw new ParquetEncodingException("String_Node_Str",e);
    }
  }
  return plainValuesWriter.getBytes();
}

Fixed version (ground truth):
@Override public BytesInput getBytes(){
  if (!dictionaryTooBig && dict.size() > 0) {
    lastUsedDictionarySize=dict.size();
    lastUsedDictionaryByteSize=dictionaryByteSize;
    int maxDicId=dict.size() - 1;
    if (DEBUG)     LOG.debug("String_Node_Str" + maxDicId);
    int bitWidth=BytesUtils.getWidthFromMaxInt(maxDicId);
    RLESimpleEncoder rleSimpleEncoder=new RLESimpleEncoder(bitWidth);
    IntIterator iterator=out.iterator();
    try {
      while (iterator.hasNext()) {
        rleSimpleEncoder.writeInt(iterator.next());
      }
      byte[] bytesHeader=new byte[]{(byte)bitWidth};
      BytesInput rleEncodedBytes=rleSimpleEncoder.toBytes();
      if (DEBUG)       LOG.debug("String_Node_Str" + rleEncodedBytes.size());
      return concat(BytesInput.from(bytesHeader),rleEncodedBytes);
    }
 catch (    IOException e) {
      throw new ParquetEncodingException("String_Node_Str",e);
    }
  }
  return plainValuesWriter.getBytes();
}
Program: 112079
Project: 112079
Buggy source:
@Override public void setDictionary(Dictionary dictionary){
  if (this.dict != null) {
    throw new ParquetDecodingException("String_Node_Str");
  }
  dict=new String[dictionary.getMaxId() + 1];
  for (int i=0; i <= dictionary.getMaxId(); i++) {
    dict[i]=dictionary.decodeToBinary(i).toStringUsingUTF8();
  }
}

Fixed version (ground truth):
@Override public void setDictionary(Dictionary dictionary){
  dict=new String[dictionary.getMaxId() + 1];
  for (int i=0; i <= dictionary.getMaxId(); i++) {
    dict[i]=dictionary.decodeToBinary(i).toStringUsingUTF8();
  }
}
Program: 112084
Project: 112084
Buggy source:
private ByteArrayBytesInput(byte[] in){
  this.in=in;
}

Fixed version (ground truth):
private ByteArrayBytesInput(byte[] in,int offset,int length){
  this.in=in;
  this.offset=offset;
  this.length=length;
}
Program: 112085
Project: 112085
Buggy source:
@Override public long size(){
  return in.length;
}

Fixed version (ground truth):
@Override public long size(){
  return length;
}
Program: 112086
Project: 112086
Buggy source:
@Override public void writeAllTo(OutputStream out) throws IOException {
  out.write(in);
}

Fixed version (ground truth):
@Override public void writeAllTo(OutputStream out) throws IOException {
  out.write(in,offset,length);
}
Program: 112087
Project: 112087
Buggy source:
@Override public int initFromPage(long valueCount,byte[] page,int offset) throws IOException {
  int effectiveBitLength=(int)valueCount * bitsPerValue;
  int length=effectiveBitLength / 8 + (effectiveBitLength % 8 == 0 ? 0 : 1);
  int intLength=(int)(valueCount + 63) / 64 * bitsPerValue;
  this.encoded=new int[intLength];
  ByteBuffer.wrap(page,offset,(length + 3) / 4).asIntBuffer().get(encoded);
  if (Log.DEBUG)   LOG.debug("String_Node_Str" + length + "String_Node_Str"+ valueCount+ "String_Node_Str"+ bitsPerValue+ "String_Node_Str");
  return offset + length;
}

Fixed version (ground truth):
@Override public int initFromPage(long valueCount,byte[] page,int offset) throws IOException {
  int effectiveBitLength=(int)valueCount * bitsPerValue;
  int length=(effectiveBitLength + 7) / 8;
  int intLength=(int)(valueCount + 63) / 64 * bitsPerValue;
  this.encoded=new int[intLength];
  for (int i=0, j=offset; i < page.length / 4; ++i, j+=4) {
    int ch4=page[j] & 0xff;
    int ch3=page[j + 1] & 0xff;
    int ch2=page[j + 2] & 0xff;
    int ch1=page[j + 3] & 0xff;
    this.encoded[i]=((ch4 << 24) + (ch3 << 16) + (ch2 << 8)+ (ch1 << 0));
  }
  if (page.length % 4 > 0) {
    int ch4=0;
    int ch3=0;
    int ch2=0;
    int ch1=0;
    int j=offset + page.length / 4 * 4;
switch (page.length % 4) {
case 3:
      ch2=page[j + 2] & 0xff;
case 2:
    ch3=page[j + 1] & 0xff;
case 1:
  ch4=page[j + 0] & 0xff;
}
this.encoded[this.encoded.length - 1]=((ch4 << 24) + (ch3 << 16) + (ch2 << 8)+ (ch1 << 0));
}
if (Log.DEBUG) LOG.debug("String_Node_Str" + length + "String_Node_Str"+ valueCount+ "String_Node_Str"+ bitsPerValue+ "String_Node_Str");
return offset + length;
}
Program: 112088
Project: 112088
Buggy source:
/** 
 * @param bound the maximum value stored by this column
 */
public IntBasedBitPackingValuesReader(int bound){
  this.bitsPerValue=getWidthFromMaxInt(bound);
  packer=LemireBitPackingBE.getPacker(bitsPerValue);
  decode();
}

Fixed version (ground truth):
/** 
 * @param bound the maximum value stored by this column
 */
public IntBasedBitPackingValuesReader(int bound){
  this.bitsPerValue=getWidthFromMaxInt(bound);
  this.packer=LemireBitPackingBE.getPacker(bitsPerValue);
  this.encoded=new int[bitsPerValue];
  decode();
}
Program: 112089
Project: 112089
Buggy source:
private IntBasedBitPackingValuesWriter(int bitWidth){
  super();
  this.bitWidth=bitWidth;
  this.packer=LemireBitPackingBE.getPacker(bitWidth);
  this.packedArraySize=bitWidth * 100000;
  this.initPacked();
}

Fixed version (ground truth):
public IntBasedBitPackingValuesWriter(int bitWidth){
  super();
  this.bitWidth=bitWidth;
  this.packer=LemireBitPackingBE.getPacker(bitWidth);
  this.packedArraySize=bitWidth * 100000;
  this.initPacked();
}
Program: 112090
Project: 112090
Buggy source:
@Override public void writeInteger(int v){
  inputBuffer[bufferedCount]=v;
  ++bufferedCount;
  if (bufferedCount == 32) {
    packer.pack32Values(inputBuffer,0,packed,packedCount);
    bufferedCount=0;
    packedCount+=bitWidth;
    if (packedCount == packed.length) {
      bytes.add(packed);
      initPacked();
    }
  }
}

Fixed version (ground truth):
@Override public void writeInteger(int v){
  ++totalValues;
  inputBuffer[bufferedCount]=v;
  ++bufferedCount;
  if (bufferedCount == 32) {
    pack();
  }
}
Program: 112091
Project: 112091
Buggy source:
@Override public BytesInput getBytes(){
  int size=(packedCount + bytes.size() * packedArraySize) * 4;
  final ByteBuffer buffer=ByteBuffer.allocate(size);
  buffer.order(ByteOrder.BIG_ENDIAN);
  final IntBuffer intBuffer=buffer.asIntBuffer();
  for (  int[] array : bytes) {
    intBuffer.put(array);
  }
  intBuffer.put(packed,0,packedCount);
  packedCount=0;
  return BytesInput.from(buffer.array());
}

Fixed version (ground truth):
@Override public BytesInput getBytes(){
  if (bufferedCount > 0) {
    for (int i=bufferedCount; i < inputBuffer.length; i++) {
      inputBuffer[i]=0;
    }
    pack();
  }
  int size=(packedCount + bytes.size() * packedArraySize) * 4;
  final ByteBuffer buffer=ByteBuffer.allocate(size);
  buffer.order(ByteOrder.BIG_ENDIAN);
  final IntBuffer intBuffer=buffer.asIntBuffer();
  for (  int[] array : bytes) {
    intBuffer.put(array);
  }
  intBuffer.put(packed,0,packedCount);
  packedCount=0;
  return BytesInput.from(buffer.array(),0,(totalValues * bitWidth + 7) / 8);
}
Program: 112092
Project: 112092
Buggy source:
@Test public void testPackUnPack(){
  System.out.println();
  System.out.println("String_Node_Str");
  for (int i=1; i < 32; i++) {
    System.out.println("String_Node_Str" + i);
    int[] values=new int[32];
    int[] packed=new int[i];
    int[] unpacked=new int[32];
    for (int j=0; j < values.length; j++) {
      values[j]=(int)(Math.random() * 100000) % (int)Math.pow(2,i);
    }
    System.out.println("String_Node_Str" + TestBitPacking.toString(values));
{
      final IntPacker packer=LemireBitPackingBE.getPacker(i);
      packer.pack32Values(values,0,packed,0);
      packer.unpack32Values(packed,0,unpacked,0);
      System.out.println("String_Node_Str" + TestBitPacking.toString(unpacked));
      Assert.assertArrayEquals("String_Node_Str" + i,values,unpacked);
    }
{
      final IntPacker packer=LemireBitPackingLE.getPacker(i);
      packer.pack32Values(values,0,packed,0);
      packer.unpack32Values(packed,0,unpacked,0);
      System.out.println("String_Node_Str" + TestBitPacking.toString(unpacked));
      Assert.assertArrayEquals("String_Node_Str" + i,values,unpacked);
    }
  }
}

Fixed version (ground truth):
@Test public void testPackUnPack(){
  System.out.println();
  System.out.println("String_Node_Str");
  for (int i=1; i < 32; i++) {
    System.out.println("String_Node_Str" + i);
    int[] unpacked=new int[32];
    int[] values=generateValues(i);
{
      packUnpack(LemireBitPackingBE.getPacker(i),values,unpacked);
      System.out.println("String_Node_Str" + TestBitPacking.toString(unpacked));
      Assert.assertArrayEquals("String_Node_Str" + i,values,unpacked);
    }
{
      packUnpack(LemireBitPackingLE.getPacker(i),values,unpacked);
      System.out.println("String_Node_Str" + TestBitPacking.toString(unpacked));
      Assert.assertArrayEquals("String_Node_Str" + i,values,unpacked);
    }
  }
}
Program: 112094
Project: 112094
Buggy source:
/** 
 * Reads all the columns requested from the row group at the current file position.
 * @throws IOException if an error occurs while reading
 * @return the PageReadStore which can provide PageReaders for each column. 
 */
public PageReadStore readNextRowGroup() throws IOException {
  if (currentBlock == blocks.size()) {
    return null;
  }
  BlockMetaData block=blocks.get(currentBlock);
  if (block.getRowCount() == 0) {
    throw new RuntimeException("String_Node_Str");
  }
  ColumnChunkPageReadStore columnChunkPageReadStore=new ColumnChunkPageReadStore(block.getRowCount());
  for (  ColumnChunkMetaData mc : block.getColumns()) {
    String pathKey=Arrays.toString(mc.getPath());
    ColumnDescriptor columnDescriptor=paths.get(pathKey);
    if (columnDescriptor != null) {
      List<Page> pagesInChunk=readColumnChunkPages(columnDescriptor,mc);
      BytesDecompressor decompressor=codecFactory.getDecompressor(mc.getCodec());
      ColumnChunkPageReader columnChunkPageReader=new ColumnChunkPageReader(decompressor,pagesInChunk);
      columnChunkPageReadStore.addColumn(columnDescriptor,columnChunkPageReader);
    }
  }
  ++currentBlock;
  return columnChunkPageReadStore;
}

Fixed version (ground truth):
/** 
 * Reads all the columns requested from the row group at the current file position.
 * @throws IOException if an error occurs while reading
 * @return the PageReadStore which can provide PageReaders for each column.
 */
public PageReadStore readNextRowGroup() throws IOException {
  if (currentBlock == blocks.size()) {
    return null;
  }
  BlockMetaData block=blocks.get(currentBlock);
  if (block.getRowCount() == 0) {
    throw new RuntimeException("String_Node_Str");
  }
  ColumnChunkPageReadStore columnChunkPageReadStore=new ColumnChunkPageReadStore(block.getRowCount());
  for (  ColumnChunkMetaData mc : block.getColumns()) {
    String pathKey=Arrays.toString(mc.getPath());
    ColumnDescriptor columnDescriptor=paths.get(pathKey);
    if (columnDescriptor != null) {
      List<Page> pagesInChunk=readColumnChunkPages(columnDescriptor,mc);
      BytesDecompressor decompressor=codecFactory.getDecompressor(mc.getCodec());
      ColumnChunkPageReader columnChunkPageReader=new ColumnChunkPageReader(decompressor,pagesInChunk);
      columnChunkPageReadStore.addColumn(columnDescriptor,columnChunkPageReader);
    }
  }
  ++currentBlock;
  return columnChunkPageReadStore;
}
Program: 112095
Project: 112095
Buggy source:
/** 
 * @param f the Parquet file
 * @param blocks the blocks to read
 * @param colums the columns to read (their path)
 * @param codecClassName the codec used to compress the blocks
 * @throws IOException if the file can not be opened
 */
public ParquetFileReader(Configuration configuration,Path filePath,List<BlockMetaData> blocks,List<ColumnDescriptor> columns) throws IOException {
  FileSystem fs=FileSystem.get(configuration);
  this.filePath=filePath;
  this.f=fs.open(filePath);
  this.blocks=blocks;
  for (  ColumnDescriptor col : columns) {
    paths.put(Arrays.toString(col.getPath()),col);
  }
  this.codecFactory=new CodecFactory(configuration);
}

Fixed version (ground truth):
/** 
 * @param f the Parquet file
 * @param blocks the blocks to read
 * @param colums the columns to read (their path)
 * @param codecClassName the codec used to compress the blocks
 * @throws IOException if the file can not be opened
 */
public ParquetFileReader(Configuration configuration,Path filePath,List<BlockMetaData> blocks,List<ColumnDescriptor> columns) throws IOException {
  this.filePath=filePath;
  FileSystem fs=filePath.getFileSystem(configuration);
  this.f=fs.open(filePath);
  this.blocks=blocks;
  for (  ColumnDescriptor col : columns) {
    paths.put(Arrays.toString(col.getPath()),col);
  }
  this.codecFactory=new CodecFactory(configuration);
}
Program: 112096
Project: 112096
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public List<InputSplit> getSplits(JobContext jobContext) throws IOException {
  List<InputSplit> splits=new ArrayList<InputSplit>();
  Configuration configuration=jobContext.getConfiguration();
  FileSystem fs=FileSystem.get(configuration);
  List<Footer> footers=getFooters(jobContext);
  for (  Footer footer : footers) {
    LOG.debug(footer.getFile());
    FileStatus fileStatus=fs.getFileStatus(footer.getFile());
    ParquetMetadata parquetMetaData=footer.getParquetMetadata();
    List<BlockMetaData> blocks=parquetMetaData.getBlocks();
    BlockLocation[] fileBlockLocations=fs.getFileBlockLocations(fileStatus,0,fileStatus.getLen());
    splits.addAll(generateSplits(blocks,fileBlockLocations,fileStatus,parquetMetaData.getFileMetaData(),readSupportClass,requestedSchema,parquetMetaData.getKeyValueMetaData()));
  }
  return splits;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public List<InputSplit> getSplits(JobContext jobContext) throws IOException {
  List<InputSplit> splits=new ArrayList<InputSplit>();
  Configuration configuration=jobContext.getConfiguration();
  List<Footer> footers=getFooters(jobContext);
  for (  Footer footer : footers) {
    final Path file=footer.getFile();
    LOG.debug(file);
    FileSystem fs=file.getFileSystem(configuration);
    FileStatus fileStatus=fs.getFileStatus(file);
    ParquetMetadata parquetMetaData=footer.getParquetMetadata();
    List<BlockMetaData> blocks=parquetMetaData.getBlocks();
    BlockLocation[] fileBlockLocations=fs.getFileBlockLocations(fileStatus,0,fileStatus.getLen());
    splits.addAll(generateSplits(blocks,fileBlockLocations,fileStatus,parquetMetaData.getFileMetaData(),readSupportClass,requestedSchema,parquetMetaData.getKeyValueMetaData()));
  }
  return splits;
}
Program: 112097
Project: 112097
Buggy source:
protected void checkRead(){
  if (!consumed) {
    return;
  }
  if (isFullyConsumed()) {
    if (DEBUG)     LOG.debug("String_Node_Str");
    repetitionLevel=0;
    return;
  }
  if (isPageFullyConsumed()) {
    if (DEBUG)     LOG.debug("String_Node_Str");
    Page page=pageReader.readPage();
    if (page.getEncoding() != PLAIN) {
      throw new ParquetDecodingException("String_Node_Str" + page.getEncoding());
    }
    repetitionLevelColumn=new BitPackingColumnReader(path.getMaxRepetitionLevel());
    definitionLevelColumn=BoundedColumnFactory.getBoundedReader(path.getMaxDefinitionLevel());
switch (path.getType()) {
case BOOLEAN:
      this.dataColumn=new BooleanPlainColumnReader();
default :
    this.dataColumn=new PlainColumnReader();
}
this.pageValueCount=page.getValueCount();
this.readValuesInPage=0;
try {
  byte[] bytes=page.getBytes().toByteArray();
  if (DEBUG)   LOG.debug("String_Node_Str" + bytes.length + "String_Node_Str"+ pageValueCount+ "String_Node_Str");
  if (DEBUG)   LOG.debug("String_Node_Str");
  int next=repetitionLevelColumn.initFromPage(pageValueCount,bytes,0);
  if (DEBUG)   LOG.debug("String_Node_Str" + next);
  next=definitionLevelColumn.initFromPage(pageValueCount,bytes,next);
  if (DEBUG)   LOG.debug("String_Node_Str" + next);
  dataColumn.initFromPage(pageValueCount,bytes,next);
}
 catch (IOException e) {
  throw new ParquetDecodingException("String_Node_Str" + page + "String_Node_Str"+ path,e);
}
}
read();
}

Fixed version (ground truth):
protected void checkRead(){
  if (!consumed) {
    return;
  }
  if (isFullyConsumed()) {
    if (DEBUG)     LOG.debug("String_Node_Str");
    repetitionLevel=0;
    return;
  }
  if (isPageFullyConsumed()) {
    if (DEBUG)     LOG.debug("String_Node_Str");
    Page page=pageReader.readPage();
    if (page.getEncoding() != PLAIN) {
      throw new ParquetDecodingException("String_Node_Str" + page.getEncoding());
    }
    repetitionLevelColumn=new BitPackingColumnReader(path.getMaxRepetitionLevel());
    definitionLevelColumn=BoundedColumnFactory.getBoundedReader(path.getMaxDefinitionLevel());
switch (path.getType()) {
case BOOLEAN:
      this.dataColumn=new BooleanPlainColumnReader();
    break;
default :
  this.dataColumn=new PlainColumnReader();
}
this.pageValueCount=page.getValueCount();
this.readValuesInPage=0;
try {
byte[] bytes=page.getBytes().toByteArray();
if (DEBUG) LOG.debug("String_Node_Str" + bytes.length + "String_Node_Str"+ pageValueCount+ "String_Node_Str");
if (DEBUG) LOG.debug("String_Node_Str");
int next=repetitionLevelColumn.initFromPage(pageValueCount,bytes,0);
if (DEBUG) LOG.debug("String_Node_Str" + next);
next=definitionLevelColumn.initFromPage(pageValueCount,bytes,next);
if (DEBUG) LOG.debug("String_Node_Str" + next);
dataColumn.initFromPage(pageValueCount,bytes,next);
}
 catch (IOException e) {
throw new ParquetDecodingException("String_Node_Str" + page + "String_Node_Str"+ path,e);
}
}
read();
}