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

Incorrect result is returned when comparing with null #9374

Closed
JinheLin opened this issue Aug 27, 2024 · 1 comment · Fixed by #9373
Closed

Incorrect result is returned when comparing with null #9374

JinheLin opened this issue Aug 27, 2024 · 1 comment · Fixed by #9373
Labels
severity/major type/bug The issue is confirmed as a bug.

Comments

@JinheLin
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

 drop table if exists test.t;

 create table test.t (a date);

 insert into test.t values("2024-08-26"),("2024-08-25"),("2024-08-24"),("2024-08-23");

 alter table test.t set tiflash replica 1;

 alter table test.t compact tiflash replica;

 set session tidb_isolation_read_engines='tiflash'; select * from test.t where not (a between NULL and '2024-08-25');

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

+------------+
| a          |
+------------+
| 2024-08-26 |
+------------+

3. What did you see instead (Required)

+------------+
| a          |
+------------+
| 2024-08-26 |
| 2024-08-25 |
| 2024-08-24 |
| 2024-08-23 |
+------------+

4. What is your TiFlash version? (Required)

f0a4087

@JinheLin
Copy link
Contributor Author

MinMaxIndex does not handle compare in correct ways:

RSResults MinMaxIndex::checkCmp(size_t start_pack, size_t pack_count, const Field & value, const DataTypePtr & type)
{
RSResults results(pack_count, RSResult::None);
if (value.isNull())
return results;

// skip null value
if (v.isNull())
continue;

ti-chi-bot bot pushed a commit that referenced this issue Aug 27, 2024
close #9374

In `MinMaxIndex`, if the input value is null, return `RSResult::NoneNull`.

Co-authored-by: JaySon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant