You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by "Katukuri, Jay" <jk...@ebay.com> on 2010/05/04 05:46:28 UTC
RE: ERROR 1045: Could not infer the matching function for
org.apache.pig.builtin.AVG
-----Original Message-----
From: Katukuri, Jay
Sent: Thursday, April 29, 2010 1:28 PM
To: 'pig-user@hadoop.apache.org'
Subject: RE: ERROR 1045: Could not infer the matching function for org.apache.pig.builtin.AVG
Alan,
The fields themselves are the result of COUNT function.
Here is the stripped down version of the script:
Raw = load '$input_dir' USING PigStorage('\t') AS (col1:int, col2:int, col3:int, col4:chararray, col5:long,col6:long, col7:int, col8:int, col9:int, col10:int, col11:int)
Raw_group = GROUP Raw BY (col4,col3,col1,col5,col6) PARALLEL 50;
Raw_group_stats = FOREACH Raw_group {
itemfiltered = FILTER Raw BY col8 == 9 AND (col10 > 0 OR col7 > 0);
a_bag = FILTER itemfiltered BY col11 > 1;
GENERATE group, group.$0 as Guid, group.$1,group.$2, group.$3,group.$4, COUNT(a_bag) as a_sum;
}
Raw_outer_group = GROUP Raw_group_stats BY ($0.$1, $0.$2, $0.$3, $0.$4) PARALLEL $input_treat_count;
treat_scores = FOREACH Raw_outer_group GENERATE group, AVG(a_sum)
Thanks,
Jay
-----Original Message-----
From: Alan Gates [mailto:gates@yahoo-inc.com]
Sent: Thursday, April 29, 2010 12:37 PM
To: pig-user@hadoop.apache.org
Subject: Re: ERROR 1045: Could not infer the matching function for org.apache.pig.builtin.AVG
What is the type of the field you are trying to take the average of?
Alan.
On Apr 29, 2010, at 11:10 AM, Katukuri, Jay wrote:
> Hi,
> I have encountered the following error in using pig's built in
> function AVG.
>
> "ERROR 1045: Could not infer the matching function for
> org.apache.pig.builtin.AVG as multiple or none of them fit. Please
> use an explicit cast."
>
> So, I wrote a non-algebraic and non-accumulator UDF for Average.
> That works fine. It is not efficient obviously.
>
> I am using pig-0.40.
>
> Can any one point to me why this error is happening?
>
> Thanks,
> jay
>