如何在猪拉丁语中组合/连接两个袋子 [英] how to combine/concat two bags in pig latin
本文介绍了如何在猪拉丁语中组合/连接两个袋子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个数据集:
A = {uid, url}; B = {uid, url};
现在我做一个cogroup
:
C = COGROUP A BY uid, B BY uid;
我想把C改成{group AS uid, DISTINCT A.url+B.url
};
我的问题是如何将两个包 A.url 和 B.url 连接起来?
My question is how do I do this concatenation of two bags A.url and B.url?
或者换一种说法,我如何在多列上做DISTINCT
?
Or to put it differently, how do I do DISTINCT
on multiple columns?
推荐答案
A = LOAD 'A' using PigStorage() as (uid,url);
B = LOAD 'B' using PigStorage() as (uid,url);
C = JOIN A by uid ,B by uid;
D = FOREACH C GENERATE $0,CONCAT(A::url,B::url);
E= DISTINCT D;
dump E;
这篇关于如何在猪拉丁语中组合/连接两个袋子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文