huaxingao commented on code in PR #14379:
URL: https://github.com/apache/iceberg/pull/14379#discussion_r2501489020
##########
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:
In test, we can construct `GenericRecord` with Spark-native values.
https://github.com/apache/iceberg/blob/4d22aa4c6ffe9e04930457923f6aaec3ae1bac1e/spark/v4.0/spark/src/test/java/org/apache/iceberg/spark/source/TestStructInternalRowVariant.java#L95
I am not sure if there are any real usage. I am OK to remove this.
--
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]