rdblue commented on a change in pull request #3249:
URL: https://github.com/apache/iceberg/pull/3249#discussion_r725681939



##########
File path: 
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/VectorizedArrowReader.java
##########
@@ -262,19 +292,35 @@ private void 
allocateVectorBasedOnOriginalType(PrimitiveType primitive, Field ar
         this.typeWidth = 8;
         break;
       case DECIMAL:
-        this.vec = arrowField.createVector(rootAlloc);
-        ((DecimalVector) vec).allocateNew(batchSize);
         switch (primitive.getPrimitiveTypeName()) {
           case BINARY:
           case FIXED_LEN_BYTE_ARRAY:
+            this.vec = arrowField.createVector(rootAlloc);
+            ((DecimalVector) vec).allocateNew(batchSize);
             this.readType = ReadType.FIXED_LENGTH_DECIMAL;
             this.typeWidth = primitive.getTypeLength();
             break;
           case INT64:
+            if (useLongVectorForLongBackedDecimal) {
+              Field field = ArrowSchemaUtil.convertToLong(icebergField);

Review comment:
       I don't think conversion should be re-done here. Can you make it so that 
this is handed the correct converted field in the first place? Then you'd just 
need to detect that the field is a long or int rather than checking the config 
property in so many places.




-- 
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: [email protected]

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to