[
https://issues.apache.org/jira/browse/PIG-4841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Koji Noguchi updated PIG-4841:
------------------------------
Attachment: pig-4841-v01.patch
In the patch I have two new tests, one from the description and another that I
decided not to fix as part of this jira and commented it out.
{code}
+ @Test
+ public void testWithInlineOpWithNestedForeach() throws Throwable {
+ // This one currently fails because "{}" is treated as
+ // IN_BLOCK in PigScriptParser.jj which jumps to PIG_END and ignore
+ // ") generate *; " part of the code.
+ // In order to support this test, we need to add parenthesis matching
+ // everywhere in PigScriptParser.jj (or stop using it)
+ //
+ String query = "a = load 'i1' as (f1:chararray);" +
+ "b = group a ALL; " +
+ "c = foreach ( foreach b {b1 = limit a 3; generate 1, b1;} )
generate *; " +
+ "dump c;";
+ ArrayList<String> msgs = new ArrayList<String>(); //
+ validate(query, true, msgs.toArray(new String[0]));
+ }
{code}
I had a patch that would cover this test case but it required me to add
parenthesis checking everywhere and it still gave me 10-20 more test failures
with mismatching ")". At that point, decided to step back and fix the original
case only and defer inlineop+nested-foreach case to PIG-2597 where we're trying
to move Grunt from javacc to ANTLR.
> Inline-op with schema declaration fails with syntax error
> ---------------------------------------------------------
>
> Key: PIG-4841
> URL: https://issues.apache.org/jira/browse/PIG-4841
> Project: Pig
> Issue Type: Bug
> Components: parser
> Affects Versions: 0.11.1, 0.15.0
> Reporter: Koji Noguchi
> Assignee: Koji Noguchi
> Priority: Minor
> Attachments: pig-4841-v01.patch
>
>
> Inline-op+foreach+schema("as") fails.
> {code}
> knoguchi@truelisten-lm pig> cat test6.pig
> A = load 'input.txt' as (a1:int, a2:int);
> B = FOREACH (FOREACH A GENERATE a1 as b1) GENERATE b1;
> dump B;
> {code}
> {panel}
> 2016-03-11 17:57:31,364 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR
> 1000: Error during parsing. Lexical error at line 5, column 0. Encountered:
> <EOF> after : ""
> {panel}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)