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

IndexHashJoin may produce redundant rows for anti semi left outer join #52902

Closed
yibin87 opened this issue Apr 26, 2024 · 7 comments · Fixed by #52908
Closed

IndexHashJoin may produce redundant rows for anti semi left outer join #52902

yibin87 opened this issue Apr 26, 2024 · 7 comments · Fixed by #52908
Labels
affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@yibin87
Copy link
Contributor

yibin87 commented Apr 26, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Because it is difficult to generate IndexHashJoin executor, we need to hack the tidb planner code to enforce it generate IndexHashJoin executor using the attached hack.txt:
hack.txt
Then using the hacked tidb, we can run sqls:
use test;
create table t1 (x int, y int);
create table t0 (a int, b int, key (b));
insert into t1 values(103, 600);
insert into t1 values(100, 200);
insert into t0 values( 105, 400);
insert into t0 values( 104, 300);
insert into t0 values( 103, 300);
insert into t0 values( 102, 200);
insert into t0 values( 101, 200);
insert into t0 values( 100, 200);
select * from t1 where 1 = 1 and case when t1.x < 1000 then 1 = 1 when t1.x < 2000 then not exists (select 1 from t0 where t0.b = t1.y) else 1 = 1 end;

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

+------+------+
| 100 | 200 |
| 103 | 600 |
+------+------+

3. What did you see instead (Required)

+------+------+
| 100 | 200 |
| 100 | 200 |
| 100 | 200 |
| 103 | 600 |
+------+------+

4. What is your TiDB version? (Required)

| Release Version: v8.1.0-alpha-143-g111abf32b4-dirty
Edition: Community
Git Commit Hash: 111abf3
Git Branch: mpp_join_issue_52828
UTC Build Time: 2024-04-26 03:20:49
GoVersion: go1.21.0
Race Enabled: false
Check Table Before Drop: false
Store: tikv |

@yibin87
Copy link
Contributor Author

yibin87 commented Apr 26, 2024

/severity critical

@yibin87
Copy link
Contributor Author

yibin87 commented Apr 26, 2024

/label affects-8.1

@ti-chi-bot ti-chi-bot bot added affects-8.1 This bug affects the 8.1.x(LTS) versions. and removed may-affects-8.1 labels Apr 26, 2024
@yibin87
Copy link
Contributor Author

yibin87 commented Apr 26, 2024

/label affects-7.5

@ti-chi-bot ti-chi-bot bot added affects-7.5 This bug affects the 7.5.x(LTS) versions. and removed may-affects-7.5 labels Apr 26, 2024
@yibin87
Copy link
Contributor Author

yibin87 commented Apr 26, 2024

/label affects-7.1

@ti-chi-bot ti-chi-bot bot added affects-7.1 This bug affects the 7.1.x(LTS) versions. and removed may-affects-7.1 labels Apr 26, 2024
@yibin87
Copy link
Contributor Author

yibin87 commented Apr 26, 2024

/label affects-6.5

@ti-chi-bot ti-chi-bot bot added affects-6.5 This bug affects the 6.5.x(LTS) versions. and removed may-affects-6.5 labels Apr 26, 2024
@yibin87
Copy link
Contributor Author

yibin87 commented Apr 26, 2024

/label affects-6.1

@ti-chi-bot ti-chi-bot bot added affects-6.1 This bug affects the 6.1.x(LTS) versions. and removed may-affects-6.1 labels Apr 26, 2024
@yibin87
Copy link
Contributor Author

yibin87 commented Apr 26, 2024

/label affects-5.4

@ti-chi-bot ti-chi-bot bot added affects-5.4 This bug affects the 5.4.x(LTS) versions. and removed may-affects-5.4 This bug maybe affects 5.4.x versions. labels Apr 26, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 26, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 28, 2024
ti-chi-bot bot pushed a commit that referenced this issue Apr 28, 2024
@jebter jebter added the sig/execution SIG execution label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects the 5.4.x(LTS) versions. affects-6.1 This bug affects the 6.1.x(LTS) versions. affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
2 participants