Reputation: 2329
Is there a way to automatically run a pig script when invoking pig from command line?
The reason I'm wondering about this is that I have several import and define statements that I use constantly over and over to set everything up. Is it possible to define this collection of statements somewhere so that when I start pig, it will automatically execute those lines? I apologize in advance if this is something trivial that I missed from the documentation.
Upvotes: 1
Views: 181
Reputation: 1082
yes you can certainly do so from version 0.11 onwards.
You need to use .pigbootup
file.
Here is a nice blogpost on setting up the pigbootup
file
http://hadoopified.wordpress.com/2013/02/06/pig-specify-a-default-script/
If you want to include Pig-Macros from a file you can use the import
command
Take a look at http://pig.apache.org/docs/r0.9.1/cont.html#import-macros for reference
Upvotes: 2