Grokbase Groups Pig user July 2011
FAQ
I am not able to assign a value with spaces to param on command line.
$ pig -p cond='x == 1' test.pig
results in command line parser error.
other attempts like 'pig -p cond='"x == 1"' test.pig' didn't help.

Is there a work around?
otherwise I will file a jira and look into a fix.

thanks,
Raghu.

Search Discussions

  • Daniel Dai at Jul 12, 2011 at 4:31 am
    It's not the space, it is the '=' character which is not allowed. Use \ to
    do the escape, cond="x \=\= 1".

    Daniel
    On Mon, Jul 11, 2011 at 2:09 PM, Raghu Angadi wrote:

    I am not able to assign a value with spaces to param on command line.
    $ pig -p cond='x == 1' test.pig
    results in command line parser error.
    other attempts like 'pig -p cond='"x == 1"' test.pig' didn't help.

    Is there a work around?
    otherwise I will file a jira and look into a fix.

    thanks,
    Raghu.
  • Raghu Angadi at Jul 12, 2011 at 5:16 am

    On Mon, Jul 11, 2011 at 9:30 PM, Daniel Dai wrote:

    It's not the space, it is the '=' character which is not allowed. Use \ to
    do the escape, cond="x \=\= 1".

    This helps.. I was wondering why my test didn't work even when there were
    no spaces.

    The space is still a problem. When there is a space it still causes
    "2011-07-12 05:10:48,496 [main] ERROR org.apache.pig.Main - ERROR 2999:
    Unexpected internal error. Encountered unexpected arguments on command line
    - please check the command line."

    to summarize :
    "x == 1" : does not work
    "x==1" : doesn't
    "x\=\=1" : does
    "x \=\= 1" : doesn't

    Raghu.
    Daniel
    On Mon, Jul 11, 2011 at 2:09 PM, Raghu Angadi wrote:

    I am not able to assign a value with spaces to param on command line.
    $ pig -p cond='x == 1' test.pig
    results in command line parser error.
    other attempts like 'pig -p cond='"x == 1"' test.pig' didn't help.

    Is there a work around?
    otherwise I will file a jira and look into a fix.

    thanks,
    Raghu.
  • Daniel Dai at Jul 12, 2011 at 6:01 pm
    Seems space works for me. You can use -r to dry-run the parameter
    substitution part to see what it results.

    Daniel
    On Mon, Jul 11, 2011 at 10:15 PM, Raghu Angadi wrote:
    On Mon, Jul 11, 2011 at 9:30 PM, Daniel Dai wrote:

    It's not the space, it is the '=' character which is not allowed. Use \ to
    do the escape, cond="x \=\= 1".

    This helps.. I was wondering why my test didn't work even when there were
    no spaces.

    The space is still a problem. When there is a space it still causes
    "2011-07-12 05:10:48,496 [main] ERROR org.apache.pig.Main - ERROR 2999:
    Unexpected internal error. Encountered unexpected arguments on command line
    - please check the command line."

    to summarize :
    "x == 1" : does not work
    "x==1" : doesn't
    "x\=\=1" : does
    "x \=\= 1" : doesn't

    Raghu.
    Daniel
    On Mon, Jul 11, 2011 at 2:09 PM, Raghu Angadi wrote:

    I am not able to assign a value with spaces to param on command line.
    $ pig -p cond='x == 1' test.pig
    results in command line parser error.
    other attempts like 'pig -p cond='"x == 1"' test.pig' didn't help.

    Is there a work around?
    otherwise I will file a jira and look into a fix.

    thanks,
    Raghu.
  • Raghu Angadi at Jul 12, 2011 at 8:33 pm
    are you using bin/pig? With bin/pig, it does not even go to substitution
    stage. bin/pig joins all the arguments into one bash string.

    If I explicitly invoke pig java command (as printed with -secredDebugCmd)
    with the arguments it works. Btw, spaces before '=' also need to be escaped
    looks like.

    Raghu.
    On Tue, Jul 12, 2011 at 11:00 AM, Daniel Dai wrote:

    Seems space works for me. You can use -r to dry-run the parameter
    substitution part to see what it results.

    Daniel
    On Mon, Jul 11, 2011 at 10:15 PM, Raghu Angadi wrote:
    On Mon, Jul 11, 2011 at 9:30 PM, Daniel Dai wrote:

    It's not the space, it is the '=' character which is not allowed. Use \ to
    do the escape, cond="x \=\= 1".

    This helps.. I was wondering why my test didn't work even when there were
    no spaces.

    The space is still a problem. When there is a space it still causes
    "2011-07-12 05:10:48,496 [main] ERROR org.apache.pig.Main - ERROR 2999:
    Unexpected internal error. Encountered unexpected arguments on command line
    - please check the command line."

    to summarize :
    "x == 1" : does not work
    "x==1" : doesn't
    "x\=\=1" : does
    "x \=\= 1" : doesn't

    Raghu.
    Daniel

    On Mon, Jul 11, 2011 at 2:09 PM, Raghu Angadi <rangadi@apache.org>
    wrote:
    I am not able to assign a value with spaces to param on command line.
    $ pig -p cond='x == 1' test.pig
    results in command line parser error.
    other attempts like 'pig -p cond='"x == 1"' test.pig' didn't help.

    Is there a work around?
    otherwise I will file a jira and look into a fix.

    thanks,
    Raghu.
  • Daniel Dai at Jul 13, 2011 at 12:40 am
    I am not using bin/pig, I am using pig.jar directly. Yes, I saw space before
    '=' is strip out, feel free to open a Jira ticket.

    Daniel
    On Tue, Jul 12, 2011 at 1:33 PM, Raghu Angadi wrote:

    are you using bin/pig? With bin/pig, it does not even go to substitution
    stage. bin/pig joins all the arguments into one bash string.

    If I explicitly invoke pig java command (as printed with -secredDebugCmd)
    with the arguments it works. Btw, spaces before '=' also need to be escaped
    looks like.

    Raghu.
    On Tue, Jul 12, 2011 at 11:00 AM, Daniel Dai wrote:

    Seems space works for me. You can use -r to dry-run the parameter
    substitution part to see what it results.

    Daniel
    On Mon, Jul 11, 2011 at 10:15 PM, Raghu Angadi wrote:

    On Mon, Jul 11, 2011 at 9:30 PM, Daniel Dai <daijy@hortonworks.com>
    wrote:
    It's not the space, it is the '=' character which is not allowed. Use
    \
    to
    do the escape, cond="x \=\= 1".

    This helps.. I was wondering why my test didn't work even when there were
    no spaces.

    The space is still a problem. When there is a space it still causes
    "2011-07-12 05:10:48,496 [main] ERROR org.apache.pig.Main - ERROR 2999:
    Unexpected internal error. Encountered unexpected arguments on command line
    - please check the command line."

    to summarize :
    "x == 1" : does not work
    "x==1" : doesn't
    "x\=\=1" : does
    "x \=\= 1" : doesn't

    Raghu.
    Daniel

    On Mon, Jul 11, 2011 at 2:09 PM, Raghu Angadi <rangadi@apache.org>
    wrote:
    I am not able to assign a value with spaces to param on command
    line.
    $ pig -p cond='x == 1' test.pig
    results in command line parser error.
    other attempts like 'pig -p cond='"x == 1"' test.pig' didn't help.

    Is there a work around?
    otherwise I will file a jira and look into a fix.

    thanks,
    Raghu.
  • Raghu Angadi at Jul 13, 2011 at 10:44 pm
    https://issues.apache.org/jira/browse/PIG-2162

    attached patch for bin/pig.

    didn't fix Pig parser. Currently parsers for %default and -p seem different.

    Raghu.
    On Tue, Jul 12, 2011 at 5:39 PM, Daniel Dai wrote:

    I am not using bin/pig, I am using pig.jar directly. Yes, I saw space
    before
    '=' is strip out, feel free to open a Jira ticket.

    Daniel
    On Tue, Jul 12, 2011 at 1:33 PM, Raghu Angadi wrote:

    are you using bin/pig? With bin/pig, it does not even go to substitution
    stage. bin/pig joins all the arguments into one bash string.

    If I explicitly invoke pig java command (as printed with -secredDebugCmd)
    with the arguments it works. Btw, spaces before '=' also need to be escaped
    looks like.

    Raghu.

    On Tue, Jul 12, 2011 at 11:00 AM, Daniel Dai <daijy@hortonworks.com>
    wrote:
    Seems space works for me. You can use -r to dry-run the parameter
    substitution part to see what it results.

    Daniel
    On Mon, Jul 11, 2011 at 10:15 PM, Raghu Angadi wrote:

    On Mon, Jul 11, 2011 at 9:30 PM, Daniel Dai <daijy@hortonworks.com>
    wrote:
    It's not the space, it is the '=' character which is not allowed.
    Use
    \
    to
    do the escape, cond="x \=\= 1".

    This helps.. I was wondering why my test didn't work even when there were
    no spaces.

    The space is still a problem. When there is a space it still causes
    "2011-07-12 05:10:48,496 [main] ERROR org.apache.pig.Main - ERROR
    2999:
    Unexpected internal error. Encountered unexpected arguments on
    command
    line
    - please check the command line."

    to summarize :
    "x == 1" : does not work
    "x==1" : doesn't
    "x\=\=1" : does
    "x \=\= 1" : doesn't

    Raghu.
    Daniel

    On Mon, Jul 11, 2011 at 2:09 PM, Raghu Angadi <rangadi@apache.org>
    wrote:
    I am not able to assign a value with spaces to param on command
    line.
    $ pig -p cond='x == 1' test.pig
    results in command line parser error.
    other attempts like 'pig -p cond='"x == 1"' test.pig' didn't
    help.
    Is there a work around?
    otherwise I will file a jira and look into a fix.

    thanks,
    Raghu.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedJul 11, '11 at 9:09p
activeJul 13, '11 at 10:44p
posts7
users3
websitepig.apache.org

People

Translate

site design / logo © 2021 Grokbase