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

join partition return wrong result #45720

Closed
aytrack opened this issue Aug 1, 2023 · 1 comment · Fixed by #45748
Closed

join partition return wrong result #45720

aytrack opened this issue Aug 1, 2023 · 1 comment · Fixed by #45748
Assignees
Labels
affects-7.3 component/tablepartition This issue is related to Table Partition of TiDB. severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@aytrack
Copy link
Contributor

aytrack commented Aug 1, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1, t2;
create table t1 (a int, b tinyint, unique key (a));
insert into t1 values(NULL, NULL), (0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (10, 10), (11, 11), (12, 12), (13, 13), (14, 14), (15, 15), (20, 20), (21, 21), (22, 22), (23, 23), (24, 24), (25, 25), (30, 30), (31, 31), (32, 32), (33, 33), (34, 34), (35, 35), (36, 36), (40, 40), (50, 50), (80, 80), (90, 90), (100, 100);

create table t2 (a int, b bigint, unique key (a)) partition by hash(a) partitions 10;
insert into t2 values (NULL, NULL), (0, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11, 11), (12, 12), (13, 13), (14, 14), (15, 15), (16, 16), (17, 17), (18, 18), (19, 19), (20, 20), (21, 21), (22, 22), (23, 23);

analyze table t1, t2;
select * from t2 partition (p0) join t1 on t1.a = t2.a where t1.a in (2, 4, 5);

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

return empty

[18:15:31]TiDB root:test> select * from t2 partition (p0) join t1 on t1.a = t2.a where t1.a in (2, 4, 5);
+---+---+---+---+
| a | b | a | b |
+---+---+---+---+
+---+---+---+---+

3. What did you see instead (Required)

[18:16:55]TiDB root:test> select * from t2 partition (p0) join t1 on t1.a = t2.a where t1.a in (2, 4, 5);
+---+---+---+---+
| a | b | a | b |
+---+---+---+---+
| 2 | 2 | 2 | 2 |
| 4 | 4 | 4 | 4 |
| 5 | 5 | 5 | 5 |
+---+---+---+---+

4. What is your TiDB version? (Required)

[18:17:09]TiDB root:test> select tidb_version();
+-----------------------------------------------------------+
| tidb_version()                                            |
+-----------------------------------------------------------+
| Release Version: v7.3.0-alpha-231-g92fcb9ab1b             |
| Edition: Community                                        |
| Git Commit Hash: 92fcb9ab1b1551f1f031bd33ad6efc86e3ee6264 |
| Git Branch: HEAD                                          |
| UTC Build Time: 2023-08-01 10:16:03                       |
| GoVersion: go1.20.2                                       |
| Race Enabled: false                                       |
| Check Table Before Drop: false                            |
| Store: unistore                                           |
+-----------------------------------------------------------+
1 row in set
@aytrack aytrack added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner severity/critical labels Aug 1, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Aug 1, 2023
@aytrack
Copy link
Contributor Author

aytrack commented Aug 1, 2023

introduced by #45472

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.3 component/tablepartition This issue is related to Table Partition of TiDB. severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants