use of org.apache.parquet.format.PageType in project parquet-mr by apache.
the class ParquetMetadataConverter method convertEncodingStats.
public List<PageEncodingStats> convertEncodingStats(EncodingStats stats) {
if (stats == null) {
return null;
}
List<PageEncodingStats> formatStats = new ArrayList<PageEncodingStats>();
for (org.apache.parquet.column.Encoding encoding : stats.getDictionaryEncodings()) {
formatStats.add(new PageEncodingStats(PageType.DICTIONARY_PAGE, getEncoding(encoding), stats.getNumDictionaryPagesEncodedAs(encoding)));
}
PageType dataPageType = (stats.usesV2Pages() ? PageType.DATA_PAGE_V2 : PageType.DATA_PAGE);
for (org.apache.parquet.column.Encoding encoding : stats.getDataEncodings()) {
formatStats.add(new PageEncodingStats(dataPageType, getEncoding(encoding), stats.getNumDataPagesEncodedAs(encoding)));
}
return formatStats;
}
use of org.apache.parquet.format.PageType in project parquet-mr by apache.
the class TestParquetMetadataConverter method testPageHeader.
@Test
public void testPageHeader() throws IOException {
ByteArrayOutputStream out = new ByteArrayOutputStream();
PageType type = PageType.DATA_PAGE;
int compSize = 10;
int uncSize = 20;
PageHeader pageHeader = new PageHeader(type, uncSize, compSize);
writePageHeader(pageHeader, out);
PageHeader readPageHeader = readPageHeader(new ByteArrayInputStream(out.toByteArray()));
assertEquals(pageHeader, readPageHeader);
}
Aggregations