Search code examples
hadoopapache-pig

Hadoop Pig: Passing Command Line Arguments


Is there a way to do this? eg, pass the name of the file to be processed, etc?


Solution

  • This showed up in another question, but you can indicate the input parameter on the command line and use that when you are loading, for example:

    Command Line:

    pig -f script.pig -param input=somefile.txt

    script.pig:

    raw = LOAD '$input' AS (...);

    Note that if you are using the Amazon Web Services Elastic Map Reduce then the '$input' is what is passed to the script for any input you provide.