Grokbase Groups Pig user June 2009
FAQ
Hi all,



I have a requirement where I need to pass an argument to pig script
which has space in it. I found that pig script is failing to parse such
kind of parameters as it is breaking at the space. This is happening
even after I surround each parameter value using quotes. So, the other
option that I am thinking is to use a special character while passing as
input parameter and replace it with space in pig script. So, can anyone
please let me know if there is a simpler way of doing it?



Thanks

Pallavi

Search Discussions

  • Alan Gates at Jun 2, 2009 at 12:36 am
    Can you give an example of your script. I tried passing a space to
    PigStorage for the column separator and it worked fine. Are you
    passing this to an EvalFunc or a LoadFunc?

    Alan.
    On Jun 1, 2009, at 3:00 AM, Palleti, Pallavi wrote:

    Hi all,



    I have a requirement where I need to pass an argument to pig script
    which has space in it. I found that pig script is failing to parse
    such
    kind of parameters as it is breaking at the space. This is happening
    even after I surround each parameter value using quotes. So, the
    other
    option that I am thinking is to use a special character while
    passing as
    input parameter and replace it with space in pig script. So, can
    anyone
    please let me know if there is a simpler way of doing it?



    Thanks

    Pallavi
  • Pallavi Palleti at Jun 2, 2009 at 4:23 am
    Hi Alan,

    I am using it in Group BY. Also, I tried with empty pig script by just touching a file called test.pig and tried to run. I got same error. The error is pasted below:

    java.lang.RuntimeException: You can only run one pig script at a time from the command line.
    at org.apache.pig.Main.main(Main.java:289)

    Please find below script and the way I am firing it at command line:

    test.pig:

    raw = LOAD '/user/ppallavi/' USING PigStorage('\t') ;
    clickAggr = GROUP raw by ($0, '$date') PARALLEL 10;
    clickCounts = FOREACH clickAggr GENERATE FLATTEN(group), COUNT($1);
    distinctclickCounts = DISTINCT clickCounts;
    STORE distinctclickCounts INTO '/somelocation/ClickCounts/' using PigStorage('\t');

    Here is how I am calling this script from command line:
    bin/pig -param date="2009-06-01 01" test.pig

    If I don't use space, it is working perfectly fine. I am using hadoop-18.2 and the pig checked out from types branch.

    Thanks
    Pallavi



    ----- Original Message -----
    From: "Alan Gates" <gates@yahoo-inc.com>
    To: pig-user@hadoop.apache.org
    Sent: Tuesday, June 2, 2009 6:05:08 AM GMT +05:30 Chennai, Kolkata, Mumbai, New Delhi
    Subject: Re: issue with space in command line arguments for pig script

    Can you give an example of your script. I tried passing a space to
    PigStorage for the column separator and it worked fine. Are you
    passing this to an EvalFunc or a LoadFunc?

    Alan.
    On Jun 1, 2009, at 3:00 AM, Palleti, Pallavi wrote:

    Hi all,



    I have a requirement where I need to pass an argument to pig script
    which has space in it. I found that pig script is failing to parse
    such
    kind of parameters as it is breaking at the space. This is happening
    even after I surround each parameter value using quotes. So, the
    other
    option that I am thinking is to use a special character while
    passing as
    input parameter and replace it with space in pig script. So, can
    anyone
    please let me know if there is a simpler way of doing it?



    Thanks

    Pallavi

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedJun 1, '09 at 10:00a
activeJun 2, '09 at 4:23a
posts3
users2
websitepig.apache.org

2 users in discussion

Pallavi Palleti: 2 posts Alan Gates: 1 post

People

Translate

site design / logo © 2022 Grokbase