Community Articles

Find and share helpful community-sourced technical articles.
Labels (3)
avatar

SYMPTOM: Attempting to submit a Pig job via WebHCat that defines parameter(s) for substitution as command-line arguments results in an "incorrect usage" message and job does not run. Doing the same through Hue results in an "undefined parameter" message and job does not run.

ROOT CAUSE: If the parameter is passed to curl as a single argument (-d 'arg=-param paramName=paramValue') it is interpreted incorrectly by Pig. Submitting the parameter via Hue as a single argument has the same unwanted effect.

WORKAROUND: Pass the parameter as two arguments:

curl -d file=myScript.pig -d 'arg=-param' -d 'arg=paramName=paramValue' 'http://<server>:50111/templeton/v1/pig'

To achieve the same using Hue, pass two arguments in sequence (refer to attached image for an example).

RESOLUTION: WebHCat works as designed. This issue is a limitation of curl. The Hue workaround is good for a single parameter, however multiple parameters may not work.

428-parameter-substitution-with-hue.png

2,236 Views
Comments
avatar
New Contributor

Any idea how we can pass multiple parameters to the curl command? eg: I would want to specify an input as well as output file as a parameter to my query.pig file

Also, I have a jar that I register within my pig script. How to use that with curl command? eg

register "/home/test/my.jar"

A = load '$input/pig' using pigstorage()

Store A into '$output'

------------------------------------

Above I am trying to pass 2 parameters: input and output as well as trying to register a jar that is there on my local. Any idea how to go about it? Again, I am trying to run the above script via curl

Thank you