planner: fix wrong TopN's ByItem with expression.ScalarFunction when to PushDownTopN (#60822)#61005
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@hawkingrei This PR has conflicts, I have hold it. |
|
@ti-chi-bot: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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-sigs/prow repository. I understand the commands that are listed here. |
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.