@Override protected void writeDecimalToBlock(BigDecimal decimal, BlockBuilder blockBuilder) { SHORT_DECIMAL_TYPE.writeLong(blockBuilder, decimal.unscaledValue().longValue()); }
@Override protected void writeDecimalToBlock(BigDecimal decimal, BlockBuilder blockBuilder) { shortDecimalType.writeLong(blockBuilder, decimal.unscaledValue().longValue()); }
@Override protected void writeDecimalToBlock(BigDecimal decimal, BlockBuilder blockBuilder) { shortDecimalType.writeLong(blockBuilder, decimal.unscaledValue().longValue()); }
@Override protected void writeDecimalToBlock(BigDecimal decimal, BlockBuilder blockBuilder) { SHORT_DECIMAL_TYPE.writeLong(blockBuilder, decimal.unscaledValue().longValue()); }
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); } }
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); } }
@Override public void decodeValueInto(int depth, BlockBuilder builder, Slice slice, int offset, int length) { if (isShortDecimal(type)) { type.writeLong(builder, parseLong(slice, offset, length)); } else { type.writeSlice(builder, parseSlice(slice, offset, length)); } }
@Override public void decodeValueInto(BlockBuilder builder, Slice slice, int offset, int length) { if (isShortDecimal(type)) { type.writeLong(builder, parseLong(slice, offset)); } else { type.writeSlice(builder, parseSlice(slice, offset)); } }
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(); } } }
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(); } } }
@Override public void append(JsonParser parser, BlockBuilder blockBuilder) throws IOException { Long result = currentTokenAsShortDecimal(parser, type.getPrecision(), type.getScale()); if (result == null) { blockBuilder.appendNull(); } else { type.writeLong(blockBuilder, result); } } }
@Override public void append(JsonParser parser, BlockBuilder blockBuilder) throws IOException { Long result = currentTokenAsShortDecimal(parser, type.getPrecision(), type.getScale()); if (result == null) { blockBuilder.appendNull(); } else { type.writeLong(blockBuilder, result); } } }
@Override public Block[] getSequenceBlocks(int start, int length) { BlockBuilder blockBuilder = SHORT_DECIMAL.createBlockBuilder(null, length); for (int i = start; i < start + length; i++) { SHORT_DECIMAL.writeLong(blockBuilder, i); } return new Block[] {blockBuilder.build()}; }
public static Block createShortDecimalSequenceBlock(int start, int end, DecimalType type) { BlockBuilder builder = type.createFixedSizeBlockBuilder(end - start); long base = BigInteger.TEN.pow(type.getScale()).longValue(); for (int i = start; i < end; ++i) { type.writeLong(builder, base * i); } return builder.build(); }
@Override public Block[] getSequenceBlocks(int start, int length) { BlockBuilder blockBuilder = SHORT_DECIMAL.createBlockBuilder(null, length); for (int i = start; i < start + length; i++) { SHORT_DECIMAL.writeLong(blockBuilder, i); } return new Block[] {blockBuilder.build()}; }
@Override public Block[] getSequenceBlocks(int start, int length) { BlockBuilder blockBuilder = SHORT_DECIMAL.createBlockBuilder(null, length); for (int i = start; i < start + length; i++) { SHORT_DECIMAL.writeLong(blockBuilder, i); } return new Block[] {blockBuilder.build()}; }
@Override public Block[] getSequenceBlocks(int start, int length) { BlockBuilder blockBuilder = SHORT_DECIMAL.createBlockBuilder(null, length); for (int i = start; i < start + length; i++) { SHORT_DECIMAL.writeLong(blockBuilder, i); } return new Block[] {blockBuilder.build()}; }
public static Block createShortDecimalSequenceBlock(int start, int end, DecimalType type) { BlockBuilder builder = type.createFixedSizeBlockBuilder(end - start); long base = BigInteger.TEN.pow(type.getScale()).longValue(); for (int i = start; i < end; ++i) { type.writeLong(builder, base * i); } return builder.build(); }
public static Block createShortDecimalsBlock(Iterable<String> values) { DecimalType shortDecimalType = DecimalType.createDecimalType(1); BlockBuilder builder = shortDecimalType.createBlockBuilder(null, 100); for (String value : values) { if (value == null) { builder.appendNull(); } else { shortDecimalType.writeLong(builder, new BigDecimal(value).unscaledValue().longValue()); } } return builder.build(); }
public static Block createShortDecimalsBlock(Iterable<String> values) { DecimalType shortDecimalType = DecimalType.createDecimalType(1); BlockBuilder builder = shortDecimalType.createBlockBuilder(null, 100); for (String value : values) { if (value == null) { builder.appendNull(); } else { shortDecimalType.writeLong(builder, new BigDecimal(value).unscaledValue().longValue()); } } return builder.build(); }