github-actions[bot] commented on code in PR #69419:
URL: https://github.com/apache/doris/pull/69419#discussion_r4344280783
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/InferPredicateByReplace.java:
##########
@@ -131,6 +134,11 @@ public Void visitLike(Like like, Map<Expression,
Set<Expression>> context) {
@Override
public Void visitOr(Or or, Map<Expression, Set<Expression>> context) {
+ // MATCH and SEARCH depend on the inverted index of their column,
so they can differ on an equal
+ // column, and a copy would also add to score().
+ if (or.containsType(Match.class, Search.class,
SearchExpression.class)) {
Review Comment:
[P2] Exclude index-dependent predicates before collector dispatch
The new check is bypassed when the OR is inside another collected predicate.
Using the new parser-regression table, this SQL still loses id=1:
```sql
SELECT id FROM infer_match_predicate_parser
WHERE c1 = c2
AND CAST((c1 MATCH_ANY 'apple' OR c1 MATCH_ANY 'pear') AS INT) > 0;
```
The reduced plan is `Filter[c1=c2, GreaterThan(Cast(Or(Match(c1),
Match(c1)), INT), 0)] -> Scan`. The Boolean-to-INT cast survives normalization,
so `visitComparisonPredicate` calls `getAllSubExpressions` on the cast and
registers its sole input slot `c1` without invoking `visitOr`.
`getEqualSetAndDoReplace` then adds `CAST((c2 MATCH_ANY 'apple' OR c2 MATCH_ANY
'pear') AS INT) > 0`. The original English-index predicate accepts `'apple
red'`, while the inferred parserless-column predicate rejects it. The default
row-evaluation path supports this expression.
This leaves a wrapped-OR instance of the wrong-row bug unfixed. Apply the
descendant-type exclusion before collecting each input predicate (or
consistently across collector entry points), and add a wrapped-OR regression.
--
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]