ebyhr commented on code in PR #16924:
URL: https://github.com/apache/iceberg/pull/16924#discussion_r3450828837
##########
spark/v4.1/spark/src/test/java/org/apache/iceberg/spark/TestSparkValueConverter.java:
##########
@@ -83,6 +84,26 @@ public void testSparkNullPrimitiveConvert() {
assertCorrectNullConversion(schema);
}
+ @Test
+ public void testConvertToSparkComplexTypesThrow() {
+ Types.StructType struct =
+ Types.StructType.of(Types.NestedField.required(1, "lat",
Types.FloatType.get()));
+ Types.ListType list = Types.ListType.ofOptional(1, Types.StringType.get());
+ Types.MapType map =
+ Types.MapType.ofOptional(1, 2, Types.StringType.get(),
Types.StringType.get());
+
+ for (Types.NestedField field :
+ new Types.NestedField[] {
+ Types.NestedField.required(0, "s", struct),
+ Types.NestedField.required(0, "l", list),
+ Types.NestedField.required(0, "m", map)
+ }) {
+ assertThatThrownBy(() ->
SparkValueConverter.convertToSpark(field.type(), "unused"))
+ .isInstanceOf(UnsupportedOperationException.class)
+ .hasMessageContaining("Complex types currently not supported");
Review Comment:
There is no need to build a NestedField object. Type is sufficient:
```java
for (Type type : List.of(struct, list, map)) {
assertThatThrownBy(() -> SparkValueConverter.convertToSpark(type,
"unused"))
.isInstanceOf(UnsupportedOperationException.class)
.hasMessageContaining("Complex types currently not supported");
}
```
--
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]