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

unexpected results returned by BatchPointGet #20100

Closed
qw4990 opened this issue Sep 18, 2020 · 2 comments · Fixed by #20108
Closed

unexpected results returned by BatchPointGet #20100

qw4990 opened this issue Sep 18, 2020 · 2 comments · Fixed by #20108
Assignees
Labels
component/executor severity/critical sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@qw4990
Copy link
Contributor

qw4990 commented Sep 18, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t (
    id bigint(20) unsigned,
    primary key(id)
);

insert into t values (8738875760185212610);
insert into t values (9814441339970117597);

select id from t where id in (8738875760185212610, 9814441339970117597) order by id;

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

mysql> select id from t where id in (8738875760185212610, 9814441339970117597) order by id;
+---------------------+
| id                  |
+---------------------+
| 8738875760185212610 |
| 9814441339970117597 |
+---------------------+
2 rows in set (0.00 sec)

3. What did you see instead (Required)

mysql> select id from t where id in (8738875760185212610, 9814441339970117597) order by id;
+---------------------+
| id                  |
+---------------------+
| 9814441339970117597 |
| 8738875760185212610 |
+---------------------+
2 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

mysql> select version();
+-------------------------------------------------+
| version()                                       |
+-------------------------------------------------+
| 5.7.25-TiDB-v4.0.0-beta.2-1253-g0e4b809ca-dirty |
+-------------------------------------------------+
1 row in set (0.00 sec)
@sre-bot
Copy link
Contributor

sre-bot commented Sep 25, 2020

Integrity check:
RCA symptom trigger_condition affect_version fix_version fields are empty
@lysu
Please comment /info to get template

@ti-srebot
Copy link
Contributor

ti-srebot commented Sep 25, 2020

Please edit this comment to complete the following information

Bug

1. Root Cause Analysis (RCA)

after #14775, tidb support point get as a data source, so we have the chance to get init logical plan like [sort -> pointBatchGet]
#14775 also let a optimize make [sort -> pointBatchGet] to [pointBatchGet(sortable)]

but for pk is handle PointGet, old code treat handle as signed int and didn't take care situation that unsign pk is handle

2. Symptom

the result is wrong, records didn't sort as to desire

3. All Trigger Conditions

need to meet 3 conditions to trigger this bug.

  • the user use unsigned int as the primary key
  • primary key value is larger than maxInt64
  • want point batch get and want to sort by primary key

4. Workaround (optional)

sort again in programm

5. Affected versions

[v4.0.0:v4.0.7]

6. Fixed versions

v4.0.8

This was referenced Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/executor 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.

4 participants