[
https://issues.apache.org/jira/browse/PIG-3110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13608326#comment-13608326
]
Prashant Kommireddi commented on PIG-3110:
------------------------------------------
Yes, we do need that in the case input is decimal number (123.45)
In my previous comment I proposed calling Double.valueOf() directly and then
turning that into a Long/Integer in such cases. Also we can avoid these calls
altogether by checking for "numericness". Let's do that in a separate JIRA?
> pig corrupts chararrays with trailing whitespace when converting them to long
> -----------------------------------------------------------------------------
>
> Key: PIG-3110
> URL: https://issues.apache.org/jira/browse/PIG-3110
> Project: Pig
> Issue Type: Bug
> Components: data
> Affects Versions: 0.10.0
> Reporter: Ido Hadanny
> Assignee: Prashant Kommireddi
> Fix For: 0.12
>
> Attachments: PIG-3110.patch
>
>
> when trying to convert the following string into long, pig corrupts it. data:
> 1703598819951657279 ,44081037
> data1 = load 'data' using CSVLoader as (a: chararray ,b: int);
> data2 = foreach data1 generate (long)a as a;
> dump data2;
> (1703598819951657216) <--- last 2 digits are corrupted
> data2 = foreach data1 generate (long)TRIM(a) as a;
> dump data2;
> (1703598819951657279) <--- correct
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira