Hive自定义函数报错10014:No matching method for class
问题:
写了一个UDF,上传到服务器,使用创建自定义函数时报错
hive (studentsdemo)> select s_id,score2.s_score,tongji(s_score) from score2;
FAILED: SemanticException [Error 10014]: Line 1:27 Wrong arguments 's_score': No matching method for class ItcastUDF2 with (int). Possible choices:
报错原因:
通过上网查找发现 ,错误码10014报错为UDF没有使用规定的方法名称,错误代码片段如下:
public class ItcastUDF extends UDF {
public String evluate(String num){
int number = Integer.parseInt(num);
int result = (number + 10) / 2 * 3 + 100 - 180 +20;
return result + "";
}
}
解决方案:
将方法名修正即可!!!!方法名少了一个a,应为evaluate
注:写代码要细心,很‘高级’的一个错误