Search in sources :

Example 1 with DictionaryPage

use of org.apache.parquet.column.page.DictionaryPage in project drill by apache.

the class PageReader method readDictionaryPage.

private void readDictionaryPage(final PageHeader pageHeader, final ColumnReader<?> parentStatus) throws IOException {
    int compressedSize = pageHeader.getCompressed_page_size();
    int uncompressedSize = pageHeader.getUncompressed_page_size();
    final DrillBuf dictionaryData = readPage(pageHeader, compressedSize, uncompressedSize);
    allocatedDictionaryBuffers.add(dictionaryData);
    DictionaryPage page = new DictionaryPage(asBytesInput(dictionaryData, 0, uncompressedSize), pageHeader.uncompressed_page_size, pageHeader.dictionary_page_header.num_values, valueOf(pageHeader.dictionary_page_header.encoding.name()));
    this.dictionary = page.getEncoding().initDictionary(parentStatus.columnDescriptor, page);
}
Also used : DictionaryPage(org.apache.parquet.column.page.DictionaryPage) DrillBuf(io.netty.buffer.DrillBuf)

Example 2 with DictionaryPage

use of org.apache.parquet.column.page.DictionaryPage in project drill by apache.

the class AsyncPageReader method readDictionaryPageData.

// Read and decode the dictionary data
private void readDictionaryPageData(final ReadStatus readStatus, final ColumnReader<?> parentStatus) throws UserException {
    try {
        pageHeader = readStatus.getPageHeader();
        int uncompressedSize = pageHeader.getUncompressed_page_size();
        final DrillBuf dictionaryData = getDecompressedPageData(readStatus);
        Stopwatch timer = Stopwatch.createStarted();
        allocatedDictionaryBuffers.add(dictionaryData);
        DictionaryPage page = new DictionaryPage(asBytesInput(dictionaryData, 0, uncompressedSize), pageHeader.uncompressed_page_size, pageHeader.dictionary_page_header.num_values, valueOf(pageHeader.dictionary_page_header.encoding.name()));
        this.dictionary = page.getEncoding().initDictionary(parentStatus.columnDescriptor, page);
        long timeToDecode = timer.elapsed(TimeUnit.NANOSECONDS);
        stats.timeDictPageDecode.addAndGet(timeToDecode);
    } catch (Exception e) {
        handleAndThrowException(e, "Error decoding dictionary page.");
    }
}
Also used : Stopwatch(com.google.common.base.Stopwatch) DictionaryPage(org.apache.parquet.column.page.DictionaryPage) UserException(org.apache.drill.common.exceptions.UserException) DrillRuntimeException(org.apache.drill.common.exceptions.DrillRuntimeException) ExecutionSetupException(org.apache.drill.common.exceptions.ExecutionSetupException) IOException(java.io.IOException) DrillBuf(io.netty.buffer.DrillBuf)

Aggregations

DrillBuf (io.netty.buffer.DrillBuf)2 DictionaryPage (org.apache.parquet.column.page.DictionaryPage)2 Stopwatch (com.google.common.base.Stopwatch)1 IOException (java.io.IOException)1 DrillRuntimeException (org.apache.drill.common.exceptions.DrillRuntimeException)1 ExecutionSetupException (org.apache.drill.common.exceptions.ExecutionSetupException)1 UserException (org.apache.drill.common.exceptions.UserException)1