@Override public void initFromPage(int valueCount, byte[] page, int offset) throws IOException { checkArgument(page.length > offset, "Attempt to read offset not in the page"); ByteArrayInputStream in = new ByteArrayInputStream(page, offset, page.length - offset); int bitWidth = BytesUtils.readIntLittleEndianOnOneByte(in); decoder = new RunLengthBitPackingHybridDecoder(bitWidth, in); }
private void readBitWidthsForMiniBlocks() { for (int i = 0; i < config.miniBlockNumInABlock; i++) { try { bitWidths[i] = BytesUtils.readIntLittleEndianOnOneByte(in); } catch (IOException e) { throw new ParquetDecodingException("Can not decode bitwidth in block header", e); } } } }
@Override public void initFromPage(int valueCount, byte[] page, int offset) throws IOException { checkArgument(page.length > offset, "Attempt to read offset not in the page"); ByteArrayInputStream in = new ByteArrayInputStream(page, offset, page.length - offset); int bitWidth = BytesUtils.readIntLittleEndianOnOneByte(in); decoder = new RunLengthBitPackingHybridDecoder(bitWidth, in); }
private void readBitWidthsForMiniBlocks() { for (int i = 0; i < config.miniBlockNumInABlock; i++) { try { bitWidths[i] = BytesUtils.readIntLittleEndianOnOneByte(in); } catch (IOException e) { throw new ParquetDecodingException("Can not decode bitwidth in block header", e); } } } }
public static int readIntLittleEndianPaddedOnBitWidth(InputStream in, int bitWidth) throws IOException { int bytesWidth = paddedByteCountFromBits(bitWidth); switch (bytesWidth) { case 0: return 0; case 1: return BytesUtils.readIntLittleEndianOnOneByte(in); case 2: return BytesUtils.readIntLittleEndianOnTwoBytes(in); case 3: return BytesUtils.readIntLittleEndianOnThreeBytes(in); case 4: return BytesUtils.readIntLittleEndian(in); default: throw new IOException( String.format("Encountered bitWidth (%d) that requires more than 4 bytes", bitWidth)); } }
public static int readIntLittleEndianPaddedOnBitWidth(InputStream in, int bitWidth) throws IOException { int bytesWidth = paddedByteCountFromBits(bitWidth); switch (bytesWidth) { case 0: return 0; case 1: return BytesUtils.readIntLittleEndianOnOneByte(in); case 2: return BytesUtils.readIntLittleEndianOnTwoBytes(in); case 3: return BytesUtils.readIntLittleEndianOnThreeBytes(in); case 4: return BytesUtils.readIntLittleEndian(in); default: throw new IOException( String.format("Encountered bitWidth (%d) that requires more than 4 bytes", bitWidth)); } }
@Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { this.in = stream.remainingStream(); if (in.available() > 0) { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); int bitWidth = BytesUtils.readIntLittleEndianOnOneByte(in); LOG.debug("bit width {}", bitWidth); decoder = new RunLengthBitPackingHybridDecoder(bitWidth, in); } else { decoder = new RunLengthBitPackingHybridDecoder(1, in) { @Override public int readInt() throws IOException { throw new IOException("Attempt to read from empty page"); } }; } }
@Override public void initFromPage(int valueCount, ByteBufferInputStream stream) throws IOException { this.in = stream.remainingStream(); if (in.available() > 0) { LOG.debug("init from page at offset {} for length {}", stream.position(), stream.available()); int bitWidth = BytesUtils.readIntLittleEndianOnOneByte(in); LOG.debug("bit width {}", bitWidth); decoder = new RunLengthBitPackingHybridDecoder(bitWidth, in); } else { decoder = new RunLengthBitPackingHybridDecoder(1, in) { @Override public int readInt() throws IOException { throw new IOException("Attempt to read from empty page"); } }; } }