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 result may be wrong when several filter merged into a point range on a prefix column #49138

Closed
time-and-fate opened this issue Dec 4, 2023 · 1 comment · Fixed by #48522
Assignees
Labels
severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@time-and-fate
Copy link
Member

time-and-fate commented Dec 4, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a varchar(20) collate utf8mb4_general_ci, index ia(a(3)));
insert into t value('aa'),('aab'),('aabb');
select * from t use index (ia) where a >= 'aabb' and a <= 'aabd';

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

> select * from t use index (ia) where a >= 'aabb' and a <= 'aabd';
+------+
| a    |
+------+
| aabb |
+------+
1 row in set (0.001 sec)

3. What did you see instead (Required)

> select * from t use index (ia) where a >= 'aabb' and a <= 'aabd';
+------+
| a    |
+------+
| aab  |
+------+
1 row in set (0.007 sec)

> explain select * from t use index (ia) where a >= 'aabb' and a <= 'aabd';
+-------------------------------+---------+-----------+----------------------+-----------------------------------------------------+
| id                            | estRows | task      | access object        | operator info                                       |
+-------------------------------+---------+-----------+----------------------+-----------------------------------------------------+
| IndexLookUp_8                 | 250.00  | root      |                      |                                                     |
| ├─IndexRangeScan_5(Build)     | 312.50  | cop[tikv] | table:t, index:ia(a) | range:["aab","aab"], keep order:false, stats:pseudo |
| └─Selection_7(Probe)          | 250.00  | cop[tikv] |                      | eq(test.t.a, "aab")                                 |
|   └─TableRowIDScan_6          | 312.50  | cop[tikv] | table:t              | keep order:false, stats:pseudo                      |
+-------------------------------+---------+-----------+----------------------+-----------------------------------------------------+
4 rows in set (0.012 sec)

4. What is your TiDB version? (Required)

only affects nightly
introduced in #48582

@winoros
Copy link
Member

winoros commented Dec 4, 2023

Currently, only the master will meet this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
4 participants