猪谜题:将涉及的减速器重写为简单的猪脚本?
有多个帐户id
,每个帐户都有一个按用户名
分组的时间戳
。对于这些用户名组中的每一个,我想要所有对(最旧的帐户、其他帐户)。
我有一个java减速器可以做到这一点,我可以将它重写为一个简单的pig脚本吗?
架构:
{group:(username),A: {(id , create_dt)}
输入:
(batman,{(id1,100), (id2,200), (id3,50)})
(lulu ,{(id7,100), (id9,50)})
所需输出:
(batman,{(id3,id1), (id3,id2)})
(lulu ,{(id9,id7)})
There are account ids
, each with a timestamp
grouped by username
. foreach of these username groups I want all pairs of (oldest account, other account).
I have a java reducer that does that, can I rewrite it as a simple pig script?
Schema:
{group:(username),A: {(id , create_dt)}
Input:
(batman,{(id1,100), (id2,200), (id3,50)})
(lulu ,{(id7,100), (id9,50)})
Desired output:
(batman,{(id3,id1), (id3,id2)})
(lulu ,{(id9,id7)})
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎没人关心,但事情就是这样。你必须创建一个 UDF:
并且 UDF:
如果你想玩得很好,请添加以下内容:
}
Not that anyone seems to care, but here goes. You have to create a UDF:
And the UDF:
and if you wanna play real nicely, add this:
}