-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
planner: fix bug that aggregate push down may generate wrong plan for outer joins #34468
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/a588d147f8b952297ebd7e7262bd50be0be2cdba |
We should format these files by using
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
768743b
to
33cb6b4
Compare
… outer joins When we push down aggregate past outer join, the top count aggregate assumed that the partial count aggregate always return non-null value. But in case of outer joins when the aggregate is pushed down to the null generating side of the outer join, the input for the final aggregate may be nullable. Before this patch, the final count aggregate always assume its input is not nullable, hence during aggregate elimimation, the optimizer rewrote aggregate into a plain column of null-generating side of outer join, which led to the wrong result. Close pingcap#34465
33cb6b4
to
6a3ff41
Compare
/run-all-tests |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 6a3ff41
|
cherry pick to release-5.1 in PR #34646 |
cherry pick to release-5.2 in PR #34647 |
cherry pick to release-5.3 in PR #34648 |
cherry pick to release-5.4 in PR #34649 |
cherry pick to release-6.0 failed |
TiDB MergeCI notify🔴 Bad News! New failing [1] after this pr merged.
|
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
/cherry-pick release-6.0 |
1 similar comment
/cherry-pick release-6.0 |
… outer joins (pingcap#34468) close pingcap#34465 (cherry picked from commit 43984d8)
What problem does this PR solve?
Issue Number: close #34465
Problem Summary:
When we push down aggregate past outer join, the top count aggregate assumed
that the partial count aggregate always return non-null value. But in case of
outer joins when the aggregate is pushed down to the null generating side of
the outer join, the input for the final aggregate may be nullable.
Before this patch, the final count aggregate always assume its input is not
nullable, hence during aggregate elimination, the optimizer rewrote aggregate
into a plain column of null-generating side of outer join, which led to the
wrong result.
Check List
Tests
Side effects
Documentation
Release note