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

Xuefu Zhang commented on PIG-2083:
----------------------------------

This is probably not caused by Antlr, but by Pig's syntactic rule. 

IDENTIFIER : ( ID DCOLON ) => ( ID DCOLON IDENTIFIER )
           | ID
;

When Antlr say NULL, it cannot make a decision until it says the next 
character, which is a colon. With the colon, the above rule applies, so it 
tries to match IDENTIFIER. As a result of such matching, it ends with two 
tokens, IDENTIFIER and ':'. When there is a space, above rule doesn't apply.

I don't know a good solution yet. A potential solution is to add predicate for 
all reserved keyword such that matching stops as long as the next character is 
not a letter. In this way, 'null:' will be match to NULL as a keyword, and ':'.





> bincond ERROR 1025: Invalid field projection when null is used
> --------------------------------------------------------------
>
>                 Key: PIG-2083
>                 URL: https://issues.apache.org/jira/browse/PIG-2083
>             Project: Pig
>          Issue Type: Bug
>          Components: build
>    Affects Versions: 0.9.0
>         Environment: Linux 2.6.18-53.1.13.el5 #1 SMP Mon Feb 11 13:27:27 EST 
> 2008 x86_64 x86_64 x86_64 GNU/Linux
> Hadoop 0.20.203.3.1104011556 -r 96519d04f65e22ffadf89b225d0d44ef1741d126
> Compiled on Fri Apr  1 16:29:09 PDT 2011
>            Reporter: Araceli Henley
>            Assignee: Thejas M Nair
>             Fix For: 0.9.0
>
>
> This is a regression for 9.
> a = load '1.txt' as (a0, a1);
> b = foreach a generate (a0==0?null:2);
> explain b;
> ERROR 1025:
> Invalid field projection. Projected field [null] does not exist in schema

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

Reply via email to