rdblue commented on code in PR #11919: URL: https://github.com/apache/iceberg/pull/11919#discussion_r1907595448
########## core/src/test/java/org/apache/iceberg/avro/AvroTestHelpers.java: ########## @@ -126,9 +139,18 @@ private static void assertEquals(Type type, Object expected, Object actual) { assertThat(actual).as("Primitive value should be equal to expected").isEqualTo(expected); break; case STRUCT: - assertThat(expected).as("Expected should be a Record").isInstanceOf(Record.class); - assertThat(actual).as("Actual should be a Record").isInstanceOf(Record.class); - assertEquals(type.asStructType(), (Record) expected, (Record) actual); + assertThat(expected) Review Comment: The problem with this approach is that it allows the struct types to be mixed. If for some reason the reader produced a top-level Avro `GenericData.Record` but nested structs were `StructLike`, this would allow it as long as the expected value passed in matches. Unfortunately, it's not uncommon for people to submit PRs where the expected values are set to whatever makes tests pass. Given the amount of code here, I'd prefer to either add a boolean flag to the `private` methods or use a separate set of methods so that the record class is validated using the same logic throughout. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org