简体   繁体   English

SemanticException [错误10014] Hive UDF

[英]SemanticException [Error 10014] Hive UDF

i'm using apache hive with and UDF function create in eclipse. 我正在使用apache配置单元和Eclipse中创建的UDF函数。 So when i call the function in my sql query, i see this error: 因此,当我在sql查询中调用该函数时,我看到此错误:

FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments 'summary': No matching method for class HiveUDF.TokenizeString with (string). 失败:SemanticException [错误10014]:行1:7错误的参数“摘要”:类HiveUDF.TokenizeString没有(字符串)的匹配方法。 Possible choices: 可能的选择:

Where is the problem? 问题出在哪儿?

UDF CLASS UDF类

package HiveUDF;
public class TokenizeString extends UDF {

public List<String> tokenize (Text text) {
    List<String> prova = new ArrayList<String>();
    if(text == null)
        return null;
    String[] words = text.toString().split("\\n");
    for (String w : words)
        prova.add(w);
    return prova;
}

} }

SQL TABLE AND QUERY SQL表和查询

id                      bigint                                      
productid               string                                      
userid                  string                                      
profilename             string                                      
helpfulnessnumerator    int                                         
helpfulnessdenominator  int                                         
score                   float                                       
time                    int                                         
summary                 string                                      
text                    string

CREATE TEMPORARY FUNCTION tokenize_summary as 'HiveUDF.TokenizeString';

select tokenize_summary(summary) from amazonproduct;

扩展UDF类时,必须重写validate(-)方法。

package HiveUDF;
public class TokenizeString extends UDF {
public List<String> evaulate (Text text) {
    List<String> prova = new ArrayList<String>();
    if(text == null)
        return null;
    String[] words = text.toString().split("\\n");
    for (String w : words)
        prova.add(w);
    return prova;
}
}

try this ... 尝试这个 ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM