pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hashut...@apache.org
Subject svn commit: r1003676 - in /hadoop/pig/branches/branch-0.8: ./ src/org/apache/pig/ src/org/apache/pig/impl/logicalLayer/validators/ src/org/apache/pig/impl/plan/ test/org/apache/pig/test/
Date Fri, 01 Oct 2010 22:14:47 GMT
Author: hashutosh
Date: Fri Oct  1 22:14:47 2010
New Revision: 1003676

URL: http://svn.apache.org/viewvc?rev=1003676&view=rev
Log:
PIG-1531: Pig gobbles up error messages (remaining part)

Modified:
    hadoop/pig/branches/branch-0.8/CHANGES.txt
    hadoop/pig/branches/branch-0.8/src/org/apache/pig/PigServer.java
    hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/validators/InputOutputFileVisitor.java
    hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/plan/PlanValidator.java
    hadoop/pig/branches/branch-0.8/test/org/apache/pig/test/TestInputOutputFileValidator.java

Modified: hadoop/pig/branches/branch-0.8/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.8/CHANGES.txt?rev=1003676&r1=1003675&r2=1003676&view=diff
==============================================================================
--- hadoop/pig/branches/branch-0.8/CHANGES.txt (original)
+++ hadoop/pig/branches/branch-0.8/CHANGES.txt Fri Oct  1 22:14:47 2010
@@ -26,6 +26,8 @@ PIG-1249: Safe-guards against misconfigu
 
 IMPROVEMENTS
 
+PIG-1531: Pig gobbles up error messages (nrai via hashutosh)
+
 PIG-1628: log this message at debug level : 'Pig Internal storage in use' (thejas)
 
 PIG-1632: The core jar in the tarball contains the kitchen sink (eli via olgan)

Modified: hadoop/pig/branches/branch-0.8/src/org/apache/pig/PigServer.java
URL: http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.8/src/org/apache/pig/PigServer.java?rev=1003676&r1=1003675&r2=1003676&view=diff
==============================================================================
--- hadoop/pig/branches/branch-0.8/src/org/apache/pig/PigServer.java (original)
+++ hadoop/pig/branches/branch-0.8/src/org/apache/pig/PigServer.java Fri Oct  1 22:14:47 2010
@@ -871,10 +871,10 @@ public class PigServer {
             LogicalPlan storePlan = compileLp(unCompiledstorePlan, g, true);
             
             return executeCompiledLogicalPlan(storePlan);
-        } catch (Exception e) {
+        } catch (PigException e) {
             int errCode = 1002;
             String msg = "Unable to store alias " + id;
-            throw new FrontendException(msg, errCode, PigException.INPUT, e);
+            throw new PigException(msg, errCode, PigException.INPUT, e);
         }   
     }
     

Modified: hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/validators/InputOutputFileVisitor.java
URL: http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/validators/InputOutputFileVisitor.java?rev=1003676&r1=1003675&r2=1003676&view=diff
==============================================================================
--- hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/validators/InputOutputFileVisitor.java
(original)
+++ hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/logicalLayer/validators/InputOutputFileVisitor.java
Fri Oct  1 22:14:47 2010
@@ -65,7 +65,7 @@ public class InputOutputFileVisitor exte
         StoreFuncInterface sf = store.getStoreFunc();
         String outLoc = store.getOutputFile().getFileName();
         int errCode = 2116;
-        String validationErrStr ="Output Location Validation Failed for: '" + outLoc ;
+        String validationErrStr ="Output Location Validation Failed for: " + outLoc ;
         Job dummyJob;
         
         try {

Modified: hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/plan/PlanValidator.java
URL: http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/plan/PlanValidator.java?rev=1003676&r1=1003675&r2=1003676&view=diff
==============================================================================
--- hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/plan/PlanValidator.java (original)
+++ hadoop/pig/branches/branch-0.8/src/org/apache/pig/impl/plan/PlanValidator.java Fri Oct
 1 22:14:47 2010
@@ -53,8 +53,9 @@ public abstract class PlanValidator<O ex
             messageCollector.collect("Unexpected exception in " 
                                       + this.getClass().getSimpleName(),
                                       MessageType.Error) ;
-            throw new PlanValidationException("An unexpected exception caused " 
-                                              + "the validation to stop", ve) ;
+            String errMsg="An unexpected exception caused the validation to stop";
+            int errCode = 2257;
+            throw new PlanValidationException( errMsg, errCode, ve) ;
         }
     }
     

