需要从包中压平多个元组

时间:2013-10-02 14:59:40

标签: hadoop apache-pig

我输入的内容如下:

100.101.74.22   {(1358308803000,start,100.101.74.22,http://server1.com/flvplay-1.26.swf%23),(1358308973000,stop,100.101.74.22,http://server1.com/flvplay-1.26.swf%23),(1358308843000,pause,100.101.74.22,http://server1.com/flvplay-1.26.swf%23)}

我写了一个这样的脚本:

A = load 'inputpath' USING PigStorage('\t') AS (f1 : chararray, B:bag{T:tuple(x1 : chararray, x2 : chararray, x3 : chararray, x4 : chararray)});

B = foreach A generate f1,flatten(B.(x1, x2,x3,x4)); 

我期待输出为:

100.101.74.22,1358308803000,start,100.101.74.22,http://server1.com/flvplay-1.26.swf%23,1358308973000,stop,100.101.74.22,http://server1.com/flvplay-1.26.swf%23,1358308843000,pause,100.101.74.22,http://server1.com/flvplay-1.26.swf%23

我怎么能得到它?请帮忙。

0 个答案:

没有答案