You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "erenavsarogullari (via GitHub)" <gi...@apache.org> on 2024/03/10 18:54:50 UTC

[PR] Port StringToArray to function-arrays [arrow-datafusion]

erenavsarogullari opened a new pull request, #9543:
URL: https://github.com/apache/arrow-datafusion/pull/9543

   ## Which issue does this PR close?
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   Closes #9497.
   
   ## Rationale for this change
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   This PR aims to  Also, following changes are added:
   1- Port Port `StringToArray` to `function-arrays`,
   2- Argument length check is added to `string_to_array` function: 
   3- Case: delimiter is `NULL` was breaking test case under `array.slt` such as `SELECT string_to_array('abc', NULL)`. This is handled:
   4- Test case is added.
   
   ## What changes are included in this PR?
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   ## Are these changes tested?
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   ## Are there any user-facing changes?
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Port StringToArray to function-arrays [arrow-datafusion]

Posted by "erenavsarogullari (via GitHub)" <gi...@apache.org>.
erenavsarogullari commented on code in PR #9543:
URL: https://github.com/apache/arrow-datafusion/pull/9543#discussion_r1519041732


##########
datafusion/core/tests/dataframe/dataframe_functions.rs:
##########
@@ -870,3 +870,22 @@ async fn test_fn_array_to_string() -> Result<()> {
 
     Ok(())
 }
+
+#[tokio::test]
+async fn test_fn_string_to_array() -> Result<()> {
+    let expr = string_to_array(lit("abc##def##ghi"), lit("##"), lit("!"));

Review Comment:
   Firstly, thanks for the review. Addressed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Port StringToArray to function-arrays [arrow-datafusion]

Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #9543:
URL: https://github.com/apache/arrow-datafusion/pull/9543#discussion_r1519025106


##########
datafusion/core/tests/dataframe/dataframe_functions.rs:
##########
@@ -870,3 +870,22 @@ async fn test_fn_array_to_string() -> Result<()> {
 
     Ok(())
 }
+
+#[tokio::test]
+async fn test_fn_string_to_array() -> Result<()> {
+    let expr = string_to_array(lit("abc##def##ghi"), lit("##"), lit("!"));

Review Comment:
   Some test cases are already covered in `array.slt`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Port StringToArray to function-arrays [arrow-datafusion]

Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on PR #9543:
URL: https://github.com/apache/arrow-datafusion/pull/9543#issuecomment-1987436239

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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Port StringToArray to function-arrays [arrow-datafusion]

Posted by "erenavsarogullari (via GitHub)" <gi...@apache.org>.
erenavsarogullari commented on code in PR #9543:
URL: https://github.com/apache/arrow-datafusion/pull/9543#discussion_r1519041732


##########
datafusion/core/tests/dataframe/dataframe_functions.rs:
##########
@@ -870,3 +870,22 @@ async fn test_fn_array_to_string() -> Result<()> {
 
     Ok(())
 }
+
+#[tokio::test]
+async fn test_fn_string_to_array() -> Result<()> {
+    let expr = string_to_array(lit("abc##def##ghi"), lit("##"), lit("!"));

Review Comment:
   Firstly, thanks for review. Addressed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Port `StringToArray` to `function-arrays` subcrate [arrow-datafusion]

Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 merged PR #9543:
URL: https://github.com/apache/arrow-datafusion/pull/9543


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Port StringToArray to function-arrays [arrow-datafusion]

Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on code in PR #9543:
URL: https://github.com/apache/arrow-datafusion/pull/9543#discussion_r1519025426


##########
docs/source/user-guide/sql/scalar_functions.md:
##########
@@ -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')`

Review Comment:
   👍 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org