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

move ArrayDims, ArrayNdims and Cardinality to datafusion-function-crate #9425

Merged
merged 3 commits into from
Mar 3, 2024

Conversation

Weijun-H
Copy link
Member

@Weijun-H Weijun-H commented Mar 2, 2024

Which issue does this PR close?

Parts #9285

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@Weijun-H Weijun-H marked this pull request as draft March 2, 2024 04:03
@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Physical Expressions labels Mar 2, 2024
@Weijun-H Weijun-H marked this pull request as ready for review March 2, 2024 04:28
@jayzhan211
Copy link
Contributor

@Weijun-H Can you also add a roundtrip test for those functions?
https://github.com/apache/arrow-datafusion/blob/2a490e48c924b76a2d389227c674b9f81b0404c8/datafusion/proto/tests/cases/roundtrip_logical_plan.rs#L578-L582

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great @Weijun-H -- thank you for the contrubution and thank you @jayzhan211 for the review

@@ -319,3 +316,125 @@ pub fn gen_range(
)?);
Ok(arr)
}

/// Returns the length of each array dimension
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is just following the existing pattern of array_functions, but I wonder if it would be better to organize the code by function.

For example, we could put the UDF and implementations in datafusion/functions-array/src/dims.rs 🤔

We could definitely do this as a follow on PR

Any thoughts @jayzhan211 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we split two files udf and kernel inside dims?

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 difficult part is naming the category name. Like array_append, array_prepend and array_concat. Should we name it mutable? How about pop_front and pop_back.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree how to organize the functions is not clear.

We could always just make one file for each function, I suppose. array_append.rs, array_prepend.rs, etc. Though that feels like a bit of an overkill

@alamb
Copy link
Contributor

alamb commented Mar 2, 2024

Looks like there is a conflict that needs to be resolved

@jayzhan211
Copy link
Contributor

Thanks @Weijun-H

@jayzhan211 jayzhan211 merged commit f229dcc into apache:main Mar 3, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logical-expr Logical plan and expressions physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants