You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Koji Noguchi (JIRA)" <ji...@apache.org> on 2016/05/05 22:30:13 UTC

[jira] [Updated] (PIG-4888) Line number off when reporting syntax error inside a macro

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

Koji Noguchi updated PIG-4888:
------------------------------
    Attachment: pig-4888-v01.patch

Antlr's {{RecognitionException}} doesn't seem to consider the line offset.  Adding this offset when showing the error message.

> Line number off when reporting syntax error inside a macro
> ----------------------------------------------------------
>
>                 Key: PIG-4888
>                 URL: https://issues.apache.org/jira/browse/PIG-4888
>             Project: Pig
>          Issue Type: Bug
>          Components: parser
>            Reporter: Koji Noguchi
>            Priority: Trivial
>         Attachments: pig-4888-v01.patch
>
>
> {panel}
>   1 /*
>   2  * extra lines to offset the line number for the macro
>   3  *
>   4  *
>   5  */
>   6
>   7
>   8 define mymacro() returns void {
>   9 A = load 'x' as ( u:int, v:long, w:bytearray);
>  10 B = limit A 100;
>  11 C = {color:red}filter_typo{color} B by 2 > 1;
>  12 D = load 'y' as (d1, d2);
>  13 E = join C by ( $0, $1 ), D by ( d1, d2 ) using 'replicated' parallel 16;
>  14 F = store E into 'output';
>  15 };
>  16 mymacro();
> {panel}
> This fails with 
> {panel}
> "2016-05-05 22:25:28,390 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <file test.pig, line 16> Failed to parse macro 'mymacro'. Reason: <file /homes/knoguchi/test.pig, line 4, column 0>  Syntax error, unexpected symbol at or near 'C'"
> {panel}
> {{test.pig, line 4,}} should have been line 11.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)