Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
ORD_HEAD = LOAD 'order_header.csv' using PigStorage (',') as (orderId:int,custId:int);
ORD_DET = LOAD 'order_detail.csv' using PigStorage (',') as (orderId:int,prdId:int,sls:int);
ORD_HD_DET = JOIN ORD_HEAD BY orderId,ORD_DET BY orderId;
ORD_HD_DET_FIN = FOREACH ORD_HD_DET GENERATE custId,prdId,sls;
GRP = GROUP ORD_HD_DET_FIN BY (custId,prdId);
RESULT = FOREACH GRP GENERATE FLATTEN($0),SUM(ORD_HD_DET_FIN.sls) as sales;
STORE RESULT INTO '/user/cloudera/ord_sls5';