Modified: hadoop/pig/branches/branch-0.8/test/org/apache/pig/test/TestInputOutputFileValidator.java
URL: http://svn.apache.org/viewvc/hadoop/pig/branches/branch-0.8/test/org/apache/pig/test/TestInputOutputFileValidator.java?rev=1003676&r1=1003675&r2=1003676&view=diff
==============================================================================
--- hadoop/pig/branches/branch-0.8/test/org/apache/pig/test/TestInputOutputFileValidator.java
(original)
+++ hadoop/pig/branches/branch-0.8/test/org/apache/pig/test/TestInputOutputFileValidator.java
Fri Oct  1 22:14:47 2010
@@ -23,20 +23,25 @@ import java.util.Properties;
 
 import org.apache.pig.ExecType; 
 import org.apache.pig.FuncSpec;
+import org.apache.pig.PigException;
 import org.apache.pig.PigServer;
+import org.apache.pig.ResourceSchema;
 import org.apache.pig.backend.datastorage.DataStorage;
 import org.apache.pig.backend.datastorage.ElementDescriptor;
 import org.apache.pig.backend.hadoop.datastorage.ConfigurationUtil;
 import org.apache.pig.backend.hadoop.executionengine.util.MapRedUtil;
+import org.apache.pig.builtin.PigStorage;
 import org.apache.pig.data.Tuple;
 import org.apache.pig.impl.PigContext;
 import org.apache.pig.impl.io.FileLocalizer;
 import org.apache.pig.impl.io.FileSpec;
+import org.apache.pig.impl.logicalLayer.FrontendException;
 import org.apache.pig.impl.logicalLayer.LOLoad;
 import org.apache.pig.impl.logicalLayer.LOStore;
 import org.apache.pig.impl.logicalLayer.LogicalPlan;
 import org.apache.pig.impl.plan.OperatorKey;
 import org.apache.pig.impl.plan.NodeIdGenerator;
+import org.apache.pig.impl.plan.PlanValidationException;
 
 import org.apache.pig.impl.logicalLayer.validators.* ;
 import org.apache.pig.impl.plan.CompilationMessageCollector;
@@ -244,6 +249,26 @@ public class TestInputOutputFileValidato
             }
         }
     }
+
+    @Test
+    public void testValidationNeg() throws Throwable{
+
+        PigServer pig = new PigServer(ExecType.MAPREDUCE,cluster.getProperties());
+        try{
+            pig.setBatchOn();
+        	pig.registerQuery("A = load 'inputfile' using PigStorage () as (a:int);");
+            pig.registerQuery("store A into 'outfile' using "+DummyStorer.class.getName()+";");
+            pig.executeBatch();
+            assert false;
+        }catch(Exception fe){
+        	assertTrue(fe instanceof PlanValidationException);
+        	PigException pe = LogUtils.getPigException(fe);
+        	assertTrue(pe instanceof FrontendException);
+        	assertEquals(1115, pe.getErrorCode());
+        	assertTrue(pe.getMessage().contains("Exception from DummyStorer."));
+        }
+    }
+ 
         
     private LogicalPlan genNewLoadStorePlan(String inputFile,
                                             String outputFile, DataStorage dfs) 
@@ -319,4 +344,11 @@ public class TestInputOutputFileValidato
             
         return distribElem.toString();
     }
+
+    public static class DummyStorer extends PigStorage{
+    @Override
+        public void checkSchema(ResourceSchema s) throws IOException {
+            throw new FrontendException("Exception from DummyStorer.", 1115);
+        }
+    }
 }



Mime
View raw message