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

Koji Noguchi commented on PIG-5335:
-----------------------------------

bq. However, for this jira, before reaching to LogicalPlan.validate(), it is 
failing within LogicalPlanBuilder's phase where ProjectStarExpander looked up

I tried moving ProjectStarExpander to later phase in  LogicalPlan.validate() 
but as I mentioned, some LogicalOperator depended on these projects range to be 
expanded at LogicalPlanBuilder time.

So, in {{pig-5335-v01.patch}}, focused on 

bq. ProjectExpression was always picking the first field (column 0) when 
provided alias was not found.

and tried returning a new fieldschema with the invalid lookup fieldname. I 
believe this allowed the compilation to move forward and get the right error 
message inside LogicalPlan.validate()->ColumnAliasConversionVisitor.

Running tests.

> Error message from range projection completely misleading
> ---------------------------------------------------------
>
>                 Key: PIG-5335
>                 URL: https://issues.apache.org/jira/browse/PIG-5335
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Koji Noguchi
>            Assignee: Koji Noguchi
>            Priority: Major
>         Attachments: pig-5335-v01.patch
>
>
> {code}
> A = load 'input.txt' as (a0,a1,a2,a3);
> B = FOREACH A GENERATE a0, a1, a2, a3;
> store B into '/tmp/deleteme';
> C = FOREACH A GENERATE a0, b1, a2, a3;
> D = FOREACH C GENERATE a0..a2;
> (end of script, no store, nothing)
> {code}
> Error message
> {panel}
> 2018-04-10 10:22:33,360 \[main] ERROR org.apache.pig.PigServer - exception 
> during parsing: Error during parsing. Invalid field projection. Projected 
> field \[a0] does not exist in schema: 
> a0:bytearray,a0:bytearray,a2:bytearray,a3:bytearray.
> {panel}
> At least two issues.
> # Error should be about FOREACH for C referencing non-existing field 'b1'.  
> But the error message is saying something about 'a0'.
> # Script itself is not using relation C and D at all.  It's confusing to see 
> errors coming out of unused relations.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to