HonahX commented on code in PR #12012:
URL: https://github.com/apache/iceberg/pull/12012#discussion_r1926050463


##########
core/src/test/java/org/apache/iceberg/TestSortOrder.java:
##########
@@ -342,6 +342,22 @@ public void testVariantUnsupported() {
         .hasMessage("Unsupported type for identity: variant");
   }
 
+  @TestTemplate
+  public void testUnknownUnsupported() {
+    Schema v3Schema =
+        new Schema(
+            Types.NestedField.required(3, "id", Types.LongType.get()),
+            Types.NestedField.required(4, "data", Types.StringType.get()),
+            Types.NestedField.required(
+                5,
+                "struct",
+                Types.StructType.of(Types.NestedField.optional(6, "u", 
Types.UnknownType.get()))));
+
+    assertThatThrownBy(() -> 
SortOrder.builderFor(v3Schema).withOrderId(10).asc("struct.u").build())
+        .isInstanceOf(IllegalArgumentException.class)
+        .hasMessage("Unsupported type for identity: unknown");

Review Comment:
   I think there should not be error here since we allow Identity transform for 
unknown.



##########
api/src/main/java/org/apache/iceberg/transforms/Identity.java:
##########
@@ -39,7 +39,9 @@ class Identity<T> implements Transform<T, T> {
   @Deprecated
   public static <I> Identity<I> get(Type type) {
     Preconditions.checkArgument(
-        type.typeId() != Type.TypeID.VARIANT, "Unsupported type for identity: 
%s", type);
+        type.typeId() != Type.TypeID.VARIANT && type.typeId() != 
Type.TypeID.UNKNOWN,

Review Comment:
   ```suggestion
           type.typeId() != Type.TypeID.VARIANT,
   ```
   Shall we also remove the check here? It's deprecated but I think we do not 
want inconsistency before it is fully removed.



##########
core/src/test/java/org/apache/iceberg/TestSortOrder.java:
##########
@@ -342,6 +342,22 @@ public void testVariantUnsupported() {
         .hasMessage("Unsupported type for identity: variant");
   }
 
+  @TestTemplate

Review Comment:
   ```suggestion
     @Test
   ```
   This maybe a general question for other tests in `TestSortOrder`. Do we need 
`TestTemplate` for tests that does not use the parametrized field, 
`formatVersion`. It seems we're running the same test three times.



-- 
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

Reply via email to