mkdir data
echo -e "1\n2\n3\n4\n8\n4\n3\n6" > data/data.txt
pig -x local
a = load 'data' Using PigStorage() As (value:int);
b = foreach a generate MAX(value);
dump b;
错误org.apache.pig.tools.grunt.Grunt - 错误1045:无法将org.apache.pig.builtin.MAX的匹配函数推断为多个或不适合。请使用明确的演员。
答案 0 :(得分:2)
刚刚找到答案,在调用函数之前只需要一个GROUP ALL ......有点觉得错误信息可能会更清晰......
a = load 'data' Using PigStorage() As (value:int);
b = GROUP a ALL;
c = foreach b generate MAX(a.value);
dump c;
> 8