@Override public int capacity() { return decimalVector.getDataBuffer().capacity(); } }
@Override public int capacity() { return decimalVector.getDataBuffer().capacity(); } }
@Override void addNext(int start, int index) { /* data read from Parquet into the bytebuf is already in BE format, no need * swap bytes to construct BigDecimal. only when we write BigDecimal to * data buffer of decimal vector, we need to swap bytes which the DecimalUtility * function already does. */ BigDecimal intermediate = DecimalHelper.getBigDecimalFromBEArrowBuf(bytebuf, index, schemaElement.getScale()); /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(intermediate, valueVec.getDataBuffer(), index); valueVec.setIndexDefined(index); } }
@Override void addNext(int start, int index) { /* data read from Parquet into the bytebuf is already in BE format, no need * swap bytes to construct BigDecimal. only when we write BigDecimal to * data buffer of decimal vector, we need to swap bytes which the DecimalUtility * function already does. */ BigDecimal intermediate = DecimalHelper.getBigDecimalFromBEArrowBuf(bytebuf, index, schemaElement.getScale()); /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(intermediate, valueVec.getDataBuffer(), index); valueVec.setIndexDefined(index); } }
private static void insertIntoDecimalVector(int index, int value, BaseFixedWidthVector vector) { DecimalVector vec = (DecimalVector)vector; DecimalHolder holder = new DecimalHolder(); holder.buffer = vec.getDataBuffer(); DecimalUtility.writeBigDecimalToArrowBuf(new BigDecimal(value), holder.buffer, 0); holder.start = 0; holder.scale = 0; holder.precision = 38; vec.setSafe(index, holder); }
@Override public boolean setSafe(int index, ArrowBuf bytebuf, int start, int length) { /* data read from Parquet into the bytebuf is already in BE format, no need * swap bytes to construct BigDecimal. only when we write BigDecimal to * data buffer of decimal vector, we need to swap bytes which the DecimalUtility * function already does. */ BigDecimal intermediate = DecimalHelper.getBigDecimalFromBEArrowBuf(bytebuf, index, schemaElement.getScale()); if (index >= decimalVector.getValueCapacity()) { return false; } /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(intermediate, decimalVector.getDataBuffer(), index); decimalVector.setIndexDefined(index); return true; }
@Override public boolean setSafe(int index, ArrowBuf bytebuf, int start, int length) { /* data read from Parquet into the bytebuf is already in BE format, no need * swap bytes to construct BigDecimal. only when we write BigDecimal to * data buffer of decimal vector, we need to swap bytes which the DecimalUtility * function already does. */ BigDecimal intermediate = DecimalHelper.getBigDecimalFromBEArrowBuf(bytebuf, index, schemaElement.getScale()); if (index >= decimalVector.getValueCapacity()) { return false; } /* this will swap bytes as we are writing to the buffer of DecimalVector */ DecimalUtility.writeBigDecimalToArrowBuf(intermediate, decimalVector.getDataBuffer(), index); decimalVector.setIndexDefined(index); return true; }
SerializedField.Builder decimalField = vectorHelper.getMetadataBuilder(); SerializedField.Builder childDecimalField = decimalField.getChildBuilderList().get(1); ByteBuf newBuffer = patchDecimal(allocator, decimalVector.getDataBuffer(), decimalField, childDecimalField);