I am trying to implement a simple UDF but that doesn't seem to work for some reason. It looks like Hive is not able to cast the arguments to the right type.
select price, mavg(0, price, 2) from prices limit 1; FAILED: Error in semantic analysis: line 1:14 Wrong Arguments 2: No matching method for class com.priceyeti.hive.udf.MovingAvg with (int, float, int). Possible choices: _FUNC_(org.apache.hadoop.io.Writable, org.apache.hadoop.io.DoubleWritable, int) Interestingly, the last argument is recognized as an int. The first one is allowed to be of any type but it looks like I have to define a method for each supported type. Is that true? Lastly, the middle argument is not recognized as a DoubleWritable. Is that because I should be using org.apache.hadoop.hive.serde2.io.DoubleWritable instead of org.apache.hadoop.io.DoubleWritable That's very confusing but it seems to be the case: http://svn.apache.org/viewvc/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/UDFCeil.java?revision=1027721&view=markup The arg types have to be from hive.serde2 but he return type has to be from hadoop. Is that right? It's even more confusing that there isn't a serde2 type for Int or Text: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/ What's going on here? Thanks! igor