JingsongLi commented on code in PR #11004:
URL: https://github.com/apache/paimon/pull/11004#discussion_r4493616187


##########
paimon-common/src/main/java/org/apache/paimon/predicate/LeafPredicateExtractor.java:
##########
@@ -30,11 +29,11 @@ public class LeafPredicateExtractor implements 
PredicateVisitor<Map<String, Leaf
 
     @Override
     public Map<String, LeafPredicate> visit(LeafPredicate predicate) {
-        Optional<FieldRef> fieldRefOptional = predicate.fieldRefOptional();
-        if (!fieldRefOptional.isPresent()) {
-            throw new UnsupportedOperationException();
-        }
-        return Collections.singletonMap(fieldRefOptional.get().name(), 
predicate);
+        // A leaf on a transform such as UPPER(name) does not constrain the 
field itself.
+        return predicate
+                .fieldRefOptional()
+                .map(fieldRef -> Collections.singletonMap(fieldRef.name(), 
predicate))

Review Comment:
   [P2] Preserve skipped transforms in the buckets reader too
   
   `BucketsScan` also uses this extractor, but `BucketsRead.withFilter` still 
ignores the predicate entirely. On a real table with partitions `{1}` and 
`{2}`, the Java SDK filter `UPPER(partition) = '{2}'` followed by 
`newRead().executeFilter()` now returns both buckets instead of only `{2}`. 
Before this change the transform failed explicitly; silently returning 
nonmatching rows violates the complete-filter contract. A local regression 
reproduces the extra `{1}` row, and retaining/evaluating the predicate before 
the buckets output projection makes it pass. Please extend the residual 
handling to this caller as well.



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

Reply via email to