andygrove commented on code in PR #756: URL: https://github.com/apache/datafusion-comet/pull/756#discussion_r1702022378
########## common/src/main/java/org/apache/comet/vector/CometVector.java: ########## @@ -125,14 +144,14 @@ byte[] getBinaryDecimal(int i) { /** Reads a 16-byte byte array which are encoded big-endian for decimal128. */ public byte[] copyBinaryDecimal(int i, byte[] dest) { - long valueBufferAddress = getValueVector().getDataBuffer().memoryAddress(); - Platform.copyMemory( - null, - valueBufferAddress + (long) i * DECIMAL_BYTE_WIDTH, - dest, - Platform.BYTE_ARRAY_OFFSET, - DECIMAL_BYTE_WIDTH); + if (DECIMAL_BYTES_ALL == null) { + ValueVector vector = getValueVector(); + DECIMAL_BYTES_ALL = new byte[vector.getBufferSize()]; + copyBuffer(vector, DECIMAL_BYTES_ALL); + } // Decimal is stored little-endian in Arrow, so we need to reverse the bytes here + System.arraycopy( + DECIMAL_BYTES_ALL, i * DECIMAL_BYTE_WIDTH, DECIMAL_BYTES, 0, DECIMAL_BYTE_WIDTH); for (int j = 0, k = DECIMAL_BYTE_WIDTH - 1; j < DECIMAL_BYTE_WIDTH / 2; j++, k--) { byte tmp = dest[j]; Review Comment: nm, I see it now -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org