-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Remove the schema checking when creating CrossJoinExec
#4432
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
Remove the schema checking when creating CrossJoinExec
#4432
Conversation
| let all_columns = { | ||
| let left_schema = left.schema(); | ||
| let right_schema = right.schema(); | ||
| let left_fields = left_schema.fields().iter(); | ||
| let right_fields = right_schema.fields().iter(); | ||
| left_fields.chain(right_fields).cloned().collect() | ||
| }; | ||
|
|
||
| let schema = Arc::new(Schema::new(all_columns)); |
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.
Could you use Schema::merge here instead?
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.
You could do something like this. This would preserve schema metadata as well.
let input_schemas = vec![left.schema().as_ref().clone(), right.schema().as_ref().clone()];
let schema = Arc::new(Schema::try_merge(input_schemas)?);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.
Sorry, I'm afraid try_merge doesn't fit this context.
What we want here is to concatenate schema, but not merge schema. It could happen that a table cross joins with itself, or two tables have same named columns, in which cases, merge doesn't work.
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.
For the metadata, we should also do concatenation, instead of merging.
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.
@andygrove, what's your suggestion?
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.
This PR makes sense to me -- thank you @HaoYang670
|
As I think all comments have been addressed, I am merging it in |
Signed-off-by: remzi 13716567376yh@gmail.com
Which issue does this PR close?
Closes #4431 .
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?
Yes, rename
CrossJoinExec::try_newtoCrossJoinExec::newand update the return type toSelf.