mrhhsg opened a new pull request, #66806:
URL: https://github.com/apache/doris/pull/66806
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
A one-sided outer join whose condition folds to `FALSE` or `NULL` still
remained in the logical plan. Although the nullable side can only produce
NULL-padded columns, the optimizer did not expose those columns as uniform NULL
values. Consequently, a later null-rejecting inner-join predicate could fail to
fold to an empty relation and execute very large nested-loop intermediates for
a query whose result is already known to be empty.
This change:
- replaces constant-false/NULL inner and cross joins with an empty relation;
- replaces constant-false/NULL left and right outer joins with a projection
over the preserved child plus typed NULL aliases, while preserving output
expression IDs, names, qualifiers, types, and order;
- reapplies join-condition elimination immediately after constant
propagation rewrites join predicates.
Mark joins, semi/anti joins, full outer joins, and ASOF joins retain their
existing behavior.
### Release note
Improve query performance by eliminating joins whose conditions are constant
`FALSE` or `NULL`.
### Check List (For Author)
- Test:
- Unit Test: `./run-fe-ut.sh --run
org.apache.doris.nereids.rules.rewrite.EliminateJoinConditionTest` (5 tests
passed)
- Regression test: Not run; the focused optimizer unit test covers
inner, left outer, right outer, NULL, FALSE, output preservation, and
cross-rule constant propagation.
- Behavior changed: Yes (semantically redundant joins are removed; query
results are unchanged)
- Does this need documentation: No
--
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]