pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@apache.org
Subject svn commit: r1174271 - in /pig/branches/branch-0.9: CHANGES.txt src/org/apache/pig/parser/LogicalPlanBuilder.java test/org/apache/pig/parser/TestQueryParser.java
Date Thu, 22 Sep 2011 17:24:21 GMT
Author: daijy
Date: Thu Sep 22 17:24:21 2011
New Revision: 1174271

URL: http://svn.apache.org/viewvc?rev=1174271&view=rev
Log:
PIG-2238: Pig 0.9 error message not useful as compared to 0.8

Modified:
    pig/branches/branch-0.9/CHANGES.txt
    pig/branches/branch-0.9/src/org/apache/pig/parser/LogicalPlanBuilder.java
    pig/branches/branch-0.9/test/org/apache/pig/parser/TestQueryParser.java

Modified: pig/branches/branch-0.9/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/CHANGES.txt?rev=1174271&r1=1174270&r2=1174271&view=diff
==============================================================================
--- pig/branches/branch-0.9/CHANGES.txt (original)
+++ pig/branches/branch-0.9/CHANGES.txt Thu Sep 22 17:24:21 2011
@@ -38,6 +38,8 @@ PIG-2221: Couldnt find documentation for
 
 BUG FIXES
 
+PIG-2238: Pig 0.9 error message not useful as compared to 0.8 (daijy)
+
 PIG-2286: Using COR function in Piggybank results in ERROR 2018: Internal error. Unable to
introduce the combiner for optimization (daijy)
 
 PIG-2274: remove pig deb package dependency on sun-java6-jre (gkesavan via daijy)

Modified: pig/branches/branch-0.9/src/org/apache/pig/parser/LogicalPlanBuilder.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/src/org/apache/pig/parser/LogicalPlanBuilder.java?rev=1174271&r1=1174270&r2=1174271&view=diff
==============================================================================
--- pig/branches/branch-0.9/src/org/apache/pig/parser/LogicalPlanBuilder.java (original)
+++ pig/branches/branch-0.9/src/org/apache/pig/parser/LogicalPlanBuilder.java Thu Sep 22 17:24:21
2011
@@ -148,23 +148,23 @@ public class LogicalPlanBuilder {
         return new LOFilter( plan );
     }
 
-    String buildFilterOp(SourceLocation loc, LOFilter op, String alias, String inputAlias,
LogicalExpressionPlan expr) {
+    String buildFilterOp(SourceLocation loc, LOFilter op, String alias, String inputAlias,
LogicalExpressionPlan expr) throws ParserValidationException {
         op.setFilterPlan( expr );
         return buildOp( loc, op, alias, inputAlias, null );
     }
     
-    String buildDistinctOp(SourceLocation loc, String alias, String inputAlias, String partitioner)
{
+    String buildDistinctOp(SourceLocation loc, String alias, String inputAlias, String partitioner)
throws ParserValidationException {
         LODistinct op = new LODistinct( plan );
         return buildOp( loc, op, alias, inputAlias, partitioner );
     }
 
-    String buildLimitOp(SourceLocation loc, String alias, String inputAlias, long limit)
{
+    String buildLimitOp(SourceLocation loc, String alias, String inputAlias, long limit)
throws ParserValidationException {
         LOLimit op = new LOLimit( plan, limit );
         return buildOp( loc, op, alias, inputAlias, null );
     }
     
     String buildSampleOp(SourceLocation loc, String alias, String inputAlias, double value,
-            SourceLocation valLoc) {
+            SourceLocation valLoc) throws ParserValidationException {
         LogicalExpressionPlan filterPlan = new LogicalExpressionPlan();
         //  Generate a filter condition.
         LogicalExpression konst = new ConstantExpression( filterPlan, value);
@@ -175,12 +175,12 @@ public class LogicalPlanBuilder {
         return buildFilterOp( loc, filter, alias, inputAlias, filterPlan );
     }
     
-    String buildUnionOp(SourceLocation loc, String alias, List<String> inputAliases,
boolean onSchema) {
+    String buildUnionOp(SourceLocation loc, String alias, List<String> inputAliases,
boolean onSchema) throws ParserValidationException {
         LOUnion op = new LOUnion( plan, onSchema );
         return buildOp( loc, op, alias, inputAliases, null );
     }
 
-    String buildSplitOp(SourceLocation loc, String inputAlias) {
+    String buildSplitOp(SourceLocation loc, String inputAlias) throws ParserValidationException
{
         LOSplit op = new LOSplit( plan );
         return buildOp( loc, op, null, inputAlias, null );
     }
@@ -190,12 +190,12 @@ public class LogicalPlanBuilder {
     }
     
     String buildSplitOutputOp(SourceLocation loc, LOSplitOutput op, String alias, String
inputAlias,
-            LogicalExpressionPlan filterPlan) {
+            LogicalExpressionPlan filterPlan) throws ParserValidationException {
         op.setFilterPlan( filterPlan );
         return buildOp ( loc, op, alias, inputAlias, null );
     }
     
-    String buildCrossOp(SourceLocation loc, String alias, List<String> inputAliases,
String partitioner) {
+    String buildCrossOp(SourceLocation loc, String alias, List<String> inputAliases,
String partitioner) throws ParserValidationException {
         LOCross op = new LOCross( plan );
         return buildOp ( loc, op, alias, inputAliases, partitioner );
     }
@@ -358,7 +358,7 @@ public class LogicalPlanBuilder {
     }
     
     private String buildOp(SourceLocation loc, LogicalRelationalOperator op, String alias,

-    		String inputAlias, String partitioner) {
+    		String inputAlias, String partitioner) throws ParserValidationException {
         List<String> inputAliases = new ArrayList<String>();
         if( inputAlias != null )
             inputAliases.add( inputAlias );
@@ -366,13 +366,16 @@ public class LogicalPlanBuilder {
     }
     
     private String buildOp(SourceLocation loc, LogicalRelationalOperator op, String alias,

-    		List<String> inputAliases, String partitioner) {
+    		List<String> inputAliases, String partitioner) throws ParserValidationException
{
         setAlias( op, alias );
         setPartitioner( op, partitioner );
         op.setLocation( loc );
         plan.add( op );
         for( String a : inputAliases ) {
             Operator pred = operators.get( a );
+            if (pred==null) {
+                throw new ParserValidationException( intStream, loc, "Unrecognized alias
" + a );
+            }
             plan.connect( pred, op );
         }
         operators.put( op.getAlias(), op );

Modified: pig/branches/branch-0.9/test/org/apache/pig/parser/TestQueryParser.java
URL: http://svn.apache.org/viewvc/pig/branches/branch-0.9/test/org/apache/pig/parser/TestQueryParser.java?rev=1174271&r1=1174270&r2=1174271&view=diff
==============================================================================
--- pig/branches/branch-0.9/test/org/apache/pig/parser/TestQueryParser.java (original)
+++ pig/branches/branch-0.9/test/org/apache/pig/parser/TestQueryParser.java Thu Sep 22 17:24:21
2011
@@ -107,6 +107,19 @@ public class TestQueryParser {
         Assert.assertTrue(msg.startsWith(expected));
     }
     
+    // See PIG-2238
+    @Test
+    public void testDependentNullAlias() throws IOException, RecognitionException {
+        PigServer pigServer = new PigServer(ExecType.LOCAL);
+        try {
+            pigServer.registerQuery( "F = limit F 20;store F into 'out';" );
+        } catch(Exception ex) {
+            Assert.assertTrue(ex.getMessage().contains("Unrecognized alias F"));
+            return;
+        }
+        Assert.fail();
+    }
+    
     @Test
     public void test2() throws IOException, RecognitionException {
         shouldPass("A = load '/Users/gates/test/data/studenttab10'; B = foreach A generate
( $0 == 0 ? 1 : 0 );");



Mime
View raw message