planner: fix wrong TopN's ByItem with expression.ScalarFunction when to PushDownTopN (#60822)#61006
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
@hawkingrei This PR has conflicts, I have hold it. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## release-8.5 #61006 +/- ##
================================================
Coverage ? 57.1303%
================================================
Files ? 1771
Lines ? 629650
Branches ? 0
================================================
Hits ? 359721
Misses ? 245874
Partials ? 24055
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
/retest-required |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, hawkingrei The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
|
/unhold |
This is an automated cherry-pick of #60822
What problem does this PR solve?
Issue Number: close #60655
Problem Summary:
In the #40593,
There is a column in topN.ByItems is generated by proj, when topN is pushed down below proj, topN cannot obtain the column from datasource, to fix this, we can check whether topN.ByItems contains a column(with ID=0) generated by proj, if so, proj will prevent the optimizer from pushing topN down.
What changed and how does it work?
If you find that the TopN you can push down cannot actually be pushed down, you should use the original TopN to assemble into a structure of
TopN -> Projection, rather than using the processed TopN to assemble.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.