neilconway commented on code in PR #20803:
URL: https://github.com/apache/datafusion/pull/20803#discussion_r2908119729
##########
datafusion/functions/src/unicode/substr.rs:
##########
@@ -53,7 +53,7 @@ use datafusion_macros::user_doc;
standard_argument(name = "str", prefix = "String"),
argument(
name = "start_pos",
- description = "Character position to start the substring at. The first
character in the string has a position of 1."
+ description = "Character position to start the substring at. The first
character in the string has a position of 1. If the start position is less than
1, it is treated as if it is before the start of the string and the (absolute)
number of characters before position 1 is subtracted from `length` (if given).
For example, `substr('abc', -3, 6)` returns `'ab'`."
Review Comment:
@Omega359 Thanks for the comment! This is not new behavior. The behavior for
negative start values actually matches what PostgreSQL implements (and what the
SQL spec dictates), even though personally that behavior doesn't seem
particularly useful to me. `get_true_start_end` does allow negative `start`
values; maybe you're thinking of negative `count` values, which are not allowed.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]