[ 
https://issues.apache.org/jira/browse/PIG-2850?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matthew Hayes updated PIG-2850:
-------------------------------

    Attachment: import_macros_from_jar_2.diff

Thanks for the feedback :)

Replaced LOG.info with LOG.debug.
Wrapped BufferedOutputStream around stream.

For the test, I like creating the JAR in the test so the test is totally self 
contained.  You don't need to refer to a file in a separate JAR to understand 
it.  What do you think?

Regarding writing to a temp file, I did it this way to mimic what happens with 
FileLocalizer.  Other parts of QueryParserDriver are assuming the macro file is 
local and I didn't want to make significant changes.  In this new diff I've 
moved the code to FileLocalizer.fetchResource(), which seems cleaner.
                
> Pig should support loading macro files as resources stored in JAR files
> -----------------------------------------------------------------------
>
>                 Key: PIG-2850
>                 URL: https://issues.apache.org/jira/browse/PIG-2850
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Matthew Hayes
>            Priority: Minor
>         Attachments: import_macros_from_jar.diff, 
> import_macros_from_jar_2.diff
>
>
> A file containing macros can be imported in pig like so:
> {code}
> IMPORT 'some_path/my_macros.pig';
> {code}
> It would be convenient if a macro file could be imported from a registered 
> JAR as well.  This would make it easier to distribute them.  One could 
> package a set of UDFs and macros in a single JAR.  Once the JAR is registered 
> any of the UDFs or macros can be used once.
> For example, support that {{some_path/my_macros.pig}} has been packaged in a 
> JAR named {{my_macros.jar}}.  The above code then becomes 
> {code}
> REGISTER my_macros.jar;
> IMPORT 'some_path/my_macros.pig';
> {code}
> Pig would first check if the file is found at the path 
> {{some_path/my_macros.pig}}, and failing that it would attempt to load a 
> resource by that name.  Since the JAR is registered it will find it.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to