You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Amir Youssefi (JIRA)" <ji...@apache.org> on 2008/06/16 20:15:44 UTC

[jira] Created: (PIG-270) Show Line Number in Pig Error Messages

Show Line Number in Pig Error Messages
--------------------------------------

                 Key: PIG-270
                 URL: https://issues.apache.org/jira/browse/PIG-270
             Project: Pig
          Issue Type: Improvement
            Reporter: Amir Youssefi


It will be a great help to users to show Line Number in Pig Error Messages. Current, user has to copy/paste script line by line to find out line that ran into a problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIG-270) Show Line Number in Pig Error Messages

Posted by "Daniel Dai (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614226#action_12614226 ] 

Daniel Dai commented on PIG-270:
--------------------------------

Here I am addressing syntactic error. Let me elaborate the cause of this problem first. 

Pig uses two seperate parser:
1. GruntParser, it will keep track of the line number of the entire Pig session/script. It handles dfs commands and other maintenance commands. If there is some syntax error in dfs/maintenance commands, GruntParser will throw the exception with correct line number. However, if GruntParser detects a pig statement(starts with "alias=", "dump", "store into", etc), it extracts this statement and pass it into QueryParser, QueryParser will parse it and throw exception if there is syntax error.

2. QueryParser take responsibility to parse pig statement. It does not have complete line number information, every pig statement starts with line 1. If there is a syntax error, QueryParser will throw the exception with wrong line number.

There two possible solutions:
1. Capture the exception from QueryParser and interpolate it with correct line number
    GruntParser.processPig should be a good place for that. The problem is we need to get access to line number which is now encapsulated in SimpleCharStream. SimpleCharStream is generated by javacc and it is better not to modify it directly. One thing we can do is to tell javacc to use a customized CharStream, so we can write CharStream class whatever we want.
Change to make: GruntParser, customized CharStream

2. Pass line number information to QueryParser
    More natual to me but more work to do. First, we need to access line number information as in solution 1, modify GruntParser.processPig to pass line number all the way down to QueryParser, and we need to change construct of QueryParser to pass line number to SimpleCharStream. Then javacc will automatically handle the line number information in error message.
Change to make: GruntParser, customized CharStream(for GruntParser), LogicalPlanBuilder.parse, construct for QueryParser.jjt

In short, both solutions are not neat but doable, solution 1 is easier but solution 2 seems to be more reasonable.

How's other's opinion?

> Show Line Number in Pig Error Messages
> --------------------------------------
>
>                 Key: PIG-270
>                 URL: https://issues.apache.org/jira/browse/PIG-270
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Amir Youssefi
>
> It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 
> Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PIG-270) Show Line Number in Pig Error Messages

Posted by "Daniel Dai (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Dai updated PIG-270:
---------------------------

    Attachment: linenum.patch

Patch using approach 2. Eventually I do not need to use a customized CharStream, I can feed the line number into SimpleCharStream in QueryParser. Only scripting mode is applicable and I do not feed line number in interactive mode.

> Show Line Number in Pig Error Messages
> --------------------------------------
>
>                 Key: PIG-270
>                 URL: https://issues.apache.org/jira/browse/PIG-270
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Amir Youssefi
>         Attachments: linenum.patch
>
>
> It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 
> Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIG-270) Show Line Number in Pig Error Messages

Posted by "Daniel Dai (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614459#action_12614459 ] 

Daniel Dai commented on PIG-270:
--------------------------------

I do not manually count line number inside parser. Instead, SimpleCharStream class inside GruntParser keeps track of the line number, we just need to access this information.

> Show Line Number in Pig Error Messages
> --------------------------------------
>
>                 Key: PIG-270
>                 URL: https://issues.apache.org/jira/browse/PIG-270
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Amir Youssefi
>
> It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 
> Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIG-270) Show Line Number in Pig Error Messages

Posted by "Olga Natkovich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614450#action_12614450 ] 

Olga Natkovich commented on PIG-270:
------------------------------------

Daniel, thanks for the detailed explanation.

I think I also like option 2 better. One comment is that we don't always now what the line number is. I assume that you were just going to count parse invokations, right? This really tells you the number of statements, not number of lines in the file since you can have empty lines which are skipped and also multi-line statements.

> Show Line Number in Pig Error Messages
> --------------------------------------
>
>                 Key: PIG-270
>                 URL: https://issues.apache.org/jira/browse/PIG-270
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Amir Youssefi
>
> It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 
> Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIG-270) Show Line Number in Pig Error Messages

Posted by "Olga Natkovich (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12616234#action_12616234 ] 

Olga Natkovich commented on PIG-270:
------------------------------------

I have reviewed the code and ran a bunch of tests. All looked good!

I committed the patch. Thanks, Daniel!

> Show Line Number in Pig Error Messages
> --------------------------------------
>
>                 Key: PIG-270
>                 URL: https://issues.apache.org/jira/browse/PIG-270
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Amir Youssefi
>         Attachments: linenum.patch
>
>
> It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 
> Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (PIG-270) Show Line Number in Pig Error Messages

Posted by "Amir Youssefi (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amir Youssefi updated PIG-270:
------------------------------

    Description: 
It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 


Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

  was:It will be a great help to users to show Line Number in Pig Error Messages. Current, user has to copy/paste script line by line to find out line that ran into a problem.


> Show Line Number in Pig Error Messages
> --------------------------------------
>
>                 Key: PIG-270
>                 URL: https://issues.apache.org/jira/browse/PIG-270
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Amir Youssefi
>
> It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 
> Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIG-270) Show Line Number in Pig Error Messages

Posted by "Santhosh Srinivasan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615845#action_12615845 ] 

Santhosh Srinivasan commented on PIG-270:
-----------------------------------------

Looks good.

> Show Line Number in Pig Error Messages
> --------------------------------------
>
>                 Key: PIG-270
>                 URL: https://issues.apache.org/jira/browse/PIG-270
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Amir Youssefi
>         Attachments: linenum.patch
>
>
> It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 
> Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIG-270) Show Line Number in Pig Error Messages

Posted by "Pi Song (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIG-270?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12605548#action_12605548 ] 

Pi Song commented on PIG-270:
-----------------------------

Two things to be addressed:-
- Syntactic errors
- Semantic errors

> Show Line Number in Pig Error Messages
> --------------------------------------
>
>                 Key: PIG-270
>                 URL: https://issues.apache.org/jira/browse/PIG-270
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Amir Youssefi
>
> It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 
> Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (PIG-270) Show Line Number in Pig Error Messages

Posted by "Olga Natkovich (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-270?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olga Natkovich resolved PIG-270.
--------------------------------

    Resolution: Fixed

> Show Line Number in Pig Error Messages
> --------------------------------------
>
>                 Key: PIG-270
>                 URL: https://issues.apache.org/jira/browse/PIG-270
>             Project: Pig
>          Issue Type: Improvement
>            Reporter: Amir Youssefi
>         Attachments: linenum.patch
>
>
> It will be a great help to users to show A) Line Number B) Actual Line in Pig Error Messages. Currently user has to copy/paste script line by line in Grunt to find out line that ran into a problem. For Grunt we can skip line number. 
> Alternatively, we can assign line numbers in Grunt and show it in command prompt alongside "grunt>".  This could be a separate issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.