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

planner: dynamic partition prune should be aware of the caller‘s on-missing action #43686

Closed
AilinKid opened this issue May 10, 2023 · 0 comments · Fixed by #43763 or #44414
Closed
Assignees
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 severity/moderate sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.

Comments

@AilinKid
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set global tidb_partition_prune_mode='dynamic';

drop table tt1;
drop table tt2;

CREATE TABLE tt1 (
    id INT NOT NULL,
    listid INT,
    name varchar(10)
)

PARTITION BY LIST (listid) (
    PARTITION p1 VALUES IN (1),
    PARTITION p2 VALUES IN (2),
    PARTITION p3 VALUES IN (3),
    PARTITION p4 VALUES IN (4)
);

CREATE TABLE tt2 (
    id INT NOT NULL,
    listid INT
);

create index idx_listid on tt1(id,listid);
create index idx_listid on tt2(listid);

delete from tt1;
delete from tt2;

insert into tt1 values(1,1,1);
insert into tt1 values(2,2,2);
insert into tt1 values(3,3,3);
insert into tt1 values(4,4,4);
insert into tt2 values(1,1);
insert into tt2 values(2,2);
insert into tt2 values(3,3);
insert into tt2 values(4,4);
insert into tt2 values(5,5);

analyze table tt1;
analyze table tt2; 

explain analyze
select /*+ inl_join(tt1)*/ count(*) from tt2
left join tt1 on tt1.listid=tt2.listid and tt1.id=tt2.id; ERROR 1526 (HY000): Table has no partition for value 5 

image

image

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

locate partition error doesn't mean it's indeed an error.
Under the index lookup scenario, the on-missing action of locate partition should return no rows infetchInnerResuts back to the caller IndexLookUpJoin

3. What did you see instead (Required)

locate partition error

4. What is your TiDB version? (Required)

all versions, even master

@AilinKid AilinKid added type/bug This issue is a bug. sig/planner SIG: Planner severity/moderate sig/sql-infra SIG: SQL Infra labels May 10, 2023
@VelocityLight VelocityLight added affects-5.1 This bug affects 5.1.x versions. affects-5.4 This bug affects 5.4.x versions. affects-7.1 affects-5.2 This bug affects 5.2.x versions. affects-5.0 This bug affects 5.0.x versions. affects-6.5 affects-6.1 affects-5.3 This bug affects 5.3.x versions. labels May 17, 2023
@qw4990 qw4990 removed the sig/planner SIG: Planner label May 17, 2023
@AilinKid AilinKid reopened this Jun 5, 2023
ti-chi-bot bot pushed a commit that referenced this issue Jun 5, 2023
ti-chi-bot bot pushed a commit that referenced this issue Jun 5, 2023
ti-chi-bot bot pushed a commit that referenced this issue Jun 6, 2023
AilinKid added a commit to AilinKid/tidb that referenced this issue Jun 6, 2023
ti-chi-bot bot pushed a commit that referenced this issue Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 severity/moderate sig/sql-infra SIG: SQL Infra type/bug This issue is a bug.
Projects
None yet
4 participants