Program: 111949
Project: 111949
Buggy source:
/** 
 * Read all of the pages in a given column chunk.
 * @return the list of pages
 */
public ColumnChunkPageReader readAllPages() throws IOException {
  List<DataPage> pagesInChunk=new ArrayList<DataPage>();
  DictionaryPage dictionaryPage=null;
  long valuesCountReadSoFar=0;
  while (valuesCountReadSoFar < descriptor.metadata.getValueCount()) {
    PageHeader pageHeader=readPageHeader();
    int uncompressedPageSize=pageHeader.getUncompressed_page_size();
    int compressedPageSize=pageHeader.getCompressed_page_size();
switch (pageHeader.type) {
case DICTIONARY_PAGE:
      if (dictionaryPage != null) {
        throw new ParquetDecodingException("String_Node_Str" + descriptor.col);
      }
    DictionaryPageHeader dicHeader=pageHeader.getDictionary_page_header();
  dictionaryPage=new DictionaryPage(this.readAsBytesInput(compressedPageSize),uncompressedPageSize,dicHeader.getNum_values(),ParquetMetadataConverter.getEncoding(dicHeader.getEncoding()));
break;
case DATA_PAGE:
DataPageHeader dataHeaderV1=pageHeader.getData_page_header();
pagesInChunk.add(new DataPageV1(this.readAsBytesInput(compressedPageSize),dataHeaderV1.getNum_values(),uncompressedPageSize,fromParquetStatistics(createdBy,dataHeaderV1.getStatistics(),descriptor.col.getType()),ParquetMetadataConverter.getEncoding(dataHeaderV1.getRepetition_level_encoding()),ParquetMetadataConverter.getEncoding(dataHeaderV1.getDefinition_level_encoding()),ParquetMetadataConverter.getEncoding(dataHeaderV1.getEncoding())));
valuesCountReadSoFar+=dataHeaderV1.getNum_values();
break;
case DATA_PAGE_V2:
DataPageHeaderV2 dataHeaderV2=pageHeader.getData_page_header_v2();
int dataSize=compressedPageSize - dataHeaderV2.getRepetition_levels_byte_length() - dataHeaderV2.getDefinition_levels_byte_length();
pagesInChunk.add(new DataPageV2(dataHeaderV2.getNum_rows(),dataHeaderV2.getNum_nulls(),dataHeaderV2.getNum_values(),this.readAsBytesInput(dataHeaderV2.getRepetition_levels_byte_length()),this.readAsBytesInput(dataHeaderV2.getDefinition_levels_byte_length()),ParquetMetadataConverter.getEncoding(dataHeaderV2.getEncoding()),this.readAsBytesInput(dataSize),uncompressedPageSize,fromParquetStatistics(createdBy,dataHeaderV2.getStatistics(),descriptor.col.getType()),dataHeaderV2.isIs_compressed()));
valuesCountReadSoFar+=dataHeaderV2.getNum_values();
break;
default :
if (DEBUG) LOG.debug("String_Node_Str" + pageHeader.getType() + "String_Node_Str"+ compressedPageSize);
this.skip(compressedPageSize);
break;
}
}
if (valuesCountReadSoFar != descriptor.metadata.getValueCount()) {
throw new IOException("String_Node_Str" + descriptor.metadata.getValueCount() + "String_Node_Str"+ filePath+ "String_Node_Str"+ descriptor.metadata.getFirstDataPageOffset()+ "String_Node_Str"+ valuesCountReadSoFar+ "String_Node_Str"+ pagesInChunk.size()+ "String_Node_Str"+ (descriptor.fileOffset + pos()));
}
BytesDecompressor decompressor=codecFactory.getDecompressor(descriptor.metadata.getCodec());
return new ColumnChunkPageReader(decompressor,pagesInChunk,dictionaryPage);
}

Fixed version (ground truth):
/** 
 * Read all of the pages in a given column chunk.
 * @return the list of pages
 */
public ColumnChunkPageReader readAllPages() throws IOException {
  List<DataPage> pagesInChunk=new ArrayList<DataPage>();
  DictionaryPage dictionaryPage=null;
  long valuesCountReadSoFar=0;
  while (valuesCountReadSoFar < descriptor.metadata.getValueCount()) {
    PageHeader pageHeader=readPageHeader();
    int uncompressedPageSize=pageHeader.getUncompressed_page_size();
    int compressedPageSize=pageHeader.getCompressed_page_size();
switch (pageHeader.type) {
case DICTIONARY_PAGE:
      if (dictionaryPage != null) {
        throw new ParquetDecodingException("String_Node_Str" + descriptor.col);
      }
    DictionaryPageHeader dicHeader=pageHeader.getDictionary_page_header();
  dictionaryPage=new DictionaryPage(this.readAsBytesInput(compressedPageSize),uncompressedPageSize,dicHeader.getNum_values(),converter.getEncoding(dicHeader.getEncoding()));
break;
case DATA_PAGE:
DataPageHeader dataHeaderV1=pageHeader.getData_page_header();
pagesInChunk.add(new DataPageV1(this.readAsBytesInput(compressedPageSize),dataHeaderV1.getNum_values(),uncompressedPageSize,fromParquetStatistics(createdBy,dataHeaderV1.getStatistics(),descriptor.col.getType()),converter.getEncoding(dataHeaderV1.getRepetition_level_encoding()),converter.getEncoding(dataHeaderV1.getDefinition_level_encoding()),converter.getEncoding(dataHeaderV1.getEncoding())));
valuesCountReadSoFar+=dataHeaderV1.getNum_values();
break;
case DATA_PAGE_V2:
DataPageHeaderV2 dataHeaderV2=pageHeader.getData_page_header_v2();
int dataSize=compressedPageSize - dataHeaderV2.getRepetition_levels_byte_length() - dataHeaderV2.getDefinition_levels_byte_length();
pagesInChunk.add(new DataPageV2(dataHeaderV2.getNum_rows(),dataHeaderV2.getNum_nulls(),dataHeaderV2.getNum_values(),this.readAsBytesInput(dataHeaderV2.getRepetition_levels_byte_length()),this.readAsBytesInput(dataHeaderV2.getDefinition_levels_byte_length()),converter.getEncoding(dataHeaderV2.getEncoding()),this.readAsBytesInput(dataSize),uncompressedPageSize,fromParquetStatistics(createdBy,dataHeaderV2.getStatistics(),descriptor.col.getType()),dataHeaderV2.isIs_compressed()));
valuesCountReadSoFar+=dataHeaderV2.getNum_values();
break;
default :
if (DEBUG) LOG.debug("String_Node_Str" + pageHeader.getType() + "String_Node_Str"+ compressedPageSize);
this.skip(compressedPageSize);
break;
}
}
if (valuesCountReadSoFar != descriptor.metadata.getValueCount()) {
throw new IOException("String_Node_Str" + descriptor.metadata.getValueCount() + "String_Node_Str"+ filePath+ "String_Node_Str"+ descriptor.metadata.getFirstDataPageOffset()+ "String_Node_Str"+ valuesCountReadSoFar+ "String_Node_Str"+ pagesInChunk.size()+ "String_Node_Str"+ (descriptor.fileOffset + pos()));
}
BytesDecompressor decompressor=codecFactory.getDecompressor(descriptor.metadata.getCodec());
return new ColumnChunkPageReader(decompressor,pagesInChunk,dictionaryPage);
}