You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by mb...@apache.org on 2020/01/28 20:32:06 UTC

[asterixdb] branch master updated (00aa061 -> 80825b6)

This is an automated email from the ASF dual-hosted git repository.

mblow pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git.


    from 00aa061  [ASTERIXDB-2566][TYPE][FUN] Added complete set of is_* type functions and a generic get_type function.
     new fb1431d  [ASTERIXDB-2690][FUN] Agg Sum: skip and warn for invalid values
     new 80825b6  Merge branch 'gerrit/mad-hatter'

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../serial_sum_mixed.3.query.sqlpp                 |  2 ++
 .../sum/sum_mixed/sum_mixed.1.query.sqlpp          |  2 ++
 .../serial_sum_mixed.3.query.sqlpp                 |  2 ++
 .../sum/sum_mixed/sum_mixed.1.query.sqlpp          |  2 ++
 .../group-by/policy-05/policy-05.3.query.sqlpp     |  2 ++
 .../sum/serial_sum_mixed/serial_sum_mixed.1.adm    |  2 +-
 .../aggregate-sql/sum/sum_mixed/sum_mixed.1.adm    |  2 +-
 .../aggregate/sum/sum_mixed/sum_mixed.1.adm        |  2 +-
 .../results/group-by/policy-05/policy-05.1.adm     |  3 +++
 .../test/resources/runtimets/testsuite_sqlpp.xml   | 22 +++++++++++-----------
 .../AbstractSerializableSumAggregateFunction.java  | 18 ++++++++++++++----
 .../std/AbstractSumAggregateFunction.java          | 19 +++++++++++++++----
 .../std/GlobalSqlSumAggregateFunction.java         | 14 +++++---------
 .../aggregates/std/GlobalSumAggregateFunction.java | 13 +++++--------
 .../std/IntermediateSqlSumAggregateFunction.java   |  6 +++---
 .../std/IntermediateSumAggregateFunction.java      |  6 +++---
 .../std/LocalSqlSumAggregateFunction.java          |  6 +++---
 .../aggregates/std/LocalSumAggregateFunction.java  |  6 +++---
 .../aggregates/std/SqlSumAggregateFunction.java    | 14 +++++---------
 .../aggregates/std/SumAggregateFunction.java       | 13 +++++--------
 20 files changed, 88 insertions(+), 68 deletions(-)
 create mode 100644 asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/policy-05/policy-05.1.adm


[asterixdb] 02/02: Merge branch 'gerrit/mad-hatter'

Posted by mb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 80825b62f8f06ca1724885274fc946d7fc22f8ad
Merge: 00aa061 fb1431d
Author: Michael Blow <mb...@apache.org>
AuthorDate: Tue Jan 28 11:32:53 2020 -0500

    Merge branch 'gerrit/mad-hatter'
    
    Change-Id: I1d286ff8dda0293068e565a2ae02c4d5afb2f6fb

 .../serial_sum_mixed.3.query.sqlpp                 |  2 ++
 .../sum/sum_mixed/sum_mixed.1.query.sqlpp          |  2 ++
 .../serial_sum_mixed.3.query.sqlpp                 |  2 ++
 .../sum/sum_mixed/sum_mixed.1.query.sqlpp          |  2 ++
 .../group-by/policy-05/policy-05.3.query.sqlpp     |  2 ++
 .../sum/serial_sum_mixed/serial_sum_mixed.1.adm    |  2 +-
 .../aggregate-sql/sum/sum_mixed/sum_mixed.1.adm    |  2 +-
 .../aggregate/sum/sum_mixed/sum_mixed.1.adm        |  2 +-
 .../results/group-by/policy-05/policy-05.1.adm     |  3 +++
 .../test/resources/runtimets/testsuite_sqlpp.xml   | 22 +++++++++++-----------
 .../AbstractSerializableSumAggregateFunction.java  | 18 ++++++++++++++----
 .../std/AbstractSumAggregateFunction.java          | 19 +++++++++++++++----
 .../std/GlobalSqlSumAggregateFunction.java         | 14 +++++---------
 .../aggregates/std/GlobalSumAggregateFunction.java | 13 +++++--------
 .../std/IntermediateSqlSumAggregateFunction.java   |  6 +++---
 .../std/IntermediateSumAggregateFunction.java      |  6 +++---
 .../std/LocalSqlSumAggregateFunction.java          |  6 +++---
 .../aggregates/std/LocalSumAggregateFunction.java  |  6 +++---
 .../aggregates/std/SqlSumAggregateFunction.java    | 14 +++++---------
 .../aggregates/std/SumAggregateFunction.java       | 13 +++++--------
 20 files changed, 88 insertions(+), 68 deletions(-)

