aihuaxu commented on code in PR #14379:
URL: https://github.com/apache/iceberg/pull/14379#discussion_r2501412843


##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/StructInternalRow.java:
##########
@@ -338,11 +348,37 @@ private ArrayData collectionToArrayData(Type elementType, 
Collection<?> values)
             array ->
                 (BiConsumer<Integer, Map<?, ?>>)
                     (pos, map) -> array[pos] = 
mapToMapData(elementType.asMapType(), map));
+      case VARIANT:
+        return fillArray(
+            values,
+            array -> (BiConsumer<Integer, Object>) (pos, v) -> array[pos] = 
toVariantVal(v));
       default:
         throw new UnsupportedOperationException("Unsupported array element 
type: " + elementType);
     }
   }
 
+  private static VariantVal toVariantVal(Object value) {
+    if (value instanceof VariantVal) {
+      return (VariantVal) value;

Review Comment:
   Can you help me understand what kind of data will be present ? From other 
types such as Map, Struct, seems we should only expect Variant here and then we 
are converting to VariantVal. 
   
   By checking the usage, seems we should expect Variant and we should not see 
VariantVal?
   



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