首先做一个小组 CITY ,然后使用bagtostring(http://pig.apache.org/docs/r0.15.0/func.html#bagtostring)将每个组的值转换为所需的字符串表示形式。有点像(未经测试!)
data = LOAD '/tmp/test.dat' using PigStorage(',') AS (city:chararray, value:chararray);
data_grp = GROUP data BY city;
result = FOREACH data_grp GENERATE group AS city, BagToString(data.value, '|') AS values;
1条答案
按热度按时间dgtucam11#
首先做一个小组
CITY
,然后使用bagtostring(http://pig.apache.org/docs/r0.15.0/func.html#bagtostring)将每个组的值转换为所需的字符串表示形式。有点像(未经测试!)