You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by dl...@apache.org on 2018/05/30 17:44:44 UTC

[17/24] asterixdb git commit: [ASTERIXDB-2393][COMP][RT] Add source location to error messages

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/ObjectsQueries.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/ObjectsQueries.xml b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/ObjectsQueries.xml
index 507e276..cb83d4b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/ObjectsQueries.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/objects/ObjectsQueries.xml
@@ -141,18 +141,21 @@
     <compilation-unit name="closed-closed-fieldname-conflict_issue173">
       <output-dir compare="Text">closed-closed-fieldname-conflict_issue173</output-dir>
       <expected-error>Closed fields 0 and 1 have the same field name "name"</expected-error>
+      <source-location>false</source-location>
     </compilation-unit>
   </test-case>
   <test-case FilePath="objects">
     <compilation-unit name="open-closed-fieldname-conflict_issue173">
       <output-dir compare="Text">open-closed-fieldname-conflict_issue173</output-dir>
       <expected-error>Open field "name" has the same field name as closed field at index 0</expected-error>
+      <source-location>false</source-location>
     </compilation-unit>
   </test-case>
   <test-case FilePath="objects">
     <compilation-unit name="open-open-fieldname-conflict_issue173">
       <output-dir compare="Text">open-open-fieldname-conflict_issue173</output-dir>
       <expected-error>Open fields 0 and 1 have the same field name "name"</expected-error>
+      <source-location>false</source-location>
     </compilation-unit>
   </test-case>
 </test-group>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index f972050..c1d1db5 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -21,7 +21,7 @@
   <!ENTITY AsyncDeferredQueries SYSTEM "queries_sqlpp/async-deferred/AsyncDeferredQueries.xml">
   <!ENTITY GeoQueries SYSTEM "queries_sqlpp/geojson/GeoJSONQueries.xml">
 ]>
-<test-suite xmlns="urn:xml.testframework.asterix.apache.org" ResultOffsetPath="results" QueryOffsetPath="queries_sqlpp" QueryFileExtension=".sqlpp">
+<test-suite xmlns="urn:xml.testframework.asterix.apache.org" ResultOffsetPath="results" QueryOffsetPath="queries_sqlpp" QueryFileExtension=".sqlpp" SourceLocation="true">
   &AsyncDeferredQueries;
   <test-group name="flwor">
     <test-case FilePath="flwor">
@@ -1853,6 +1853,7 @@
       <compilation-unit name="insert-duplicated-keys">
         <output-dir compare="Text">insert-duplicated-keys</output-dir>
         <expected-error>Inserting duplicate keys into the primary storage</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="dml">
@@ -1901,13 +1902,13 @@
     <test-case FilePath="dml">
       <compilation-unit name="load-with-autogenerated-pk_adm_02">
         <output-dir compare="Text">load-with-autogenerated-pk_adm_02</output-dir>
-        <expected-error>Parse error at (0, 5): ASX3058: This record is closed, you can not add extra fields! new field name: id</expected-error>
+        <expected-error>ASX3058: This record is closed, you can not add extra fields! new field name: id</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="dml">
       <compilation-unit name="load-with-autogenerated-pk_adm_03">
         <output-dir compare="Text">load-with-autogenerated-pk_adm_03</output-dir>
-        <expected-error>Parse error at (0, 5): ASX3058: This record is closed, you can not add extra fields! new field name: id</expected-error>
+        <expected-error>ASX3058: This record is closed, you can not add extra fields! new field name: id</expected-error>
       </compilation-unit>
     </test-case>
     <test-case FilePath="dml">
@@ -5426,6 +5427,7 @@
       <compilation-unit name="query-issue410">
         <output-dir compare="Text">query-issue410</output-dir>
         <expected-error>Field type double can't be promoted to type string</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="open-closed">
@@ -8142,36 +8144,42 @@
       <compilation-unit name="drop-dependency-1">
         <output-dir compare="Text">drop-dependency-1</output-dir>
         <expected-error>Cannot drop dataverse. Function B.f0@2 depends on function C.f1@2</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="user-defined-functions">
       <compilation-unit name="drop-dependency-2">
         <output-dir compare="Text">drop-dependency-2</output-dir>
         <expected-error>Cannot drop dataverse. Function B.f2@2 depends on dataset C.TweetMessages</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="user-defined-functions">
       <compilation-unit name="drop-dependency-3">
         <output-dir compare="Text">drop-dependency-3</output-dir>
         <expected-error>Cannot drop function C.f1@2 being used by function B.f0@2</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="user-defined-functions">
       <compilation-unit name="drop-dependency-4">
         <output-dir compare="Text">drop-dependency-4</output-dir>
         <expected-error>Cannot drop dataset C.TweetMessages being used by function B.f2@2</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="user-defined-functions">
       <compilation-unit name="drop-dependency-5">
         <output-dir compare="Text">drop-dependency-5</output-dir>
         <expected-error>Cannot drop function C.f1@2 being used by function C.f0@2</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="user-defined-functions">
       <compilation-unit name="drop-dependency-6">
         <output-dir compare="Text">drop-dependency-6</output-dir>
         <expected-error>Cannot drop dataset C.TweetMessages being used by function C.f2@2</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="user-defined-functions">
@@ -8416,18 +8424,21 @@
       <compilation-unit name="csv_05">
         <output-dir compare="Text">csv_05</output-dir>
         <expected-error>At record: 1, field#: 4 - a quote enclosing a field needs to be placed in the beginning of that field</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="load">
       <compilation-unit name="csv_06">
         <output-dir compare="Text">csv_06</output-dir>
         <expected-error>At record: 1, field#: 3 - a quote enclosing a field needs to be placed in the beginning of that field</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="load">
       <compilation-unit name="csv_07">
         <output-dir compare="Text">csv_07</output-dir>
         <expected-error>At record: 1, field#: 3 -  A quote enclosing a field needs to be followed by the delimiter</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="load">
@@ -8449,12 +8460,14 @@
       <compilation-unit name="issue14_query">
         <output-dir compare="Text">issue14_query</output-dir>
         <expected-error>Unspecified parameter: format</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="load">
       <compilation-unit name="issue315_query">
         <output-dir compare="Text">none</output-dir>
         <expected-error>Invalid path</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="load">
@@ -8498,6 +8511,7 @@
       <compilation-unit name="duplicate-key-error">
         <output-dir compare="Text">none</output-dir>
         <expected-error>Loading duplicate keys into the primary storage</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="load">
