pig latin - create multiple row output from single line input

I had input data like below:

Row1|2014-04-04 18:46:18|37.52|-84.34|30870|580.372 ms, 759.065 ms, 695.879 ms

Row2|2014-04-04 18:47:18|37.68|-84.34|31127|619.341 ms, 725.121 ms, 696.790 ms

How can I make into multiple rows as below:

Row1|2014-04-04 18:46:18|37.52|-84.34|30870|580.372 ms

Row1|2014-04-04 18:46:18|37.52|-84.34|30870|759.065 ms

Row1|2014-04-04 18:46:18|37.52|-84.34|30870|695.879 ms

Row2|2014-04-04 18:47:18|37.68|-84.34|31127|619.341 ms

Row2|2014-04-04 18:47:18|37.68|-84.34|31127|725.121 ms

Row2|2014-04-04 18:47:18|37.68|-84.34|31127|696.790 ms

thanks in advance


You can use FLATTEN. E.g.,

a = load 'test.txt' using PigStorage('|') as (c1: chararray, c2: chararray, c3: double, c4: double, c5: long, c6: chararray);
b = foreach a generate c1, c2, c3, c4, c5, STRSPLIT(c6, ', ', 3) as c6;
c = foreach b generate c1, c2, c3, c4, c5, FLATTEN(c6) as (c6: chararray, c7: chararray, c8: chararray);
dump c;

Need Your Help

Bash script using sed acts differently when passing variable

bash sed

I have a script that I am writing that checks a value and then based on the value modifies it.

using a div:title tag attribute instead of a:href attribute to toggle divs

javascript jquery

I have this script that uses an a:href attribute tag to swap divs out. I'd like to instead use a div tag with the title attribute.