我正在尝试使用 Pig Latin 创建以下关系格式:
用户 ID,日期,{(pid,fulldate, x,y),(pid,fulldate, x,y), ...}
关系描述:每个用户(userid)在每一天(day)都购买了多个产品(pid)
我正在将数据加载到:
A= LOAD '**from a HDFS URL**' AS (pid: chararray,userid:
chararray,day:int,fulldate: chararray,x: chararray,y:chararray);
B= GROUP A BY (userid, day);
Describe B;
B:{组:(userid:chararray,day:int),A:{(pid:chararray,day:int,fulldate:chararray,x:chararray,userid:chararray,y:chararray)}}
C= FOREACH B FLATTEN(B) AS (userid,day), $1.pid, $1.fulldate,$1.x,$1.y;
Describe C;
C: {userid: chararray,day: int,{(pid: chararray)}},{(fulldate: chararray)},{(x: chararray)},{(y: chararray)}}
描述 C 的结果没有给出我想要的格式!我做错了什么?