i'm using apache hive with and UDF function create in eclipse. So when i call the function in my sql query, i see this error:
FAILED: SemanticException [Error 10014]: Line 1:7 Wrong arguments 'summary': No matching method for class HiveUDF.TokenizeString with (string). Possible choices:
Where is the problem?
UDF CLASS
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
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 ...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.