You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Ryan LeCompte <le...@gmail.com> on 2009/11/03 23:35:13 UTC

Allowing NULL as a result of an IF statement

Hello all,

I was trying to do something like this today and Hive didn't like it:

SELECT AVG(IF(expression, anotherexpression, NULL)) ...

I don't think Hive supports returning NULL as the value of the last argument
to IF(...).

Is there any plan to support this?

Thanks,
Ryan

Re: Allowing NULL as a result of an IF statement

Posted by Ryan LeCompte <le...@gmail.com>.
I'm running 0.40 release. I can try trunk.

Thanks,
Ryan




On Nov 3, 2009, at 6:29 PM, Ning Zhang <nz...@facebook.com> wrote:

> It is supported in trunk. Which version of Hive are you running?
>
> Ning
>
> On Nov 3, 2009, at 2:35 PM, Ryan LeCompte wrote:
>
>> Hello all,
>>
>> I was trying to do something like this today and Hive didn't like it:
>>
>> SELECT AVG(IF(expression, anotherexpression, NULL)) ...
>>
>> I don't think Hive supports returning NULL as the value of the last
>> argument to IF(...).
>>
>> Is there any plan to support this?
>>
>> Thanks,
>> Ryan
>>
>

Re: Allowing NULL as a result of an IF statement

Posted by Ning Zhang <nz...@facebook.com>.
It is supported in trunk. Which version of Hive are you running?

Ning

On Nov 3, 2009, at 2:35 PM, Ryan LeCompte wrote:

> Hello all,
>
> I was trying to do something like this today and Hive didn't like it:
>
> SELECT AVG(IF(expression, anotherexpression, NULL)) ...
>
> I don't think Hive supports returning NULL as the value of the last  
> argument to IF(...).
>
> Is there any plan to support this?
>
> Thanks,
> Ryan
>