I tried this in local mode, it works - 
http://hadoop.apache.org/pig/docs/r0.5.0/piglatin_reference.html#exec

$ cat s1.pig

a = LOAD 'student' AS (name, age, gpa);
b = ORDER a BY age;
DUMP b;

$ cat s.pig

a = LOAD 'student' AS (name, age, gpa);
b = LIMIT a 3;
DUMP b;
exec s1.pig


$ pig -x local s.pig
I can't find HOD configuration for cluster, hopefully you weren't planning on 
using HOD.
2010-02-11 09:47:45,708 [main] INFO  org.apache.pig.Main - Logging error 
messages to: /homes/gankur/pig_1265881665706.log
2010-02-11 09:47:46,506 [main] WARN  org.apache.pig.impl.io.FileLocalizer - 
FileLocalizer.create: failed to create /tmp/temp-1460326964
2010-02-11 09:47:46,545 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - Successfully 
stored result in: "file:/tmp/temp-1460326964/tmp-1949967585"
2010-02-11 09:47:46,546 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - Records written 
: 3
2010-02-11 09:47:46,546 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - Bytes written : 
101
2010-02-11 09:47:46,546 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - 100% complete!
2010-02-11 09:47:46,546 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - Success!!
(alice,20,2.47)
(luke,18,4.00)
(holly,24,3.27)
2010-02-11 09:47:46,625 [main] WARN  org.apache.pig.impl.io.FileLocalizer - 
FileLocalizer.create: failed to create /tmp/temp-1460326964
2010-02-11 09:47:46,652 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - Successfully 
stored result in: "file:/tmp/temp-1460326964/tmp1891452502"
2010-02-11 09:47:46,652 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - Records written 
: 3
2010-02-11 09:47:46,652 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - Bytes written : 
101
2010-02-11 09:47:46,652 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - 100% complete!
2010-02-11 09:47:46,653 [main] INFO  
org.apache.pig.backend.local.executionengine.LocalPigLauncher - Success!!
(luke,18,4.00)
(alice,20,2.47)
(holly,24,3.27)

-...@nkur

On 2/10/10 10:38 AM, "Alan Gates" <[email protected]> wrote:

You are not wrong.  This is a feature we'd like to add but haven't
gotten to yet.

Alan.

On Feb 9, 2010, at 8:12 PM, prasenjit mukherjee wrote:

> May be I was not clear enough on my problem. I would like to call
> another pig-script from a pig-script. How can I do that.
>
> As far as I understand, you can call a pig script from a unix-shell (
> or windows ) passing those parameters, but not from another pig-script
> ? I would be glad to be proved wrong. I wish I am wrong :)
>
> On Wed, Feb 10, 2010 at 8:36 AM, zaki rahaman
> <[email protected]> wrote:
>> Hi Prasen,
>>
>> If the only thing changing is the input and/or output, you can
>> parametrize
>> your script so that you can easily re-use your script with parameter
>> substitution.
>>
>> On Tue, Feb 9, 2010 at 9:49 PM, prasenjit mukherjee <
>> [email protected]> wrote:
>>
>>> Is there a way to reuse a pig scripts ( like def:: in python or
>>> function calls etc)  from inside a calling pig script. I have a
>>> set of
>>>  basic pig script which I would like to call from a high-level
>>> pig-script. Currently I have to copy/paste exact same set of code
>>> with
>>> different input relation. This makes the code unnecessary bulky
>>> and is
>>> error prone. Even a macro def will be a great help.
>>>
>>> -Thanks,
>>> Prasen
>>>
>>
>>
>>
>> --
>> Zaki Rahaman
>>


Reply via email to