Type: New Feature
Affects Version/s: None
Fix Version/s: 0.9.0
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.
- Macro Expansion
Example: Use above macro in a Pig script:
This script is expanded into the following Pig Latin statements:
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.
Note: All macro names are in the global namespace.
|Field||Original Value||New Value|
|Attachment||PIG-1793.patch [ 12470305 ]|
|Status||Open [ 1 ]||In Progress [ 3 ]|
|Status||In Progress [ 3 ]||Resolved [ 5 ]|
|Resolution||Fixed [ 1 ]|
|Status||Resolved [ 5 ]||Closed [ 6 ]|
|Transition||Time In Source Status||Execution Times||Last Executer||Last Execution Date|
|30d 18h 10m||1||Richard Ding||07/Feb/11 18:20|
|7d 6h 49m||1||Richard Ding||15/Feb/11 01:09|
|169d 23h 25m||1||Olga Natkovich||04/Aug/11 01:35|