我在运行这个pig脚本时遇到以下错误…请帮助!!!提前谢谢。
"ERROR 1000: Error during parsing. Scalars can be only used with projections"
MOVIES = LOAD '/MOVIES' using PigStorage(',') as (mid:double, mn:chararray, yr:int, rt:float, dr:int);
Filter11 = filter MOVIES by $2 >= 1950;
Filter12 = filter Filter11 by $2 <= 1960;
Group1 = group Filter12 by yr;
Count1 = foreach Group1 generate group, COUNT(Filter12);
Sum1 = foreach Count1 generate SUM(Group1);
DUMP Sum1;
1条答案
按热度按时间iibxawm41#
将两个过滤条件结合起来,在最后一步中,将计数相加,即count(filter11)或$1。