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
Re: define global constants in pig script
Pig already has this! :)

Unless I'm really misunderstanding what you mean?

2012/7/26 Haitao Yao <[EMAIL PROTECTED]>

> 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
> weibo: @haitao_yao
> Skype:  haitao.yao.final