我写一个 UDF 作为流:
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());
}
}
然后我通过eclipse导出这个测试项目的jar(udftest.jar)。
之后,我在配置单元中添加 jar udftest.jar
:
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'
执行失败!
Failed: Error occurred during execution.
Detail message: FAILED: Execution Error, return code [-101] (unknow error) from org.apache.hadoop.hive.ql.exec.FunctionTask
不知道为什么!我在网上搜索但没有处理这个问题!
最佳答案
我找到了为什么我不能创建临时函数(困扰了好几天!):因为我使用的 Java 版本是 1.7,但是 hive 只支持 1.6!!!
关于java - HIVE:执行错误,从 org.apache.hadoop.hive.ql.exec.FunctionTask 返回代码 [-101](未知错误),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27353418/