如何在Pig中将字段转换为行? [英] How to convert fields to rows in Pig?

查看:63
本文介绍了如何在Pig中将字段转换为行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将字段转换为Pig中的行.

I want to convert fields to rows in Pig.

来自input.txt

from input.txt

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9

字段之间的距离为'\ t'.

delimeter between fields is '\t'.

到output.txt

to output.txt

1 2个 3 4 ... 但我不能使用TOKENIZER,因为字段的内容可能是一个句子. 请帮我. 非常感谢.

1 2 3 4 ... but I must not use TOKENIZER because the content of fields might be a sentence. Please help me. Many Thanks.

推荐答案

我认为alexeipab的答案是正确的方向.这是一个简单的示例:

I think alexeipab's answer is the right direction. Here is a simple example:

> A = load 'input.txt';
> dump A
(0,1,2,3,4,5,6,7,8,9)
> B = foreach A generate FLATTEN(TOBAG(*));
> dump B
(0)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(9)

这篇关于如何在Pig中将字段转换为行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