Invoke Pig Latin script from another Pig script

I have a question about PIG Latin. Is there any way how to call a pig script from another pig script?

I know that you can run custom functions (UDF), for example:

REGISTER myudfs.jar; A = LOAD 'student_data' AS (name: chararray, age: int, gpa: float); B = FOREACH A GENERATE myudfs.UPPER(name); DUMP B; 

But it does not work for the pig script. We count some various client parameters, and for reading and reusing it would be great to load some swing fragments, for example:

 REGISTER somepigscript.pig; LOAD somepigscript.pig; 

Do you know if there is such functionality? Or any UDF?

Thank you, you have a nice day ...

+4
source share
2 answers

The pig has two teams: RUN and EXEC . They differ in that the RUN will execute the Pig script and leave your aliases and properties available for later use, while EXEC simply execute the script and return with the calling environment unchanged (but with any new files created on HDFS).

For example, I have a set of macros, jars, and properties that I want to set at the beginning of every script that I write. Instead of typing them in every time, I put this in a Pig script and called RUN /my/script.pig at the beginning of my scripts.

+4
source

You can use macros for such things: http://pig.apache.org/docs/r0.11.1/cont.html#macros

0
source

All Articles