@@ -8660,6 +8674,7 @@
         <output-dir compare="Text">twitter-feed</output-dir>
         <expected-error>Twitter4J library not found!</expected-error>
         <expected-error>Unknown source feed: TwitterFeed</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="feeds">
@@ -8667,6 +8682,7 @@
         <output-dir compare="Text">revised-tweet-parser</output-dir>
         <expected-error>Twitter4J library not found!</expected-error>
         <expected-error>Unknown source feed: TwitterFeed</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="feeds">
@@ -8713,12 +8729,14 @@
       <compilation-unit name="start-started-feed">
         <output-dir compare="Text">start-started-feed</output-dir>
         <expected-error>experiments.TweetFeed(Feed) is already started</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="feeds">
       <compilation-unit name="stop-stopped-feed">
         <output-dir compare="Text">stop-stopped-feed</output-dir>
         <expected-error>new_experiments.TweetFeed(Feed) cannot be stopped because its state is STOPPED</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="feeds">
@@ -9724,6 +9742,7 @@
       <compilation-unit name="numeric-tinyint-overflow">
         <output-dir compare="Text">numeric-tinyint</output-dir>
         <expected-error>Numeric value (1000) out of range of Java byte</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
@@ -9745,12 +9764,14 @@
       <compilation-unit name="duplicate-fields">
         <output-dir compare="Text">duplicate-fields</output-dir>
         <expected-error>Duplicate field 'field'</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="malformed-json">
         <output-dir compare="Text">malformed-json</output-dir>
         <expected-error>Unexpected character ('}' (code 125)): was expecting double-quote to start field name</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
@@ -9762,12 +9783,14 @@
       <compilation-unit name="nonoptional-missing">
         <output-dir compare="Text">nonoptional-missing</output-dir>
         <expected-error>ASX3075: Closed field missing_value has null value</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="nonoptional-null">
         <output-dir compare="Text">nonoptional-null</output-dir>
         <expected-error>ASX3075: Closed field null_value has null value</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
@@ -9779,18 +9802,21 @@
       <compilation-unit name="spatial-line-3-points">
         <output-dir compare="Text">spatial-line-3-points</output-dir>
         <expected-error>Line must have 4 coordinates</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="spatial-polygon-unclosed">
         <output-dir compare="Text">spatial-polygon-unclosed</output-dir>
         <expected-error>Unclosed polygon is not supported</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="spatial-polygon-with-hole">
         <output-dir compare="Text">spatial-polygon-with-hole</output-dir>
         <expected-error>Only simple geometries are supported (Point, LineString and Polygon without holes)</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
@@ -9802,48 +9828,56 @@
       <compilation-unit name="type-mismatch">
         <output-dir compare="Text">type-mismatch</output-dir>
         <expected-error>ASX3054: Mismatch Type, expecting a value of type string</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="unsupported-type-circle">
         <output-dir compare="Text">unsupported-type-circle</output-dir>
         <expected-error>ASX0004: Unsupported type: org.apache.asterix.external.parser.factory.JSONDataParserFactory cannot process input type circle</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="unsupported-type-daytimeduration">
         <output-dir compare="Text">unsupported-type-daytimeduration</output-dir>
         <expected-error>ASX0004: Unsupported type: org.apache.asterix.external.parser.factory.JSONDataParserFactory cannot process input type daytimeduration</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="unsupported-type-duration">
         <output-dir compare="Text">unsupported-type-duration</output-dir>
         <expected-error>ASX0004: Unsupported type: org.apache.asterix.external.parser.factory.JSONDataParserFactory cannot process input type duration</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="unsupported-type-interval">
         <output-dir compare="Text">unsupported-type-interval</output-dir>
         <expected-error>ASX0004: Unsupported type: org.apache.asterix.external.parser.factory.JSONDataParserFactory cannot process input type interval</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="unsupported-type-multiset">
         <output-dir compare="Text">unsupported-type-multiset</output-dir>
         <expected-error>ASX0004: Unsupported type: org.apache.asterix.external.parser.factory.JSONDataParserFactory cannot process input type multiset</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="unsupported-type-point3d">
         <output-dir compare="Text">unsupported-type-point3d</output-dir>
         <expected-error>ASX0004: Unsupported type: org.apache.asterix.external.parser.factory.JSONDataParserFactory cannot process input type point3d</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
     <test-case FilePath="json-parser">
       <compilation-unit name="unsupported-type-rectangle">
         <output-dir compare="Text">unsupported-type-rectangle</output-dir>
         <expected-error>ASX0004: Unsupported type: org.apache.asterix.external.parser.factory.JSONDataParserFactory cannot process input type rectangle</expected-error>
+        <source-location>false</source-location>
       </compilation-unit>
     </test-case>
   </test-group>

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java
index b3936de..1401c0a 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMInsertDeleteOperatorNodePushable.java
@@ -28,6 +28,7 @@ import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
 import org.apache.hyracks.api.exceptions.ErrorCode;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAccessor;
 import org.apache.hyracks.dataflow.common.comm.io.FrameTupleAppender;
 import org.apache.hyracks.dataflow.common.comm.util.FrameUtils;
@@ -48,6 +49,7 @@ public class LSMInsertDeleteOperatorNodePushable extends LSMIndexInsertUpdateDel
 
     public static final String KEY_INDEX = "Index";
     private final boolean isPrimary;
+    private final SourceLocation sourceLoc;
     // This class has both lsmIndex and index (in super class) pointing to the same object
     private AbstractLSMIndex lsmIndex;
     private int i = 0;
@@ -69,10 +71,11 @@ public class LSMInsertDeleteOperatorNodePushable extends LSMIndexInsertUpdateDel
     public LSMInsertDeleteOperatorNodePushable(IHyracksTaskContext ctx, int partition, int[] fieldPermutation,
             RecordDescriptor inputRecDesc, IndexOperation op, boolean isPrimary,
             IIndexDataflowHelperFactory indexHelperFactory, IModificationOperationCallbackFactory modCallbackFactory,
-            ITupleFilterFactory tupleFilterFactory) throws HyracksDataException {
+            ITupleFilterFactory tupleFilterFactory, SourceLocation sourceLoc) throws HyracksDataException {
         super(ctx, partition, indexHelperFactory, fieldPermutation, inputRecDesc, op, modCallbackFactory,
                 tupleFilterFactory);
         this.isPrimary = isPrimary;
+        this.sourceLoc = sourceLoc;
     }
 
     @Override
@@ -138,8 +141,8 @@ public class LSMInsertDeleteOperatorNodePushable extends LSMIndexInsertUpdateDel
                         }
                         break;
                     default: {
-                        throw HyracksDataException.create(ErrorCode.INVALID_OPERATOR_OPERATION, op.toString(),
-                                LSMInsertDeleteOperatorNodePushable.class.getSimpleName());
+                        throw HyracksDataException.create(ErrorCode.INVALID_OPERATOR_OPERATION, sourceLoc,
+                                op.toString(), LSMInsertDeleteOperatorNodePushable.class.getSimpleName());
                     }
                 }
             }
@@ -147,10 +150,10 @@ public class LSMInsertDeleteOperatorNodePushable extends LSMIndexInsertUpdateDel
             if (e.getErrorCode() == ErrorCode.INVALID_OPERATOR_OPERATION) {
                 throw e;
             } else {
-                throw HyracksDataException.create(ErrorCode.ERROR_PROCESSING_TUPLE, e, i);
+                throw HyracksDataException.create(ErrorCode.ERROR_PROCESSING_TUPLE, e, sourceLoc, i);
             }
         } catch (Exception e) {
-            throw HyracksDataException.create(ErrorCode.ERROR_PROCESSING_TUPLE, e, i);
+            throw HyracksDataException.create(ErrorCode.ERROR_PROCESSING_TUPLE, e, sourceLoc, i);
         }
 
         writeBuffer.ensureFrameSize(buffer.capacity());

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMTreeInsertDeleteOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMTreeInsertDeleteOperatorDescriptor.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMTreeInsertDeleteOperatorDescriptor.java
index 6d58f6d..45661e4 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMTreeInsertDeleteOperatorDescriptor.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/dataflow/LSMTreeInsertDeleteOperatorDescriptor.java
@@ -48,7 +48,7 @@ public class LSMTreeInsertDeleteOperatorDescriptor extends LSMTreeIndexInsertUpd
             IRecordDescriptorProvider recordDescProvider, int partition, int nPartitions) throws HyracksDataException {
         RecordDescriptor inputRecDesc = recordDescProvider.getInputRecordDescriptor(getActivityId(), 0);
         return new LSMInsertDeleteOperatorNodePushable(ctx, partition, fieldPermutation, inputRecDesc, op, isPrimary,
-                indexHelperFactory, modCallbackFactory, tupleFilterFactory);
+                indexHelperFactory, modCallbackFactory, tupleFilterFactory, sourceLoc);
     }
 
     public boolean isPrimary() {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
index dc884f1..a834a06 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/AsterixException.java
@@ -21,6 +21,7 @@ package org.apache.asterix.common.exceptions;
 import java.io.Serializable;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 
 public class AsterixException extends AlgebricksException {
     private static final long serialVersionUID = 1L;
@@ -33,9 +34,12 @@ public class AsterixException extends AlgebricksException {
         super(message);
     }
 
+    public AsterixException(int errorCode, SourceLocation sourceLoc, Serializable... params) {
+        super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), sourceLoc, params);
+    }
+
     public AsterixException(int errorCode, Serializable... params) {
         super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), params);
-
     }
 
     /**
@@ -47,6 +51,11 @@ public class AsterixException extends AlgebricksException {
         super(cause);
     }
 
+    public AsterixException(int errorCode, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+        super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), sourceLoc, params);
+        addSuppressed(cause);
+    }
+
     public AsterixException(int errorCode, Throwable cause, Serializable... params) {
         super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), params);
         addSuppressed(cause);
@@ -60,6 +69,10 @@ public class AsterixException extends AlgebricksException {
         super(message, cause);
     }
 
+    public static AsterixException create(int errorCode, SourceLocation sourceLoc, Serializable... params) {
+        return new AsterixException(errorCode, sourceLoc, params);
+    }
+
     public static AsterixException create(int errorCode, Serializable... params) {
         return new AsterixException(errorCode, params);
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/CompilationException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/CompilationException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/CompilationException.java
index 693b1c0..0de6b72 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/CompilationException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/CompilationException.java
@@ -22,14 +22,23 @@ package org.apache.asterix.common.exceptions;
 import java.io.Serializable;
 
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 
 public class CompilationException extends AlgebricksException {
     private static final long serialVersionUID = 1L;
 
+    public CompilationException(int errorCode, SourceLocation sourceLoc, Serializable... params) {
+        super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), sourceLoc, params);
+    }
+
     public CompilationException(int errorCode, Serializable... params) {
         super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), params);
     }
 
+    public CompilationException(int errorCode, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+        super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), cause, sourceLoc, params);
+    }
+
     public CompilationException(int errorCode, Throwable cause, Serializable... params) {
         super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), cause, params);
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
index bd84832..55c70f2 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
@@ -150,6 +150,16 @@ public class ErrorCode {
     public static final int CANNOT_FIND_NON_MISSING_SELECT_OPERATOR = 1067;
     public static final int CANNOT_GET_CONDITIONAL_SPLIT_KEY_VARIABLE = 1068;
     public static final int CANNOT_DROP_INDEX = 1069;
+    public static final int METADATA_ERROR = 1070;
+    public static final int DATAVERSE_EXISTS = 1071;
+    public static final int DATASET_EXISTS = 1072;
+    public static final int UNDEFINED_IDENTIFIER = 1073;
+    public static final int AMBIGUOUS_IDENTIFIER = 1074;
+    public static final int FORBIDDEN_SCOPE = 1075;
+    public static final int UNKNOWN_DATASET = 1076;
+    public static final int UNKNOWN_DATASET_IN_DATAVERSE = 1077;
+    public static final int COMPILATION_UNEXPECTED_OPERATOR = 1078;
+    public static final int COMPILATION_ERROR = 1079;
 
     // Feed errors
     public static final int DATAFLOW_ILLEGAL_STATE = 3001;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
index 085f465..a735c81 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/MetadataException.java
@@ -21,6 +21,7 @@ package org.apache.asterix.common.exceptions;
 
 import java.io.Serializable;
 
+import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -62,10 +63,18 @@ public class MetadataException extends CompilationException {
         super(errorCode, params);
     }
 
+    public MetadataException(int errorCode, SourceLocation sourceLoc, Serializable... params) {
+        super(errorCode, sourceLoc, params);
+    }
+
     public MetadataException(int errorCode, Throwable cause, Serializable... params) {
         super(errorCode, cause, params);
     }
 
+    public MetadataException(int errorCode, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+        super(errorCode, cause, sourceLoc, params);
+    }
+
     public static MetadataException create(Throwable cause) {
         if (cause instanceof MetadataException || cause == null) {
             return (MetadataException) cause;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
index 85bfaa5..1c6763f 100644
--- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
+++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/RuntimeDataException.java
@@ -22,6 +22,7 @@ package org.apache.asterix.common.exceptions;
 import java.io.Serializable;
 
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 
 public class RuntimeDataException extends HyracksDataException {
     private static final long serialVersionUID = 1L;
@@ -30,7 +31,15 @@ public class RuntimeDataException extends HyracksDataException {
         super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), params);
     }
 
+    public RuntimeDataException(int errorCode, SourceLocation sourceLoc, Serializable... params) {
+        super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), null, sourceLoc, params);
+    }
+
     public RuntimeDataException(int errorCode, Throwable cause, Serializable... params) {
         super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), cause, params);
     }
+
+    public RuntimeDataException(int errorCode, Throwable cause, SourceLocation sourceLoc, Serializable... params) {
+        super(ErrorCode.ASTERIX, errorCode, ErrorCode.getErrorMessage(errorCode), cause, sourceLoc, params);
+    }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
index d62ffde..21813e3 100644
--- a/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
+++ b/asterixdb/asterix-common/src/main/resources/asx_errormsg/en.properties
@@ -137,6 +137,16 @@
 1067 = Cannot find a non-missing SELECT operator in GROUP operator for a left-outer-join plan optimization.
 1068 = Cannot get the conditional split variable for the given UNNESTMAP operator.
 1069 = Cannot drop index \"%1$s\". Drop dataset \"%1$s\" to remove this index
+1070 = Metadata error. %1$s
+1071 = A dataverse with this name %1$s already exists.
+1072 = A dataset with this name %1$s already exists.
+1073 = Cannot resolve alias reference for undefined identifier %1$s in %2$s
+1074 = Cannot resolve ambiguous alias reference for undefined identifier %1$s in %2$s
+1075 = Inside limit clauses, it is disallowed to reference a variable having the same name as any variable bound in the same scope as the limit clause.
+1076 = Cannot find dataset %1$s because there is no dataverse declared, nor an alias with name %1$s!
+1077 = Cannot find dataset %1$s in dataverse %2$s nor an alias with name %1$s!
+1078 = Unexpected operator %1$s in an OperatorExpr starting with %2$s
+1079 = %1$s
 
 # Feed Errors
 3001 = Illegal state.

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/operators/ExternalFilesIndexModificationOperatorDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/operators/ExternalFilesIndexModificationOperatorDescriptor.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/operators/ExternalFilesIndexModificationOperatorDescriptor.java
index 3bada4a..ea99993 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/operators/ExternalFilesIndexModificationOperatorDescriptor.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/operators/ExternalFilesIndexModificationOperatorDescriptor.java
@@ -89,7 +89,7 @@ public class ExternalFilesIndexModificationOperatorDescriptor extends AbstractSi
                             case NO_OP:
                                 break;
                             default:
-                                throw HyracksDataException.create(ErrorCode.UNKNOWN_EXTERNAL_FILE_PENDING_OP,
+                                throw HyracksDataException.create(ErrorCode.UNKNOWN_EXTERNAL_FILE_PENDING_OP, sourceLoc,
                                         file.getPendingOp());
                         }
                     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ParseException.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ParseException.java b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ParseException.java
index 34e3eef..333ac55 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ParseException.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/parser/ParseException.java
@@ -65,15 +65,14 @@ public class ParseException extends HyracksDataException {
     public String getMessage() {
         StringBuilder msg = new StringBuilder("Parse error");
         if (filename != null) {
-            msg.append(" in file " + filename);
+            msg.append(" in file ").append(filename);
         }
         if (line >= 0) {
+            msg.append(" in line ").append(line);
             if (column >= 0) {
-                msg.append(" at (" + line + ", " + column + ")");
-            } else {
-                msg.append(" in line " + line);
+                msg.append(", at column ").append(column);
             }
         }
-        return msg.append(": " + super.getMessage()).toString();
+        return msg.append(": ").append(super.getMessage()).toString();
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceCheckEvaluator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceCheckEvaluator.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceCheckEvaluator.java
index 4cc4975..62e4732 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceCheckEvaluator.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceCheckEvaluator.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
@@ -53,9 +54,9 @@ public class EditDistanceCheckEvaluator extends EditDistanceEvaluator {
     protected final ISerializerDeserializer<ABoolean> booleanSerde =
             SerializerDeserializerProvider.INSTANCE.getSerializerDeserializer(BuiltinType.ABOOLEAN);
 
-    public EditDistanceCheckEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws HyracksDataException {
-        super(args, context);
+    public EditDistanceCheckEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(args, context, sourceLoc);
         edThreshEval = args[2].createScalarEvaluator(context);
         listBuilder = new OrderedListBuilder();
         listItemVal = new ArrayBackedValueStorage();
@@ -110,7 +111,7 @@ public class EditDistanceCheckEvaluator extends EditDistanceEvaluator {
             }
 
             default: {
-                throw new TypeMismatchException(BuiltinFunctions.EDIT_DISTANCE_CHECK, 0, argType.serialize(),
+                throw new TypeMismatchException(sourceLoc, BuiltinFunctions.EDIT_DISTANCE_CHECK, 0, argType.serialize(),
                         ATypeTag.SERIALIZED_STRING_TYPE_TAG, ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG);
             }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
index eaf3368..d35dd89 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceContainsEvaluator.java
@@ -24,13 +24,14 @@ import org.apache.asterix.om.types.ATypeTag;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.hyracks.data.std.api.IPointable;
 
 public class EditDistanceContainsEvaluator extends EditDistanceCheckEvaluator {
 
-    public EditDistanceContainsEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws HyracksDataException {
-        super(args, context);
+    public EditDistanceContainsEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(args, context, sourceLoc);
     }
 
     @Override
@@ -51,8 +52,9 @@ public class EditDistanceContainsEvaluator extends EditDistanceCheckEvaluator {
                 return ed.getSimilarityContains(firstOrdListIter, secondOrdListIter, edThresh);
             }
             default: {
-                throw new TypeMismatchException(BuiltinFunctions.EDIT_DISTANCE_CONTAINS, 0, argType.serialize(),
-                        ATypeTag.SERIALIZED_STRING_TYPE_TAG, ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG);
+                throw new TypeMismatchException(sourceLoc, BuiltinFunctions.EDIT_DISTANCE_CONTAINS, 0,
+                        argType.serialize(), ATypeTag.SERIALIZED_STRING_TYPE_TAG,
+                        ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
index c3af387..cc103e0 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/common/EditDistanceEvaluator.java
@@ -37,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
@@ -53,6 +54,7 @@ public class EditDistanceEvaluator implements IScalarEvaluator {
     protected final IPointable argPtr2 = new VoidPointable();
     protected final IScalarEvaluator firstStringEval;
     protected final IScalarEvaluator secondStringEval;
+    protected final SourceLocation sourceLoc;
     protected final SimilarityMetricEditDistance ed = new SimilarityMetricEditDistance();
     protected final OrderedListIterator firstOrdListIter = new OrderedListIterator();
     protected final OrderedListIterator secondOrdListIter = new OrderedListIterator();
@@ -66,10 +68,11 @@ public class EditDistanceEvaluator implements IScalarEvaluator {
     protected ATypeTag firstTypeTag;
     protected ATypeTag secondTypeTag;
 
-    public EditDistanceEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
+    public EditDistanceEvaluator(IScalarEvaluatorFactory[] args, IHyracksTaskContext context, SourceLocation sourceLoc)
             throws HyracksDataException {
         firstStringEval = args[0].createScalarEvaluator(context);
         secondStringEval = args[1].createScalarEvaluator(context);
+        this.sourceLoc = sourceLoc;
     }
 
     @Override
@@ -115,7 +118,7 @@ public class EditDistanceEvaluator implements IScalarEvaluator {
                 return (int) ed.computeSimilarity(firstOrdListIter, secondOrdListIter);
             }
             default: {
-                throw new TypeMismatchException(BuiltinFunctions.EDIT_DISTANCE, 0, argType.serialize(),
+                throw new TypeMismatchException(sourceLoc, BuiltinFunctions.EDIT_DISTANCE, 0, argType.serialize(),
                         ATypeTag.SERIALIZED_STRING_TYPE_TAG, ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG);
             }
 
@@ -124,13 +127,13 @@ public class EditDistanceEvaluator implements IScalarEvaluator {
 
     protected boolean checkArgTypes(ATypeTag typeTag1, ATypeTag typeTag2) throws HyracksDataException {
         if (typeTag1 != typeTag2) {
-            throw new IncompatibleTypeException(BuiltinFunctions.EDIT_DISTANCE, typeTag1.serialize(),
+            throw new IncompatibleTypeException(sourceLoc, BuiltinFunctions.EDIT_DISTANCE, typeTag1.serialize(),
                     typeTag2.serialize());
         }
 
         // Since they are equal, check one tag is enough.
         if (typeTag1 != ATypeTag.STRING && typeTag1 != ATypeTag.ARRAY) { // could be an list
-            throw new TypeMismatchException(BuiltinFunctions.EDIT_DISTANCE, 0, typeTag1.serialize(),
+            throw new TypeMismatchException(sourceLoc, BuiltinFunctions.EDIT_DISTANCE, 0, typeTag1.serialize(),
                     ATypeTag.SERIALIZED_STRING_TYPE_TAG, ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG);
         }
 
@@ -138,12 +141,14 @@ public class EditDistanceEvaluator implements IScalarEvaluator {
             itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
                     .deserialize(argPtr1.getByteArray()[argPtr1.getStartOffset() + 1]);
             if (itemTypeTag == ATypeTag.ANY) {
-                throw new UnsupportedItemTypeException(BuiltinFunctions.EDIT_DISTANCE, itemTypeTag.serialize());
+                throw new UnsupportedItemTypeException(sourceLoc, BuiltinFunctions.EDIT_DISTANCE,
+                        itemTypeTag.serialize());
             }
             itemTypeTag = EnumDeserializer.ATYPETAGDESERIALIZER
                     .deserialize(argPtr2.getByteArray()[argPtr2.getStartOffset() + 1]);
             if (itemTypeTag == ATypeTag.ANY) {
-                throw new UnsupportedItemTypeException(BuiltinFunctions.EDIT_DISTANCE, itemTypeTag.serialize());
+                throw new UnsupportedItemTypeException(sourceLoc, BuiltinFunctions.EDIT_DISTANCE,
+                        itemTypeTag.serialize());
             }
         }
         return true;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
index e4b40b1..d803a47 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceCheckDescriptor.java
@@ -46,7 +46,7 @@ public class EditDistanceCheckDescriptor extends AbstractScalarFunctionDynamicDe
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
-                return new EditDistanceCheckEvaluator(args, ctx);
+                return new EditDistanceCheckEvaluator(args, ctx, sourceLoc);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
index 4c7c257..b6002b5 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceContainsDescriptor.java
@@ -46,7 +46,7 @@ public class EditDistanceContainsDescriptor extends AbstractScalarFunctionDynami
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
-                return new EditDistanceContainsEvaluator(args, ctx);
+                return new EditDistanceContainsEvaluator(args, ctx, sourceLoc);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
index 8c6c9ed..60c8867 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/EditDistanceDescriptor.java
@@ -46,7 +46,7 @@ public class EditDistanceDescriptor extends AbstractScalarFunctionDynamicDescrip
 
             @Override
             public IScalarEvaluator createScalarEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
-                return new EditDistanceEvaluator(args, ctx);
+                return new EditDistanceEvaluator(args, ctx, sourceLoc);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
index 17637bc..e7d582f 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenDescriptor.java
@@ -91,7 +91,7 @@ public class PrefixLenDescriptor extends AbstractScalarFunctionDynamicDescriptor
                         byte[] data = inputVal.getByteArray();
                         int offset = inputVal.getStartOffset();
                         if (data[offset] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
-                            throw new TypeMismatchException(getIdentifier(), 0, data[offset],
+                            throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data[offset],
                                     ATypeTag.SERIALIZED_INT32_TYPE_TAG);
                         }
                         int length = IntegerPointable.getInteger(data, offset + 1);
@@ -101,7 +101,7 @@ public class PrefixLenDescriptor extends AbstractScalarFunctionDynamicDescriptor
                         data = inputVal.getByteArray();
                         offset = inputVal.getStartOffset();
                         if (data[offset] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
-                            throw new TypeMismatchException(getIdentifier(), 1, data[offset],
+                            throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, data[offset],
                                     ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
                         }
                         float similarityThreshold = (float) ADoubleSerializerDeserializer.getDouble(data, offset + 1);
@@ -112,7 +112,7 @@ public class PrefixLenDescriptor extends AbstractScalarFunctionDynamicDescriptor
                         offset = inputVal.getStartOffset();
                         int len = inputVal.getLength();
                         if (data[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            throw new TypeMismatchException(getIdentifier(), 2, data[offset],
+                            throw new TypeMismatchException(sourceLoc, getIdentifier(), 2, data[offset],
                                     ATypeTag.SERIALIZED_STRING_TYPE_TAG);
                         }
                         SimilarityFilters similarityFilters =

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
index 52bd8b1..d3fc6fc 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/PrefixLenJaccardDescriptor.java
@@ -94,7 +94,7 @@ public class PrefixLenJaccardDescriptor extends AbstractScalarFunctionDynamicDes
                         byte[] data = thresholdPtr.getByteArray();
                         int offset = thresholdPtr.getStartOffset();
                         if (data[offset] != ATypeTag.SERIALIZED_FLOAT_TYPE_TAG) {
-                            throw new TypeMismatchException(getIdentifier(), 1, data[offset],
+                            throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, data[offset],
                                     ATypeTag.SERIALIZED_FLOAT_TYPE_TAG);
                         }
                         float similarityThreshold = AFloatSerializerDeserializer.getFloat(data, offset + 1);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
index 8584d06..89da0a1 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SimilarityDescriptor.java
@@ -105,7 +105,7 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
                         int offset = inputVal.getStartOffset();
 
                         if (data[offset] != ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG) {
-                            throw new TypeMismatchException(getIdentifier(), 0, data[offset],
+                            throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data[offset],
                                     ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
                         }
                         float similarityThreshold = (float) ADoubleSerializerDeserializer.getDouble(data, offset + 1);
@@ -116,7 +116,7 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
                         offset = inputVal.getStartOffset();
                         int len = inputVal.getLength();
                         if (data[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                            throw new TypeMismatchException(getIdentifier(), 1, data[offset],
+                            throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, data[offset],
                                     ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG);
                         }
                         SimilarityFilters similarityFilters =
@@ -126,7 +126,7 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
                         data = inputVal.getByteArray();
                         offset = inputVal.getStartOffset();
                         if (data[offset] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
-                            throw new TypeMismatchException(getIdentifier(), 2, data[offset],
+                            throw new TypeMismatchException(sourceLoc, getIdentifier(), 2, data[offset],
                                     ATypeTag.SERIALIZED_INT32_TYPE_TAG);
                         }
                         int length1 = IntegerPointable.getInteger(data, offset + 1);
@@ -135,7 +135,7 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
                         data = inputVal.getByteArray();
                         offset = inputVal.getStartOffset();
                         if (data[offset] != ATypeTag.SERIALIZED_INT32_TYPE_TAG) {
-                            throw new TypeMismatchException(getIdentifier(), 3, data[offset],
+                            throw new TypeMismatchException(sourceLoc, getIdentifier(), 3, data[offset],
                                     ATypeTag.SERIALIZED_INT32_TYPE_TAG);
                         }
                         int length2 = IntegerPointable.getInteger(data, offset + 1);
@@ -156,7 +156,7 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
 
                             if (serList[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
                                     && serList[offset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
-                                throw new TypeMismatchException(getIdentifier(), 4, data[offset],
+                                throw new TypeMismatchException(sourceLoc, getIdentifier(), 4, data[offset],
                                         ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG,
                                         ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG);
                             }
@@ -192,7 +192,7 @@ public class SimilarityDescriptor extends AbstractScalarFunctionDynamicDescripto
 
                             if (serList[offset] != ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG
                                     && serList[offset] != ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG) {
-                                throw new TypeMismatchException(getIdentifier(), 5, data[offset],
+                                throw new TypeMismatchException(sourceLoc, getIdentifier(), 5, data[offset],
                                         ATypeTag.SERIALIZED_ORDEREDLIST_TYPE_TAG,
                                         ATypeTag.SERIALIZED_UNORDEREDLIST_TYPE_TAG);
                             }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
index 4229f87..67e519f 100644
--- a/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
+++ b/asterixdb/asterix-fuzzyjoin/src/main/java/org/apache/asterix/runtime/evaluators/functions/SpatialIntersectDescriptor.java
@@ -122,7 +122,8 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                 offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                         if (numOfPoints1 < 3) {
-                            throw new InvalidDataFormatException(getIdentifier(), ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
+                            throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
+                                    ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                         }
 
                         int counter = 0;
@@ -231,7 +232,8 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                 offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                         if (numOfPoints1 < 3) {
-                            throw new InvalidDataFormatException(getIdentifier(), ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
+                            throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
+                                    ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                         }
                         for (int i = 0; i < numOfPoints1; i++) {
                             double startX2 = ADoubleSerializerDeserializer.getDouble(bytes1,
@@ -383,7 +385,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                         int v = middleVertex;
                         while (!foundEar) {
                             if (0 >= (nonSimplePolygonDetection--)) {
-                                throw new InvalidDataFormatException(getIdentifier(),
+                                throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
                                         ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                             }
                             int u = v;
@@ -676,7 +678,8 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                 offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                         if (numOfPoints1 < 3) {
-                            throw new InvalidDataFormatException(getIdentifier(), ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
+                            throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
+                                    ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                         }
 
                         getCounterClockWisePolygon(bytes1, offset1, pointsOffsets1, numOfPoints1);
@@ -728,7 +731,8 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                 offset0 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                         if (numOfPoints < 3) {
-                            throw new InvalidDataFormatException(getIdentifier(), ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
+                            throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
+                                    ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                         }
 
                         getCounterClockWisePolygon(bytes0, offset0, pointsOffsets0, numOfPoints);
@@ -825,7 +829,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                         res = pointInRectangle(bytes0, offset0, bytes1, offset1);
                                         break;
                                     default:
-                                        throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+                                        throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, bytes1[offset1],
                                                 ATypeTag.SERIALIZED_POINT_TYPE_TAG, ATypeTag.SERIALIZED_LINE_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_POLYGON_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG,
@@ -894,7 +898,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                         res = lineRectangleIntersection(bytes0, offset0, bytes1, offset1);
                                         break;
                                     default:
-                                        throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+                                        throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, bytes1[offset1],
                                                 ATypeTag.SERIALIZED_POINT_TYPE_TAG, ATypeTag.SERIALIZED_LINE_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_POLYGON_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG,
@@ -916,7 +920,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                                 offset1 + APolygonSerializerDeserializer.getNumberOfPointsOffset());
 
                                         if (numOfPoints0 < 3 || numOfPoints1 < 3) {
-                                            throw new InvalidDataFormatException(getIdentifier(),
+                                            throw new InvalidDataFormatException(sourceLoc, getIdentifier(),
                                                     ATypeTag.SERIALIZED_POLYGON_TYPE_TAG);
                                         }
 
@@ -987,7 +991,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                         res = rectanglePolygonIntersection(bytes1, offset1, bytes0, offset0);
                                         break;
                                     default:
-                                        throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+                                        throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, bytes1[offset1],
                                                 ATypeTag.SERIALIZED_POINT_TYPE_TAG, ATypeTag.SERIALIZED_LINE_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_POLYGON_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG,
@@ -1012,7 +1016,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                         res = rectangleCircleIntersection(bytes1, offset1, bytes0, offset0);
                                         break;
                                     default:
-                                        throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+                                        throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, bytes1[offset1],
                                                 ATypeTag.SERIALIZED_POINT_TYPE_TAG, ATypeTag.SERIALIZED_LINE_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_POLYGON_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG,
@@ -1061,7 +1065,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                         }
                                         break;
                                     default:
-                                        throw new TypeMismatchException(getIdentifier(), 1, bytes1[offset1],
+                                        throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, bytes1[offset1],
                                                 ATypeTag.SERIALIZED_POINT_TYPE_TAG, ATypeTag.SERIALIZED_LINE_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_POLYGON_TYPE_TAG,
                                                 ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG,
@@ -1069,7 +1073,7 @@ public class SpatialIntersectDescriptor extends AbstractScalarFunctionDynamicDes
                                 }
                                 break;
                             default:
-                                throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+                                throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes0[offset0],
                                         ATypeTag.SERIALIZED_POINT_TYPE_TAG, ATypeTag.SERIALIZED_LINE_TYPE_TAG,
                                         ATypeTag.SERIALIZED_POLYGON_TYPE_TAG, ATypeTag.SERIALIZED_CIRCLE_TYPE_TAG,
                                         ATypeTag.SERIALIZED_RECTANGLE_TYPE_TAG);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateDescriptor.java
index ec45877..99eaf46 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateDescriptor.java
@@ -54,7 +54,7 @@ public class STUnionAggregateDescriptor extends AbstractAggregateFunctionDynamic
 
             @Override
             public IAggregateEvaluator createAggregateEvaluator(IHyracksTaskContext ctx) throws HyracksDataException {
-                return new STUnionAggregateFunction(args, ctx);
+                return new STUnionAggregateFunction(args, ctx, sourceLoc);
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateFunction.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateFunction.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateFunction.java
index c9c2eca..41c8c5b 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateFunction.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/aggregates/STUnionAggregateFunction.java
@@ -29,6 +29,7 @@ import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.types.ATypeTag;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.EnumDeserializer;
+import org.apache.asterix.runtime.aggregates.std.AbstractAggregateFunction;
 import org.apache.asterix.runtime.exceptions.UnsupportedItemTypeException;
 import org.apache.hyracks.algebricks.runtime.base.IAggregateEvaluator;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -36,6 +37,7 @@ import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.dataflow.value.ISerializerDeserializer;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
+import org.apache.hyracks.api.exceptions.SourceLocation;
 import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.VoidPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
@@ -52,7 +54,7 @@ import java.io.IOException;
  * multilinestring is created. Is the result contains geometries of different types, e.g., points and linestring, the
  * output is a GeometryCollection.
  */
