【发布时间】:2016-03-21 10:24:16
【问题描述】:
我有一个简单的蜂巢 UDF:
package com.matthewrathbone.example;
import org.apache.hadoop.hive.ql.exec.Description;
import org.apache.hadoop.hive.ql.exec.UDF;
import org.apache.hadoop.io.Text;
@Description(
name="SimpleUDFExample",
value="returns 'hello x', where x is whatever you give it (STRING)",
extended="SELECT simpleudfexample('world') from foo limit 1;"
)
class SimpleUDFExample extends UDF {
public Text evaluate(Text input) {
if(input == null) return null;
return new Text("Hello " + input.toString());
}
}
当我使用选择查询执行它时: 从 tests3atable 限制 10 中选择 helloUdf(method); method 是 tests3atable 表中的列名。
我遇到了以下异常: 失败:SemanticException [错误 10014]:第 1:7 行错误的参数“方法”:无法实例化 UDF 实现类 com.matthewrathbone.example.SimpleUDFExample:java.lang.IllegalAccessException:类 org.apache.hadoop.hive.ql.udf .generic.GenericUDFBridge 无法使用修饰符“”访问 com.matthewrathbone.example.SimpleUDFExample 类的成员
【问题讨论】:
标签: hive