You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ch...@apache.org on 2013/08/14 23:29:07 UTC

svn commit: r1514056 - in /pig/branches/branch-0.11: CHANGES.txt src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj test/org/apache/pig/test/TestGrunt.java

Author: cheolsoo
Date: Wed Aug 14 21:29:07 2013
New Revision: 1514056

URL: http://svn.apache.org/r1514056
Log:
PIG-2507: Semicolon in paramenters for UDF results in parsing error (tnachen via daijy)

Modified:
    pig/branches/branch-0.11/CHANGES.txt
    pig/branches/branch-0.11/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
    pig/branches/branch-0.11/test/org/apache/pig/test/TestGrunt.java

Modified: pig/branches/branch-0.11/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.11/CHANGES.txt?rev=1514056&r1=1514055&r2=1514056&view=diff
==============================================================================
--- pig/branches/branch-0.11/CHANGES.txt (original)
+++ pig/branches/branch-0.11/CHANGES.txt Wed Aug 14 21:29:07 2013
@@ -32,6 +32,8 @@ PIG-2769: a simple logic causes very lon
 
 BUG FIXES
 
+PIG-2507: Semicolon in paramenters for UDF results in parsing error (tnachen via daijy)
+ 
 PIG-3341: Strict datetime parsing and improve performance of loading datetime values (rohini)
 
 PIG-3329: RANK operator failed when working with SPLIT (xalan via cheolsoo)

Modified: pig/branches/branch-0.11/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.11/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj?rev=1514056&r1=1514055&r2=1514056&view=diff
==============================================================================
--- pig/branches/branch-0.11/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj (original)
+++ pig/branches/branch-0.11/src/org/apache/pig/tools/pigscript/parser/PigScriptParser.jj Wed Aug 14 21:29:07 2013
@@ -304,7 +304,13 @@ TOKEN_MGR_DECLS : {
         prevState = getState(prevState);
         saveState(prevState);
         prevState = GENERATE; 
-     } : SCHEMA_DEFINITION
+    } : SCHEMA_DEFINITION
+|   <"'">
+    {
+        prevState = getState(prevState);
+        saveState(prevState);
+        prevState = GENERATE;
+    } : IN_STRING
 |	<";"> 
     {
         prevState = getState(prevState);

Modified: pig/branches/branch-0.11/test/org/apache/pig/test/TestGrunt.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.11/test/org/apache/pig/test/TestGrunt.java?rev=1514056&r1=1514055&r2=1514056&view=diff
==============================================================================
--- pig/branches/branch-0.11/test/org/apache/pig/test/TestGrunt.java (original)
+++ pig/branches/branch-0.11/test/org/apache/pig/test/TestGrunt.java Wed Aug 14 21:29:07 2013
@@ -1322,6 +1322,16 @@ public class TestGrunt {
     }
     
     @Test
+    public void testCheckScriptSyntaxWithSemiColonUDFErr() throws Throwable {
+        // Should able to handle semicolons in udf
+        String query = "a = load 'i1' as (f1:chararray);" +
+        			   "c = foreach a generate REGEX_EXTRACT(f1, '.;' ,1); dump c;";
+                
+        ArrayList<String> msgs = new ArrayList<String>();                //
+        validate(query, true, msgs.toArray(new String[0]));
+    }
+    
+    @Test
     public void testCheckScriptTypeCheckErr() throws Throwable {
         // a query which has grunt commands intermixed with pig statements - this
         // should fail with the -check option with a type checking error