@Test public void testSkipsValue() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); writeBigInteger(baos, BigInteger.valueOf(Long.MAX_VALUE)); writeBigInteger(baos, BigInteger.valueOf(Long.MIN_VALUE)); OrcInputStream inputStream = orcInputStreamFor("skip test", baos.toByteArray()); DecimalInputStream stream = new DecimalInputStream(inputStream); stream.skip(1); assertEquals(stream.nextLong(), Long.MIN_VALUE); }
private void seekToOffset() throws IOException { if (readOffset > 0) { if (presentStream != null) { // skip ahead the present bit reader, but count the set bits // and use this as the skip size for the data reader readOffset = presentStream.countBitsSet(readOffset); } if (readOffset > 0) { if (decimalStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but decimal stream is not present"); } if (scaleStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but scale stream is not present"); } decimalStream.skip(readOffset); scaleStream.skip(readOffset); } } }
@Test public void testSkipsValue() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); writeBigInteger(baos, BigInteger.valueOf(Long.MAX_VALUE)); writeBigInteger(baos, BigInteger.valueOf(Long.MIN_VALUE)); OrcInputStream inputStream = orcInputStreamFor("skip test", baos.toByteArray()); DecimalInputStream stream = new DecimalInputStream(inputStream); stream.skip(1); assertEquals(stream.nextLong(), Long.MIN_VALUE); }
private void seekToOffset() throws IOException { if (readOffset > 0) { if (presentStream != null) { // skip ahead the present bit reader, but count the set bits // and use this as the skip size for the data reader readOffset = presentStream.countBitsSet(readOffset); } if (readOffset > 0) { if (decimalStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but decimal stream is not present"); } if (scaleStream == null) { throw new OrcCorruptionException(streamDescriptor.getOrcDataSourceId(), "Value is not null but scale stream is not present"); } decimalStream.skip(readOffset); scaleStream.skip(readOffset); } } }