grunt parser fails for: load .. as \n (b:bag{}); 
-------------------------------------------------

                 Key: PIG-2086
                 URL: https://issues.apache.org/jira/browse/PIG-2086
             Project: Pig
          Issue Type: Bug
          Components: grunt
    Affects Versions: 0.10
         Environment: mac 10.5.8
            Reporter: Woody Anderson


this snippet fails:
{code}
IN4 = load '$in' using
    com.zzz.Storage() as
    ( inpt:bag{} );
{code}
this works (as on same line as semi-colon)
{code}
IN4 = load '$in' using
    com.zzz.Storage()
    as ( inpt:bag{} );
{code}

this is the grunt error:
2011-05-20 20:19:34,934 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 
1200: <file loadstore.pig, line 68, column 16>  mismatched input ';' expecting 
RIGHT_PAREN

this only happens in cases where the types of the fields are complex e.g. 
bags/tuples
eg. change the type of _inpt_ to be _chararray_ and it will parse.

this is very strange! and i spent hours debugging my schema writing skills and 
reading QueryParser.g before simply trying "as (expr);" on the same line.

_all_ of my scripts had been written with the lines split the other way (with 
lots of ctor args and as-clause elements: hence the line breaks), this is not 
an issue if i don't load complicated types, but it fails in this particular 
case.
This is quite unexpected and seems to be undocumented and a bug imho.
i don't know enough about antlr (i was a javacc person) to make sense of why 
this would be an issue for the parser b/c the grammar looks good assuming 
newline is basically whitespace.

though i can't figure out how newlines are treated in the grammar, there does 
not seem to be a newline routine ala 
https://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/antlr/antlr.html

I'm going to assume the grammar author is much more sophisticated than that 
tutorial and knows how to fix this.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to