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

Switch to Threaded View
Pig >> mail # user >> define global constants in pig script


Copy link to this message
-
define global constants in pig script
Hi, all
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?
Haitao Yao
[EMAIL PROTECTED]
weibo: @haitao_yao
Skype:  haitao.yao.final