package hive.analytics;
public class FirstUpper extends UDF {
public Text evaulate(Text actualName) throws IOException{
String name = actualName.toString().trim().toLowerCase();
String fc = name.substring(0,1).toUpperCase();
String rc = name.substring(1).toLowerCase();
String res = fc + rc;
return new Text(res);
}
}
我按照以下步骤进行操作..
add jar /home/chenna/Desktop/HiveApp1.jar;
create temporary function fupper
as 'hive.analytics.FirstUpper';
查询
select fupper(name) from emp;
错误
FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments 'name': No matching method for class hive.analytics.FirstUpper with (string). Possible choices: