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

Dmitriy V. Ryaboy commented on PIG-2952:
----------------------------------------

Agreed with Jon.

If you want a float to come out, you can always cast i or use 23.0.

This behavior is clearly documented: 
http://pig.apache.org/docs/r0.10.0/basic.html#arithmetic
                
> Division of an integer by an integer returns an integer
> -------------------------------------------------------
>
>                 Key: PIG-2952
>                 URL: https://issues.apache.org/jira/browse/PIG-2952
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.3.0, 0.4.0, 0.5.0, 0.6.0, 0.7.0, 0.8.0, 0.8.1, 0.9.0, 
> 0.9.1, 0.9.2, 0.10.0
>            Reporter: Ashutosh Chauhan
>
> Currently, 
> {code}
> a = load 'data' as (i:int); 
> b = foreach a generate i / 23;
> {code}
> will result in values in b being truncated to nearest int.
> SQL standard says correct behavior in such cases is to return double. MySQL 
> does this correctly as well.

--
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

Reply via email to