tidb icon indicating copy to clipboard operation
tidb copied to clipboard

planner: merge FullSchema and FullNames of subplans when rewriting "in (subquery)" to inner join

Open dash12653 opened this issue 1 year ago • 5 comments

What problem does this PR solve?

Issue Number: close #53766

Problem Summary:

What changed and how does it work?

Merge FullSchema and FullNames of subplans when rewring "in (subquery)" to inner join, which will be used to rewrite fields when using natural join. https://github.com/pingcap/tidb/blob/438169989e2d6ab5f778238d02eb50c8eb408a76/pkg/planner/core/expression_rewriter.go#L2469-L2485 The merging code I referenced was from the code in buildJoin as follows:

https://github.com/pingcap/tidb/blob/438169989e2d6ab5f778238d02eb50c8eb408a76/pkg/planner/core/logical_plan_builder.go#L985-L1026

Check List

Tests

  • [ ] Unit test
  • [x] Integration test
  • [ ] Manual test (add detailed scripts or steps below)
  • [ ] No need to test
    • [ ] I checked and no code files have been changed.

Side effects

  • [ ] Performance regression: Consumes more CPU
  • [ ] Performance regression: Consumes more Memory
  • [ ] Breaking backward compatibility

Documentation

  • [ ] Affects user behaviors
  • [ ] Contains syntax changes
  • [ ] Contains variable changes
  • [ ] Contains experimental features
  • [ ] Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

dash12653 avatar Jul 01 '24 03:07 dash12653

CLA assistant check
All committers have signed the CLA.

sre-bot avatar Jul 01 '24 03:07 sre-bot

Welcome @dash12653!

It looks like this is your first PR to pingcap/tidb 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/tidb. :smiley:

ti-chi-bot[bot] avatar Jul 01 '24 03:07 ti-chi-bot[bot]

Hi @dash12653. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 kubernetes/test-infra repository.

ti-chi-bot[bot] avatar Jul 01 '24 03:07 ti-chi-bot[bot]

Hi @dash12653. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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 kubernetes-sigs/prow repository.

tiprow[bot] avatar Jul 01 '24 03:07 tiprow[bot]

/ok-to-test

hawkingrei avatar Jul 03 '24 11:07 hawkingrei

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.0460%. Comparing base (b520f61) to head (9dddc81). Report is 832 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #54334        +/-   ##
================================================
+ Coverage   73.3867%   77.0460%   +3.6593%     
================================================
  Files          1620       1626         +6     
  Lines        447041     464984     +17943     
================================================
+ Hits         328069     358252     +30183     
+ Misses        98877      86453     -12424     
- Partials      20095      20279       +184     
Flag Coverage Δ
integration 51.3031% <100.0000%> (?)
unit 74.3418% <100.0000%> (+1.8635%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 53.6562% <76.9230%> (+8.1269%) :arrow_up:

codecov[bot] avatar Jul 03 '24 11:07 codecov[bot]

@dash12653 Hi, you need to also update the test result. Follow the below step:

  • Use make to create binary.
  • Go to tests/integrationtest
  • run ./run-tests.sh -s ../../bin/tidb-server -r planner/core/issuetest/planner_issue to re-generate the file planner_issue.result

winoros avatar Sep 27 '24 15:09 winoros

@dash12653 Hi, you need to also update the test result. Follow the below step:

  • Use make to create binary.
  • Go to tests/integrationtest
  • run ./run-tests.sh -s ../../bin/tidb-server -r planner/core/issuetest/planner_issue to re-generate the file planner_issue.result

Hi winoros, Thank you very much for your comment, I have generated a new result file now, but it seems that I accidentally closed this PR. Do you know how to reopen this PR, or do I need to create a new PR?

dash12653 avatar Sep 27 '24 18:09 dash12653

@dash12653 Hi, you need to also update the test result. Follow the below step:

  • Use make to create binary.
  • Go to tests/integrationtest
  • run ./run-tests.sh -s ../../bin/tidb-server -r planner/core/issuetest/planner_issue to re-generate the file planner_issue.result

Hi winoros, Thank you very much for your comment, I have generated a new result file now, but it seems that I accidentally closed this PR. Do you know how to reopen this PR, or do I need to create a new PR?

It has been reopened.

dash12653 avatar Sep 27 '24 18:09 dash12653

Thanks! I'll check whether the tests all are green and help to merge this pull request.

winoros avatar Sep 27 '24 18:09 winoros

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hawkingrei, winoros

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

ti-chi-bot[bot] avatar Oct 10 '24 06:10 ti-chi-bot[bot]

[LGTM Timeline notifier]

Timeline:

  • 2024-09-27 15:05:36.944048396 +0000 UTC m=+21692.364261408: :ballot_box_with_check: agreed by winoros.
  • 2024-10-10 06:14:01.875649957 +0000 UTC m=+1112997.295862969: :ballot_box_with_check: agreed by hawkingrei.

ti-chi-bot[bot] avatar Oct 10 '24 06:10 ti-chi-bot[bot]

/retest

dash12653 avatar Oct 10 '24 07:10 dash12653

@AilinKid: You cannot manually add or delete the reviewing state labels, only I and the tursted members have permission to do so.

In response to removing label named approved.

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.

ti-chi-bot[bot] avatar Oct 31 '24 09:10 ti-chi-bot[bot]

In response to a cherrypick label: new pull request created to branch release-7.1: #57036.

ti-chi-bot avatar Oct 31 '24 09:10 ti-chi-bot

/cherrypick release-7.5

hawkingrei avatar Dec 09 '24 10:12 hawkingrei

@hawkingrei: new pull request created to branch release-7.5: #58089.

In response to this:

/cherrypick release-7.5

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.

ti-chi-bot avatar Dec 09 '24 10:12 ti-chi-bot

In response to a cherrypick label: new pull request created to branch release-6.5: #59176.

ti-chi-bot avatar Jan 24 '25 08:01 ti-chi-bot