I write a UDF as flow:
package com.test;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;
public class Lower extends UDF {
public Text evaluate(final Text s) {
if (s == null) {
return null;
}
return new Text(s.toString().toLowerCase());
}
}
then I export a jar(udftest.jar) of this test project by eclipse.
After that I add jar udftest.jar
in hive:
hive command: add jar udftest.jar;
hive command: create temporary function my_lower as 'com.test.Lower';
hive command: Executing command: create temporary function my_lower as 'com.test.Lower'
Execution Failed!
Failed: Error occurred during execution.
Detail message: FAILED: Execution Error, return code [-101] (unknow error) from org.apache.hadoop.hive.ql.exec.FunctionTask
I don't know why! I search the internet but not deal with this problem!
I find why I can't create temporary function(it had bothered for days!): because the Java version I used is 1.7, but the hive only support 1.6!!!