[ 
https://issues.apache.org/jira/browse/SPARK-16890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15407550#comment-15407550
 ] 

Jeff Zhang commented on SPARK-16890:
------------------------------------

If I remember correctly, it is by design. Because in the sql world, string is 1 
based rather than 0 based. 

> substring returns wrong result for positive position
> ----------------------------------------------------
>
>                 Key: SPARK-16890
>                 URL: https://issues.apache.org/jira/browse/SPARK-16890
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 1.5.2, 1.6.2, 2.0.0
>            Reporter: Kapil Singh
>
> If position > 0 then substring function reduces it by 1. So if it is invoked 
> like substring("First", 1, 4) then result is "Fir" instead of "irs". This is 
> because UTF8String's substring method does this fancy modification before 
> invoking substring on underlying String.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to