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

svn commit: r1081477 - in /pig/trunk: ./ src/org/apache/pig/parser/ test/org/apache/pig/parser/

Author: thejas
Date: Mon Mar 14 17:11:19 2011
New Revision: 1081477

URL: http://svn.apache.org/viewvc?rev=1081477&view=rev
Log:
PIG-719: store <expr> into 'filename'; should be valid syntax, but does not work (xuefuz via thejas)

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/parser/AliasMasker.g
    pig/trunk/src/org/apache/pig/parser/AstValidator.g
    pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g
    pig/trunk/src/org/apache/pig/parser/QueryParser.g
    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=1081477&r1=1081476&r2=1081477&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Mon Mar 14 17:11:19 2011
@@ -112,6 +112,8 @@ PIG-1696: Performance: Use System.arrayc
 
 BUG FIXES
 
+PIG-719: store <expr> into 'filename'; should be valid syntax, but does not work (xuefuz via thejas)
+
 PIG-1770: matches clause problem with chars that have special meaning in dk.brics - #, @ .. (thejas)
 
 PIG-1862: Pig returns exit code 0 for the failed Pig script due to non-existing input directory (rding)

Modified: pig/trunk/src/org/apache/pig/parser/AliasMasker.g
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/parser/AliasMasker.g?rev=1081477&r1=1081476&r2=1081477&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/AliasMasker.g (original)
+++ pig/trunk/src/org/apache/pig/parser/AliasMasker.g Mon Mar 14 17:11:19 2011
@@ -293,7 +293,7 @@ flatten_clause 
 ;
 
 store_clause 
-    : ^( STORE { sb.append($STORE.text).append(" "); } alias { sb.append(" INTO "); } filename ( { sb.append(" USING "); } func_clause)? )
+    : ^( STORE { sb.append($STORE.text).append(" "); } rel { sb.append(" INTO "); } filename ( { sb.append(" USING "); } func_clause)? )
 ;
 
 filter_clause 

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=1081477&r1=1081476&r2=1081477&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/AstValidator.g (original)
+++ pig/trunk/src/org/apache/pig/parser/AstValidator.g Mon Mar 14 17:11:19 2011
@@ -262,7 +262,7 @@ flatten_generated_item : ( flatten_claus
 flatten_clause : ^( FLATTEN expr )
 ;
 
-store_clause : ^( STORE alias filename func_clause? )
+store_clause : ^( STORE rel filename func_clause? )
 ;
 
 filter_clause : ^( FILTER rel cond )

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=1081477&r1=1081476&r2=1081477&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g (original)
+++ pig/trunk/src/org/apache/pig/parser/LogicalPlanGenerator.g Mon Mar 14 17:11:19 2011
@@ -550,10 +550,10 @@ flatten_clause[LogicalExpressionPlan pla
 ;
 
 store_clause returns[String alias]
- : ^( STORE alias filename func_clause[FunctionType.STOREFUNC]? )
+ : ^( STORE rel filename func_clause[FunctionType.STOREFUNC]? )
    {
        $alias= builder.buildStoreOp( $statement::alias,
-          $alias.name, $filename.filename, $func_clause.funcSpec );
+          $statement::inputAlias, $filename.filename, $func_clause.funcSpec );
    }
 ;
 

Modified: pig/trunk/src/org/apache/pig/parser/QueryParser.g
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/parser/QueryParser.g?rev=1081477&r1=1081476&r2=1081477&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/parser/QueryParser.g (original)
+++ pig/trunk/src/org/apache/pig/parser/QueryParser.g Mon Mar 14 17:11:19 2011
@@ -85,6 +85,10 @@ throws RecognitionException {
 }
 
 public String getErrorMessage(RecognitionException e, String[] tokenNames ) {
+    if( !log.isDebugEnabled() ) {
+        return super.getErrorMessage( e, tokenNames );
+    }
+    
     List stack =  getRuleInvocationStack( e, this.getClass().getName() );
     String msg = null;
     if( e instanceof NoViableAltException ) {
@@ -266,7 +270,7 @@ flatten_generated_item : flatten_clause 
 flatten_clause : FLATTEN^ LEFT_PAREN! expr RIGHT_PAREN!
 ;
 
-store_clause : STORE^ alias INTO! filename ( USING! func_clause )?
+store_clause : STORE^ rel INTO! filename ( USING! func_clause )?
 ;
 
 filter_clause : FILTER^ rel BY! cond

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=1081477&r1=1081476&r2=1081477&view=diff
==============================================================================
--- pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java (original)
+++ pig/trunk/test/org/apache/pig/parser/TestLogicalPlanGenerator.java Mon Mar 14 17:11:19 2011
@@ -218,6 +218,12 @@ public class TestLogicalPlanGenerator {
     }
 
     @Test
+    public void test17() {
+        String query = "store ( load 'x' ) into 'y';";
+        generateLogicalPlan( query );
+    }
+
+    @Test
     public void testFilter() {
         String query = "A = load 'x' as ( u:int, v:long, w:bytearray); " + 
                        "B = filter A by 2 > 1; ";