diff --cc asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
index 7beeb04,206474a..ae82628
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@@ -358,16 -338,16 +358,16 @@@
          <expected-error>Type incompatibility: function agg-stddev_pop gets incompatible input values: string and float</expected-error>
        </compilation-unit>
      </test-case>
-     <test-case FilePath="aggregate">
+     <test-case FilePath="aggregate" check-warnings="true">
 -      <compilation-unit name="sum_mixed">
 -        <output-dir compare="Text">sum_mixed</output-dir>
 +      <compilation-unit name="sum/sum_mixed">
 +        <output-dir compare="Text">sum/sum_mixed</output-dir>
-         <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error>
+         <expected-warn>Unsupported type: agg-sum cannot process input type string (in line 27, at column 16)</expected-warn>
        </compilation-unit>
      </test-case>
-     <test-case FilePath="aggregate">
+     <test-case FilePath="aggregate" check-warnings="true">
 -      <compilation-unit name="serial_sum_mixed">
 -        <output-dir compare="Text">serial_sum_mixed</output-dir>
 +      <compilation-unit name="sum/serial_sum_mixed">
 +        <output-dir compare="Text">sum/serial_sum_mixed</output-dir>
-         <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error>
+         <expected-warn>Unsupported type: agg-sum cannot process input type string (in line 29, at column 39)</expected-warn>
        </compilation-unit>
      </test-case>
      <test-case FilePath="aggregate">
@@@ -1552,16 -1532,16 +1552,16 @@@
          <expected-error>Type incompatibility: function agg-stddev_pop gets incompatible input values: string and float</expected-error>
        </compilation-unit>
      </test-case>
-     <test-case FilePath="aggregate-sql">
+     <test-case FilePath="aggregate-sql" check-warnings="true">
 -      <compilation-unit name="sum_mixed">
 -        <output-dir compare="Text">sum_mixed</output-dir>
 +      <compilation-unit name="sum/sum_mixed">
 +        <output-dir compare="Text">sum/sum_mixed</output-dir>
-         <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error>
+         <expected-warn>Unsupported type: agg-sum cannot process input type string (in line 27, at column 16)</expected-warn>
        </compilation-unit>
      </test-case>
-     <test-case FilePath="aggregate-sql">
+     <test-case FilePath="aggregate-sql" check-warnings="true">
 -      <compilation-unit name="serial_sum_mixed">
 -        <output-dir compare="Text">serial_sum_mixed</output-dir>
 +      <compilation-unit name="sum/serial_sum_mixed">
 +        <output-dir compare="Text">sum/serial_sum_mixed</output-dir>
-         <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error>
+         <expected-warn>Unsupported type: agg-sum cannot process input type string (in line 29, at column 38)</expected-warn>
        </compilation-unit>
      </test-case>
      <test-case FilePath="aggregate-sql">


[asterixdb] 01/02: [ASTERIXDB-2690][FUN] Agg Sum: skip and warn for invalid values

Posted by mb...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mblow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit fb1431d2ed148c70cae268aa0db4f5445b4098cd
Author: Hussain Towaileb <Hu...@Couchbase.com>
AuthorDate: Tue Jan 21 05:47:33 2020 +0300

    [ASTERIXDB-2690][FUN] Agg Sum: skip and warn for invalid values
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    - Currently, the aggregate sum function throws an exception
      when an invalid (non-numeric but not null or missing) value
      is encountered, this patch changes the behavior to skip
      the invalid value (treat it as null) and issue a warning.
    
    Change-Id: Ia7cde094302331d8f37670b4e6c6ce894d549154
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/4603
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Hussain Towaileb <hu...@gmail.com>
    Reviewed-by: Ali Alsuliman <al...@gmail.com>
