[ 
https://issues.apache.org/jira/browse/PIG-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12640426#action_12640426
 ] 

Daniel Dai commented on PIG-499:
--------------------------------

Hi, Viraj,
I understand your concern. How about always adding semicolon? I think this 
should be the right way. When the grammar is wrong, javacc sometimes complains 
sometimes not. Let's just stick to the right way.

> Alias which contains substring "as" causes Parser to throw a syntax error
> -------------------------------------------------------------------------
>
>                 Key: PIG-499
>                 URL: https://issues.apache.org/jira/browse/PIG-499
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: types_branch
>         Environment: Hadoop 18
>            Reporter: Viraj Bhat
>            Assignee: Santhosh Srinivasan
>             Fix For: types_branch
>
>
> ---------------------------------------------------------------------------------------
> {code}
> MYDATA = load 'testfile.txt' as (f1, f2, f3, f4, f5);
> MYDATA_PROJECTION = foreach MYDATA generate f3, f5;
> CAST = group MYDATA_PROJECTION by f3;
> RESULT = foreach CAST {
>           MYSORTED = ORDER MYDATA_PROJECTION by f5;
>           generate flatten(MYSORTED);
> }
> dump RESULT;
> {code}
> ---------------------------------------------------------------------------------------
> The above query throws a syntax error 
> java.io.IOException: Encountered "dump" at line 8, column 1.
> Was expecting one of:
>     "parallel" ...
>     ";" ...
>     
>         at org.apache.pig.PigServer.parseQuery(PigServer.java:298)
>         at org.apache.pig.PigServer.registerQuery(PigServer.java:263)
>         at 
> org.apache.pig.tools.grunt.GruntParser.processPig(GruntParser.java:439)
>         at 
> org.apache.pig.tools.pigscript.parser.PigScriptParser.parse(PigScriptParser.java:249)
>         at 
> org.apache.pig.tools.grunt.GruntParser.parseStopOnError(GruntParser.java:84)
>         at org.apache.pig.tools.grunt.Grunt.exec(Grunt.java:64)
>         at org.apache.pig.Main.main(Main.java:306)
> Caused by: org.apache.pig.impl.logicalLayer.parser.ParseException: 
> Encountered "dump" at line 8, column 1.
> Was expecting one of:
>     "parallel" ...
>     ";" ...
>     
>         at 
> org.apache.pig.impl.logicalLayer.parser.QueryParser.generateParseException(QueryParser.java:7763)
>         at 
> org.apache.pig.impl.logicalLayer.parser.QueryParser.jj_consume_token(QueryParser.java:7640)
>         at 
> org.apache.pig.impl.logicalLayer.parser.QueryParser.Parse(QueryParser.java:551)
>         at 
> org.apache.pig.impl.logicalLayer.LogicalPlanBuilder.parse(LogicalPlanBuilder.java:60)
>         at org.apache.pig.PigServer.parseQuery(PigServer.java:295)
>         ... 6 more
> ---------------------------------------------------------------------------------------
> But now changing this query to:(changing CAST to CST) makes the query execute 
> successfully.  
> ---------------------------------------------------------------------------------------
> {code}
> MYDATA = load 'testfile.txt' as (f1, f2, f3, f4, f5);
> MYDATA_PROJECTION = foreach MYDATA generate f3, f5;
> CST = group MYDATA_PROJECTION by f3;
> RESULT = foreach CST {
>           MYSORTED = ORDER MYDATA_PROJECTION by f5;
>           generate flatten(MYSORTED);
> }
> dump RESULT;
> {code}
> ---------------------------------------------------------------------------------------
> I believe this might have been caused due to the patch which resolved issue: 
> https://issues.apache.org/jira/browse/PIG-437

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

Reply via email to