Skip to content

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 Changes to the physical-expr crates 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.

### `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
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 StringToArray to function-arrays

2 participants