bodduv commented on code in PR #14500:
URL: https://github.com/apache/iceberg/pull/14500#discussion_r2714161485


##########
api/src/main/java/org/apache/iceberg/expressions/InclusiveMetricsEvaluator.java:
##########
@@ -86,8 +113,12 @@ private class MetricsEvalVisitor extends 
ExpressionVisitors.BoundVisitor<Boolean
     private Map<Integer, Long> nanCounts = null;
     private Map<Integer, ByteBuffer> lowerBounds = null;
     private Map<Integer, ByteBuffer> upperBounds = null;
+    // Flag to use signed UUID comparator for backward compatibility.
+    // This is needed for the IN predicate because the comparator information 
is lost
+    // when binding converts literals to a Set<T> of raw values.
+    private boolean useSignedUuidComparator = false;
 
-    private boolean eval(ContentFile<?> file) {
+    private boolean eval(ContentFile<?> file, Expression expression, boolean 
signedUuidMode) {

Review Comment:
   I needed to pass `this.expr` or `this.signedUuidExpr` conditionally. The 
difference between them comes from ExpressionUtil.withSignedUUIDComparator(), 
which transforms UUID literals to use a signed comparator instead of the 
default RFC-compliant comparator.
   
   So after preparing `this.expr` in the constructor, when and where relevant, 
`this.signedUuidExpr` is also prepared. The `SignedUUIDLiteralTransformer` 
visitor walks the expression and for each UUID literal, calls 
`uuidLit.withSignedComparator()` which creates a new UUIDLiteral that uses 
signed comparator.
   
   The reason for doing all this is currently a comparator is picked up from 
two places. For `lt/gt/...` its picked up from `Comparators.COMPARATORS` and 
for IN and NOT IN its picked up from the `BoundReference`. We need to make sure 
both these cases are covered.
   
   I could not think of any better approach. Considering that its a private 
member and we are not modifying its interface, I relied on this.



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