I am having the text file in which fields are separated by :: like below.
124::2345::3::647483
234::5940::3::939390
340::3492::3::948284
How can i load the data in the pig latin and what is the parameter for using pigStorage??
答案 0 :(得分:2)
PigStorage
only accepts a single character.
Load the data on each line. Use STRSPLIT
with a regex pattern to get the fields.
A = LOAD 'data.txt' USING PigStorage('\n');
B = FOREACH A GENERATE FLATTEN(STRSPLIT($0, '::'));
\d B
Output
(124,2345,3,647483)
(234,5940,3,939390)
(340,3492,3,948284)