【问题标题】:Hive Udf exceptionHive Udf 异常
【发布时间】: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


    【解决方案1】:

    将类声明为公开的,它应该可以工作

    【讨论】:

      【解决方案2】:

      我也有同样的问题。事实证明,eclipse 并没有刷新我修改的程序。所以请确保您在代码中所做的修改会反映在 jar 中。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-12
        • 2016-01-27
        • 2021-12-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多