-public class STUnionAggregateFunction implements IAggregateEvaluator {
+public class STUnionAggregateFunction extends AbstractAggregateFunction {
     /**Use WGS 84 (EPSG:4326) as the default coordinate reference system*/
     public static final SpatialReference DEFAULT_CRS = SpatialReference.create(4326);
     @SuppressWarnings("unchecked")
@@ -64,8 +66,9 @@ public class STUnionAggregateFunction implements IAggregateEvaluator {
 
     private ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
 
-    public STUnionAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context)
-            throws HyracksDataException {
+    public STUnionAggregateFunction(IScalarEvaluatorFactory[] args, IHyracksTaskContext context,
+            SourceLocation sourceLoc) throws HyracksDataException {
+        super(sourceLoc);
         eval = args[0].createScalarEvaluator(context);
     }
 
@@ -110,6 +113,7 @@ public class STUnionAggregateFunction implements IAggregateEvaluator {
     }
 
     protected void processNull() throws UnsupportedItemTypeException {
-        throw new UnsupportedItemTypeException(BuiltinFunctions.ST_UNION, ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
+        throw new UnsupportedItemTypeException(sourceLoc, BuiltinFunctions.ST_UNION,
+                ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractGetValDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractGetValDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractGetValDescriptor.java
index 325b10a..65992f7 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractGetValDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractGetValDescriptor.java
@@ -31,8 +31,8 @@ public abstract class AbstractGetValDescriptor extends AbstractScalarFunctionDyn
         } else if (bytes[offset] == ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
             return AInt64SerializerDeserializer.getLong(bytes, offset + 1);
         } else {
-            throw new TypeMismatchException(getIdentifier(), 1, bytes[offset], ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG,
-                    ATypeTag.SERIALIZED_INT64_TYPE_TAG);
+            throw new TypeMismatchException(sourceLoc, getIdentifier(), 1, bytes[offset],
+                    ATypeTag.SERIALIZED_DOUBLE_TYPE_TAG, ATypeTag.SERIALIZED_INT64_TYPE_TAG);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java
index 83925a1..60f6ea4 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTDoubleGeometryDescriptor.java
@@ -95,12 +95,12 @@ public abstract class AbstractSTDoubleGeometryDescriptor extends AbstractScalarF
 
                 ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
                 if (tag != ATypeTag.GEOMETRY) {
-                    throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+                    throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes0[offset0],
                             ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
                 }
                 tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes1[offset1]);
                 if (tag != ATypeTag.GEOMETRY) {
-                    throw new TypeMismatchException(getIdentifier(), 0, bytes1[offset1],
+                    throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes1[offset1],
                             ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
                 }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java
index 62e8db9..cf1a900 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTGeometryNDescriptor.java
@@ -90,11 +90,12 @@ public abstract class AbstractSTGeometryNDescriptor extends AbstractScalarFuncti
             int offset0 = inputArg0.getStartOffset();
 
             if (data[offset] != ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG) {
-                throw new TypeMismatchException(getIdentifier(), 0, data[offset],
+                throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data[offset],
                         ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
             }
             if (data0[offset0] != ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
-                throw new TypeMismatchException(getIdentifier(), 0, data0[offset0], ATypeTag.SERIALIZED_INT64_TYPE_TAG);
+                throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data0[offset0],
+                        ATypeTag.SERIALIZED_INT64_TYPE_TAG);
             }
 
             ByteArrayInputStream inStream = new ByteArrayInputStream(data, offset + 1, len - 1);
@@ -108,7 +109,8 @@ public abstract class AbstractSTGeometryNDescriptor extends AbstractScalarFuncti
                 AGeometrySerializerDeserializer.INSTANCE.serialize(new AGeometry(geometryN), out);
                 result.set(resultStorage);
             } catch (IOException e) {
-                throw new InvalidDataFormatException(getIdentifier(), e, ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
+                throw new InvalidDataFormatException(sourceLoc, getIdentifier(), e,
+                        ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java
index 0acf731..0100261 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/AbstractSTSingleGeometryDescriptor.java
@@ -92,7 +92,7 @@ public abstract class AbstractSTSingleGeometryDescriptor extends AbstractScalarF
 
                 ATypeTag tag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes0[offset0]);
                 if (tag != ATypeTag.GEOMETRY) {
-                    throw new TypeMismatchException(getIdentifier(), 0, bytes0[offset0],
+                    throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, bytes0[offset0],
                             ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
                 }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java
index e59c3f8..75b3331 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/ParseGeoJSONDescriptor.java
@@ -116,7 +116,7 @@ public class ParseGeoJSONDescriptor extends AbstractScalarFunctionDynamicDescrip
             int len = inputArg.getLength();
 
             if (data[offset] != ATypeTag.SERIALIZED_RECORD_TYPE_TAG) {
-                throw new TypeMismatchException(BuiltinFunctions.GEOMETRY_CONSTRUCTOR, 0, data[offset],
+                throw new TypeMismatchException(sourceLoc, BuiltinFunctions.GEOMETRY_CONSTRUCTOR, 0, data[offset],
                         ATypeTag.SERIALIZED_RECORD_TYPE_TAG);
             }
             ByteArrayInputStream inStream = new ByteArrayInputStream(data, offset + 1, len - 1);
@@ -133,7 +133,8 @@ public class ParseGeoJSONDescriptor extends AbstractScalarFunctionDynamicDescrip
                 out.write(wKBGeometryBuffer);
                 result.set(resultStorage);
             } catch (IOException e) {
-                throw new InvalidDataFormatException(getIdentifier(), e, ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
+                throw new InvalidDataFormatException(sourceLoc, getIdentifier(), e,
+                        ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
             }
 
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java
index 8676600..81fa68d 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextDescriptor.java
@@ -101,7 +101,7 @@ public class STGeomFromTextDescriptor extends AbstractScalarFunctionDynamicDescr
             int len = inputArg.getLength();
 
             if (data[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                throw new TypeMismatchException(BuiltinFunctions.ST_GEOM_FROM_TEXT, 0, data[offset],
+                throw new TypeMismatchException(sourceLoc, BuiltinFunctions.ST_GEOM_FROM_TEXT, 0, data[offset],
                         ATypeTag.SERIALIZED_STRING_TYPE_TAG);
             }
             ByteArrayInputStream inStream = new ByteArrayInputStream(data, offset + 1, len - 1);
@@ -120,7 +120,8 @@ public class STGeomFromTextDescriptor extends AbstractScalarFunctionDynamicDescr
                 result.set(resultStorage);
 
             } catch (IOException e) {
-                throw new InvalidDataFormatException(getIdentifier(), e, ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
+                throw new InvalidDataFormatException(sourceLoc, getIdentifier(), e,
+                        ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
             }
 
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java
index 01f7438..42401c5 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromTextSRIDDescriptor.java
@@ -110,10 +110,12 @@ public class STGeomFromTextSRIDDescriptor extends AbstractScalarFunctionDynamicD
             int offset0 = inputArg0.getStartOffset();
 
             if (data[offset] != ATypeTag.SERIALIZED_STRING_TYPE_TAG) {
-                throw new TypeMismatchException(getIdentifier(), 0, data[offset], ATypeTag.SERIALIZED_STRING_TYPE_TAG);
+                throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data[offset],
+                        ATypeTag.SERIALIZED_STRING_TYPE_TAG);
             }
             if (data0[offset0] != ATypeTag.SERIALIZED_INT64_TYPE_TAG) {
-                throw new TypeMismatchException(getIdentifier(), 0, data0[offset0], ATypeTag.SERIALIZED_INT64_TYPE_TAG);
+                throw new TypeMismatchException(sourceLoc, getIdentifier(), 0, data0[offset0],
+                        ATypeTag.SERIALIZED_INT64_TYPE_TAG);
             }
 
             ByteArrayInputStream inStream = new ByteArrayInputStream(data, offset + 1, len - 1);
@@ -133,7 +135,8 @@ public class STGeomFromTextSRIDDescriptor extends AbstractScalarFunctionDynamicD
                 result.set(resultStorage);
 
             } catch (IOException e) {
-                throw new InvalidDataFormatException(getIdentifier(), e, ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
+                throw new InvalidDataFormatException(sourceLoc, getIdentifier(), e,
+                        ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
             }
 
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java
index ad3365e..e949b90 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STGeomFromWKBDescriptor.java
@@ -93,7 +93,7 @@ public class STGeomFromWKBDescriptor extends AbstractScalarFunctionDynamicDescri
             int len = inputArg.getLength();
 
             if (data[offset] != ATypeTag.SERIALIZED_BINARY_TYPE_TAG) {
-                throw new TypeMismatchException(BuiltinFunctions.ST_GEOM_FROM_WKB, 0, data[offset],
+                throw new TypeMismatchException(sourceLoc, BuiltinFunctions.ST_GEOM_FROM_WKB, 0, data[offset],
                         ATypeTag.SERIALIZED_BINARY_TYPE_TAG);
             }
             try {
@@ -105,7 +105,8 @@ public class STGeomFromWKBDescriptor extends AbstractScalarFunctionDynamicDescri
                 out.write(data);
                 result.set(resultStorage);
             } catch (IOException e) {
-                throw new InvalidDataFormatException(getIdentifier(), e, ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
+                throw new InvalidDataFormatException(sourceLoc, getIdentifier(), e,
+                        ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
             }
 
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/ee54cc02/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java
index efb4032..5fa6da8 100644
--- a/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java
+++ b/asterixdb/asterix-geo/src/main/java/org/apache/asterix/geo/evaluators/functions/STMakeEnvelopeDescriptorSRID.java
@@ -137,7 +137,8 @@ public class STMakeEnvelopeDescriptorSRID extends AbstractGetValDescriptor {
                 out.write(bytes);
                 result.set(resultStorage);
             } catch (IOException e) {
-                throw new InvalidDataFormatException(getIdentifier(), e, ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
+                throw new InvalidDataFormatException(sourceLoc, getIdentifier(), e,
+                        ATypeTag.SERIALIZED_GEOMETRY_TYPE_TAG);
             }
 
         }