Grokbase Groups Pig user June 2009
FAQ
In trying to use the Top() function from the piggybank (PIG-732), I
consistently get the error "could not infer matching function".
This happens even when I write a simple script that just goes through the
steps described in the Top() Javadoc.

Thoughts?

grunt> register piggybank.jar
grunt> data = load 'top-data.dat' using PigStorage(',') as (grp, data);

-- what is the source data?
grunt> dump data;
(big,data)
(big,data2)
(big,data3)
(small,data)

-- go through the steps in the Top() Javadoc
grunt> grouped = group data by grp;
grunt> counted = FOREACH grouped GENERATE FLATTEN(group), COUNT(data) as
cnt;
grunt> regrouped = GROUP counted BY group;

grunt> dump regrouped;
(big,{(big,3L)})
(small,{(small,1L)})

grunt> describe regrouped;
regrouped: {group: bytearray,counted: {group: bytearray,cnt: long}}

-- now, let's try that Top() function

grunt> topres = FOREACH regrouped {
res = org.apache.pig.piggybank.evaluation.util.Top(1,1,counted);
GENERATE FLATTEN (res);
}
grunt> dump topres;
2009-06-16 07:11:56,867 [main] ERROR org.apache.pig.tools.grunt.Grunt -
ERROR 1045: Could not infer the matching function for
org.apache.pig.piggybank.evaluation.util.Top as multiple or none of them
fit. Please use an explicit cast.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 2 | next ›
Discussion Overview
groupuser @
categoriespig, hadoop
postedJun 16, '09 at 2:20p
activeJun 18, '09 at 8:31p
posts2
users2
websitepig.apache.org

People

Translate

site design / logo © 2021 Grokbase