You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Olga Natkovich (JIRA)" <ji...@apache.org> on 2010/07/09 21:34:52 UTC

[jira] Updated: (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:all-tabpanel ]

Olga Natkovich updated PIG-579:
-------------------------------

    Fix Version/s: 0.9.0

> 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
>             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.