clairemcginty commented on code in PR #2941:
URL: https://github.com/apache/parquet-java/pull/2941#discussion_r1665896250
##########
parquet-column/src/main/java/org/apache/parquet/filter2/predicate/ContainsRewriter.java:
##########
@@ -118,15 +118,18 @@ public FilterPredicate visit(And and) {
} else if (and.getRight() instanceof Contains) {
right = and.getRight();
} else {
- return and;
+ right = and.getRight();
}
- if (left instanceof Contains) {
- if (!(right instanceof Contains)) {
- throw new UnsupportedOperationException(
- "Contains predicates cannot be composed with non-Contains
predicates");
- }
+ // If two Contains predicates refer to the same column, optimize by
combining into a single predicate
Review Comment:
This fixes a bug with the way Contains predicates were composed --
previously it would throw an error if you tried to do something like
`and(contains(binaryColumn("foo", ...), contains(binaryColumn("bar"), ...))`
because the columns didn't match. however, that is still a valid predicate --
it's just that they should not be attempted to be combined into a single
`Contains` predicate.
--
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]