-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: Add additional required expression for natural join #11713
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
Conversation
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Lordworms -- this code looks reasonable to me. I had some suggestions / requests for some more comments.
Maybe @jonahgao has ideas of how to improve this too
|
I checked that the final logical plan is correct, but the calling of expand_wildcard in The use of let mut projection = vec![Expr::Wildcard];
projection.extend(expr_join_keys.into_iter());
LogicalPlanBuilder::from(input)
.project(projection)?
.build()?Its purpose should be to re-project all the outputs of the input plan. So I think another simpler fix might be to replace |
I agree, It's is much simpler, I was thinking about how to add missing expressions that are excluded by |
jonahgao
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Lordworms and @jonahgao -- this is a beautifully simple PR now. 🏆
| let need_project = join_keys.iter().any(|key| !matches!(key, Expr::Column(_))); | ||
| let plan = if need_project { | ||
| let mut projection = expand_wildcard(input_schema, &input, None)?; | ||
| // Include all columns from the input and extend them with the join keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍 that is beautiful.
Which issue does this PR close?
Closes #11635
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?