Skip to content
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, cte: fix cte in the embeded union #38122

Merged
merged 3 commits into from Oct 11, 2022

Conversation

YangKeao
Copy link
Member

Signed-off-by: YangKeao yangkeao@chunibyo.icu

What problem does this PR solve?

Issue Number: close #37928

Problem Summary:

The With in the second element of union WITH xxx SELECT UNION (WITH xxx SELECT UNION SELECT) is ignored. It can cause multiple problems like #37928, or the table is not found (as the cte disappeared)...

What is changed and how it works?

Pass the With field in the buildIntersect function.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Release note

Fix the issue that the WITH clause in the second elements in the union is ignored.

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Sep 23, 2022

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • CbcWestwolf
  • wjhuang2016

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Type: Need cherry pick to release-5.4 needs-cherry-pick-release-6.1 needs-cherry-pick-6.3 size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 23, 2022
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 29, 2022
@@ -7533,3 +7533,24 @@ func TestExplainAnalyzeDMLCommit(t *testing.T) {
require.NoError(t, err)
tk.MustQuery("select * from t").Check(testkit.Rows())
}

func TestOverrideCTEInUnion(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can push the test to cmd/explain-test/t/cte

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good! I moved this test to cmd/explaintest/t/cte 🍻 Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL

Signed-off-by: YangKeao <yangkeao@chunibyo.icu>
@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Oct 8, 2022
@YangKeao
Copy link
Member Author

@wjhuang2016 @CbcWestwolf Could you help me to merge this PR?

@CbcWestwolf
Copy link
Member

Could you help me to merge this PR?

I am not a committer yet. :-|

@wjhuang2016
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 8b13f33

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Oct 11, 2022
@ti-chi-bot ti-chi-bot merged commit accff68 into pingcap:master Oct 11, 2022
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: cannot checkout 5.3: error checking out 5.3: exit status 1. output: error: pathspec '5.3' did not match any file(s) known to git

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: cannot checkout 5.4: error checking out 5.4: exit status 1. output: error: pathspec '5.4' did not match any file(s) known to git

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: cannot checkout 6.1: error checking out 6.1: exit status 1. output: error: pathspec '6.1' did not match any file(s) known to git

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: cannot checkout 6.3: error checking out 6.3: exit status 1. output: error: pathspec '6.3' did not match any file(s) known to git

@sre-bot
Copy link
Contributor

sre-bot commented Oct 11, 2022

TiDB MergeCI notify

🔴 Bad News! New failing [1] after this pr merged.
These new failed integration tests seem to be caused by the current PR, please try to fix these new failed integration tests, thanks!

CI Name Result Duration Compare with Parent commit
idc-jenkins-ci-tidb/common-test 🟥 failed 1, success 10, total 11 9 min 23 sec New failing
idc-jenkins-ci-tidb/integration-ddl-test 🔴 failed 3, success 3, total 6 23 min Existing failure
idc-jenkins-ci/integration-cdc-test 🟢 all 37 tests passed 26 min Existing passed
idc-jenkins-ci-tidb/integration-common-test 🟢 all 17 tests passed 10 min Existing passed
idc-jenkins-ci-tidb/tics-test 🟢 all 1 tests passed 5 min 44 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-2 🟢 all 28 tests passed 5 min 3 sec Existing passed
idc-jenkins-ci-tidb/sqllogic-test-1 🟢 all 26 tests passed 4 min 14 sec Existing passed
idc-jenkins-ci-tidb/mybatis-test 🟢 all 1 tests passed 2 min 45 sec Existing passed
idc-jenkins-ci-tidb/integration-compatibility-test 🟢 all 1 tests passed 2 min 35 sec Existing passed
idc-jenkins-ci-tidb/plugin-test 🟢 build success, plugin test success 4min Existing passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Type: Need cherry pick to release-5.4 needs-cherry-pick-release-6.1 release-note size/S Denotes a PR that changes 10-29 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CTE + Union return incorrect results
5 participants