jackylee-ch commented on code in PR #17998:
URL: https://github.com/apache/iceberg/pull/17998#discussion_r3958066201


##########
orc/src/test/java/org/apache/iceberg/orc/TestExpressionToSearchArgument.java:
##########
@@ -221,6 +221,24 @@ public void testUnsupportedTypes() {
     assertThat(actual.toString()).isEqualTo(expected.toString());
   }
 
+  @Test
+  public void testVariantType() {
+    Schema schema =
+        new Schema(
+            required(1, "long", Types.LongType.get()),
+            optional(2, "variant", Types.VariantType.get()));
+
+    // predicates on other columns are still pushed down when the schema 
contains a variant column
+    Expression expr = equal("long", 1);
+    Expression boundFilter = Binder.bind(schema.asStruct(), expr, true);
+    SearchArgument expected =
+        SearchArgumentFactory.newBuilder().startAnd().equals("`long`", 
Type.LONG, 1L).end().build();
+
+    SearchArgument actual =
+        ExpressionToSearchArgument.convert(boundFilter, 
ORCSchemaUtil.convert(schema));
+    assertThat(actual.toString()).isEqualTo(expected.toString());
+  }
+

Review Comment:
   You're right, and reachable as you describe: reverting the one-line change 
makes the new assertion fail with `UnsupportedOperationException: Type variant 
not supported in ORC SearchArguments` at `type()` via `lambda$isNull$5`. The 
map-build fix alone left the crash one step later rather than gone.
   
   Added `TypeID.VARIANT` to `UNSUPPORTED_TYPES` and extended `testVariantType` 
with `isNull("variant")` on an optional column. `GEOMETRY`/`GEOGRAPHY` have no 
`ORCSchemaUtil.convert` case and `UNKNOWN` is folded at bind time, so variant 
was the only one missing.



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

Reply via email to