udf 類型不匹配,從text到intwriteabel
NoMatchingMethodException No matching method for class hivedemon.UDFDemo with (int, int). Possible choices:?
代碼如下:
public IntWritable evaluate(IntWritable num1, IntWritable num2){
? ? ? ? if(num1 == null || num2 == null){
? ? ? ? ? ? return null;
? ? ? ? }
? ? ? ? return new IntWritable(num1.get() + num2.get());
? ? }
報錯如上。
2018-05-21
我試了一下,你的這個沒問題,你是不是輸參數的時候帶上了單引號,導致參數的類型成了Text而不是IntWritable。