You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Alan Gates <ga...@yahoo-inc.com> on 2009/09/09 22:38:32 UTC
Re: COUNT(*) for a empty relation
There is not a work around for 0.2.0. If you must stay on 0.2.0
rather than upgrading, you may be able to apply the patch for PIG-514
to a 0.2.0 base and recompile.
Alan.
On Aug 19, 2009, at 9:56 AM, Irfan Mohammed wrote:
> I see that there is a related JIRA [http://issues.apache.org/jira/browse/PIG-514
> ] for this and the fix went in for 0.3.0 version. Is there a
> workaround for pig 0.2.0?
>
> Thanks,
> Irfan
>
> Irfan Mohammed wrote:
>> Hi,
>> What is the best way to get the COUNT(*) for a empty relation?
>>
>> s6 = FILTER r1 BY f1 == 'x1';
>> -- dump s6;
>> b6 = GROUP s6 ALL;
>> c6 = FOREACH b6 GENERATE 'c6', FLATTEN((IsEmpty(s6) ? 0 :
>> COUNT(s6.$0)));
>>
>> If s6 is empty, I still want to generate 0 for the count.
>>
>> Any pointers?
>>
>> Thanks.
>> Irfan
Re: COUNT(*) for a empty relation
Posted by Irfan Mohammed <ir...@gmail.com>.
Thanks Alan.
I moved to pig-0.3.0 and hadoop-0.20.0 to get around this issue and
another issue related to inputs/outputs to s3.
Alan Gates wrote:
> There is not a work around for 0.2.0. If you must stay on 0.2.0
> rather than upgrading, you may be able to apply the patch for PIG-514
> to a 0.2.0 base and recompile.
>
> Alan.
>
> On Aug 19, 2009, at 9:56 AM, Irfan Mohammed wrote:
>
>> I see that there is a related JIRA
>> [http://issues.apache.org/jira/browse/PIG-514] for this and the fix
>> went in for 0.3.0 version. Is there a workaround for pig 0.2.0?
>>
>> Thanks,
>> Irfan
>>
>> Irfan Mohammed wrote:
>>> Hi,
>>> What is the best way to get the COUNT(*) for a empty relation?
>>>
>>> s6 = FILTER r1 BY f1 == 'x1';
>>> -- dump s6;
>>> b6 = GROUP s6 ALL;
>>> c6 = FOREACH b6 GENERATE 'c6', FLATTEN((IsEmpty(s6) ? 0 :
>>> COUNT(s6.$0)));
>>>
>>> If s6 is empty, I still want to generate 0 for the count.
>>>
>>> Any pointers?
>>>
>>> Thanks.
>>> Irfan
>