2016-03-21 70 views
2

我有一個簡單蜂房UDF:蜂房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(方法); 方法是tests3atable表中列的名稱。

我得到以下例外: FAILED:SemanticException [錯誤10014]:第1行:7個錯誤參數 '方法':無法實例UDF實現類com.matthewrathbone.example.SimpleUDFExample:java.lang.IllegalAccessException:類org.apache.hadoop.hive.ql.udf.generic.GenericUDFBridge不能訪問類com.matthewrathbone.example.SimpleUDFExample的成員使用修改器「」

回答

3

聲明類爲public,它應該工作

0

我也有同樣的問題。事實證明,日食並沒有刷新我修改的程序。所以請確保您在代碼中所做的修改反映在jar中。