feiniaofeiafei opened a new pull request, #67919:
URL: https://github.com/apache/doris/pull/67919
### What problem does this PR solve?
Problem Summary:
Fix two predicate inference errors that change query results:
- `chooseInputPredicates` records a retained `GT`/`GTE` predicate as `EQ`.
The false equality can make another necessary predicate appear redundant. For
example, `a > b AND rn > b AND a > rn` can lose `a > rn` and return extra rows
in a QUALIFY query. Record the actual relation in the working graph.
- Comparison-equal operands are not interchangeable inside arbitrary
expressions. DATE and DATETIME values can compare equal but have different
string lengths; negative and positive floating-point zero compare equal but
have different SIGNBIT results. Substitution can therefore add filters that
discard matching rows. Restrict expression substitution to exactly matching
supported scalar types with value-preserving equality. Preserve direct
comparisons, IN and their negations on the unwrapped operand, along with the
existing determinism and cast-analysis checks.
The fixes are in separate commits. Shared cast extraction is unchanged, and
existing regression expectations are unchanged.
### Release note
Fix extra or missing rows caused by incorrect predicate inference, including
QUALIFY inequality chains and substitutions inside type-sensitive or
representation-sensitive expressions.
### Check List (For Author)
- Test:
- [x] Regression test: all six suites passed: `infer_predicate_qualify`,
`infer_predicate_replace_type`, `infer_unequal_predicates`,
`extend_infer_equal_predicate`, `infer_predicate`, and
`infer_datetimev2_cast_precision`. New expected files were generated by the
regression runner and verified by rerunning the suites.
- [x] Unit Test: all 65 tests in `UnequalPredicateInferTest` and
`InferPredicateByReplaceTest` passed. New inequality checks cover 234
relation/order/qualifier combinations with 64 value assignments per
combination. Substitution tests cover type/precision boundaries, signed zero,
safe same-type substitutions, widening casts, and direct comparison/IN/NOT IN
propagation.
- [x] Manual test: reproduced extra QUALIFY rows and missing
DATE/signed-zero rows before deployment; the rebuilt FE returned the expected
results. Verified the deployed FE jar checksum.
- Build: `DISABLE_BUILD_UI=ON ./build.sh --fe` passed, including
Checkstyle.
- Behavior changed:
- [x] Yes. Necessary inequalities are retained and unsafe expression
substitutions are rejected while direct comparison propagation is preserved.
- Does this need documentation?
- [x] No.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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]