chenjian2664 commented on code in PR #11004:
URL: https://github.com/apache/paimon/pull/11004#discussion_r4493835274
##########
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:
Thanks, confirmed. `BucketsRead.withFilter` dropped the predicate, so a
transform leaf the scan skips was applied nowhere. The read now keeps the
predicate and evaluates it on the rows before the output projection. I added a
regression with `UPPER(partition) = '{2}'`.
Related: `$snapshots`, `$schemas`, `$manifests` and `$consumers` only use
the filter to narrow ids and have never evaluated other predicates on rows, so
a transform there is ignored rather than failing. Adding row evaluation to them
breaks existing callers that pass Java `String` literals
(`ConsumersTableTest#testFilterByConsumerIdIn` throws `ClassCastException`), so
I left them unchanged here. Should I handle them in a follow-up?
--
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]