-define global constants in pig script
Haitao Yao 2012-07-27, 03:32
I got an idea about a new feature for pig: define global constants in pig script.
Here's the example like this:
-- define a global constant for storage
define store_location "/where_you_store_result";
-- then all the following constants reference will be replaced in runtime
store Result into $$store_location using PigStorage(',');
so, in this way, we just write the template scripts and import them with the constants defined. A commonly use case is use it to compute data for different days.
Without this feature, I have to use sed to replace the variables on the template script to generate the daily pig scripts.
How do you guy think so?