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

unique key get wrong row count when to query the Null value #56116

Closed
hawkingrei opened this issue Sep 18, 2024 · 0 comments · Fixed by #56117
Closed

unique key get wrong row count when to query the Null value #56116

hawkingrei opened this issue Sep 18, 2024 · 0 comments · Fixed by #56117
Assignees
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/statistics severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@hawkingrei
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t2(id bigint(20) DEFAULT NULL, UNIQUE KEY index_on_id (id));
insert into t2 values (), (), ();
analyze table t2;
explain select count(*) from t2 where id is null;

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

StreamAgg_17 1.00 root  funcs:count(Column#5)->Column#3,
└─IndexReader_18 1.00 root  index:StreamAgg_9,
  └─StreamAgg_9 1.00 cop[tikv]  funcs:count(1)->Column#5,
    └─IndexRangeScan_16 3.00 cop[tikv] table:t2, index:index_on_id(id) range:[NULL,NULL], keep order:false,

3. What did you see instead (Required)

StreamAgg_17 1.00 root  funcs:count(Column#5)->Column#3,
└─IndexReader_18 1.00 root  index:StreamAgg_9,
  └─StreamAgg_9 1.00 cop[tikv]  funcs:count(1)->Column#5,
    └─IndexRangeScan_16 1.00 cop[tikv] table:t2, index:index_on_id(id) range:[NULL,NULL], keep order:false,

4. What is your TiDB version? (Required)

@hawkingrei hawkingrei added the type/bug The issue is confirmed as a bug. label Sep 18, 2024
@hawkingrei hawkingrei changed the title unique key querying the Null value get wrong row count unique key get wrong row count when to query the Null value Sep 18, 2024
@hawkingrei hawkingrei self-assigned this Sep 18, 2024
@winoros winoros added affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. labels Sep 19, 2024
@ti-chi-bot ti-chi-bot bot closed this as completed in 70a26f8 Sep 19, 2024
ti-chi-bot bot pushed a commit that referenced this issue Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.1 This bug affects the 8.1.x(LTS) versions. component/statistics severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
2 participants