Skip to content
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

Minor: Refactor array_union function to use a generic union_arrays function #8381

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

Weijun-H
Copy link
Member

@Weijun-H Weijun-H commented Nov 30, 2023

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?

@github-actions github-actions bot added the physical-expr Physical Expressions label Nov 30, 2023
@Weijun-H Weijun-H changed the title Minor: Refactor array_union function to use a generic Minor: Refactor array_union function to use a generic union_arrays function Nov 30, 2023
r_field_ref: &Arc<Field>,
) -> Result<ArrayRef> {
match (l_field_ref.data_type(), r_field_ref.data_type()) {
(DataType::Null, _) => Ok(array2.clone()),
Copy link
Contributor

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.... 🤔

Copy link
Member Author

@Weijun-H Weijun-H Dec 1, 2023

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor

@comphead comphead left a 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()),
Copy link
Contributor

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

@alamb alamb merged commit 8882f1b into apache:main Dec 1, 2023
23 of 24 checks passed
appletreeisyellow pushed a commit to appletreeisyellow/datafusion that referenced this pull request Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants