You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pig.apache.org by xu...@apache.org on 2011/04/26 07:06:57 UTC
svn commit: r1096665 - in /pig/branches/branch-0.9: CHANGES.txt
src/org/apache/pig/parser/QueryParser.g
test/org/apache/pig/parser/TestLogicalPlanGenerator.java
Author: xuefu
Date: Tue Apr 26 05:06:56 2011
New Revision: 1096665
URL: http://svn.apache.org/viewvc?rev=1096665&view=rev
Log:
PIG-2003: Using keyward as alias doesn't either emit an error or produce a logical plan
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/parser/TestLogicalPlanGenerator.java
Modified: pig/branches/branch-0.9/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/CHANGES.txt?rev=1096665&r1=1096664&r2=1096665&view=diff
==============================================================================
--- pig/branches/branch-0.9/CHANGES.txt (original)
+++ pig/branches/branch-0.9/CHANGES.txt Tue Apr 26 05:06:56 2011
@@ -32,6 +32,8 @@ PIG-1876: Typed map for Pig (daijy)
IMPROVEMENTS
+PIG-2003: Using keyward as alias doesn't either emit an error or produce a logical plan (xuefu)
+
PIG-1981: LoadPushDown.pushProjection should pass alias in addition to position (daijy)
PIG-2006: Regression: NPE when Pig processes an empty script file, fix test case (xuefu)
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=1096665&r1=1096664&r2=1096665&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 Tue Apr 26 05:06:56 2011
@@ -136,8 +136,10 @@ catch(RecognitionException re) {
}
}
-query : statement*
- -> ^( QUERY statement* )
+query : statement+
+ -> ^( QUERY statement+ )
+ |
+ -> ^( QUERY )
;
statement : SEMI_COLON!
Modified: pig/branches/branch-0.9/test/org/apache/pig/parser/TestLogicalPlanGenerator.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/parser/TestLogicalPlanGenerator.java?rev=1096665&r1=1096664&r2=1096665&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/parser/TestLogicalPlanGenerator.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/parser/TestLogicalPlanGenerator.java Tue Apr 26 05:06:56 2011
@@ -24,6 +24,7 @@ import java.io.IOException;
import junit.framework.Assert;
+import org.antlr.runtime.NoViableAltException;
import org.apache.pig.test.Util;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -283,4 +284,17 @@ public class TestLogicalPlanGenerator {
}
Assert.fail( "Query is supposed to be failing." );
}
+
+ @Test
+ public void testNegative2() {
+ String query = "ship = load 'x';";
+ try {
+ ParserTestingUtils.generateLogicalPlan( query );
+ } catch(Exception ex) {
+ Assert.assertTrue( ex instanceof NoViableAltException );
+ return;
+ }
+ Assert.fail( "Query is supposed to be failing." );
+ }
+
}