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

Join reorder might put the filters to the wrong place #45564

Closed
winoros opened this issue Jul 25, 2023 · 0 comments · Fixed by #45565
Closed

Join reorder might put the filters to the wrong place #45564

winoros opened this issue Jul 25, 2023 · 0 comments · Fixed by #45565
Assignees

Comments

@winoros
Copy link
Member

winoros commented Jul 25, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a int);
create table t1(a int, b int);
create table t2(a int, b int, c int);
create table t3(a int, b int);
create table t4(a int, b int);
explain format='brief' select * from t left join t1 on t.a=t1.a inner join t2 on t.a=t2.a and t2.c = 100 left join t3 on t2.a=t3.a and t3.b > 1 left join t4 on t2.a = t4.a where (t2.b > 100 or t.a > 10 or t1.b < 10);

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

The filter (t2.b > 100 or t.a > 10 or t1.b < 10) should be attached either as an independent selection or to an inner join plan.

3. What did you see instead (Required)

The filter is attached to the outer join node.

4. What is your TiDB version? (Required)

master

@winoros winoros added type/bug The issue is confirmed as a bug. affects-6.5 affects-7.1 sig/planner SIG: Planner severity/major labels Jul 25, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Jul 25, 2023
@winoros winoros removed may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants