My requirement is to generate multiple lines of output by using single line of input in pig scripting. What are the possible solutions?
The idea is to convert you input line into a bag and then flatten it. Here could be 2 cases:
Reading text:
txt = load '/pig_fun/input/text.txt' using TextLoader();
words = foreach txt generate TOKENIZE($0);
pivoted = foreach words generate FLATTEN($0);
dump pivoted;
Input:
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?)
Reading columns and then pivoting them see Pivot table with Apache Pig
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With