Grokbase Groups Pig user March 2011
FAQ
Hi all,

I have a problem where I need to limit the number of results generated by
pig script based on some condition.

say,
if ( $x == 0 )
then do not limit #results
else:
limited_result = LIMIT results $x ;

(here x comes from cmd line)

How can I achieve this with a single Pig script ?

Thanks in advance,
Souri

Search Discussions

  • Dexin Wang at Mar 27, 2011 at 9:11 pm
    Here's a trick I used:

    Together with $x, pass in another parameter $comment that's either ''
    (blank) when x>0 or '--' (double dashes) when x==0. Then

    result = SOME OPERATION
    $comment result = LIMIT result $x
    On Sun, Mar 27, 2011 at 12:36 PM, souri datta wrote:

    Hi all,

    I have a problem where I need to limit the number of results generated by
    pig script based on some condition.

    say,
    if ( $x == 0 )
    then do not limit #results
    else:
    limited_result = LIMIT results $x ;

    (here x comes from cmd line)

    How can I achieve this with a single Pig script ?

    Thanks in advance,
    Souri
  • Souri datta at Mar 28, 2011 at 6:48 pm
    thanks! its cool :)
    On Mon, Mar 28, 2011 at 2:40 AM, Dexin Wang wrote:

    Here's a trick I used:

    Together with $x, pass in another parameter $comment that's either ''
    (blank) when x>0 or '--' (double dashes) when x==0. Then

    result = SOME OPERATION
    $comment result = LIMIT result $x

    On Sun, Mar 27, 2011 at 12:36 PM, souri datta wrote:

    Hi all,

    I have a problem where I need to limit the number of results generated by
    pig script based on some condition.

    say,
    if ( $x == 0 )
    then do not limit #results
    else:
    limited_result = LIMIT results $x ;

    (here x comes from cmd line)

    How can I achieve this with a single Pig script ?

    Thanks in advance,
    Souri

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedMar 27, '11 at 7:37p
activeMar 28, '11 at 6:48p
posts3
users2
websitepig.apache.org

2 users in discussion

Souri datta: 2 posts Dexin Wang: 1 post

People

Translate

site design / logo © 2021 Grokbase