private static void assertReadsShortValue(long value) throws IOException { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(BigInteger.valueOf(value))); assertEquals(stream.nextLong(), value); }
@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 static void assertShortValueReadFails(BigInteger value) { assertThrows(OrcCorruptionException.class, () -> { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(value)); stream.nextLong(); }); }
private static void assertReadsLongValue(BigInteger value) throws IOException { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(value)); Slice decimal = unscaledDecimal(); stream.nextLongDecimal(decimal); assertEquals(unscaledDecimalToBigInteger(decimal), value); }
private static void assertLongValueReadFails(BigInteger value) { Slice decimal = unscaledDecimal(); assertThrows(OrcCorruptionException.class, () -> { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(value)); stream.nextLongDecimal(decimal); }); }
@Override protected DecimalInputStream createValueStream(Slice slice) throws OrcCorruptionException { Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE); OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()); return new DecimalInputStream(input); }
@Override protected DecimalInputStream createValueStream(Slice slice) throws OrcCorruptionException { Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE); return new DecimalInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize())); }
return createLongStream(inputStream, encoding, type, true, usesVInt); case DECIMAL: return new DecimalInputStream(inputStream);
private static void assertReadsShortValue(long value) throws IOException { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(BigInteger.valueOf(value))); assertEquals(stream.nextLong(), value); }
@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 static void assertReadsLongValue(BigInteger value) throws IOException { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(value)); Slice decimal = unscaledDecimal(); stream.nextLongDecimal(decimal); assertEquals(unscaledDecimalToBigInteger(decimal), value); }
private static void assertShortValueReadFails(BigInteger value) { assertThrows(OrcCorruptionException.class, () -> { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(value)); stream.nextLong(); }); }
private static void assertLongValueReadFails(BigInteger value) { Slice decimal = unscaledDecimal(); assertThrows(OrcCorruptionException.class, () -> { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(value)); stream.nextLongDecimal(decimal); }); }
@Override protected DecimalInputStream createValueStream(Slice slice) throws OrcCorruptionException { Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE); OrcInputStream input = new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize()); return new DecimalInputStream(input); }
@Override protected DecimalInputStream createValueStream(Slice slice) throws OrcCorruptionException { Optional<OrcDecompressor> orcDecompressor = createOrcDecompressor(ORC_DATA_SOURCE_ID, SNAPPY, COMPRESSION_BLOCK_SIZE); return new DecimalInputStream(new OrcInputStream(ORC_DATA_SOURCE_ID, slice.getInput(), orcDecompressor, newSimpleAggregatedMemoryContext(), slice.getRetainedSize())); }
return createLongStream(inputStream, encoding, type, true, usesVInt); case DECIMAL: return new DecimalInputStream(inputStream);