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: fix index out of range in constructIndexJoinInnerSideTask #54534

Merged
merged 5 commits into from
Aug 1, 2024

Conversation

joechenrh
Copy link
Contributor

@joechenrh joechenrh commented Jul 10, 2024

What problem does this PR solve?

Issue Number: close #54535

Problem Summary:

When set system variable tidb_enable_inl_join_inner_multi_pattern to ON, the following SQL will get an error.

set GLOBAL tidb_enable_inl_join_inner_multi_pattern='ON';
create table ta(a1 int, a2 int, a3 int, index idx_a(a1));
create table tb(b1 int, b2 int, b3 int, index idx_b(b1));
explain SELECT /*+ inl_join(tmp) */ * FROM ta, (SELECT b1, COUNT(b3) AS cnt FROM tb GROUP BY b1, b2) as tmp where ta.a1 = tmp.b1;

ERROR 1105 (HY000): runtime error: index out of range [1] with length 1

What changed and how does it work?

Check List

Tests

  • Unit test
  • 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

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels Jul 10, 2024
Copy link

ti-chi-bot bot commented Jul 10, 2024

Welcome @joechenrh!

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. 😃

@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jul 10, 2024
Copy link

ti-chi-bot bot commented Jul 10, 2024

Hi @joechenrh. 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 ti-chi-bot bot added the sig/planner SIG: Planner label Jul 10, 2024
Copy link

tiprow bot commented Jul 10, 2024

Hi @joechenrh. 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.

@hawkingrei
Copy link
Member

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jul 10, 2024
Copy link

codecov bot commented Jul 10, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.6463%. Comparing base (cf4bb51) to head (9e369c9).
Report is 59 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #54534        +/-   ##
================================================
- Coverage   74.7249%   74.6463%   -0.0786%     
================================================
  Files          1558       1575        +17     
  Lines        363817     455938     +92121     
================================================
+ Hits         271862     340341     +68479     
- Misses        72284      95041     +22757     
- Partials      19671      20556       +885     
Flag Coverage Δ
integration 49.5084% <85.7142%> (?)
unit 71.6990% <16.6666%> (-1.9139%) ⬇️

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

Components Coverage Δ
dumpling 52.9567% <ø> (-2.2327%) ⬇️
parser ∅ <ø> (∅)
br 52.3065% <ø> (+4.5800%) ⬆️

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 11, 2024
@joechenrh
Copy link
Contributor Author

/retest

}
p = p.(base.PhysicalPlan).Children()[0]
}
require.True(t, ok)
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 use tk.MustQuery("explain xxx") to check whether the planner is right.

Copy link
Member

@winoros winoros left a comment

Choose a reason for hiding this comment

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

Just align with other test case name

@@ -86,3 +86,33 @@ func Test53726(t *testing.T) {
" └─TableReader_11 2.00 root data:TableFullScan_10",
" └─TableFullScan_10 2.00 cop[tikv] table:t7 keep order:false"))
}

func Test54535(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.

Suggested change
func Test54535(t *testing.T) {
func TestIssue54535(t *testing.T) {

@AilinKid
Copy link
Contributor

/retest-required

@hawkingrei
Copy link
Member

@joechenrh Please sync the code with master.

@joechenrh
Copy link
Contributor Author

/retest-required

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Aug 1, 2024
@lance6716
Copy link
Contributor

/retest

Copy link

ti-chi-bot bot commented Aug 1, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, 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 ti-chi-bot bot added approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 1, 2024
Copy link

ti-chi-bot bot commented Aug 1, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-08-01 02:30:27.562199475 +0000 UTC m=+409343.842247529: ☑️ agreed by lance6716.
  • 2024-08-01 14:23:55.514924947 +0000 UTC m=+13032.733686566: ☑️ agreed by winoros.

@winoros winoros added the needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. label Aug 1, 2024
@ti-chi-bot ti-chi-bot bot merged commit 194711a into pingcap:master Aug 1, 2024
23 checks passed
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Aug 1, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot removed the needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. label Aug 2, 2024
@joechenrh joechenrh deleted the inl-join branch October 12, 2024 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
6 participants