You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/10/20 03:18:05 UTC

[GitHub] [arrow-datafusion] r4ntix opened a new pull request, #3902: Add `Substring(str [from int] [for int])` support in `datafusion-proto`

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

   # 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 #3901 and https://github.com/apache/arrow-ballista/issues/375
   
    # 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.  
   -->
   
   See #3901 
   
   # 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.
   -->
   
   * Add `substring` expr to support `Substring(str [from int] [for int])`
   * Modify `from_proto.rs` to support `Substring(str [from int] [for int])`
   * Add `roundtrip_substr` test
   
   # 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.
   -->
   
   None


-- 
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


[GitHub] [arrow-datafusion] alamb merged pull request #3902: Add `Substring(str [from int] [for int])` support in `datafusion-proto`

Posted by GitBox <gi...@apache.org>.
alamb merged PR #3902:
URL: https://github.com/apache/arrow-datafusion/pull/3902


-- 
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


[GitHub] [arrow-datafusion] alamb commented on pull request #3902: Add `Substring(str [from int] [for int])` support in `datafusion-proto`

Posted by GitBox <gi...@apache.org>.
alamb commented on PR #3902:
URL: https://github.com/apache/arrow-datafusion/pull/3902#issuecomment-1286728782

   Thanks @r4ntix 


-- 
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


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #3902: Add `Substring(str [from int] [for int])` support in `datafusion-proto`

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #3902:
URL: https://github.com/apache/arrow-datafusion/pull/3902#discussion_r1000921939


##########
datafusion/proto/src/from_proto.rs:
##########
@@ -1137,10 +1138,20 @@ pub fn parse_expr(
                     parse_expr(&args[0], registry)?,
                     parse_expr(&args[1], registry)?,
                 )),
-                ScalarFunction::Substr => Ok(substr(
-                    parse_expr(&args[0], registry)?,
-                    parse_expr(&args[1], registry)?,
-                )),
+                ScalarFunction::Substr => {
+                    if args.len() > 2 {

Review Comment:
   I recommend adding an assert `assert_eq!(args.len(), 3)` in this case so that we don't get another silent failure if we add additional argument support to substr



-- 
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


[GitHub] [arrow-datafusion] r4ntix commented on a diff in pull request #3902: Add `Substring(str [from int] [for int])` support in `datafusion-proto`

Posted by GitBox <gi...@apache.org>.
r4ntix commented on code in PR #3902:
URL: https://github.com/apache/arrow-datafusion/pull/3902#discussion_r1001418328


##########
datafusion/proto/src/from_proto.rs:
##########
@@ -1137,10 +1138,20 @@ pub fn parse_expr(
                     parse_expr(&args[0], registry)?,
                     parse_expr(&args[1], registry)?,
                 )),
-                ScalarFunction::Substr => Ok(substr(
-                    parse_expr(&args[0], registry)?,
-                    parse_expr(&args[1], registry)?,
-                )),
+                ScalarFunction::Substr => {
+                    if args.len() > 2 {

Review Comment:
   Thanks for the feedback, I've added the assert in the new commit :)



-- 
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