use of com.facebook.presto.hive.parquet.ParquetDataPageV1 in project presto by prestodb.
the class ParquetColumnChunk method readDataPageV1.
private long readDataPageV1(PageHeader pageHeader, int uncompressedPageSize, int compressedPageSize, List<ParquetDataPage> pages) throws IOException {
DataPageHeader dataHeaderV1 = pageHeader.getData_page_header();
pages.add(new ParquetDataPageV1(getSlice(compressedPageSize), dataHeaderV1.getNum_values(), uncompressedPageSize, ParquetMetadataReader.readStats(dataHeaderV1.getStatistics(), descriptor.getColumnDescriptor().getType()), getParquetEncoding(Encoding.valueOf(dataHeaderV1.getRepetition_level_encoding().name())), getParquetEncoding(Encoding.valueOf(dataHeaderV1.getDefinition_level_encoding().name())), getParquetEncoding(Encoding.valueOf(dataHeaderV1.getEncoding().name()))));
return dataHeaderV1.getNum_values();
}
use of com.facebook.presto.hive.parquet.ParquetDataPageV1 in project presto by prestodb.
the class ParquetPageReader method readPage.
public ParquetDataPage readPage() {
if (compressedPages.isEmpty()) {
return null;
}
ParquetDataPage compressedPage = compressedPages.remove(0);
try {
if (compressedPage instanceof ParquetDataPageV1) {
ParquetDataPageV1 dataPageV1 = (ParquetDataPageV1) compressedPage;
return new ParquetDataPageV1(decompress(codec, dataPageV1.getSlice(), dataPageV1.getUncompressedSize()), dataPageV1.getValueCount(), dataPageV1.getUncompressedSize(), dataPageV1.getStatistics(), dataPageV1.getRepetitionLevelEncoding(), dataPageV1.getDefinitionLevelEncoding(), dataPageV1.getValueEncoding());
} else {
ParquetDataPageV2 dataPageV2 = (ParquetDataPageV2) compressedPage;
if (!dataPageV2.isCompressed()) {
return dataPageV2;
}
int uncompressedSize = toIntExact(dataPageV2.getUncompressedSize() - dataPageV2.getDefinitionLevels().length() - dataPageV2.getRepetitionLevels().length());
return new ParquetDataPageV2(dataPageV2.getRowCount(), dataPageV2.getNullCount(), dataPageV2.getValueCount(), dataPageV2.getRepetitionLevels(), dataPageV2.getDefinitionLevels(), dataPageV2.getDataEncoding(), decompress(codec, dataPageV2.getSlice(), uncompressedSize), dataPageV2.getUncompressedSize(), dataPageV2.getStatistics(), false);
}
} catch (IOException e) {
throw new RuntimeException("Could not decompress page", e);
}
}
Aggregations