---
 .../serial_sum_mixed.3.query.sqlpp                 |  2 ++
 .../sum_mixed/sum_mixed.3.query.sqlpp              |  2 ++
 .../serial_sum_mixed.3.query.sqlpp                 |  2 ++
 .../aggregate/sum_mixed/sum_mixed.3.query.sqlpp    |  2 ++
 .../group-by/policy-05/policy-05.3.query.sqlpp     |  2 ++
 .../serial_sum_mixed/serial_sum_mixed.1.adm        |  2 +-
 .../aggregate-sql/sum_mixed/sum_mixed.1.adm        |  2 +-
 .../results/aggregate/sum_mixed/sum_mixed.1.adm    |  2 +-
 .../results/group-by/policy-05/policy-05.1.adm     |  3 +++
 .../test/resources/runtimets/testsuite_sqlpp.xml   | 22 +++++++++++-----------
 .../AbstractSerializableSumAggregateFunction.java  | 18 ++++++++++++++----
 .../std/AbstractSumAggregateFunction.java          | 19 +++++++++++++++----
 .../std/GlobalSqlSumAggregateFunction.java         | 14 +++++---------
 .../aggregates/std/GlobalSumAggregateFunction.java | 13 +++++--------
 .../std/IntermediateSqlSumAggregateFunction.java   |  6 +++---
 .../std/IntermediateSumAggregateFunction.java      |  6 +++---
 .../std/LocalSqlSumAggregateFunction.java          |  6 +++---
 .../aggregates/std/LocalSumAggregateFunction.java  |  6 +++---
 .../aggregates/std/SqlSumAggregateFunction.java    | 14 +++++---------
 .../aggregates/std/SumAggregateFunction.java       | 13 +++++--------
 20 files changed, 88 insertions(+), 68 deletions(-)

diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp
index 36d1701..47613b7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp
@@ -22,6 +22,8 @@
  * Date         : March 5th 2018
  */
 
+-- param max-warnings:json=1000
+
 use test;
 
 select gid, array_sum((select value g.valplus from g)) as sum
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.query.sqlpp
index fed4cc9..1be93de 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_mixed/sum_mixed.3.query.sqlpp
@@ -22,6 +22,8 @@
 * Date         : Feb 7th 2014
 */
 
