与 apache Pig 拉丁语中的 GROUP 相反?
假设我在 apache pig 中有以下输入:
(123, ( (1, 2), (3, 4) ) )
(666, ( (8, 9), (10, 11), (3, 4) ) )
并且我想将这 2 行转换为以下 7 行:
(123, (1, 2) )
(123, (3, 4) )
(666, (8, 9) )
(666, (10, 11) )
(666, (3, 4) )
即,这有点“与 GROUP 相反”。这在猪拉丁语中可能吗?
Let's say I have the following input in apache pig:
(123, ( (1, 2), (3, 4) ) )
(666, ( (8, 9), (10, 11), (3, 4) ) )
and I want to convert these 2 rows into the following 7 rows:
(123, (1, 2) )
(123, (3, 4) )
(666, (8, 9) )
(666, (10, 11) )
(666, (3, 4) )
i.e. this is sorta 'doing the opposite of a GROUP'. Is this possible in pig latin?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看
FLATTEN
。它可以满足您可能需要的功能。但是,使用上面的符号,元组列表看起来像是一个元组。这应该是一个袋子才能正常工作。
而不是:
您应该将数据表示为:
然后,一旦采用这种形式,您可以执行以下操作:
Take a look at
FLATTEN
. It does what you probably need.However, using your notation above, it looks like the list of tuples is a tuple. This should be a bag for this to work properly.
Instead of:
You should be representing your data as:
Then, once it is this form, you can do: