-
Notifications
You must be signed in to change notification settings - Fork 590
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
Optimizer: push down predicate inferred by hash join equal condition #8376
Comments
It will little more complex when we consider the NULL-safe equal condition 🤔 We can handle them respectively but I am not sure if we can handle this condition |
Yeah, in the original use case, a and b are different alias of the same table that is used to represent a graph, where |
Using an optimization rule to solve a panic sounds a little bit weird to me. It would be a required step to transform plans into a preferred form, rather than an optional "optimization". |
Once null safe equal appears, we can just push down a condition like |
Good point. Although this is a potential way to address the problem, we decided to fix the bug by #8377 and treat this one as an optimization. |
We do something similar here:
But this is implemented only for one-sided expression. Needs futher investigationBy applying this to eq conditions, this could turn the following condition: into
NULL safety reasoning could be extended from here: #6895. In particular: we "can only handle pushing down to an inner side.". Not sure if it is accurate when applied reflexively to eq conditions. |
Hey, any updates? |
Because we solve the #7698, it becomes less emergent and a optimization. |
For queries like
select * from a, b on a.x = b.x and a.y = b.x
, we can push down a filter before sidea
with conditiona.x=a.y
and only keep one of the two join condition in hash join executor.Such optimization can apply to almost all kinds of hash join with the exception of anti-join.
For anti-join we can not push down a filter or keep let join key. Instead, we need to evaluate the predicate in hash join executor. If
a.x=a.y
is false, we know the join conditiona.x = b.x and a.y = b.x
is false.This can also solve the #7698
The text was updated successfully, but these errors were encountered: