-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Minor: Refactor array_union function to use a generic union_arrays function #8381
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
union_arrays function
r_field_ref: &Arc<Field>, | ||
) -> Result<ArrayRef> { | ||
match (l_field_ref.data_type(), r_field_ref.data_type()) { | ||
(DataType::Null, _) => Ok(array2.clone()), |
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.
Awesome @Weijun-H
Makes the code cleaner
Its not a problem of this PR but I'm thinking why we need to clone arrays in case of nulls.... 🤔
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.
If array1 is Null
, return array2 directly because it is a union function. @comphead
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.
nvm, thanks @Weijun-H its cloning a reference not the underlying data
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.
I think the whole handling of Nulls in array functions is not quite correct (DataType::Null) should not be passed in. I believe @jayzhan211 is working on this
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.
lgtm thanks @Weijun-H
r_field_ref: &Arc<Field>, | ||
) -> Result<ArrayRef> { | ||
match (l_field_ref.data_type(), r_field_ref.data_type()) { | ||
(DataType::Null, _) => Ok(array2.clone()), |
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.
I think the whole handling of Nulls in array functions is not quite correct (DataType::Null) should not be passed in. I believe @jayzhan211 is working on this
union_arrays function
Which issue does this PR close?
Closes #.
Rationale for this change
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?