Skip to content

Conversation

@erenavsarogullari
Copy link
Member

@erenavsarogullari erenavsarogullari commented Mar 15, 2024

Which issue does this PR close?

Closes #9616.

What changes are included in this PR?

This PR aims to do following changes in terms of Epic #9285:
ArrayPosition and ArrayPositions are ported to functions-array subcrate.

Are these changes tested?

Yes, all array.slt based ArrayPosition and ArrayPositions tests are passed.

Are there any user-facing changes?

No

@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Changes to the physical-expr crates labels Mar 15, 2024
@erenavsarogullari
Copy link
Member Author

@jayzhan211 Created this PR in terms of our previous discussion on the kernels/udf structure. Please let me know if you have any concern. Also, will be working on current test failures. Just fyi.

@erenavsarogullari erenavsarogullari changed the title [WIP] Port ArrayPosition and ArrayPositions to functions-array subcrate Port ArrayPosition and ArrayPositions to functions-array subcrate Mar 15, 2024
@jayzhan211
Copy link
Contributor

Remind to add the roundtrip test

Copy link
Member

@Weijun-H Weijun-H left a comment

Choose a reason for hiding this comment

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

Nice work! Thanks @erenavsarogullari

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.

Thank you @erenavsarogullari

I took the liberty of merging up from main to fix the merge conflicts and I removed the dependency on arrow-ord to fix the datafusion-cli CI check

Thank you @Weijun-H for the review

generic_position::<O>(list_array, element_array, arr_from)
}

fn check_datatypes(name: &str, args: &[&ArrayRef]) -> datafusion_common::Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use function in crate::utils

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed

}

fn return_type(&self, arg_types: &[DataType]) -> datafusion_common::Result<DataType> {
Ok(match arg_types[0] {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the type checking is necessary in return_type 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Addressed by reflecting both array_position and array_positions.

@erenavsarogullari
Copy link
Member Author

Thanks everyone for the reviews and feedbacks.

@jayzhan211
Copy link
Contributor

Thanks @erenavsarogullari and @alamb , @Weijun-H for the review

@jayzhan211 jayzhan211 merged commit dcfe709 into apache:main Mar 17, 2024
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 Changes to the physical-expr crates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Port ArrayPosition and ArrayPositions to functions-array subcrate

4 participants