我的要求是在pig脚本中使用单行输入生成多行输出。有哪些可能的解决方案?
答案 0 :(得分:7)
我们的想法是将您的输入线转换为包,然后将其展平。这可能是2个案例:
阅读文字:
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?)
读取列然后转动它们,请参阅Pivot table with Apache Pig