pig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From knogu...@apache.org
Subject svn commit: r1842987 - in /pig/trunk: CHANGES.txt src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/PhysicalOperator.java
Date Fri, 05 Oct 2018 21:12:08 GMT
Author: knoguchi
Date: Fri Oct  5 21:12:08 2018
New Revision: 1842987

URL: http://svn.apache.org/viewvc?rev=1842987&view=rev
Log:
PIG-5354: Show fieldname and a line number for casting errors (knoguchi)

Modified:
    pig/trunk/CHANGES.txt
    pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/PhysicalOperator.java

Modified: pig/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/pig/trunk/CHANGES.txt?rev=1842987&r1=1842986&r2=1842987&view=diff
==============================================================================
--- pig/trunk/CHANGES.txt (original)
+++ pig/trunk/CHANGES.txt Fri Oct  5 21:12:08 2018
@@ -26,6 +26,8 @@ PIG-5282: Upgade to Java 8 (satishsaley
  
 IMPROVEMENTS
 
+PIG-5354: Show fieldname and a line number for casting errors (knoguchi)
+
 PIG-5342: Add setting to turn off bloom join combiner (satishsaley via rohini)
 
 PIG-5349: Log stderr output when shell command fail (knoguchi)

Modified: pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/PhysicalOperator.java
URL: http://svn.apache.org/viewvc/pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/PhysicalOperator.java?rev=1842987&r1=1842986&r2=1842987&view=diff
==============================================================================
--- pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/PhysicalOperator.java
(original)
+++ pig/trunk/src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/PhysicalOperator.java
Fri Oct  5 21:12:08 2018
@@ -360,11 +360,30 @@ public abstract class PhysicalOperator e
             default:
                 throw new ExecException("Unsupported type for getNext: " + DataType.findTypeName(dataType));
             }
+        } catch (ExecException e) {
+            throw new ExecException("Exception while executing for " + originalLocationsToDescriptiveString()
+                                    + ": " + e.toString(), e.getErrorCode(), e);
         } catch (RuntimeException e) {
             throw new ExecException("Exception while executing " + this.toString() + ": "
+ e.toString(), e);
         }
     }
 
+    private String originalLocationsToDescriptiveString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append('[');
+        boolean isFirstItem = true;
+        for( OriginalLocation ol : getOriginalLocations() ) {
+            if( isFirstItem ) {
+                isFirstItem = false;
+            } else {
+                sb.append(",");
+            }
+            sb.append(ol.getAlias()).append("[line=").append(ol.getLine())
+              .append(",offset=").append(ol.getOffset()).append("]");
+        }
+        return sb.append(']').toString();
+    }
+
     public Result getNextInteger() throws ExecException {
         return res;
     }



Mime
View raw message