[ https://issues.apache.org/jira/browse/PIG-2238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13090820#comment-13090820 ]
Vivek Padmanabhan commented on PIG-2238: ---------------------------------------- Looks like this issue was introduced as part of the parser changes. In Pig 0.9, the validation is done like below; In org.apache.pig.parser.AstValidator private void validateAliasRef(Set<String> aliases, CommonTree node, String alias) throws UndefinedAliasException { if( !aliases.contains( alias ) ) { throw new UndefinedAliasException( input, new SourceLocation( (PigParserNode)node ), alias ); } } Here it just checks that the alias is contained inside the set "aliases", but this contains all the aliases and it doesnt check for the order in which they are defined in the script. Hence this will lead to other sort of issues like NullPointerException, if i replace the F in the above script with below F = foreach F generate *; > Pig 0.9 error message not useful as compared to 0.8 > --------------------------------------------------- > > Key: PIG-2238 > URL: https://issues.apache.org/jira/browse/PIG-2238 > Project: Pig > Issue Type: Improvement > Affects Versions: 0.9.0 > Reporter: Vivek Padmanabhan > > The below is my faulty script (note the usage of alias F) for which Pig 0.9 > composes not so useful message as compared to 0.8; > A = load 'input' using TextLoader as (doc:chararray) ; > B = foreach A generate flatten(TOKENIZE(doc)) as myword; > C = group B by myword parallel 30; > D = foreach C generate group,COUNT(B) as count,SIZE(group) as size; > E = order D by size parallel 5; > >F = limit F 20; > dump F; > For this script , error message in 0.9 > >ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2240: LogicalPlanVisitor can > >only visit logical plan > Error message in 0.8 > >ERROR 1000: Error during parsing. Unrecognized alias F -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira