pachadotdev commented on a change in pull request #10624:
URL: https://github.com/apache/arrow/pull/10624#discussion_r667533252
##########
File path: r/R/dplyr-functions.R
##########
@@ -280,6 +280,45 @@ nse_funcs$str_trim <- function(string, side = c("both",
"left", "right")) {
Expression$create(trim_fun, string)
}
+nse_funcs$substr <- function(string, start, stop) {
+ assert_that(
+ length(start) == 1,
+ msg = "Start of length != 1 not supported in Arrow"
+ )
+ assert_that(
+ length(end) == 1,
+ msg = "End of length != 1 not supported in Arrow"
+ )
+
+ if (start > stop) {
+ start <- 0
+ stop <- 0
+ } else {
+ start <- max(0, start - 1)
+ stop <- max(0, stop)
+ start_stop <- c(min(start, stop), max(start, stop))
+ start <- start_stop[1]
+ stop <- start_stop[2]
+ }
Review comment:
hmmm.... maybe it's just a bad try from me to avoid situations where
start > end
i'l lremove this
--
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]