You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Marian Condurache <M....@bigpoint.net> on 2011/06/29 17:36:56 UTC

SUM function problem

Hi,
I have a really weird problem ....i am new to PIG so I don't really understand this SUM function error

ERROR 1045: Could not infer the matching function for org.apache.pig.builtin.SUM as multiple or none of them fit. Please use an explicit cast

I am using pig 0.8.1 from your website.... And the script is simple

%default INPUT_DIR '/user/test/input';
%default OUTPUT_DIR '/user/test/output';


ee = load '$INPUT_DIR/myData'  USING PigStorage(',') AS (myId:int, myNumber:int , mycount:int);

aa = foreach ee generate SUM(mycount);

STORE aa INTO '$OUTPUT_DIR/g6' using PigStorage(',');

I even tried

ee = load '$INPUT_DIR/myData'  USING PigStorage(',') AS (myId:int, myNumber:int , mycount:int);

aa = foreach ee generate SUM(ee.mycount);

STORE aa INTO '$OUTPUT_DIR/g6' using PigStorage(',');

Nothing.


Regards, Marian



AW: SUM function problem

Posted by Marian Condurache <M....@bigpoint.net>.
Thanks it worked 

-----Ursprüngliche Nachricht-----
Von: Raghu Angadi [mailto:rangadi@apache.org] 
Gesendet: Mittwoch, 29. Juni 2011 18:28
An: user@pig.apache.org
Betreff: Re: SUM function problem

try :

aa = foreach ( group ee all ) generate SUM(mycount);

read description and examples of 'GROUP' in PIG manual.
Raghu.

On Wed, Jun 29, 2011 at 8:36 AM, Marian Condurache <
M.Condurache@bigpoint.net> wrote:

> Hi,
> I have a really weird problem ....i am new to PIG so I don't really
> understand this SUM function error
>
> ERROR 1045: Could not infer the matching function for
> org.apache.pig.builtin.SUM as multiple or none of them fit. Please use an
> explicit cast
>
> I am using pig 0.8.1 from your website.... And the script is simple
>
> %default INPUT_DIR '/user/test/input';
> %default OUTPUT_DIR '/user/test/output';
>
>
> ee = load '$INPUT_DIR/myData'  USING PigStorage(',') AS (myId:int,
> myNumber:int , mycount:int);
>
> aa = foreach ee generate SUM(mycount);
>
> STORE aa INTO '$OUTPUT_DIR/g6' using PigStorage(',');
>
> I even tried
>
> ee = load '$INPUT_DIR/myData'  USING PigStorage(',') AS (myId:int,
> myNumber:int , mycount:int);
>
> aa = foreach ee generate SUM(ee.mycount);
>
> STORE aa INTO '$OUTPUT_DIR/g6' using PigStorage(',');
>
> Nothing.
>
>
> Regards, Marian
>
>
>

Re: SUM function problem

Posted by Raghu Angadi <ra...@apache.org>.
try :

aa = foreach ( group ee all ) generate SUM(mycount);

read description and examples of 'GROUP' in PIG manual.
Raghu.

On Wed, Jun 29, 2011 at 8:36 AM, Marian Condurache <
M.Condurache@bigpoint.net> wrote:

> Hi,
> I have a really weird problem ....i am new to PIG so I don't really
> understand this SUM function error
>
> ERROR 1045: Could not infer the matching function for
> org.apache.pig.builtin.SUM as multiple or none of them fit. Please use an
> explicit cast
>
> I am using pig 0.8.1 from your website.... And the script is simple
>
> %default INPUT_DIR '/user/test/input';
> %default OUTPUT_DIR '/user/test/output';
>
>
> ee = load '$INPUT_DIR/myData'  USING PigStorage(',') AS (myId:int,
> myNumber:int , mycount:int);
>
> aa = foreach ee generate SUM(mycount);
>
> STORE aa INTO '$OUTPUT_DIR/g6' using PigStorage(',');
>
> I even tried
>
> ee = load '$INPUT_DIR/myData'  USING PigStorage(',') AS (myId:int,
> myNumber:int , mycount:int);
>
> aa = foreach ee generate SUM(ee.mycount);
>
> STORE aa INTO '$OUTPUT_DIR/g6' using PigStorage(',');
>
> Nothing.
>
>
> Regards, Marian
>
>
>