starocean999 opened a new pull request, #66482:
URL: https://github.com/apache/doris/pull/66482
Problem Summary:
The old `ExpressionUtils.canInferNotNullForMarkSlot` only returned a single
boolean telling whether every mark join slot in a predicate could be treated as
non-nullable (its null value could be replaced by false). That coarse,
predicate-level answer limited how far the optimizer could go in eliminating
redundant mark joins.
This PR replaces it with `ExpressionUtils.inferMarkSlotNotNullMap`, which
returns per-mark-slot information as a
`Map<MarkJoinSlotReference, Pair<Boolean, Boolean>>`:
- `Pair.first` is computed on the predicate simplified by
`TrySimplifyPredicateWithMarkJoinSlot` (conjuncts without any mark slot in
`And` are replaced by true, in `Or` by false): it is true when the simplified
predicate taking false or null always evaluates to false or null, meaning the
mark slot's null value can be replaced by false (the mark slot can be
non-nullable).
- `Pair.second` is computed on the original predicate: it is true when
taking false or null always evaluates to false or null AND taking true always
evaluates to true, meaning the predicate is equivalent to the mark slot being
true.
`SubqueryToApply` now consumes this map: when `Pair.second` is true, the
mark slot conjunct is replaced by the true literal and the mark slot is
eliminated from the `LogicalApply`, so an `IN` subquery used directly as a
filter or join ON conjunct is unnested into a plain `LEFT_SEMI_JOIN`, and a
`NOT IN` into a plain `NULL_AWARE_LEFT_ANTI_JOIN`, without materializing a mark
column. The duplicated inference and replacement logic is extracted into
`simplifyConjunctWithMarkJoinSlot`.
### Release note
None
### Check List (For Author)
- Test: Unit Test
- Behavior changed: No
- Does this need documentation: No
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
### Release note
None
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]