Author: olga
Date: Mon Sep 22 17:49:35 2008
New Revision: 698048

URL: http://svn.apache.org/viewvc?rev=698048&view=rev
Log:
PIG-447: improved error messages

Modified:
    incubator/pig/branches/types/CHANGES.txt
    
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckingVisitor.java

Modified: incubator/pig/branches/types/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/CHANGES.txt?rev=698048&r1=698047&r2=698048&view=diff
==============================================================================
--- incubator/pig/branches/types/CHANGES.txt (original)
+++ incubator/pig/branches/types/CHANGES.txt Mon Sep 22 17:49:35 2008
@@ -235,3 +235,5 @@
     (shravanmn via olgan)
 
     PIG-444: job.jar is left behined (pradeepk via olgan)
+
+    PIG-447: improved error messages

Modified: 
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckingVisitor.java
URL: 
http://svn.apache.org/viewvc/incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckingVisitor.java?rev=698048&r1=698047&r2=698048&view=diff
==============================================================================
--- 
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckingVisitor.java
 (original)
+++ 
incubator/pig/branches/types/src/org/apache/pig/impl/logicalLayer/validators/TypeCheckingVisitor.java
 Mon Sep 22 17:49:35 2008
@@ -415,7 +415,9 @@
             insertRightCastForBinaryOp(binOp, DataType.DOUBLE) ;
         }
         else {
-            String msg = "Cannot evaluate output type of Mul/Div Operator" ;
+            String msg = "Incompatible types in Multiplication Operator"
+                            + " LHS:" + DataType.findTypeName(lhsType)
+                            + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error);
             throw new VisitorException(msg) ;
         }
@@ -423,7 +425,7 @@
         try {
             binOp.regenerateFieldSchema();
         } catch (FrontendException fe) {
-            String msg = "Could not set LOSubtract field schema";
+            String msg = "Could not set LOMultiply field schema";
             msgCollector.collect(msg, MessageType.Error);
             VisitorException vse = new VisitorException(msg) ;
             vse.initCause(fe) ;
@@ -468,7 +470,9 @@
             insertRightCastForBinaryOp(binOp, DataType.DOUBLE) ;
         }
         else {
-            String msg = "Cannot evaluate output type of Mul/Div Operator" ;
+            String msg = "Incompatible types in Division Operator"
+                            + " LHS:" + DataType.findTypeName(lhsType)
+                            + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error);
             throw new VisitorException(msg) ;
         }
@@ -476,7 +480,7 @@
         try {
             binOp.regenerateFieldSchema();
         } catch (FrontendException fe) {
-            String msg = "Could not set LOSubtract field schema";
+            String msg = "Could not set LODivide field schema";
             msgCollector.collect(msg, MessageType.Error);
             VisitorException vse = new VisitorException(msg) ;
             vse.initCause(fe) ;
@@ -521,14 +525,16 @@
             insertRightCastForBinaryOp(binOp, DataType.DOUBLE) ;
         }
         else {
-            String msg = "Cannot evaluate output type of Add/Subtract 
Operator" ;
+            String msg = "Incompatible types in Add Operator"
+                            + " LHS:" + DataType.findTypeName(lhsType)
+                            + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error);
             throw new VisitorException(msg) ;
         }
         try {
             binOp.regenerateFieldSchema();
         } catch (FrontendException fe) {
-            String msg = "Could not set LOSubtract field schema";
+            String msg = "Could not set LOAdd field schema";
             msgCollector.collect(msg, MessageType.Error);
             VisitorException vse = new VisitorException(msg) ;
             vse.initCause(fe) ;
@@ -573,7 +579,9 @@
             insertRightCastForBinaryOp(binOp, DataType.DOUBLE) ;
         }
         else {
-            String msg = "Cannot evaluate output type of Add/Subtract 
Operator" ;
+            String msg = "Incompatible types in Subtract Operator"
+                            + " LHS:" + DataType.findTypeName(lhsType)
+                            + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error);
             throw new VisitorException(msg) ;
         }
@@ -632,8 +640,7 @@
             insertRightCastForBinaryOp(binOp, lhsType) ;
         }
         else {
-            String msg = "Cannot evaluate output type of "
-                            + binOp.getClass().getSimpleName()
+            String msg = "Incompatible types in GreaterThan comparision 
operator"
                             + " LHS:" + DataType.findTypeName(lhsType)
                             + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error) ;
@@ -684,8 +691,7 @@
             insertRightCastForBinaryOp(binOp, lhsType) ;
         }
         else {
-            String msg = "Cannot evaluate output type of "
-                            + binOp.getClass().getSimpleName()
+            String msg = "Incompatible types in GreaterThanEqualTo comparison 
operator"
                             + " LHS:" + DataType.findTypeName(lhsType)
                             + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error) ;
@@ -735,8 +741,7 @@
             insertRightCastForBinaryOp(binOp, lhsType) ;
         }
         else {
-            String msg = "Cannot evaluate output type of "
-                            + binOp.getClass().getSimpleName()
+            String msg = "Incompatible types in LesserThan comparison operator"
                             + " LHS:" + DataType.findTypeName(lhsType)
                             + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error) ;
@@ -787,8 +792,7 @@
             insertRightCastForBinaryOp(binOp, lhsType) ;
         }
         else {
-            String msg = "Cannot evaluate output type of "
-                            + binOp.getClass().getSimpleName()
+            String msg = "Incompatible types in LesserThanEqualTo comparison 
operator"
                             + " LHS:" + DataType.findTypeName(lhsType)
                             + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error) ;
@@ -850,7 +854,9 @@
             // good
         }
         else {
-            String msg = "Cannot evaluate output type of Equal/NotEqual 
Operator" ;
+            String msg = "Incompatible types in EqualTo Comparison Operator" 
+                            + " LHS:" + DataType.findTypeName(lhsType)
+                            + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error);
             throw new VisitorException(msg) ;
         }
@@ -909,7 +915,9 @@
             // good
         }
         else {
-            String msg = "Cannot evaluate output type of Equal/NotEqual 
Operator" ;
+            String msg = "Incompatible types in NotEqual Comparison Operator"
+                            + " LHS:" + DataType.findTypeName(lhsType)
+                            + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error);
             throw new VisitorException(msg) ;
         }
@@ -942,14 +950,16 @@
             insertLeftCastForBinaryOp(binOp, rhsType) ;
         }
         else {
-            String msg = "Cannot evaluate output type of Mod Operator" ;
+            String msg = "Incompatible types in Mod Operator"
+                            + " LHS:" + DataType.findTypeName(lhsType)
+                            + " RHS:" + DataType.findTypeName(rhsType) ;
             msgCollector.collect(msg, MessageType.Error);
             throw new VisitorException(msg) ;
         }
         try {
             binOp.regenerateFieldSchema();
         } catch (FrontendException fe) {
-            String msg = "Could not set LOSubtract field schema";
+            String msg = "Could not set LOMod field schema";
             msgCollector.collect(msg, MessageType.Error);
             VisitorException vse = new VisitorException(msg) ;
             vse.initCause(fe) ;


Reply via email to