+-- param max-warnings:json=1000
+
 select element array_sum((
     select element x
     from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as x
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp
index 96551e2..a1e0951 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/serial_sum_mixed/serial_sum_mixed.3.query.sqlpp
@@ -22,6 +22,8 @@
  * Date         : March 5th 2018
  */
 
+-- param max-warnings:json=1000
+
 use test;
 
 select gid, strict_sum((select value g.valplus from g)) as sum
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_mixed/sum_mixed.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_mixed/sum_mixed.3.query.sqlpp
index 3c20a2c..ff48896 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_mixed/sum_mixed.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_mixed/sum_mixed.3.query.sqlpp
@@ -22,6 +22,8 @@
 * Date         : Jun 2nd 2013
 */
 
+-- param max-warnings:json=1000
+
 select element strict_sum((
     select element x
     from  [float('2.0'),'hello world',93847382783847382,date('2013-01-01')] as x
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/policy-05/policy-05.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/policy-05/policy-05.3.query.sqlpp
index 9a03c50..b20900a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/policy-05/policy-05.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/policy-05/policy-05.3.query.sqlpp
@@ -17,6 +17,8 @@
  * under the License.
  */
 
+-- param max-warnings:json=1000
+
 USE gby;
 
 FROM policies p
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_mixed/serial_sum_mixed.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_mixed/serial_sum_mixed.1.adm
index eb5581f..ad13028 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_mixed/serial_sum_mixed.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/serial_sum_mixed/serial_sum_mixed.1.adm
@@ -1 +1 @@
-{ "gid": 1, "sum": null }
+{ "gid": 1, "sum": 5.0 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/sum_mixed/sum_mixed.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/sum_mixed/sum_mixed.1.adm
index e3b97f5..799c1ac 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/sum_mixed/sum_mixed.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/sum_mixed/sum_mixed.1.adm
@@ -1 +1 @@
-[  ]
+9.3847382783847376E16
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/sum_mixed/sum_mixed.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/sum_mixed/sum_mixed.1.adm
index e3b97f5..19765bd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/sum_mixed/sum_mixed.1.adm
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/sum_mixed/sum_mixed.1.adm
@@ -1 +1 @@
-[  ]
+null
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/policy-05/policy-05.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/policy-05/policy-05.1.adm
new file mode 100644
index 0000000..2448312
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/group-by/policy-05/policy-05.1.adm
@@ -0,0 +1,3 @@
+{ "state": "AZ", "risk": 0.0 }
+{ "state": "CA", "risk": 0.0 }
+{ "state": "UT", "risk": 0.0 }
\ No newline at end of file
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 cc5d18d..206474a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -338,16 +338,16 @@
         <expected-error>Type incompatibility: function agg-stddev_pop gets incompatible input values: string and float</expected-error>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="aggregate">
+    <test-case FilePath="aggregate" check-warnings="true">
       <compilation-unit name="sum_mixed">
         <output-dir compare="Text">sum_mixed</output-dir>
-        <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error>
+        <expected-warn>Unsupported type: agg-sum cannot process input type string (in line 27, at column 16)</expected-warn>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="aggregate">
+    <test-case FilePath="aggregate" check-warnings="true">
       <compilation-unit name="serial_sum_mixed">
         <output-dir compare="Text">serial_sum_mixed</output-dir>
-        <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error>
+        <expected-warn>Unsupported type: agg-sum cannot process input type string (in line 29, at column 39)</expected-warn>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate">
@@ -1532,16 +1532,16 @@
         <expected-error>Type incompatibility: function agg-stddev_pop gets incompatible input values: string and float</expected-error>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="aggregate-sql">
+    <test-case FilePath="aggregate-sql" check-warnings="true">
       <compilation-unit name="sum_mixed">
         <output-dir compare="Text">sum_mixed</output-dir>
-        <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error>
+        <expected-warn>Unsupported type: agg-sum cannot process input type string (in line 27, at column 16)</expected-warn>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="aggregate-sql">
+    <test-case FilePath="aggregate-sql" check-warnings="true">
       <compilation-unit name="serial_sum_mixed">
         <output-dir compare="Text">serial_sum_mixed</output-dir>
-        <expected-error>Invalid item type: function agg-sum cannot process item type string in an input array</expected-error>
+        <expected-warn>Unsupported type: agg-sum cannot process input type string (in line 29, at column 38)</expected-warn>
       </compilation-unit>
     </test-case>
     <test-case FilePath="aggregate-sql">
@@ -5233,10 +5233,10 @@
         <output-dir compare="Text">policy-04</output-dir>
       </compilation-unit>
     </test-case>
-    <test-case FilePath="group-by">
+    <test-case FilePath="group-by" check-warnings="true">
       <compilation-unit name="policy-05">
-        <output-dir compare="Text">none</output-dir>
-        <expected-error>Invalid item type: function agg-sum cannot process item type object in an input array (or multiset)</expected-error>
+        <output-dir compare="Text">policy-05</output-dir>
+        <expected-warn>Unsupported type: agg-sum cannot process input type object (in line 29, at column 23)</expected-warn>
       </compilation-unit>
     </test-case>
     <test-case FilePath="group-by">
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
index cb174ee..bedfeb0 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/serializable/std/AbstractSerializableSumAggregateFunction.java
@@ -30,12 +30,12 @@ import org.apache.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeseriali
 import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
 import org.apache.asterix.om.base.AMutableDouble;
 import org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.exceptions.ExceptionUtil;
 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.exceptions.OverflowException;
-import org.apache.asterix.runtime.exceptions.UnsupportedItemTypeException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -49,6 +49,11 @@ import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public abstract class AbstractSerializableSumAggregateFunction extends AbstractSerializableAggregateFunction {
 
+    private final IEvaluatorContext context;
+
+    // Warning flag to warn only once in case of non-numeric data
+    private boolean isWarned = false;
+
     // Handles evaluating and storing/passing serialized data
     protected static final int AGG_TYPE_OFFSET = 0;
     private static final int SUM_OFFSET = 1;
@@ -77,6 +82,7 @@ public abstract class AbstractSerializableSumAggregateFunction extends AbstractS
     public AbstractSerializableSumAggregateFunction(IScalarEvaluatorFactory[] args, IEvaluatorContext context,
             SourceLocation sourceLoc) throws HyracksDataException {
         super(sourceLoc);
+        this.context = context;
         eval = args[0].createScalarEvaluator(context);
     }
 
@@ -97,6 +103,7 @@ public abstract class AbstractSerializableSumAggregateFunction extends AbstractS
         try {
             state.writeByte(ATypeTag.SERIALIZED_SYSTEM_NULL_TYPE_TAG);
             state.writeLong(0);
+            isWarned = false;
         } catch (IOException e) {
             throw HyracksDataException.create(e);
         }
@@ -114,8 +121,6 @@ public abstract class AbstractSerializableSumAggregateFunction extends AbstractS
         eval.evaluate(tuple, inputVal);
         byte[] bytes = inputVal.getByteArray();
         int offset = inputVal.getStartOffset();
-
-        // Get the data type tag
         ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(bytes[offset]);
 
         // Handle MISSING and NULL values
@@ -162,7 +167,12 @@ public abstract class AbstractSerializableSumAggregateFunction extends AbstractS
                 processSystemNull();
                 break;
             default:
-                throw new UnsupportedItemTypeException(sourceLoc, BuiltinFunctions.SUM, bytes[offset]);
+                // Issue warning only once and treat current tuple as null
+                if (!isWarned) {
+                    isWarned = true;
+                    ExceptionUtil.warnUnsupportedType(context, sourceLoc, getIdentifier().getName(), typeTag);
+                }
+                processNull(state, start);
         }
     }
 
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractSumAggregateFunction.java
index 7e78aad..c560255 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/AbstractSumAggregateFunction.java
@@ -29,12 +29,12 @@ import org.apache.asterix.dataflow.data.nontagged.serde.AInt8SerializerDeseriali
 import org.apache.asterix.formats.nontagged.SerializerDeserializerProvider;
 import org.apache.asterix.om.base.AMutableDouble;
 import org.apache.asterix.om.base.AMutableInt64;
+import org.apache.asterix.om.exceptions.ExceptionUtil;
 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.exceptions.OverflowException;
-import org.apache.asterix.runtime.exceptions.UnsupportedItemTypeException;
 import org.apache.hyracks.algebricks.core.algebra.functions.FunctionIdentifier;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluator;
@@ -49,6 +49,11 @@ import org.apache.hyracks.dataflow.common.data.accessors.IFrameTupleReference;
 
 public abstract class AbstractSumAggregateFunction extends AbstractAggregateFunction {
 
+    private final IEvaluatorContext context;
+
+    // Warning flag to warn only once in case of non-numeric data
+    private boolean isWarned = false;
+
     // Handles evaluating and storing/passing serialized data
     protected ArrayBackedValueStorage resultStorage = new ArrayBackedValueStorage();
     private IPointable inputVal = new VoidPointable();
@@ -78,6 +83,7 @@ public abstract class AbstractSumAggregateFunction extends AbstractAggregateFunc
     public AbstractSumAggregateFunction(IScalarEvaluatorFactory[] args, IEvaluatorContext context,
             SourceLocation sourceLoc) throws HyracksDataException {
         super(sourceLoc);
+        this.context = context;
         eval = args[0].createScalarEvaluator(context);
     }
 
@@ -98,6 +104,7 @@ public abstract class AbstractSumAggregateFunction extends AbstractAggregateFunc
         aggType = ATypeTag.SYSTEM_NULL;
         sumInt64 = 0;
         sumDouble = 0.0;
+        isWarned = false;
     }
 
     // Called for each incoming tuple
@@ -165,7 +172,12 @@ public abstract class AbstractSumAggregateFunction extends AbstractAggregateFunc
                 break;
             }
             default: {
-                throw new UnsupportedItemTypeException(sourceLoc, BuiltinFunctions.SUM, typeTag.serialize());
+                // Issue warning only once and treat current tuple as null
+                if (!isWarned) {
+                    isWarned = true;
+                    ExceptionUtil.warnUnsupportedType(context, sourceLoc, getIdentifier().getName(), typeTag);
+                }
+                processNull();
             }
         }
     }
@@ -236,12 +248,11 @@ public abstract class AbstractSumAggregateFunction extends AbstractAggregateFunc
                 if (isUseInt64ForResult) {
                     aInt64.setValue(sumInt64);
                     aInt64Serde.serialize(aInt64, resultStorage.getDataOutput());
-                    result.set(resultStorage);
                 } else {
                     aDouble.setValue(sumDouble);
                     aDoubleSerde.serialize(aDouble, resultStorage.getDataOutput());
-                    result.set(resultStorage);
                 }
+                result.set(resultStorage);
             }
         } catch (IOException ex) {
             throw HyracksDataException.create(ex);
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlSumAggregateFunction.java
index c854519..11f0a21 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSqlSumAggregateFunction.java
@@ -18,9 +18,7 @@
  */
 package org.apache.asterix.runtime.aggregates.std;
 
-import java.io.IOException;
-
-import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -67,15 +65,13 @@ public class GlobalSqlSumAggregateFunction extends AbstractSumAggregateFunction
 
     // Handle NULL finish
     @Override
-    protected void finishNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 
     // Handle SYSTEM_NULL finish
     @Override
-    protected void finishSystemNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishSystemNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSumAggregateFunction.java
index 79e264b..1437a10 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/GlobalSumAggregateFunction.java
@@ -18,9 +18,8 @@
  */
 package org.apache.asterix.runtime.aggregates.std;
 
-import java.io.IOException;
-
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -67,15 +66,13 @@ public class GlobalSumAggregateFunction extends AbstractSumAggregateFunction {
 
     // Handle NULL finish
     @Override
-    protected void finishNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 
     // Handle SYSTEM_NULL finish
     @Override
-    protected void finishSystemNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishSystemNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlSumAggregateFunction.java
index 94d934e..838a763 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSqlSumAggregateFunction.java
@@ -21,6 +21,7 @@ package org.apache.asterix.runtime.aggregates.std;
 import java.io.IOException;
 
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -67,9 +68,8 @@ public class IntermediateSqlSumAggregateFunction extends AbstractSumAggregateFun
 
     // Handle NULL finish
     @Override
-    protected void finishNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 
     // Handle SYSTEM_NULL finish
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSumAggregateFunction.java
index c280b33..9579cb3 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/IntermediateSumAggregateFunction.java
@@ -21,6 +21,7 @@ package org.apache.asterix.runtime.aggregates.std;
 import java.io.IOException;
 
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -67,9 +68,8 @@ public class IntermediateSumAggregateFunction extends AbstractSumAggregateFuncti
 
     // Handle NULL finish
     @Override
-    protected void finishNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 
     // Handle SYSTEM_NULL finish
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlSumAggregateFunction.java
index eddf7cf..4cc3df4 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSqlSumAggregateFunction.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 
 import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.UnsupportedItemTypeException;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -70,9 +71,8 @@ public class LocalSqlSumAggregateFunction extends AbstractSumAggregateFunction {
 
     // Handle NULL finish
     @Override
-    protected void finishNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 
     // Handle SYSTEM_NULL finish
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSumAggregateFunction.java
index f966742..09df733 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/LocalSumAggregateFunction.java
@@ -22,6 +22,7 @@ import java.io.IOException;
 
 import org.apache.asterix.om.functions.BuiltinFunctions;
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.asterix.runtime.exceptions.UnsupportedItemTypeException;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
@@ -70,9 +71,8 @@ public class LocalSumAggregateFunction extends AbstractSumAggregateFunction {
 
     // Handle NULL finish
     @Override
-    protected void finishNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 
     // Handle SYSTEM_NULL finish
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateFunction.java
index 02f5ac3..d0d4748 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SqlSumAggregateFunction.java
@@ -18,9 +18,7 @@
  */
 package org.apache.asterix.runtime.aggregates.std;
 
-import java.io.IOException;
-
-import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -67,15 +65,13 @@ public class SqlSumAggregateFunction extends AbstractSumAggregateFunction {
 
     // Handle NULL finish
     @Override
-    protected void finishNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 
     // Handle SYSTEM_NULL finish
     @Override
-    protected void finishSystemNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishSystemNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 }
diff --git a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateFunction.java b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateFunction.java
index 8833952..ba07d2a 100644
--- a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateFunction.java
+++ b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/aggregates/std/SumAggregateFunction.java
@@ -18,9 +18,8 @@
  */
 package org.apache.asterix.runtime.aggregates.std;
 
-import java.io.IOException;
-
 import org.apache.asterix.om.types.ATypeTag;
+import org.apache.asterix.runtime.evaluators.functions.PointableHelper;
 import org.apache.hyracks.algebricks.runtime.base.IEvaluatorContext;
 import org.apache.hyracks.algebricks.runtime.base.IScalarEvaluatorFactory;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -67,15 +66,13 @@ public class SumAggregateFunction extends AbstractSumAggregateFunction {
 
     // Handle NULL finish
     @Override
-    protected void finishNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 
     // Handle SYSTEM_NULL finish
     @Override
-    protected void finishSystemNull(IPointable result) throws IOException {
-        resultStorage.getDataOutput().writeByte(ATypeTag.SERIALIZED_NULL_TYPE_TAG);
-        result.set(resultStorage);
+    protected void finishSystemNull(IPointable result) {
+        PointableHelper.setNull(result);
     }
 }