hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Fan <d...@appnexus.com>
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.


Thanks


Dan


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message