@Override protected Long readValue(DecimalInputStream valueStream) throws IOException { return valueStream.nextLong(); } }
long sourceScale = scaleStream.next(); if (decimalType.isShort()) { long rescaledDecimal = Decimals.rescale(decimalStream.nextLong(), (int) sourceScale, decimalType.getScale()); decimalType.writeLong(builder, rescaledDecimal); long sourceScale = scaleStream.next(); if (decimalType.isShort()) { long rescaledDecimal = Decimals.rescale(decimalStream.nextLong(), (int) sourceScale, decimalType.getScale()); decimalType.writeLong(builder, rescaledDecimal);
public void nextShortDecimalVector(int items, BlockBuilder builder, DecimalType targetType, long[] sourceScale) throws IOException { for (int i = 0; i < items; i++) { long value = nextLong(); long rescaledDecimal = Decimals.rescale(value, (int) sourceScale[i], targetType.getScale()); targetType.writeLong(builder, rescaledDecimal); } }
long sourceScale = scaleStream.next(); if (decimalType.isShort()) { long rescaledDecimal = Decimals.rescale(decimalStream.nextLong(), (int) sourceScale, decimalType.getScale()); decimalType.writeLong(builder, rescaledDecimal); long sourceScale = scaleStream.next(); if (decimalType.isShort()) { long rescaledDecimal = Decimals.rescale(decimalStream.nextLong(), (int) sourceScale, decimalType.getScale()); decimalType.writeLong(builder, rescaledDecimal);
private static void assertReadsShortValue(long value) throws IOException { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(BigInteger.valueOf(value))); assertEquals(stream.nextLong(), value); }
public void nextShortDecimalVector(int items, BlockBuilder builder, DecimalType targetType, long[] sourceScale, boolean[] isNull) throws IOException { for (int i = 0; i < items; i++) { if (!isNull[i]) { long rescaledDecimal = Decimals.rescale(nextLong(), (int) sourceScale[i], targetType.getScale()); targetType.writeLong(builder, rescaledDecimal); } else { builder.appendNull(); } } }
@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(); }); }
@Override protected Long readValue(DecimalInputStream valueStream) throws IOException { return valueStream.nextLong(); } }
public void nextShortDecimalVector(int items, BlockBuilder builder, DecimalType targetType, long[] sourceScale) throws IOException { for (int i = 0; i < items; i++) { long value = nextLong(); long rescaledDecimal = Decimals.rescale(value, (int) sourceScale[i], targetType.getScale()); targetType.writeLong(builder, rescaledDecimal); } }
private static void assertReadsShortValue(long value) throws IOException { DecimalInputStream stream = new DecimalInputStream(decimalInputStream(BigInteger.valueOf(value))); assertEquals(stream.nextLong(), value); }
public void nextShortDecimalVector(int items, BlockBuilder builder, DecimalType targetType, long[] sourceScale, boolean[] isNull) throws IOException { for (int i = 0; i < items; i++) { if (!isNull[i]) { long rescaledDecimal = Decimals.rescale(nextLong(), (int) sourceScale[i], targetType.getScale()); targetType.writeLong(builder, rescaledDecimal); } else { builder.appendNull(); } } }
@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(); }); }