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



##########
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:
       i reverted this back to its original contents and inlined the writeLong 
method for BigDecimal into BigDecimal256

##########
File path: java/vector/src/main/codegen/templates/ArrowType.java
##########
@@ -165,7 +165,20 @@ public final T visit(${type.name?remove_ending("_")} type) 
{
     ${fieldType} ${field.name};
     </#list>
 
+
+    <#if type.name == "Decimal">
+    // Needed to support golden file integration tests.
+    @JsonCreator
+    public static Decimal createDecimal128(

Review comment:
       yes, you are right, thanks for your attention to detail.

##########
File path: 
java/vector/src/main/codegen/templates/AbstractPromotableFieldWriter.java
##########
@@ -75,7 +75,7 @@ public void endList() {
 
   <#list vv.types as type><#list type.minor as minor><#assign name = 
minor.class?cap_first />
     <#assign fields = minor.fields!type.fields />
-  <#if minor.class != "Decimal">
+  <#if minor.class != "Decimal" && minor.class != "BigDecimal">

Review comment:
       nice catch.




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