Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-2850

Pig should support loading macro files as resources stored in JAR files

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 0.11
    • None
    • None

    Description

      A file containing macros can be imported in pig like so:

      IMPORT 'some_path/my_macros.pig';
      

      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

      REGISTER my_macros.jar;
      IMPORT 'some_path/my_macros.pig';
      

      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.

      Attachments

        1. import_macros_from_jar_5.diff
          9 kB
          Matthew Hayes
        2. import_macros_from_jar_4.diff
          8 kB
          Matthew Hayes
        3. import_macros_from_jar_3.diff
          8 kB
          Matthew Hayes
        4. import_macros_from_jar_2.diff
          8 kB
          Matthew Hayes
        5. import_macros_from_jar.diff
          7 kB
          Matthew Hayes

        Issue Links

          Activity

            People

              mhayes Matthew Hayes
              mhayes Matthew Hayes
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: