You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Xuefu Zhang (JIRA)" <ji...@apache.org> on 2011/03/10 20:20:59 UTC

[jira] Commented: (PIG-579) Adding newlines to format foreach statement with constants causes parse errors

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

Xuefu Zhang commented on PIG-579:
---------------------------------

Appearing to have the same cause as PIg-548.

> Adding newlines to format foreach statement with constants causes parse errors
> ------------------------------------------------------------------------------
>
>                 Key: PIG-579
>                 URL: https://issues.apache.org/jira/browse/PIG-579
>             Project: Pig
>          Issue Type: Bug
>          Components: impl
>    Affects Versions: 0.2.0
>            Reporter: David Ciemiewicz
>            Assignee: Xuefu Zhang
>             Fix For: 0.9.0
>
>
> The following code example files with parse errors on step D:
> {code}
> A = LOAD 'student_data' AS (name: chararray, age: int, gpa: float);
> B = LOAD 'voter_data' AS (name: chararray, age: int, registration: chararray, contributions: float);
> C = COGROUP A BY name, B BY name;
> D = FOREACH C GENERATE
>         group,
>         flatten((not IsEmpty(A) ? A : (bag{tuple(chararray, int, float)}){(null, null, null)})),
>         flatten((not IsEmpty(B) ? B : (bag{tuple(chararray, int, chararray, float)}){(null,null,null, null)}));
> dump D;
> {code}
> I get the parse error:
> Caused by: org.apache.pig.impl.logicalLayer.parser.ParseException: Encountered "not IsEmpty ( A ) ? A : ( bag { tuple ( chararray , int , float ) } ;" at line 9, column 18.
> Was expecting one of:
>     "(" ...
>     "-" ...
>     "tuple" ...
>     "bag" ...
>     "map" ...
>     "int" ...
>     "long" ...
> ...
> However, if I simply remove the new lines from statement D and make it:
> {code}
> D = FOREACH C GENERATE group, flatten((not IsEmpty(A) ? A : (bag{tuple(chararray, int, float)}){(null, null, null)})), flatten((not IsEmpty(B) ? B : (bag{tuple(chararray, int, chararray, float)}){(null,null,null, null)}));
> {code}

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