[
https://issues.apache.org/jira/browse/PIG-1793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12990842#comment-12990842
]
Richard Ding commented on PIG-1793:
-----------------------------------
Unit tests pass. The output of test-patch:
{code}
[exec] -1 overall.
[exec]
[exec] +1 @author. The patch does not contain any @author tags.
[exec]
[exec] +1 tests included. The patch appears to include 3 new or
modified tests.
[exec]
[exec] +1 javadoc. The javadoc tool did not generate any warning
messages.
[exec]
[exec] -1 javac. The applied patch generated 973 javac compiler
warnings (more than the trunk's current 962 warnings).
[exec]
[exec] +1 findbugs. The patch does not introduce any new Findbugs
warnings.
[exec]
[exec] -1 release audit. The applied patch generated 514 release
audit warnings (more than the trunk's current 513 warnings).
{code}
The release audit warning is html related.
> Add macro expansion to Pig Latin
> --------------------------------
>
> Key: PIG-1793
> URL: https://issues.apache.org/jira/browse/PIG-1793
> Project: Pig
> Issue Type: New Feature
> Reporter: Richard Ding
> Assignee: Richard Ding
> Fix For: 0.9.0
>
> Attachments: PIG-1793.patch
>
>
> As production Pig scripts grow longer and longer, Pig Latin has a need to
> integrate standard programming techniques of separation and code sharing
> offered by functions and modules. A proposal of adding macro expansion to
> Pig Latin is posted here: http://wiki.apache.org/pig/TuringCompletePig
> Below is a brief summary of the proposed syntax (and examples):
> * Macro Definition
> The existing DEFINE keyword will be expanded to allow definitions of Pig
> macros.
> *Syntax*
> {code}
> define <name> (<params>) returns <aliases> {
> <Pig Latin fragment>
> };
> {code}
> *Example*
> {code}
> define my_macro(A, sortkey) returns C {
> B = filter $A by my_filter(*);
> $C = order B by $sortkey;
> }
> {code}
> * Macro Expansion
> *Syntax*
> {code}
> <aliases> = <macro name> (<params>);
> {code}
> *Example:* Use above macro in a Pig script:
> {code}
> X = load 'foo' as (user, address, phone);
> Y = my_macro(X, user);
> store Y into 'bar';
> {code}
> This script is expanded into the following Pig Latin statements:
> {code}
> X = load 'foo' as (user, address, phone);
> macro_my_macro_B_1 = filter X by my_filter(*);
> Y = order macro_my_macro_B_1 by user;
> store Y into 'bar';
> {code}
> *Notes*
> 1. Any alias in the macro which isn't visible from outside will be prefixed
> with macro name and suffixed with instance id to avoid namespace collision.
> 2. Macro expansion is not a complete replacement for function calls.
> Recursive expansions are not supported.
> * Macro Import
> The new IMPORT keyword can be used to add macros defined in another Pig Latin
> file.
> *Syntax*
> {code}
> import <Pig Latin file name>;
> {code}
> *Example*
> {code}
> import my_macro.pig;
> {code}
> *Note:* All macro names are in the global namespace.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira