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

parallel apply got wrong result when there are multiple columns as primary key #51372

Closed
guo-shaoge opened this issue Feb 27, 2024 · 2 comments · Fixed by #51414
Closed

parallel apply got wrong result when there are multiple columns as primary key #51372

guo-shaoge opened this issue Feb 27, 2024 · 2 comments · Fixed by #51414
Assignees
Labels
affects-6.1 affects-6.5 affects-7.1 affects-7.5 report/customer Customers have encountered this bug. severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@guo-shaoge
Copy link
Collaborator

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  drop table if exists t1;
  create table t1 (c1 bigint, c2 int, c3 int, c4 int, primary key(c1, c2), index (c3));
  insert into t1 values(1, 1, 1, 1), (1, 2, 3, 3), (2, 1, 4, 4), (2, 2, 2, 2);

  set @@tidb_enable_parallel_apply = off;
  select (select /*+ NO_DECORRELATE() */ sum(c4) from t1 where t1.c3 = alias.c3) from t1 alias where alias.c1 = 1;

  set @@tidb_enable_parallel_apply = on;
  select (select /*+ NO_DECORRELATE() */ sum(c4) from t1 where t1.c3 = alias.c3) from t1 alias where alias.c1 = 1;

2. What did you expect to see? (Required)

Results are same for parallel apply and serial apply.

3. What did you see instead (Required)

Results are different

image

4. What is your TiDB version? (Required)

v7.5.0

@guo-shaoge guo-shaoge added the type/bug The issue is confirmed as a bug. label Feb 27, 2024
@guo-shaoge
Copy link
Collaborator Author

guo-shaoge commented Feb 27, 2024

I think this bug is because PhysicalIndexLookupReader.Clone() miss clone CommonHandles, check code

@windtalker windtalker added the sig/execution SIG execution label Feb 28, 2024
@guo-shaoge guo-shaoge self-assigned this Feb 28, 2024
@ti-chi-bot ti-chi-bot bot added may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Feb 28, 2024
@aytrack aytrack removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Feb 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Feb 29, 2024
ti-chi-bot bot pushed a commit that referenced this issue Mar 1, 2024
ti-chi-bot bot pushed a commit that referenced this issue Mar 1, 2024
ti-chi-bot bot pushed a commit that referenced this issue Mar 1, 2024
ti-chi-bot bot pushed a commit that referenced this issue Mar 7, 2024
@seiya-annie
Copy link

/found customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.1 affects-6.5 affects-7.1 affects-7.5 report/customer Customers have encountered this bug. severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants