Mark Liu (JIRA | 15 Jun 2012 11:25
Picon
Favicon

[Created] (PIG-2754) pig can't sum with inner mutiply

Mark Liu created PIG-2754:
-----------------------------

             Summary: pig can't sum with inner mutiply
                 Key: PIG-2754
                 URL: https://issues.apache.org/jira/browse/PIG-2754
             Project: Pig
          Issue Type: Bug
          Components: internal-udfs
    Affects Versions: 0.10.0
         Environment: GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
            Reporter: Mark Liu

sample code like that:

txns = LOAD '/test' USING PigStorage() AS (domain:chararray,amount:double);

txns_by_domain = GROUP txns BY domain;

test_txns = FOREACH txns_by_domain { domain = group;  test_out = SUM(txns.amount * txns.amount);}
...

it looks built-in function SUM did not support inner multiply and sum up.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

(Continue reading)

Alan Gates (JIRA | 15 Jun 2012 20:04
Picon
Favicon

[Commented] (PIG-2754) pig can't sum with inner mutiply


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

Alan Gates commented on PIG-2754:
---------------------------------

This is not a bug, it is the semantics of the language.  When you do txns.amount, the result is not a double, but
a bag of tuples with one column which is a double.  This is an issue because by definition no order is
guaranteed for records in a bag so in general there is no coherent way to resolve bag1.x * bag2.y.

                
> pig can't sum with inner mutiply
> --------------------------------
>
>                 Key: PIG-2754
>                 URL: https://issues.apache.org/jira/browse/PIG-2754
>             Project: Pig
>          Issue Type: Bug
>          Components: internal-udfs
>    Affects Versions: 0.10.0
>         Environment: GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
>            Reporter: Mark Liu
>
> sample code like that:
> txns = LOAD '/test' USING PigStorage() AS (domain:chararray,amount:double);
> txns_by_domain = GROUP txns BY domain;
> test_txns = FOREACH txns_by_domain { domain = group;  test_out = SUM(txns.amount * txns.amount);}
> ...
(Continue reading)

Alan Gates (JIRA | 15 Jun 2012 20:04
Picon
Favicon

[Resolved] (PIG-2754) pig can't sum with inner mutiply


     [
https://issues.apache.org/jira/browse/PIG-2754?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alan Gates resolved PIG-2754.
-----------------------------

    Resolution: Invalid

> pig can't sum with inner mutiply
> --------------------------------
>
>                 Key: PIG-2754
>                 URL: https://issues.apache.org/jira/browse/PIG-2754
>             Project: Pig
>          Issue Type: Bug
>          Components: internal-udfs
>    Affects Versions: 0.10.0
>         Environment: GNU bash, version 3.2.25(1)-release (x86_64-redhat-linux-gnu)
>            Reporter: Mark Liu
>
> sample code like that:
> txns = LOAD '/test' USING PigStorage() AS (domain:chararray,amount:double);
> txns_by_domain = GROUP txns BY domain;
> test_txns = FOREACH txns_by_domain { domain = group;  test_out = SUM(txns.amount * txns.amount);}
> ...
> it looks built-in function SUM did not support inner multiply and sum up.

--
This message is automatically generated by JIRA.
(Continue reading)


Gmane