Pig脚本可对JSON数组数据进行分组和聚合

时间:2018-12-31 08:47:21

标签: apache-pig elephantbird

我刚开始编写Pig脚本。

我有以下输入的json数据

{"userid":"user-1","subjects":["abc","pqr"]}
{"userid":"user-1","subjects":["efg","xyz","abc"]}
{"userid":"user-2","subjects":["abc","pqr","mno"]}
{"userid":"user-2","subjects":["abc","efg"]}

我想编写一个猪脚本,将数据转换为

{"userid":"user-1","subjects":["abc","pqr","efg","xyz"]}
{"userid":"user-2","subjects":["abc","pqr","mno","efg"]}

输出按不同的用户ID分组,主题包含唯一性。

0 个答案:

没有答案