Grokbase Groups Pig user July 2011
FAQ
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

Search Discussions

  • Andrew Clegg at Jul 26, 2011 at 2:28 pm
    +1
    On 26 July 2011 15:18, Grant Ingersoll 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
  • Daniel Dai at Jul 29, 2011 at 9:05 pm
    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 wrote:

    +1
    On 26 July 2011 15:18, Grant Ingersoll 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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedJul 26, '11 at 2:18p
activeJul 29, '11 at 9:05p
posts3
users3
websitepig.apache.org

People

Translate

site design / logo © 2021 Grokbase