-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Proposal: Improve the join keys of logical plan #4389
Comments
I think this makes a lot of sense to me. Thank you @ygf11 . I would suggest a few other fields as well:
This design also extends naturally to adding other specialized join predicates in the future (eg. range joins)
|
Thanks for your suggestion @alamb @jackwener, I will work on it. |
in the spark just the
cc @ygf11 |
Can we change the logical plan of join to presto or doris? and extract the If we can change the |
😭, I also confused about we split the join to I think it's necessary to refactor this to combine them together in the logical phase, but it will bring a |
Thank you @liukun4515. Another way to avoid adding the special type coercion, is:
I'm not sure if this way will change a lot, so need some tries. |
I would prefer to keep the current two logical joins, |
make sense for me, we can try it.
Thanks |
cc @ygf11 we should make the equal join condition to |
Wouldn't an empty list for the join conditions effectively the same as |
Currently the planner will convert I also have the same confuse of empty list and |
Yes, If i have time, and will do this.
|
@ygf11 One thing that I'm not very clear is that you will change to use |
I plan to add physical projection when transforming logical plan to physical plan. |
Thanks for the explanation. |
I think @liukun4515 's suggestion of #4389 (comment) is consistent with what I have seen in other systems. I don't really know why we have Join / CrossJoin in the logical plan and I think it would make more sense to encode that information in a single LogicalPlan node That being said, I don't have a strong opinion on the matter and I leave the decision to those doing the work |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Join keys in
LogicalPlan::Join
arecolumns
now, which is the same as physical plan.To add features base on it, we need add additional projections in logical plan level, like #4193 and #4353. There are some drawbacks:
Join key need alias when do type coercion
One join key may happen one more time in join on condition, then it may also need do type coercion one more time, to distinguish each position, we have to add alias for them.
For example, we have:
then the logical plan will:
This makes our logical plan more complex.
logical plan is verbose
for sql:
the logical plan will be like(does not do type coercion):
Two projections will be added before join.
Describe the solution you'd like
I would like to fold the additional projections to join(logical-plan), and keep the physical join as before. I think it can make our logical plan clean and easy to extend.
After I check the current code base, the main changes are the optimizers:
We can step by step to finish it, and refactor the LogicalPlan::Join finally.
Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: