0
我想要做一個簡單的豬查詢,我需要找到電影的平均評級爲ID 178我已經嘗試了一些版本的下面和過濾器工作,但沒有AVG功能。任何人都可以建議嗎?由於阿帕奇豬AVG功能
a = load '/user/pig/u.data' AS (userid:int, movieid:int, rating:double, timestamp:chararray);
b = FOREACH a GENERATE AVG(rating) as rate, movieid;
c = group b by rate;
d= filter a by movieid==178;
dump d;
首先過濾,然後組,然後平均。 – philantrovert