liyafan82 commented on a change in pull request #8475:
URL: https://github.com/apache/arrow/pull/8475#discussion_r508272146



##########
File path: 
java/vector/src/main/java/org/apache/arrow/vector/util/DecimalUtility.java
##########
@@ -119,34 +121,47 @@ public static boolean checkPrecisionAndScale(int 
decimalPrecision, int decimalSc
    * UnsupportedOperationException if the decimal size is greater than the 
Decimal vector byte
    * width.
    */
-  public static void writeBigDecimalToArrowBuf(BigDecimal value, ArrowBuf 
bytebuf, int index) {
+  public static void writeBigDecimalToArrowBuf(BigDecimal value, ArrowBuf 
bytebuf, int index, int byteWidth) {
     final byte[] bytes = value.unscaledValue().toByteArray();
-    writeByteArrayToArrowBufHelper(bytes, bytebuf, index);
+    writeByteArrayToArrowBufHelper(bytes, bytebuf, index, byteWidth);
   }
 
   /**
    * Write the given long to the ArrowBuf at the given value index.
    */
   public static void writeLongToArrowBuf(long value, ArrowBuf bytebuf, int 
index) {
-    final long addressOfValue = bytebuf.memoryAddress() + (long) index * 
DECIMAL_BYTE_LENGTH;
+    final long addressOfValue = bytebuf.memoryAddress() + (long) index * 16;

Review comment:
       It would be better to use DecimalVector.BYTE_WIDTH?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to