Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to call a pig script within another pig script

I have a file in hdfs with 100 columns, which i want to proces using pig. I want to load this file into a tuple with columns names in a separate pig script, and reuse this script from other pig scripts. How do I do this?

Say this 100 column pig script is - 100col.pig. How do i call it from anotherone.pig?

like image 827
hese Avatar asked Dec 22 '22 08:12

hese


2 Answers

Check into the exec command (for batch processing) or the run command (for interactive scripts). Also, if you need to use (non-grunt) shell commands, check the fs command. Here's a good reference:

http://pig.apache.org/docs/r0.7.0/piglatin_ref2.html

like image 122
Jonathan M Avatar answered Jan 16 '23 05:01

Jonathan M


You should try using macros that is present in pig version 0.9.

http://pig.apache.org/docs/r0.9.1/cont.html#macros

like image 39
jaguarpaw Avatar answered Jan 16 '23 04:01

jaguarpaw