You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by ga...@apache.org on 2011/08/13 17:47:14 UTC

svn commit: r1157385 - in /pig/trunk: CHANGES.txt src/org/apache/pig/parser/AstValidator.g src/org/apache/pig/parser/LogicalPlanGenerator.g test/org/apache/pig/parser/TestAstValidator.java test/org/apache/pig/parser/TestLogicalPlanGenerator.java

Author: gates
Date: Sat Aug 13 15:47:13 2011
New Revision: 1157385

URL: http://svn.apache.org/viewvc?rev=1157385&view=rev
Log:
PIG-2215: Newlines in function arguments still cause exceptions to be thrown

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/parser/AstValidator.g
    pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g
    pig/trunk/test/org/apache/pig/parser/TestAstValidator.java
    pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1157385&r1=1157384&r2=1157385&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Sat Aug 13 15:47:13 2011
@@ -105,6 +105,8 @@ PIG-2011: Speed up TestTypedMap.java (dv
 
 BUG FIXES
 
+PIG-2215: Newlines in function arguments still cause exceptions to be thrown (awarring via gates)
+
 PIG-2214: InternalSortedBag two-arg constructor doesn't pass bagCount (sallen via gates)
 
 PIG-2102: MonitoredUDF does not work (dvryaboy)

Modified: pig/trunk/src/org/apache/pig/parser/AstValidator.g
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/parser/AstValidator.g?rev=1157385&r1=1157384&r2=1157385&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/AstValidator.g (original)
+++ pig/trunk/src/org/apache/pig/parser/AstValidator.g Sat Aug 13 15:47:13 2011
@@ -222,7 +222,10 @@ func_clause : ^( FUNC_REF func_name )
 func_name : eid ( ( PERIOD | DOLLAR ) eid )*
 ;
 
-func_args : QUOTEDSTRING+
+func_args_string : QUOTEDSTRING | MULTILINE_QUOTEDSTRING
+;
+
+func_args : func_args_string+
 ;
 
 group_clause

Modified: pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g?rev=1157385&r1=1157384&r2=1157385&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g (original)
+++ pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g Sat Aug 13 15:47:13 2011
@@ -432,7 +432,9 @@ func_name returns[String funcName]
 
 func_args returns[List<String> args]
 @init { $args = new ArrayList<String>(); }
-: ( QUOTEDSTRING { $args.add( builder.unquote( $QUOTEDSTRING.text ) ); } )+
+: ( QUOTEDSTRING { $args.add( builder.unquote( $QUOTEDSTRING.text ) ); } 
+    | MULTILINE_QUOTEDSTRING { $args.add( builder.unquote( $MULTILINE_QUOTEDSTRING.text ) ); }
+  )+
 ;
 
 group_clause returns[String alias]

Modified: pig/trunk/test/org/apache/pig/parser/TestAstValidator.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/parser/TestAstValidator.java?rev=1157385&r1=1157384&r2=1157385&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/parser/TestAstValidator.java (original)
+++ pig/trunk/test/org/apache/pig/parser/TestAstValidator.java Sat Aug 13 15:47:13 2011
@@ -121,4 +121,12 @@ public class TestAstValidator {
     }
     
     // TODO: need a test similar to above but for foreach inner plan.
+
+    @Test
+    public void testMultilineFunctionArgument() throws RecognitionException, ParsingFailureException, IOException {
+        String query = "LOAD 'testIn' \n" +
+            "USING PigStorage ('\n');";
+        ParserTestingUtils.validateAst(query);
+    }
+
 }

Modified: pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java
URL: http://svn.apache.org/viewvc/pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java?rev=1157385&r1=1157384&r2=1157385&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java (original)
+++ pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java Sat Aug 13 15:47:13 2011
@@ -320,4 +320,11 @@ public class TestLogicalPlanGenerator {
         Assert.fail( "Query is supposed to be failing." );
     }
 
+    @Test
+    public void testMultilineFunctionArgument() {
+        String query = "LOAD 'testIn' \n" +
+            "USING PigStorage ('\n');";
+        generateLogicalPlan( query );
+    }
+
 }