我有如下输入数据:



我如何分成多行,如下所示:



提前致谢

最佳答案

您可以使用FLATTEN。例如。,

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;

关于hadoop - pig 拉丁语-从单行输入创建多行输出,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22927083/

10-12 23:01