Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/20464
  
    > One followup question is though, would it be difficult to match the 
behaviour with substr in R when the index is 0 or minus? If i understood #20464 
(comment) correctly, it sounds better to match it to substr's behaviour in R. 
Took a quick look/test and seems we can just set start to 1 for both cases.
    
    If we both consider the indices at starting and ending, setting them to 1 
seems not enough. E.g.,
    
    ```R
    > substr("abcdef", -2, -3)
    [1] ""
    > substr("abcdef", 1, 1)
    [1] "a"
    ```
    
    For the cases when only ending is zero/negative, no matter what starting 
is, the result is empty string.
    
    For the cases when only starting is zero/negative, we can set it to 1.
    
    For the cases they are both zero/negative, the result is empty string.
    
    We can address this in another PR.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to