gpt4 book ai didi

hadoop - pig 拉丁语-从单行输入创建多行输出

转载 作者:行者123 更新时间:2023-12-02 21:48:40 25 4
gpt4 key购买 nike

我有如下输入数据:

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



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

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



提前致谢

最佳答案

您可以使用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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com