Sounds like you are using the older style UDF class. In that case, yes you would have to override evaluate() for each type of input. You could also try overriding the GenericUDF class - that would allow you to do a single method, though it may be a bit more complicated (can look at the Hive code for some examples)
On Jul 30, 2014, at 7:43 AM, Dan Fan <d...@appnexus.com> wrote: > Hi there > > I am writing a hive UDF function. The input could be string, int, double etc. > The return is based on the data type. I was trying to use the generic method, > however, hive seems not recognize it. > Here is the piece of code I have as example. > > public <T> T evaluate(final T s, final String column_name, final int > bitmap) throws Exception { > > if (s instanceof Double) > return (T) new Double(-1.0); > Else if( s instance of Integer) > Return (T) new Integer(-1) ; > ….. > } > > Does anyone know if hive supports the generic method ? Or I have to override > the evaluate method for each type of input. > > Thanks > > Dan > -- CONFIDENTIALITY NOTICE NOTICE: This message is intended for the use of the individual or entity to which it is addressed and may contain information that is confidential, privileged and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, you are hereby notified that any printing, copying, dissemination, distribution, disclosure or forwarding of this communication is strictly prohibited. If you have received this communication in error, please contact the sender immediately and delete it from your system. Thank You.