RussellSpitzer commented on code in PR #18935:
URL: https://github.com/apache/iceberg/pull/18935#discussion_r4591685715
##########
api/src/test/java/org/apache/iceberg/types/TestReadabilityChecks.java:
##########
@@ -286,6 +286,27 @@ public void testIncompatibleStructAndPrimitive() {
.contains("struct cannot be read as a string");
}
+ @Test
+ void incompatibleFileAndStruct() {
+ Schema fileSchema = new Schema(optional(1, "photo", Types.FileType.of(1)));
+ Schema structSchema =
+ new Schema(optional(1, "photo",
Types.StructType.of(Types.FileType.of(1).fields())));
+
+ List<String> asFile =
CheckCompatibility.readCompatibilityErrors(fileSchema, structSchema);
+ assertThat(asFile).hasSize(1);
+ assertThat(asFile.get(0))
+ .as("Should complain that a struct cannot be read as a file")
+ .contains("cannot be read as a file");
+
+ List<String> asStruct =
CheckCompatibility.readCompatibilityErrors(structSchema, fileSchema);
+ assertThat(asStruct).hasSize(1);
+ assertThat(asStruct.get(0))
+ .as("Should complain that a file cannot be read as a struct")
+ .contains("file cannot be read as a struct");
+
+ assertThat(CheckCompatibility.readCompatibilityErrors(fileSchema,
fileSchema)).isEmpty();
+ }
Review Comment:
Behaviors are now in their own tests.
--
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]