You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Ashutosh Chauhan (JIRA)" <ji...@apache.org> on 2012/10/07 22:16:02 UTC
[jira] [Created] (PIG-2952) Division of an integer by an integer
returns an integer
Ashutosh Chauhan created PIG-2952:
-------------------------------------
Summary: 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.10.0, 0.9.2, 0.9.1, 0.9.0, 0.8.1, 0.8.0, 0.7.0, 0.6.0, 0.5.0, 0.4.0, 0.3.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
[jira] [Resolved] (PIG-2952) Division of an integer by an integer
returns an integer
Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2952?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dmitriy V. Ryaboy resolved PIG-2952.
------------------------------------
Resolution: Not A Problem
> 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
[jira] [Commented] (PIG-2952) Division of an integer by an integer
returns an integer
Posted by "Jonathan Coveney (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/PIG-2952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13471336#comment-13471336 ]
Jonathan Coveney commented on PIG-2952:
---------------------------------------
In this case, Pig follows the Java convention. I think in general that's the expectation we create, though sometimes we do try and go with the SQL standard, so I'll leave this open until some other committers weigh in.
> 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
[jira] [Commented] (PIG-2952) Division of an integer by an integer
returns an integer
Posted by "Dmitriy V. Ryaboy (JIRA)" <ji...@apache.org>.
[ 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