[BugFix] Preserve null fractions for outer join columns#70144
Open
OliLay wants to merge 4 commits intoStarRocks:mainfrom
Open
[BugFix] Preserve null fractions for outer join columns#70144OliLay wants to merge 4 commits intoStarRocks:mainfrom
OliLay wants to merge 4 commits intoStarRocks:mainfrom
Conversation
|
@codex review |
Signed-off-by: Oliver Layer <o.layer@celonis.com>
486f5e0 to
4bacfb4
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 486f5e06f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
fe/fe-core/src/main/java/com/starrocks/sql/optimizer/statistics/StatisticsCalculator.java
Show resolved
Hide resolved
Signed-off-by: Oliver Layer <o.layer@celonis.com>
Contributor
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Contributor
[FE Incremental Coverage Report]✅ pass : 15 / 15 (100.00%) file detail
|
Contributor
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Why I'm doing:
Consider the following query:
At the moment, even though
t1.NULLABLEhas proper null fractions (e.g. 0.8), the second join assumes thatt1.NULLABLEhas 0.0 null fractions. This is because for equality predicates, we reset the null fractions to 0 since NULLs are not preserved. In the context of the predicate (and inner joins) this is right, but outer joins should not reset null fractions. Subsequent joins should re-use the original column null fractions instead.See the following EXPLAIN where the in the topmost join (7) 4: NULLABLE has 0 null fractions, while for the joins prior to that join the correct null fractions are shown. The fixed EXPLAIN contains the proper null fractions for 4: NULLABLE
Wrong null fractions lead to the join not being rewritten, e.g. by the join skew rule.
What I'm doing:
For outer joins, do not reset the null fractions of columns used in join predicates.
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: