-
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: when pushing topN
down below proj
, check whether topN.ByItems
contains a column(with ID=0) generated by proj
(#40593)
#41178
planner: when pushing topN
down below proj
, check whether topN.ByItems
contains a column(with ID=0) generated by proj
(#40593)
#41178
Conversation
…calSort.pushDownTopN
[REVIEW NOTIFICATION] This pull request has not been approved. 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. |
/hold high priority for trunk branch |
/unhold |
/test unit-test |
@qw4990: No presubmit jobs available for pingcap/tidb@release-6.5 In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hawkingrei, qw4990 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## release-6.5 #41178 +/- ##
================================================
Coverage ? 77.1157%
================================================
Files ? 1083
Lines ? 375896
Branches ? 0
================================================
Hits ? 289875
Misses ? 70258
Partials ? 15763 |
This is an automated cherry-pick of #40593
What problem does this PR solve?
Issue Number: close #40535
Problem Summary:
The minimal reproduce step can be simplified to:
logical plan before
logicalOptimize
:logical plan after
logicalOptimize
:In
planner/core/task.go:*PhysicalTopN.attach2Task
:TopN.ByItems
contains a column that cannot be obtained fromcopTask.indexPlan
, so the optimizer chooses to usecopTask.tablePlan
, butcopTask.tablePlan
isnil
, this results in "null pointer dereference".What is changed and how it works?
There is a column in
topN.ByItems
is generated byproj
, whentopN
is pushed down belowproj
,topN
cannot obtain the column from datasource, to fix this, we can check whethertopN.ByItems
contains a column(with ID=0) generated byproj
, if so,proj
will prevent the optimizer from pushingtopN
down.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.