[UDF] How do I return NULL

2015-10-06 Thread Tugdual Grall
Hello Drillers,

I am developing a custom function and I would like to return NULL (based on
the value, for example if the varchar is '' I want my function to return
NULL)

I have not found the way to do it.


Regards
Tug
@tgrall


Re: [UDF] How do I return NULL

2015-10-06 Thread Abdel Hakim Deneche
Hi Tug,

Let's say your UDF returns an int, your @output field will be defined like
this:

@Output NullableIntHolder out;


To return a NULL you just have to set:

out.isSet = 0;


Thanks

On Tue, Oct 6, 2015 at 1:56 AM, Tugdual Grall  wrote:

> Hello Drillers,
>
> I am developing a custom function and I would like to return NULL (based on
> the value, for example if the varchar is '' I want my function to return
> NULL)
>
> I have not found the way to do it.
>
>
> Regards
> Tug
> @tgrall
>



-- 

Abdelhakim Deneche

Software Engineer

  


Now Available - Free Hadoop On-Demand Training



Re: [UDF] How do I return NULL

2015-10-06 Thread Steven Phillips
In addition, your UDF needs to have the attribute "nulls =
NullHandling.INTERNAL"

On Tue, Oct 6, 2015 at 8:32 AM, Abdel Hakim Deneche 
wrote:

> Hi Tug,
>
> Let's say your UDF returns an int, your @output field will be defined like
> this:
>
> @Output NullableIntHolder out;
>
>
> To return a NULL you just have to set:
>
> out.isSet = 0;
>
>
> Thanks
>
> On Tue, Oct 6, 2015 at 1:56 AM, Tugdual Grall  wrote:
>
> > Hello Drillers,
> >
> > I am developing a custom function and I would like to return NULL (based
> on
> > the value, for example if the varchar is '' I want my function to return
> > NULL)
> >
> > I have not found the way to do it.
> >
> >
> > Regards
> > Tug
> > @tgrall
> >
>
>
>
> --
>
> Abdelhakim Deneche
>
> Software Engineer
>
>   
>
>
> Now Available - Free Hadoop On-Demand Training
> <
> http://www.mapr.com/training?utm_source=Email&utm_medium=Signature&utm_campaign=Free%20available
> >
>