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 { BytesInput bytes = page.getBytes(); LOG.debug("page size " + bytes.size() + " bytes and " + pageValueCount + " records"); ByteBufferInputStream in = bytes.toInputStream(); LOG.debug("reading repetition levels at " + in.position()); rlReader.initFromPage(pageValueCount, in); LOG.debug("reading definition levels at " + in.position()); dlReader.initFromPage(pageValueCount, in); LOG.debug("reading data at " + in.position()); initDataReader(page.getValueEncoding(), in, page.getValueCount()); } catch (IOException e) { throw new ParquetDecodingException("could not read page " + page + " in col " + descriptor, e); } }
public long position() { return delegate.position(); }
/** * {@inheritDoc} * @see org.apache.parquet.column.values.ValuesReader#initFromPage(int, ByteBufferInputStream) */ @Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); this.in.initFromPage(valueCount, stream); }
@Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); this.in = stream.remainingStream(); } }
/** * {@inheritDoc} * @see org.apache.parquet.column.values.ValuesReader#initFromPage(int, ByteBufferInputStream) */ @Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); this.in.initFromPage(valueCount, stream); } }
@Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); this.in = stream.remainingStream(); } }
@Override public void skip() { try { in.skipFully(length); } catch (IOException | RuntimeException e) { throw new ParquetDecodingException("could not skip bytes at offset " + in.position(), e); } }
@Override public void skip(int n) { try { in.skipFully(n * length); } catch (IOException | RuntimeException e) { throw new ParquetDecodingException("could not skip bytes at offset " + in.position(), e); } }
@Override public void skip() { try { int length = BytesUtils.readIntLittleEndian(in); in.skipFully(length); } catch (IOException e) { throw new ParquetDecodingException("could not skip bytes at offset " + in.position(), e); } catch (RuntimeException e) { throw new ParquetDecodingException("could not skip bytes at offset " + in.position(), e); } }
@Override public void skip() { try { int length = BytesUtils.readIntLittleEndian(in); in.skipFully(length); } catch (IOException e) { throw new ParquetDecodingException("could not skip bytes at offset " + in.position(), e); } catch (RuntimeException e) { throw new ParquetDecodingException("could not skip bytes at offset " + in.position(), e); } }
@Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); lengthReader.initFromPage(valueCount, stream); this.in = stream.remainingStream(); }
@Override public Binary readBytes() { try { int length = BytesUtils.readIntLittleEndian(in); return Binary.fromConstantByteBuffer(in.slice(length)); } catch (IOException e) { throw new ParquetDecodingException("could not read bytes at offset " + in.position(), e); } catch (RuntimeException e) { throw new ParquetDecodingException("could not read bytes at offset " + in.position(), e); } }
@Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); this.in = new LittleEndianDataInputStream(stream.remainingStream()); }
@Override public Binary readBytes() { try { int length = BytesUtils.readIntLittleEndian(in); return Binary.fromConstantByteBuffer(in.slice(length)); } catch (IOException e) { throw new ParquetDecodingException("could not read bytes at offset " + in.position(), e); } catch (RuntimeException e) { throw new ParquetDecodingException("could not read bytes at offset " + in.position(), e); } }
@Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); lengthReader.initFromPage(valueCount, stream); this.in = stream.remainingStream(); }
@Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); this.in = new LittleEndianDataInputStream(stream.remainingStream()); }
@Override public Binary readBytes() { try { return Binary.fromConstantByteBuffer(in.slice(length)); } catch (IOException | RuntimeException e) { throw new ParquetDecodingException("could not read bytes at offset " + in.position(), e); } }
@Override public Binary readBytes() { try { return Binary.fromConstantByteBuffer(in.slice(length)); } catch (IOException | RuntimeException e) { throw new ParquetDecodingException("could not read bytes at offset " + in.position(), e); } }