Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> Shared script commands

Copy link to this message
Shared script commands
Hi everyone,

I'm trying to determine the best way for all of my scripts to have
shared initialization statements like jar register commands, default
variable declarations, etc. and I'm not sure what the best way to do
it is.

Is it possible to create a script that does all of these boilerplate
things and then use the "exec" command from all of my other scripts to
call that "initialization" script?

For example, here's a somewhat abstracted version of what all of my
scripts start with:

myscript.pig -->

------------- Boilerplate declarations necessary in ALL scripts -------------

REGISTER /home/$USERNAME/apps/hadoop/build/share/myudfs.jar
%DEFAULT SCRIPT_MODE 'development'
SET pig.build.id '$BUILD_ID'


// pig code to do useful things
*/ end myscript.pig
Or is there a better way to use shared pig code like this (macros
don't allow a lot of the statements I need)?

Thank you!