huaxingao commented on code in PR #5113:
URL: https://github.com/apache/iceberg/pull/5113#discussion_r905766291


##########
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:
   If the predicate value is a complex type, for example
   ```
       Float[] value = {1.23f, 2.34f};
       UnboundPredicate<Float[]> lt = new UnboundPredicate<>(LT, ref("list"), 
value);
   ```
   The Exception will be thrown at `Literals.from(value)` at this 
[line](https://github.com/apache/iceberg/blob/master/api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java#L40)
   
   If the predicate value is a primitive, for example
   
   ```
       UnboundPredicate lt = new UnboundPredicate<>(LT, ref("list"), 1.23f);
   ```
   It will throw Exception at this 
[line](https://github.com/apache/iceberg/blob/master/api/src/main/java/org/apache/iceberg/expressions/UnboundPredicate.java#L116).
 So this `if (bound.type().isNestedType())` might be needed when a primitive 
value is accidentally used for Predicate on a nested type. 
   
   I changed this to `Preconditions`.
   
   



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