You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by rd...@apache.org on 2011/05/11 18:54:17 UTC

svn commit: r1101976 - in /pig/branches/branch-0.9: CHANGES.txt src/org/apache/pig/parser/QueryParser.g test/org/apache/pig/test/TestMacroExpansion.java

Author: rding
Date: Wed May 11 16:54:17 2011
New Revision: 1101976

URL: http://svn.apache.org/viewvc?rev=1101976&view=rev
Log:
PIG-2058: Macro missing returns clause doesn't give a good error message

Modified:
    pig/branches/branch-0.9/CHANGES.txt
    pig/branches/branch-0.9/src/org/apache/pig/parser/QueryParser.g
    pig/branches/branch-0.9/test/org/apache/pig/test/TestMacroExpansion.java

Modified: pig/branches/branch-0.9/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/CHANGES.txt?rev=1101976&r1=1101975&r2=1101976&view=diff
==============================================================================
--- pig/branches/branch-0.9/CHANGES.txt (original)
+++ pig/branches/branch-0.9/CHANGES.txt Wed May 11 16:54:17 2011
@@ -178,6 +178,8 @@ PIG-1696: Performance: Use System.arrayc
 
 BUG FIXES
 
+PIG-2058: Macro missing returns clause doesn't give a good error message (rding)
+
 PIG-2035: Macro expansion doesn't handle multiple expansions of same macro inside another macro (rding)
 
 PIG-2030: Merged join/cogroup does not automatically ship loader (daijy)

Modified: pig/branches/branch-0.9/src/org/apache/pig/parser/QueryParser.g
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/src/org/apache/pig/parser/QueryParser.g?rev=1101976&r1=1101975&r2=1101976&view=diff
==============================================================================
--- pig/branches/branch-0.9/src/org/apache/pig/parser/QueryParser.g (original)
+++ pig/branches/branch-0.9/src/org/apache/pig/parser/QueryParser.g Wed May 11 16:54:17 2011
@@ -215,10 +215,8 @@ macro_param_clause : LEFT_PAREN ( alias 
 ;
 
 macro_return_clause 
-    : RETURNS alias (COMMA alias)*
-        -> ^(RETURN_VAL alias+)
-    | RETURNS VOID 
-        -> ^(RETURN_VAL)
+    : RETURNS ((alias (COMMA alias)*) | VOID)
+        -> ^(RETURN_VAL alias*)
 ;
 
 macro_body_clause : content

Modified: pig/branches/branch-0.9/test/org/apache/pig/test/TestMacroExpansion.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/test/TestMacroExpansion.java?rev=1101976&r1=1101975&r2=1101976&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/test/TestMacroExpansion.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/test/TestMacroExpansion.java Wed May 11 16:54:17 2011
@@ -1090,6 +1090,16 @@ public class TestMacroExpansion {
         validateFailure(macro + script, expectedErr, "pig script failed to validate:");
     }
    
+    // PIG-2058
+    @Test
+    public void negativeTest9() throws Throwable {
+        String macro = "define test( out1,out2 ){ A = load 'x' as (u:int, v:int); $B = filter A by u < 3 and v < 20; }";
+        
+        String expectedErr = "Error during parsing. <file myscript.pig, line 1, column 24>  mismatched input '{' expecting RETURNS";
+
+        validateFailure(macro, expectedErr, "Error");
+    }
+    
     @Test
     public void recursiveMacrosTest() throws Exception {
         String macro1 = "define group_and_partition (A, group_key, reducers) returns B {\n" +