szehon-ho commented on code in PR #5113:
URL: https://github.com/apache/iceberg/pull/5113#discussion_r905604572


##########
api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java:
##########
@@ -109,6 +109,10 @@ public Expression bind(StructType struct, boolean 
caseSensitive) {
       return bindUnaryOperation(bound);
     }
 
+    if (bound.type().isNestedType()) {

Review Comment:
   Wondering if this is necessary.  Today will hit ValidationException when it 
tries to make a Literal?  
   
   If necessary, we can use "Preconditions".



##########
api/src/test/java/org/apache/iceberg/expressions/TestPredicateBinding.java:
##########
@@ -605,4 +605,188 @@ public void 
testNotInPredicateBindingConversionToExpression() {
     Expression expr = unbound.bind(struct);
     Assert.assertEquals("Should change NOT_IN to alwaysTrue expression", 
Expressions.alwaysTrue(), expr);
   }
+
+  @Test
+  public void testStructFields() {
+    StructType structFieldType =
+        Types.StructType.of(Types.NestedField.optional(11, "float_field", 
Types.FloatType.get()));
+    StructType struct = StructType.of(
+        optional(10, "struct", structFieldType)
+    );
+
+    UnboundPredicate<Float> lt = new UnboundPredicate<>(LT, ref("struct"), 
1.234f);
+    try {
+      lt.bind(struct);

Review Comment:
   For this and other instance of validation exception, we can use 
"AssertHelpers.assertThrowsCause"



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