如何在猪拉丁中组合/组合两个袋子 [英] 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
};
and I want to change C into {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屋!
查看全文