[ 
https://issues.apache.org/jira/browse/PIG-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alan Gates reassigned PIG-579:
------------------------------

    Assignee: Xuefu Zhang

> 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.
-
You can reply to this email to add a comment to the issue online.

Reply via email to