我想在hbase的一列中存储0。所以,我在Pig的剧本里做了以下几点。
data = load 'access_log_Jul95' using PigStorage(' ') as (ip:chararray, dash1:chararray, dash2:chararray, date:chararray, date1:chararray, getRequset:chararray, location:chararray, http:chararray, code:int, size:int);
splitDate = foreach data generate 0 AS size:int , ip as ip, FLATTEN(STRSPLIT(date, ':')) as h;
groupedIp = group splitDate by h.$1;
然后我就这样做了
a = foreach groupedIp generate SUM(splitDate.size);
在控制台上抛出错误
Could not infer the matching function for org.apache.pig.builtin.SUM as multiple or none of them fit. Please use an explicit cast
在这种情况下,有没有什么方法可以不用求和就写零,或者求和处理所有零的方法会很有用。
谢谢。
1条答案
按热度按时间xwmevbvl1#
试试这个-