我想在Hbase中的一列中存储零。所以,我在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
在这种情况下,如果不使用SUM或者SUM在这里使用全零的方式,我总是可以写零的方式。
感谢。
答案 0 :(得分:0)
试试这个 -
1 | "File1.doc"
1 | "File2.xls"
1 | "File1.pdf"
2 | "File2.doc"
2 | "File1.xls"
2 | "File2.pdf"