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

query gets incorrect result caused by hash partition #50044

Closed
wjhuang2016 opened this issue Jan 3, 2024 · 0 comments · Fixed by #50045
Closed

query gets incorrect result caused by hash partition #50044

wjhuang2016 opened this issue Jan 3, 2024 · 0 comments · Fixed by #50045
Assignees

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

CREATE TABLE `t4e32b983` (
  `col_29` tinyint(4) DEFAULT NULL,
  UNIQUE KEY `idx_25` (`col_29`),
  KEY `idx_26` (`col_29`),
  UNIQUE KEY `idx_27` (`col_29`),
  UNIQUE KEY `idx_28` (`col_29`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
PARTITION BY HASH (`col_29`) PARTITIONS 7;
INSERT INTO `t4e32b983` VALUES (-1), (11), (-128), (39), (-46), (38), (-102), (-99), (-87), (-127), (-89), (43), (108), (59), (0), (24), (101), (37), (-103), (90), (-95), (-44), (123), (124), (-123), (-52), (-49), (-98), (-104), (-68), (2), (-24), (67), (89), (1), (-65), (36), (-109), (41), (5), (98), (-63), (-14), (127), (-6), (121), (14), (-122);

select * from t4e32b983 where col_29 between -2 and 1;

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

Three rows

mysql> select count(*) from (select col_29 between -2 and 1 as a from t4e32b983) t where a = 1;
+----------+
| count(*) |
+----------+
|        3 |
+----------+
1 row in set (0.00 sec)

3. What did you see instead (Required)

mysql> select * from t4e32b983 where col_29 between -2 and 1;
Empty set (0.01 sec)

mysql> select * from t4e32b983 where col_29 between -2 and 2;
+--------+
| col_29 |
+--------+
|      2 |
+--------+
1 row in set (0.00 sec)

mysql> select * from t4e32b983 where col_29 between -2 and 3;
+--------+
| col_29 |
+--------+
|      0 |
|      2 |
+--------+
2 rows in set (0.01 sec)

mysql> select * from t4e32b983 where col_29 between -2 and 4;
+--------+
| col_29 |
+--------+
|      2 |
|      0 |
|     -1 |
|      1 |
+--------+
4 rows in set (0.01 sec)

4. What is your TiDB version? (Required)

33480e8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants