hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Gong" <fellowt...@163.com>
Subject Re: Re: can i define an udf which can process more than one argument?
Date Fri, 19 Oct 2012 06:11:11 GMT
yes , it works , thank you very much  Jan.




Chris Gong

From: Jan Dolinár
Date: 2012-10-19 13:17
To: user; fellowtree
Subject: Re: can i define an udf which can process more than one argument?
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 <fellowtree@163.com> 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
Mime
View raw message