2012-06-26 45 views

回答

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? 

OUTPUT:

(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