jackye1995 commented on code in PR #3249:
URL: https://github.com/apache/iceberg/pull/3249#discussion_r1146877191


##########
arrow/src/main/java/org/apache/iceberg/arrow/vectorized/VectorizedReaderBuilder.java:
##########
@@ -129,11 +130,31 @@ public VectorizedReader<?> primitive(
     if (desc.getMaxRepetitionLevel() > 0) {
       return null;
     }
-    Types.NestedField icebergField = icebergSchema.findField(parquetFieldId);
-    if (icebergField == null) {
+    Types.NestedField logicalType = icebergSchema.findField(parquetFieldId);
+    if (logicalType == null) {
       return null;
     }
+
+    Types.NestedField physicalType = logicalType;
+    PrimitiveType.PrimitiveTypeName typeName = 
primitive.getPrimitiveTypeName();
+    if (OriginalType.DECIMAL.equals(primitive.getOriginalType())) {
+      org.apache.iceberg.types.Type type;
+      if (PrimitiveType.PrimitiveTypeName.INT64.equals(typeName)) {
+        // Use BigIntVector for long backed decimal
+        type = Types.LongType.get();
+      } else if (PrimitiveType.PrimitiveTypeName.INT32.equals(typeName)) {
+        // Use IntVector for int backed decimal
+        type = Types.IntegerType.get();
+      } else {
+        // Use FixedSizeBinaryVector for binary backed decimal
+        type = Types.FixedType.ofLength(primitive.getTypeLength());
+      }
+      physicalType =
+          Types.NestedField.of(
+              logicalType.fieldId(), logicalType.isOptional(), 
logicalType.name(), type);

Review Comment:
   +1, you have access to the column descriptor in VectorizedArrowReader anyway



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