You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Grant Ingersoll <gs...@apache.org> on 2011/07/26 16:18:39 UTC

RowCount

I've been doing the following to count rows:

x = foreach (group foo all) generate COUNT($1);

Is that the current best practice?  If so, would there be interest in a patch that simply did: x = rowcount(foo) ?  I find myself doing sanity checks on scripts a fair amount and am starting to wish for something less verbose.

-Grant

--------------------------
Grant Ingersoll




Re: RowCount

Posted by Daniel Dai <da...@hortonworks.com>.
This can be done using Pig 0.9 Macro feature. Check this blog:
http://www.hortonworks.com/new-apache-pig-features-part-1-macro/

Daniel

On Tue, Jul 26, 2011 at 7:26 AM, Andrew Clegg <andrew.clegg+mahout@gmail.com
> wrote:

> +1
>
> On 26 July 2011 15:18, Grant Ingersoll <gs...@apache.org> wrote:
> > I've been doing the following to count rows:
> >
> > x = foreach (group foo all) generate COUNT($1);
> >
> > Is that the current best practice?  If so, would there be interest in a
> patch that simply did: x = rowcount(foo) ?  I find myself doing sanity
> checks on scripts a fair amount and am starting to wish for something less
> verbose.
> >
> > -Grant
> >
> > --------------------------
> > Grant Ingersoll
> >
> >
> >
> >
>
>
>
> --
>
> http://tinyurl.com/andrew-clegg-linkedin | http://twitter.com/andrew_clegg
>

Re: RowCount

Posted by Andrew Clegg <an...@gmail.com>.
+1

On 26 July 2011 15:18, Grant Ingersoll <gs...@apache.org> wrote:
> I've been doing the following to count rows:
>
> x = foreach (group foo all) generate COUNT($1);
>
> Is that the current best practice?  If so, would there be interest in a patch that simply did: x = rowcount(foo) ?  I find myself doing sanity checks on scripts a fair amount and am starting to wish for something less verbose.
>
> -Grant
>
> --------------------------
> Grant Ingersoll
>
>
>
>



-- 

http://tinyurl.com/andrew-clegg-linkedin | http://twitter.com/andrew_clegg