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

Alan Gates commented on PIG-1885:
---------------------------------

Changes look good.  One thought I had is rather than paying the cost of three 
ifs up front we could still call String.substring as we do today and catch the 
StringIndexOutofBoundsException, and only then figure out what was and wrong 
and give an error message.  That way you are only paying the cost of the checks 
once (since String.substring will do it anyway).  Up to you.

You will need to add units tests before we can commit it.  Add them to the 
existing TestStringUDFs class.  A test should be added for each of the error 
conditions you check for.

> SUBSTRING fails when input length less than start
> -------------------------------------------------
>
>                 Key: PIG-1885
>                 URL: https://issues.apache.org/jira/browse/PIG-1885
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.8.0, 0.9.0
>            Reporter: Alan Gates
>            Assignee: Deepak Kumar V
>            Priority: Minor
>             Fix For: 0.9.0
>
>         Attachments: PIG-1885.txt
>
>
> SUBSTRING throws an error if it gets a string which has a length less than 
> its start value.  For example, SUBSTRING(x, 100, 120) will fail with any 
> chararray of length less than 100.  It should return null instead.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to