pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Gates (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PIG-2244) Macros cannot be passed relation names
Date Fri, 26 Aug 2011 19:49:30 GMT

    [ https://issues.apache.org/jira/browse/PIG-2244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13091982#comment-13091982
] 

Alan Gates commented on PIG-2244:
---------------------------------

Given a script

{code}
define simple_macro(in_relation, min_gpa, max_age) returns c {
    b = filter $in_relation by gpa >= $min_gpa and age <= $max_age;
    $c = foreach b generate age, name;
}

a = load '/user/pig/tests/data/singlefile/studenttab10k' as (name, age, gpa);
x = simple_macro('a', '3.0', '40');
store x into '/user/pig/out/hortonal.1314386707/Macro_DefinitionAndInline_4.out';
{code}

(Notice the incorrect quotes around alias a in the invocation of simple_macro.)

This produces
{code}
a = load '/user/pig/tests/data/singlefile/studenttab10k' as (name, age, gpa);
macro_simple_macro_b_0 = filter macro_simple_macro_a_0 BY ((gpa >= 3.0) and (age <=
40));
x = foreach macro_simple_macro_b_0 generate age, name;
store x INTO '/user/pig/out/hortonal.1314386707/Macro_DefinitionAndInline_4.out';
{code}

The alias a gets expanded to macro_simple_macro_a.

> Macros cannot be passed relation names
> --------------------------------------
>
>                 Key: PIG-2244
>                 URL: https://issues.apache.org/jira/browse/PIG-2244
>             Project: Pig
>          Issue Type: Bug
>          Components: parser
>    Affects Versions: 0.9.0
>            Reporter: Alan Gates
>            Priority: Minor
>
> If an alias is passed quoted, it gets expanded as if it were an alias in the macro, which
leads to a very strange error message.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message