rdblue commented on code in PR #11831: URL: https://github.com/apache/iceberg/pull/11831#discussion_r1953620434
########## api/src/test/java/org/apache/iceberg/types/TestTypeUtil.java: ########## @@ -645,4 +651,77 @@ public void testReassignOrRefreshIdsCaseInsensitive() { required(2, "FIELD2", Types.IntegerType.get()))); assertThat(actualSchema.asStruct()).isEqualTo(expectedSchema.asStruct()); } + + private static Stream<Arguments> testTypes() { + return Stream.of( + Arguments.of(Types.UnknownType.get()), + Arguments.of(Types.VariantType.get()), + Arguments.of(Types.TimestampNanoType.withoutZone()), + Arguments.of(Types.TimestampNanoType.withZone())); + } + + @ParameterizedTest + @MethodSource("testTypes") + public void testAssignFreshIdsWithType(Type testType) { + Schema schema = + new Schema(required(0, "v", testType), required(1, "A", Types.IntegerType.get())); + Schema sourceSchema = + new Schema(required(1, "v", testType), required(2, "A", Types.IntegerType.get())); + + Schema assignedSchema = + TypeUtil.assignFreshIds(sourceSchema, new AtomicInteger(10)::incrementAndGet); Review Comment: This doesn't use `sourceSchema` as intended. ID assignment with a source schema uses assigned IDs from that schema when names match and assigns missing/new IDs using the `NextID` supplier. When using the single schema version, the second schema should not be present. That also raises the question about what we need to test for new types. In this case, because the type just needs to be handled by `field` and `struct`, I think it's fine to just have a case that validates that `UnsupportedOperationException` is not thrown and that the behavior is expected. That is, we only need on test with a variant here. Other tests with more logic for primitives may need more cases though. -- 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