开发者

How to call perl script from PIG..?

Anyone knows the way t开发者_StackOverflow中文版o call a perl script from a pig script..also i want to know how to call pig from perl..

Please help me on this.

Thanks, Ranjith


For your first question:

The closest thing you are going to get with "calling a perl script from pig" is Pig's streaming capability. Example from the documentation:

A = LOAD 'data';
B = STREAM A THROUGH 'stream.pl -n 5';

You have to make sure your perl script takes in data via stdin and puts data out via stdout. This is the way that Pig streams the data through the call you are making. I'm not sure what data format the script should expect in and out (you might have to try an example).

For your second question:

Running a pig script inside of perl is the same as running any external shell command via perl. Check out this tutorial. Example:

system("pig myjob.pig");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