Search in sources :

Example 1 with DictionaryPageHeader

use of org.apache.parquet.format.DictionaryPageHeader in project parquet-mr by apache.

the class ParquetMetadataConverter method writeDictionaryPageHeader.

public void writeDictionaryPageHeader(int uncompressedSize, int compressedSize, int valueCount, org.apache.parquet.column.Encoding valuesEncoding, OutputStream to) throws IOException {
    PageHeader pageHeader = new PageHeader(PageType.DICTIONARY_PAGE, uncompressedSize, compressedSize);
    pageHeader.setDictionary_page_header(new DictionaryPageHeader(valueCount, getEncoding(valuesEncoding)));
    writePageHeader(pageHeader, to);
}
Also used : PageHeader(org.apache.parquet.format.PageHeader) Util.writePageHeader(org.apache.parquet.format.Util.writePageHeader) DictionaryPageHeader(org.apache.parquet.format.DictionaryPageHeader) DataPageHeader(org.apache.parquet.format.DataPageHeader) DictionaryPageHeader(org.apache.parquet.format.DictionaryPageHeader)

Example 2 with DictionaryPageHeader

use of org.apache.parquet.format.DictionaryPageHeader in project parquet-mr by apache.

the class ParquetFileReader method readCompressedDictionary.

private DictionaryPage readCompressedDictionary(PageHeader pageHeader, SeekableInputStream fin) throws IOException {
    DictionaryPageHeader dictHeader = pageHeader.getDictionary_page_header();
    int uncompressedPageSize = pageHeader.getUncompressed_page_size();
    int compressedPageSize = pageHeader.getCompressed_page_size();
    byte[] dictPageBytes = new byte[compressedPageSize];
    fin.readFully(dictPageBytes);
    BytesInput bin = BytesInput.from(dictPageBytes);
    return new DictionaryPage(bin, uncompressedPageSize, dictHeader.getNum_values(), converter.getEncoding(dictHeader.getEncoding()));
}
Also used : BytesInput(org.apache.parquet.bytes.BytesInput) DictionaryPageHeader(org.apache.parquet.format.DictionaryPageHeader) DictionaryPage(org.apache.parquet.column.page.DictionaryPage)

Aggregations

DictionaryPageHeader (org.apache.parquet.format.DictionaryPageHeader)2 BytesInput (org.apache.parquet.bytes.BytesInput)1 DictionaryPage (org.apache.parquet.column.page.DictionaryPage)1 DataPageHeader (org.apache.parquet.format.DataPageHeader)1 PageHeader (org.apache.parquet.format.PageHeader)1 Util.writePageHeader (org.apache.parquet.format.Util.writePageHeader)1