我的要求是通过在 pig 脚本中使用单行输入来生成多行输出。有哪些可能的解决方案?
问问题
2147 次
1 回答
7
这个想法是将您的输入线转换成一个袋子,然后将其展平。这里可能有两种情况:
阅读文字:
txt = load '/pig_fun/input/text.txt' using TextLoader();
words = foreach txt generate TOKENIZE($0);
pivoted = foreach words generate FLATTEN($0);
dump pivoted;
输入:
My requirement is to generate multiple lines of output by using single line of input in pig scripting.
What are the possible solutions?
输出:
(My)
(requirement)
(is)
(to)
(generate)
(multiple)
(lines)
(of)
(output)
(by)
(using)
(single)
(line)
(of)
(input)
(in)
(pig)
(scripting.)
(What)
(are)
(the)
(possible)
(solutions?)
读取列,然后旋转它们,请参见使用 Apache Pig 的数据透视表
于 2012-06-27T15:02:36.547 回答