我必须找出在城市和产品上的最大花费。
我的实现:
A = LOAD '/home/cloudera/Desktop/test' USING PigStorage (',') AS (T_id:int,date:chararray,pro_id:int,amount:int,product:chararray,city:chararray);
B = FOREACH A GENERATE $3,$4,$5;
describe B;
B: {amount: int,product: chararray,city: chararray}
C = group B BY $2;
D = FOREACH C GENERATE group, MAX(B.amount);
DUMP D;
我得到了什么
(Reno,279)
(clark,2000)
(colum,500)
(Petersburg,421)
(charleston,1974)
(long beach,300)
预期产量
(Com ports,Reno,279)
(Exer & Fit,clark,2000)
(Wat ports,colum,500)
(Team Sports,Petersburg,421)
(Recreation,charleston,1974)
(Exer & Fit,long beach,300)
请帮帮我。。
1条答案
按热度按时间bxgwgixi1#
按产品和城市分组。