Grokbase Groups Pig user May 2012
FAQ
Hello everyone,

I have been trying to debug some macros I've written, but I'm finding that every Diagnostic Operator (describe, dump, explain, and illustrate) are all being recognized as illegal inside a macro. I could find no documentation stating that they are disallowed in this context, so I wanted to check that I'm not doing anything silly before opening a JIRA ticket. Any explanations for the issues I'm having would be highly appreciated. Here's some example code,

--------------------
DEFINE dumpme(data) RETURNS void {
DUMP $data;
};

positions = LOAD '/user/dduckwor/positions' USING AvroStorage();
dumpme(positions);
--------------------

And the output from doing "pig –dryrun test.pig",

--------------------
2012-05-24 09:42:21,737 [main] ERROR org.apache.pig.Main - ERROR 1200: <file src/test.pig.substituted, line 6> Failed to parse macro 'dumpme'. Reason: <file src/test.pig.substituted, line 2, column 2> Syntax error, unexpected symbol at or near 'DUMP'
macro content:
DUMP positions;
--------------------

Search Discussions

  • Alan Gates at May 29, 2012 at 9:30 pm
    It's not an intended feature, but it is a side effect of the way macros are implemented. Pig actually has a couple of parser in it. One parses Pig Latin, the other is used by Grunt, the shell. Grunt does not know Pig Latin, but it knows to pass it on to the Pig Latin parser. Pig Latin knows nothing of Grunt.

    Describe, dump, explain, and illustrate are implemented in Grunt, not Pig Latin. Macros are resolved (that is, replaced and written inline) by the Pig Latin parser before Grunt is called. Since the Pig Latin parser doesn't understand Grunt commands, it is complaining when it encounters them inside macros.

    Alan.
    On May 24, 2012, at 9:43 AM, Daniel Duckworth wrote:

    Hello everyone,

    I have been trying to debug some macros I've written, but I'm finding that every Diagnostic Operator (describe, dump, explain, and illustrate) are all being recognized as illegal inside a macro. I could find no documentation stating that they are disallowed in this context, so I wanted to check that I'm not doing anything silly before opening a JIRA ticket. Any explanations for the issues I'm having would be highly appreciated. Here's some example code,

    --------------------
    DEFINE dumpme(data) RETURNS void {
    DUMP $data;
    };

    positions = LOAD '/user/dduckwor/positions' USING AvroStorage();
    dumpme(positions);
    --------------------

    And the output from doing "pig –dryrun test.pig",

    --------------------
    2012-05-24 09:42:21,737 [main] ERROR org.apache.pig.Main - ERROR 1200: <file src/test.pig.substituted, line 6> Failed to parse macro 'dumpme'. Reason: <file src/test.pig.substituted, line 2, column 2> Syntax error, unexpected symbol at or near 'DUMP'
    macro content:
    DUMP positions;
    --------------------
  • Jonathan Coveney at May 29, 2012 at 10:28 pm
    There is a GSOC to move grunt into ANTLR, which may make it possible (if it
    is desirable) to move more of these commands into macros.

    2012/5/29 Alan Gates <gates@hortonworks.com>
    It's not an intended feature, but it is a side effect of the way macros
    are implemented. Pig actually has a couple of parser in it. One parses
    Pig Latin, the other is used by Grunt, the shell. Grunt does not know Pig
    Latin, but it knows to pass it on to the Pig Latin parser. Pig Latin knows
    nothing of Grunt.

    Describe, dump, explain, and illustrate are implemented in Grunt, not Pig
    Latin. Macros are resolved (that is, replaced and written inline) by the
    Pig Latin parser before Grunt is called. Since the Pig Latin parser
    doesn't understand Grunt commands, it is complaining when it encounters
    them inside macros.

    Alan.
    On May 24, 2012, at 9:43 AM, Daniel Duckworth wrote:

    Hello everyone,

    I have been trying to debug some macros I've written, but I'm finding
    that every Diagnostic Operator (describe, dump, explain, and illustrate)
    are all being recognized as illegal inside a macro. I could find no
    documentation stating that they are disallowed in this context, so I wanted
    to check that I'm not doing anything silly before opening a JIRA ticket.
    Any explanations for the issues I'm having would be highly appreciated.
    Here's some example code,
    --------------------
    DEFINE dumpme(data) RETURNS void {
    DUMP $data;
    };

    positions = LOAD '/user/dduckwor/positions' USING AvroStorage();
    dumpme(positions);
    --------------------

    And the output from doing "pig –dryrun test.pig",

    --------------------
    2012-05-24 09:42:21,737 [main] ERROR org.apache.pig.Main - ERROR 1200:
    <file src/test.pig.substituted, line 6> Failed to parse macro 'dumpme'.
    Reason: <file src/test.pig.substituted, line 2, column 2> Syntax error,
    unexpected symbol at or near 'DUMP'
    macro content:
    DUMP positions;
    --------------------

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedMay 24, '12 at 4:52p
activeMay 29, '12 at 10:28p
posts3
users3
websitepig.apache.org

People

Translate

site design / logo © 2021 Grokbase