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

Port StringToArray to function-arrays subcrate #9543

Merged
merged 3 commits into from
Mar 11, 2024
Merged

Port StringToArray to function-arrays subcrate #9543

merged 3 commits into from
Mar 11, 2024

Conversation

erenavsarogullari
Copy link
Member

@erenavsarogullari erenavsarogullari commented Mar 10, 2024

Which issue does this PR close?

Closes #9497.

What changes are included in this PR?

This PR aims to do following changes in terms of Epic #9285:
1- Port StringToArray to function-arrays subcrate,
2- Argument length check is added to string_to_array function: ref
3- Case: delimiter is NULL was breaking test case under array.slt such as SELECT string_to_array('abc', NULL). This case is also handled: ref
4- Function Documentation is added.

Are these changes tested?

Yes, all array.slt based string_to_array tests are passed.

Are there any user-facing changes?

No

@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Physical Expressions core Core DataFusion crate labels Mar 10, 2024

#[tokio::test]
async fn test_fn_string_to_array() -> Result<()> {
let expr = string_to_array(lit("abc##def##ghi"), lit("##"), lit("!"));
Copy link
Contributor

Choose a reason for hiding this comment

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

Some test cases are already covered in array.slt

Copy link
Member Author

@erenavsarogullari erenavsarogullari Mar 11, 2024

Choose a reason for hiding this comment

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

Firstly, thanks for the review. Addressed.

@@ -3113,6 +3113,7 @@ _Alias of [make_array](#make_array)._
### `string_to_array`

Splits a string in to an array of substrings based on a delimiter. Any substrings matching the optional `null_str` argument are replaced with NULL.
`SELECT string_to_array('abc##def', '##')` or `SELECT string_to_array('abc def', ' ', 'def')`
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@jayzhan211
Copy link
Contributor

jayzhan211 commented Mar 11, 2024

You can follow the How to format .md document section at https://arrow.apache.org/datafusion/contributor-guide/index.html#developer-s-guide to solve the formatting issue

@github-actions github-actions bot removed the core Core DataFusion crate label Mar 11, 2024
@erenavsarogullari erenavsarogullari changed the title Port StringToArray to function-arrays Port StringToArray to function-arrays subcrate Mar 11, 2024
@erenavsarogullari erenavsarogullari changed the title Port StringToArray to function-arrays subcrate Port StringToArray to function-arrays subcrate Mar 11, 2024
Copy link
Contributor

@jayzhan211 jayzhan211 left a comment

Choose a reason for hiding this comment

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

@jayzhan211 jayzhan211 merged commit 4cd3c43 into apache:main Mar 11, 2024
24 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.

Port StringToArray to function-arrays
2 participants