hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Fan <>
Subject hive udf cannot recognize generic method
Date Wed, 30 Jul 2014 14:43:17 GMT
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.



View raw message