planner: fix wrong TopN's ByItem with expression.ScalarFunction when to PushDownTopN (#60822)#61004
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
@hawkingrei This PR has conflicts, I have hold it. |
|
/unhold |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-7.5 #61004 +/- ##
================================================
Coverage ? 72.3042%
================================================
Files ? 1417
Lines ? 414663
Branches ? 0
================================================
Hits ? 299819
Misses ? 94901
Partials ? 19943
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AilinKid, fixdb 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 |
|
/retest |
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.