-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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 CTE bug when MergeJoin is used #25514
Conversation
/label needs-cherry-pick-to-5.1 |
@guo-shaoge: The label(s) 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 ti-community-infra/tichi repository. |
/label needs-cherry-pick-5.1 |
/merge |
@zhouqiang-cl: 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 ti-community-infra/tichi repository. |
/merge |
@zhouqiang-cl: 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 ti-community-infra/tichi repository. |
/run-all-tests |
3 similar comments
/run-all-tests |
/run-all-tests |
/run-all-tests |
@wjhuang2016 ptal~ |
/run-integration-common-test |
/run-integration-common-test |
df9eaff
to
38eb916
Compare
id estRows task access object operator info | ||
MergeJoin_24 10000.00 root inner join, left key:test.tpk.c1, right key:test.tpk.c1 | ||
├─Sort_22(Build) 8000.00 root test.tpk.c1 | ||
│ └─Selection_20 8000.00 root not(isnull(test.tpk.c1)) |
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.
An extra sort operator, because tpk.c1 is orded.
@wjhuang2016 ptal |
planner/core/find_best_task.go
Outdated
if err != nil { | ||
return | ||
} | ||
if !prop.IsEmpty() && prop.CanAddEnforcer { |
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.
prop.CanAddEnforcer must be true here.
planner/core/find_best_task.go
Outdated
return invalidTask, 1, nil | ||
} | ||
if p.cte.cteTask != nil { | ||
t = p.cte.cteTask | ||
defer func() { |
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.
We better add some tests for the case that different prop on CTE
Signed-off-by: guo-shaoge <shaoge1994@163.com>
a120961
to
30bda97
Compare
/run-check_dev_2 |
@wjhuang2016 ptal |
cmd/explaintest/r/cte.result
Outdated
1 1 | ||
2 2 | ||
3 3 | ||
// No Sort on CTE. Because we have order by in CTE definition. |
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.
Need fix
Signed-off-by: guo-shaoge <shaoge1994@163.com>
[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. |
/run-check_dev_2 |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: 0885f07
|
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-5.1 in PR #26658 |
Signed-off-by: guo-shaoge shaoge1994@163.com
What problem does this PR solve?
Issue Number: close #25474
Problem Summary: When use MERGE JOIN to join a CTE table, planner give errors
What is changed and how it works?
What's Changed: Change logic in
LogicalCTE.findBestTask
, when prop requires sort item, we add a sort operator explicitly.Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Side effects: no
Release note