Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive, mail # user - Re: Re: can i define an udf which can process more than one argument?


+
Chris Gong 2012-10-19, 06:11
+
Chris Gong 2012-10-19, 03:36
+
Chen Song 2012-10-19, 14:00
Copy link to this message
-
Re: can i define an udf which can process more than one argument?
Jan Dolinár 2012-10-19, 05:17
Hi Chris,

Of course it is possible to write UDF with as many parameters as you want,
even with variable number of arguments. Have a look at the nice article
from Mark Grover [1] about writing UDFs. It also contains link to a
real-life example [2].

Best regards,
Jan Dolinar

[1] http://mark.thegrovers.ca/1/post/2012/06/how-to-write-a-hive-udf.html
[2]
https://github.com/markgrover/hive-translate/blob/master/GenericUDFTranslate.java

On Fri, Oct 19, 2012 at 5:36 AM, Chris Gong <[EMAIL PROTECTED]> wrote:

> **
> i find that UDF can only process one argument like
>    public long evaluate(String ip) {
>
>   }
>
> can i define a udf like  COALESCE(T v1, T v2, …) or  if(boolean
> testCondition, T valueTrue, T valueFalseOrNull)?
>
> ------------------------------
> Chris Gong
>