Search in sources :

Example 1 with ParquetDecodingException

use of org.apache.parquet.io.ParquetDecodingException in project hive by apache.

the class VectorizedPrimitiveColumnReader method readPageV1.

private void readPageV1(DataPageV1 page) {
    ValuesReader rlReader = page.getRlEncoding().getValuesReader(descriptor, REPETITION_LEVEL);
    ValuesReader dlReader = page.getDlEncoding().getValuesReader(descriptor, DEFINITION_LEVEL);
    this.repetitionLevelColumn = new ValuesReaderIntIterator(rlReader);
    this.definitionLevelColumn = new ValuesReaderIntIterator(dlReader);
    try {
        byte[] bytes = page.getBytes().toByteArray();
        LOG.debug("page size " + bytes.length + " bytes and " + pageValueCount + " records");
        LOG.debug("reading repetition levels at 0");
        rlReader.initFromPage(pageValueCount, bytes, 0);
        int next = rlReader.getNextOffset();
        LOG.debug("reading definition levels at " + next);
        dlReader.initFromPage(pageValueCount, bytes, next);
        next = dlReader.getNextOffset();
        LOG.debug("reading data at " + next);
        initDataReader(page.getValueEncoding(), bytes, next, page.getValueCount());
    } catch (IOException e) {
        throw new ParquetDecodingException("could not read page " + page + " in col " + descriptor, e);
    }
}
Also used : ValuesReader(org.apache.parquet.column.values.ValuesReader) ParquetDecodingException(org.apache.parquet.io.ParquetDecodingException) IOException(java.io.IOException)

Example 2 with ParquetDecodingException

use of org.apache.parquet.io.ParquetDecodingException in project hive by apache.

the class VectorizedPrimitiveColumnReader method readPageV2.

private void readPageV2(DataPageV2 page) {
    this.pageValueCount = page.getValueCount();
    this.repetitionLevelColumn = newRLEIterator(descriptor.getMaxRepetitionLevel(), page.getRepetitionLevels());
    this.definitionLevelColumn = newRLEIterator(descriptor.getMaxDefinitionLevel(), page.getDefinitionLevels());
    try {
        LOG.debug("page data size " + page.getData().size() + " bytes and " + pageValueCount + " records");
        initDataReader(page.getDataEncoding(), page.getData().toByteArray(), 0, page.getValueCount());
    } catch (IOException e) {
        throw new ParquetDecodingException("could not read page " + page + " in col " + descriptor, e);
    }
}
Also used : ParquetDecodingException(org.apache.parquet.io.ParquetDecodingException) IOException(java.io.IOException)

Example 3 with ParquetDecodingException

use of org.apache.parquet.io.ParquetDecodingException in project hive by apache.

the class BaseVectorizedColumnReader method readPageV1.

private void readPageV1(DataPageV1 page) {
    ValuesReader rlReader = page.getRlEncoding().getValuesReader(descriptor, REPETITION_LEVEL);
    ValuesReader dlReader = page.getDlEncoding().getValuesReader(descriptor, DEFINITION_LEVEL);
    this.repetitionLevelColumn = new ValuesReaderIntIterator(rlReader);
    this.definitionLevelColumn = new ValuesReaderIntIterator(dlReader);
    try {
        byte[] bytes = page.getBytes().toByteArray();
        LOG.debug("page size " + bytes.length + " bytes and " + pageValueCount + " records");
        LOG.debug("reading repetition levels at 0");
        rlReader.initFromPage(pageValueCount, bytes, 0);
        int next = rlReader.getNextOffset();
        LOG.debug("reading definition levels at " + next);
        dlReader.initFromPage(pageValueCount, bytes, next);
        next = dlReader.getNextOffset();
        LOG.debug("reading data at " + next);
        initDataReader(page.getValueEncoding(), bytes, next, page.getValueCount());
    } catch (IOException e) {
        throw new ParquetDecodingException("could not read page " + page + " in col " + descriptor, e);
    }
}
Also used : ValuesReader(org.apache.parquet.column.values.ValuesReader) ParquetDecodingException(org.apache.parquet.io.ParquetDecodingException) IOException(java.io.IOException)

Example 4 with ParquetDecodingException

use of org.apache.parquet.io.ParquetDecodingException in project hive by apache.

the class BaseVectorizedColumnReader method readPageV2.

private void readPageV2(DataPageV2 page) {
    this.pageValueCount = page.getValueCount();
    this.repetitionLevelColumn = newRLEIterator(descriptor.getMaxRepetitionLevel(), page.getRepetitionLevels());
    this.definitionLevelColumn = newRLEIterator(descriptor.getMaxDefinitionLevel(), page.getDefinitionLevels());
    try {
        LOG.debug("page data size " + page.getData().size() + " bytes and " + pageValueCount + " records");
        initDataReader(page.getDataEncoding(), page.getData().toByteArray(), 0, page.getValueCount());
    } catch (IOException e) {
        throw new ParquetDecodingException("could not read page " + page + " in col " + descriptor, e);
    }
}
Also used : ParquetDecodingException(org.apache.parquet.io.ParquetDecodingException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)4 ParquetDecodingException (org.apache.parquet.io.ParquetDecodingException)4 ValuesReader (org.apache.parquet.column.values.ValuesReader)2