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

Switch to Threaded View
Pig, mail # user - COALESCE UDF?


Copy link to this message
-
Re: COALESCE UDF?
Ruslan Al-Fakikh 2013-09-04, 11:30
Hi,

I think you could mimic it with an expression like this:
b = foreach a generate ((field1 is null) ? ((field2 is null) ? null :
field2) : field1);

Hope that helps,
Ruslan
On Wed, Sep 4, 2013 at 9:50 AM, Something Something <
[EMAIL PROTECTED]> wrote:

> Is there a UDF in Piggybank (or somewhere) that will mimic functionality of
> the COALESCE function in MySQL:
>
>
> http://www.w3resource.com/mysql/comparision-functions-and-operators/coalesce-function.php
>
> I know it will be very (very) easy to write this, but just don't want to
> create one if one already exists.  I looked but couldn't find one.
>
> Please let me know.  Thanks.
>