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/11/06 18:41:49 UTC

[5/5] asterixdb git commit: [ASTERIXDB-2460][FUN] Fix sum() overflow bug

[ASTERIXDB-2460][FUN] Fix sum() overflow bug

- user model changes: yes
- storage format changes: no
- interface changes: no

Details:
- Fixed the sum() overflow problem. Now the sum() function will
return either bigint or double based on the input types.

- Added sum() aggregate local, intermediate and global classes.
Currently, it is using the same class for the three steps and
checking the type using an if statement. Although the three
steps all have a very similar behavior, having them in split
classes makes it cleaner and easier to read and maintain in the
future.

- Added sum() aggregate local, intermediate and global for serialized
classes.

- Added sum() and serial sum() test cases and modified test cases
to cause the reported overflow issue.

- Added sum() and serial sum() test cases that cause a
Long.MAX_VALUE type overflow.

- Valid data type check is now part of the sum calculation to
avoid redundant steps.

Change-Id: I987417770b3bfbda6af29a27acc8c96dc8a99eb8
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3012
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/5af85d9e
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/5af85d9e
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/5af85d9e

Branch: refs/heads/master
Commit: 5af85d9ed157ad6f942712ea5e6108ea3f1544e0
Parents: a993e9b
Author: Hussain Towaileb <Hu...@Gmail.com>
Authored: Tue Nov 6 13:12:40 2018 +0300
Committer: Dmitry Lychagin <dm...@couchbase.com>
Committed: Tue Nov 6 10:41:23 2018 -0800

----------------------------------------------------------------------
 .../serial_sum_double.1.ddl.sqlpp               |  33 +++
 .../serial_sum_double.2.update.sqlpp            |  31 +++
 .../serial_sum_double.3.query.sqlpp             |  25 ++
 .../serial_sum_double_null.1.ddl.sqlpp          |  33 +++
 .../serial_sum_double_null.2.update.sqlpp       |  31 +++
 .../serial_sum_double_null.3.query.sqlpp        |  25 ++
 .../serial_sum_empty.1.ddl.sqlpp                |  33 +++
 .../serial_sum_empty.2.update.sqlpp             |  18 ++
 .../serial_sum_empty.3.query.sqlpp              |  25 ++
 .../serial_sum_float.1.ddl.sqlpp                |  33 +++
 .../serial_sum_float.2.update.sqlpp             |  31 +++
 .../serial_sum_float.3.query.sqlpp              |  25 ++
 .../serial_sum_float_null.1.ddl.sqlpp           |  33 +++
 .../serial_sum_float_null.2.update.sqlpp        |  31 +++
 .../serial_sum_float_null.3.query.sqlpp         |  25 ++
 .../serial_sum_int16.1.ddl.sqlpp                |  33 +++
 .../serial_sum_int16.2.update.sqlpp             |  31 +++
 .../serial_sum_int16.3.query.sqlpp              |  25 ++
 .../serial_sum_int16_null.1.ddl.sqlpp           |  33 +++
 .../serial_sum_int16_null.2.update.sqlpp        |  31 +++
 .../serial_sum_int16_null.3.query.sqlpp         |  25 ++
 .../serial_sum_int32.1.ddl.sqlpp                |  33 +++
 .../serial_sum_int32.2.update.sqlpp             |  31 +++
 .../serial_sum_int32.3.query.sqlpp              |  25 ++
 .../serial_sum_int32_null.1.ddl.sqlpp           |  33 +++
 .../serial_sum_int32_null.2.update.sqlpp        |  31 +++
 .../serial_sum_int32_null.3.query.sqlpp         |  25 ++
 .../serial_sum_int64.1.ddl.sqlpp                |  33 +++
 .../serial_sum_int64.2.update.sqlpp             |  31 +++
 .../serial_sum_int64.3.query.sqlpp              |  25 ++
 .../serial_sum_int64_null.1.ddl.sqlpp           |  33 +++
 .../serial_sum_int64_null.2.update.sqlpp        |  31 +++
 .../serial_sum_int64_null.3.query.sqlpp         |  25 ++
 .../serial_sum_int64_overflow.1.ddl.sqlpp       |  33 +++
 .../serial_sum_int64_overflow.2.update.sqlpp    |  33 +++
 .../serial_sum_int64_overflow.3.query.sqlpp     |  25 ++
 .../serial_sum_int8/serial_sum_int8.1.ddl.sqlpp |  33 +++
 .../serial_sum_int8.2.update.sqlpp              |  31 +++
 .../serial_sum_int8.3.query.sqlpp               |  25 ++
 .../serial_sum_int8_null.1.ddl.sqlpp            |  33 +++
 .../serial_sum_int8_null.2.update.sqlpp         |  31 +++
 .../serial_sum_int8_null.3.query.sqlpp          |  25 ++
 .../serial_sum_mixed.1.ddl.sqlpp                |  33 +++
 .../serial_sum_mixed.2.update.sqlpp             |  29 +++
 .../serial_sum_mixed.3.query.sqlpp              |  31 +++
 .../sum_int64_overflow.1.ddl.sqlpp              |  22 ++
 .../sum_int64_overflow.2.update.sqlpp           |  19 ++
 .../sum_int64_overflow.3.query.sqlpp            |  26 ++
 .../sum_int8/sum_int8.3.query.sqlpp             |   2 +-
 .../serial_sum_double.1.ddl.sqlpp               |  33 +++
 .../serial_sum_double.2.update.sqlpp            |  31 +++
 .../serial_sum_double.3.query.sqlpp             |  25 ++
 .../serial_sum_double_null.1.ddl.sqlpp          |  33 +++
 .../serial_sum_double_null.2.update.sqlpp       |  31 +++
 .../serial_sum_double_null.3.query.sqlpp        |  25 ++
 .../serial_sum_empty.1.ddl.sqlpp                |  33 +++
 .../serial_sum_empty.2.update.sqlpp             |  18 ++
 .../serial_sum_empty.3.query.sqlpp              |  25 ++
 .../serial_sum_float.1.ddl.sqlpp                |  33 +++
 .../serial_sum_float.2.update.sqlpp             |  31 +++
 .../serial_sum_float.3.query.sqlpp              |  25 ++
 .../serial_sum_float_null.1.ddl.sqlpp           |  33 +++
 .../serial_sum_float_null.2.update.sqlpp        |  31 +++
 .../serial_sum_float_null.3.query.sqlpp         |  25 ++
 .../serial_sum_int16.1.ddl.sqlpp                |  33 +++
 .../serial_sum_int16.2.update.sqlpp             |  31 +++
 .../serial_sum_int16.3.query.sqlpp              |  25 ++
 .../serial_sum_int16_null.1.ddl.sqlpp           |  33 +++
 .../serial_sum_int16_null.2.update.sqlpp        |  31 +++
 .../serial_sum_int16_null.3.query.sqlpp         |  25 ++
 .../serial_sum_int32.1.ddl.sqlpp                |  33 +++
 .../serial_sum_int32.2.update.sqlpp             |  31 +++
 .../serial_sum_int32.3.query.sqlpp              |  25 ++
 .../serial_sum_int32_null.1.ddl.sqlpp           |  33 +++
 .../serial_sum_int32_null.2.update.sqlpp        |  31 +++
 .../serial_sum_int32_null.3.query.sqlpp         |  25 ++
 .../serial_sum_int64.1.ddl.sqlpp                |  33 +++
 .../serial_sum_int64.2.update.sqlpp             |  31 +++
 .../serial_sum_int64.3.query.sqlpp              |  25 ++
 .../serial_sum_int64_null.1.ddl.sqlpp           |  33 +++
 .../serial_sum_int64_null.2.update.sqlpp        |  31 +++
 .../serial_sum_int64_null.3.query.sqlpp         |  25 ++
 .../serial_sum_int64_overflow.1.ddl.sqlpp       |  33 +++
 .../serial_sum_int64_overflow.2.update.sqlpp    |  33 +++
 .../serial_sum_int64_overflow.3.query.sqlpp     |  25 ++
 .../serial_sum_int8/serial_sum_int8.1.ddl.sqlpp |  33 +++
 .../serial_sum_int8.2.update.sqlpp              |  31 +++
 .../serial_sum_int8.3.query.sqlpp               |  25 ++
 .../serial_sum_int8_null.1.ddl.sqlpp            |  33 +++
 .../serial_sum_int8_null.2.update.sqlpp         |  31 +++
 .../serial_sum_int8_null.3.query.sqlpp          |  25 ++
 .../serial_sum_mixed.1.ddl.sqlpp                |  33 +++
 .../serial_sum_mixed.2.update.sqlpp             |  29 +++
 .../serial_sum_mixed.3.query.sqlpp              |  30 +++
 .../sum_int64_overflow.1.ddl.sqlpp              |  22 ++
 .../sum_int64_overflow.2.update.sqlpp           |  19 ++
 .../sum_int64_overflow.3.query.sqlpp            |  26 ++
 .../aggregate/sum_int8/sum_int8.3.query.sqlpp   |   2 +-
 .../serial_sum_double/serial_sum_double.1.adm   |   1 +
 .../serial_sum_double_null.1.adm                |   1 +
 .../serial_sum_empty/serial_sum_empty.1.adm     |   0
 .../serial_sum_float/serial_sum_float.1.adm     |   1 +
 .../serial_sum_float_null.1.adm                 |   1 +
 .../serial_sum_int16/serial_sum_int16.1.adm     |   1 +
 .../serial_sum_int16_null.1.adm                 |   1 +
 .../serial_sum_int32/serial_sum_int32.1.adm     |   1 +
 .../serial_sum_int32_null.1.adm                 |   1 +
 .../serial_sum_int64/serial_sum_int64.1.adm     |   1 +
 .../serial_sum_int64_null.1.adm                 |   1 +
 .../serial_sum_int8/serial_sum_int8.1.adm       |   1 +
 .../serial_sum_int8_null.1.adm                  |   1 +
 .../serial_sum_mixed/serial_sum_mixed.1.adm     |   1 +
 .../aggregate-sql/sum_int8/sum_int8.1.adm       |   2 +-
 .../serial_sum_double/serial_sum_double.1.adm   |   1 +
 .../serial_sum_double_null.1.adm                |   1 +
 .../serial_sum_empty/serial_sum_empty.1.adm     |   0
 .../serial_sum_float/serial_sum_float.1.adm     |   1 +
 .../serial_sum_float_null.1.adm                 |   1 +
 .../serial_sum_int16/serial_sum_int16.1.adm     |   1 +
 .../serial_sum_int16_null.1.adm                 |   1 +
 .../serial_sum_int32/serial_sum_int32.1.adm     |   1 +
 .../serial_sum_int32_null.1.adm                 |   1 +
 .../serial_sum_int64/serial_sum_int64.1.adm     |   1 +
 .../serial_sum_int64_null.1.adm                 |   1 +
 .../serial_sum_int8/serial_sum_int8.1.adm       |   1 +
 .../serial_sum_int8_null.1.adm                  |   1 +
 .../serial_sum_mixed/serial_sum_mixed.1.adm     |   1 +
 .../results/aggregate/sum_int8/sum_int8.1.adm   |   2 +-
 .../explain_field_access.1.adm                  |   2 +-
 .../explain_field_access_closed.1.adm           |   2 +-
 .../aggregate-sql/sum_int8/sum_int8.3.ast       |   6 +-
 .../aggregate/sum_int8/sum_int8.3.ast           |   6 +-
 .../resources/runtimets/testsuite_sqlpp.xml     | 215 ++++++++++++++--
 .../asterix/om/functions/BuiltinFunctions.java  | 108 +++++---
 .../impl/NumericAggTypeComputer.java            |  74 ------
 .../impl/NumericSumAggTypeComputer.java         |  78 ++++++
 .../scalar/ScalarSqlSumAggregateDescriptor.java |  12 +-
 .../scalar/ScalarSumAggregateDescriptor.java    |  12 +-
 ...bstractSerializableSumAggregateFunction.java | 258 +++++++++++--------
 ...alizableGlobalSqlSumAggregateDescriptor.java |  55 ++++
 ...rializableGlobalSqlSumAggregateFunction.java |  79 ++++++
 ...erializableGlobalSumAggregateDescriptor.java |  54 ++++
 .../SerializableGlobalSumAggregateFunction.java |  81 ++++++
 ...leIntermediateSqlSumAggregateDescriptor.java |  55 ++++
 ...ableIntermediateSqlSumAggregateFunction.java |  79 ++++++
 ...zableIntermediateSumAggregateDescriptor.java |  55 ++++
 ...lizableIntermediateSumAggregateFunction.java |  81 ++++++
 ...ializableLocalSqlSumAggregateDescriptor.java |  10 +-
 ...erializableLocalSqlSumAggregateFunction.java |  82 ++++++
 ...SerializableLocalSumAggregateDescriptor.java |  12 +-
 .../SerializableLocalSumAggregateFunction.java  |  84 ++++++
 .../SerializableSqlSumAggregateDescriptor.java  |  10 +-
 .../SerializableSqlSumAggregateFunction.java    |  66 ++---
 .../std/SerializableSumAggregateDescriptor.java |  10 +-
 .../std/SerializableSumAggregateFunction.java   |  64 ++---
 .../std/AbstractSumAggregateFunction.java       | 237 +++++++++--------
 .../std/GlobalSqlSumAggregateDescriptor.java    |  53 ++++
 .../std/GlobalSqlSumAggregateFunction.java      |  81 ++++++
 .../std/GlobalSumAggregateDescriptor.java       |  53 ++++
 .../std/GlobalSumAggregateFunction.java         |  81 ++++++
 .../IntermediateSqlSumAggregateDescriptor.java  |  53 ++++
 .../IntermediateSqlSumAggregateFunction.java    |  81 ++++++
 .../std/IntermediateSumAggregateDescriptor.java |  53 ++++
 .../std/IntermediateSumAggregateFunction.java   |  81 ++++++
 .../std/LocalSqlSumAggregateDescriptor.java     |  13 +-
 .../std/LocalSqlSumAggregateFunction.java       |  84 ++++++
 .../std/LocalSumAggregateDescriptor.java        |  13 +-
 .../std/LocalSumAggregateFunction.java          |  84 ++++++
 .../std/SqlSumAggregateDescriptor.java          |  10 +-
 .../aggregates/std/SqlSumAggregateFunction.java |  66 +++--
 .../aggregates/std/SumAggregateDescriptor.java  |  10 +-
 .../aggregates/std/SumAggregateFunction.java    |  66 ++---
 .../runtime/functions/FunctionCollection.java   |  16 ++
 173 files changed, 5040 insertions(+), 568 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.1.ddl.sqlpp
new file mode 100644
index 0000000..da0bd7b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : double
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.2.update.sqlpp
new file mode 100644
index 0000000..88d820c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':double(4.32),'valplus':double(473847.0)};
+insert into Test
+select element {'id':1,'gid':1,'val':double(5.32)};
+insert into Test
+select element {'id':2,'gid':1,'val':double(6.32),'valplus':double(38473827484738239.0)};
+insert into Test
+select element {'id':3,'gid':1,'val':double(4.32),'valplus':double(678900.0)};
+insert into Test
+select element {'id':4,'gid':1,'val':double(4.32),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.3.query.sqlpp
new file mode 100644
index 0000000..4259ca2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double/serial_sum_double.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.val) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.1.ddl.sqlpp
new file mode 100644
index 0000000..da0bd7b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : double
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.2.update.sqlpp
new file mode 100644
index 0000000..88d820c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':double(4.32),'valplus':double(473847.0)};
+insert into Test
+select element {'id':1,'gid':1,'val':double(5.32)};
+insert into Test
+select element {'id':2,'gid':1,'val':double(6.32),'valplus':double(38473827484738239.0)};
+insert into Test
+select element {'id':3,'gid':1,'val':double(4.32),'valplus':double(678900.0)};
+insert into Test
+select element {'id':4,'gid':1,'val':double(4.32),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.3.query.sqlpp
new file mode 100644
index 0000000..5ed57e7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_double_null/serial_sum_double_null.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.valplus) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.1.ddl.sqlpp
new file mode 100644
index 0000000..da0bd7b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : double
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.2.update.sqlpp
new file mode 100644
index 0000000..042f3ce
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.2.update.sqlpp
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.3.query.sqlpp
new file mode 100644
index 0000000..4259ca2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_empty/serial_sum_empty.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.val) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.1.ddl.sqlpp
new file mode 100644
index 0000000..ddac6a0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : float
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.2.update.sqlpp
new file mode 100644
index 0000000..40641b5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':float('4.32'),'valplus':float('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':float('5.32')};
+insert into Test
+select element {'id':2,'gid':1,'val':float('6.32'),'valplus':float('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':float('4.32'),'valplus':float('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':float('4.32'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.3.query.sqlpp
new file mode 100644
index 0000000..4259ca2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float/serial_sum_float.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.val) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.1.ddl.sqlpp
new file mode 100644
index 0000000..ddac6a0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : float
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.2.update.sqlpp
new file mode 100644
index 0000000..40641b5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':float('4.32'),'valplus':float('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':float('5.32')};
+insert into Test
+select element {'id':2,'gid':1,'val':float('6.32'),'valplus':float('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':float('4.32'),'valplus':float('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':float('4.32'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.3.query.sqlpp
new file mode 100644
index 0000000..5ed57e7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_float_null/serial_sum_float_null.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.valplus) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.1.ddl.sqlpp
new file mode 100644
index 0000000..0c0bfee
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : smallint
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.2.update.sqlpp
new file mode 100644
index 0000000..6210af4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':smallint('4'),'valplus':smallint('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':smallint('5')};
+insert into Test
+select element {'id':2,'gid':1,'val':smallint('6'),'valplus':smallint('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':smallint('4'),'valplus':smallint('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':smallint('4'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.3.query.sqlpp
new file mode 100644
index 0000000..4259ca2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16/serial_sum_int16.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.val) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.1.ddl.sqlpp
new file mode 100644
index 0000000..0c0bfee
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : smallint
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.2.update.sqlpp
new file mode 100644
index 0000000..6210af4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':smallint('4'),'valplus':smallint('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':smallint('5')};
+insert into Test
+select element {'id':2,'gid':1,'val':smallint('6'),'valplus':smallint('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':smallint('4'),'valplus':smallint('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':smallint('4'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.3.query.sqlpp
new file mode 100644
index 0000000..5ed57e7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int16_null/serial_sum_int16_null.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.valplus) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.1.ddl.sqlpp
new file mode 100644
index 0000000..07312bf
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : integer
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.2.update.sqlpp
new file mode 100644
index 0000000..a248a0f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':integer('4'),'valplus':integer('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':integer('5')};
+insert into Test
+select element {'id':2,'gid':1,'val':integer('6'),'valplus':integer('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':integer('4'),'valplus':integer('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':integer('4'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.3.query.sqlpp
new file mode 100644
index 0000000..4259ca2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32/serial_sum_int32.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.val) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.1.ddl.sqlpp
new file mode 100644
index 0000000..07312bf
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : integer
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.2.update.sqlpp
new file mode 100644
index 0000000..a248a0f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':integer('4'),'valplus':integer('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':integer('5')};
+insert into Test
+select element {'id':2,'gid':1,'val':integer('6'),'valplus':integer('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':integer('4'),'valplus':integer('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':integer('4'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.3.query.sqlpp
new file mode 100644
index 0000000..5ed57e7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int32_null/serial_sum_int32_null.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.valplus) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.1.ddl.sqlpp
new file mode 100644
index 0000000..5e9972c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : bigint
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.2.update.sqlpp
new file mode 100644
index 0000000..b460af2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':bigint('4'),'valplus':bigint('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':bigint('5')};
+insert into Test
+select element {'id':2,'gid':1,'val':bigint('6'),'valplus':bigint('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':bigint('4'),'valplus':bigint('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':bigint('4'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.3.query.sqlpp
new file mode 100644
index 0000000..4259ca2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64/serial_sum_int64.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.val) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.1.ddl.sqlpp
new file mode 100644
index 0000000..5e9972c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : bigint
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.2.update.sqlpp
new file mode 100644
index 0000000..b460af2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':bigint('4'),'valplus':bigint('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':bigint('5')};
+insert into Test
+select element {'id':2,'gid':1,'val':bigint('6'),'valplus':bigint('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':bigint('4'),'valplus':bigint('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':bigint('4'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.3.query.sqlpp
new file mode 100644
index 0000000..5ed57e7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_null/serial_sum_int64_null.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.valplus) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.1.ddl.sqlpp
new file mode 100644
index 0000000..5e9972c
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : bigint
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.2.update.sqlpp
new file mode 100644
index 0000000..5efbe51
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.2.update.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':bigint('4'),'valplus':bigint('1')};
+insert into Test
+select element {'id':1,'gid':1,'val':bigint('5')};
+insert into Test
+select element {'id':2,'gid':1,'val':bigint('6'),'valplus':bigint('2')};
+insert into Test
+select element {'id':3,'gid':1,'val':bigint('4'),'valplus':bigint('3')};
+insert into Test
+select element {'id':4,'gid':1,'val':bigint('4'),'valplus':null};
+insert into Test
+select element {'id':5,'gid':1,'val':bigint('9223372036854775807'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.3.query.sqlpp
new file mode 100644
index 0000000..4259ca2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int64_overflow/serial_sum_int64_overflow.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.val) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.1.ddl.sqlpp
new file mode 100644
index 0000000..c45dbfe
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : tinyint
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.2.update.sqlpp
new file mode 100644
index 0000000..eb41173
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':tinyint('100'),'valplus':tinyint('100')};
+insert into Test
+select element {'id':1,'gid':1,'val':tinyint('100')};
+insert into Test
+select element {'id':2,'gid':1,'val':tinyint('90'),'valplus':tinyint('100')};
+insert into Test
+select element {'id':3,'gid':1,'val':tinyint('40'),'valplus':tinyint('100')};
+insert into Test
+select element {'id':4,'gid':1,'val':tinyint('40'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.3.query.sqlpp
new file mode 100644
index 0000000..4259ca2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8/serial_sum_int8.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.val) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.1.ddl.sqlpp
new file mode 100644
index 0000000..c45dbfe
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.1.ddl.sqlpp
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+drop  dataverse test if exists;
+create  dataverse test;
+
+use test;
+
+
+create type test.TestType as
+{
+  id : bigint,
+  gid : bigint,
+  val : tinyint
+};
+
+create  dataset Test(TestType) primary key id;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.2.update.sqlpp
new file mode 100644
index 0000000..eb41173
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.2.update.sqlpp
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+insert into Test
+select element {'id':0,'gid':1,'val':tinyint('100'),'valplus':tinyint('100')};
+insert into Test
+select element {'id':1,'gid':1,'val':tinyint('100')};
+insert into Test
+select element {'id':2,'gid':1,'val':tinyint('90'),'valplus':tinyint('100')};
+insert into Test
+select element {'id':3,'gid':1,'val':tinyint('40'),'valplus':tinyint('100')};
+insert into Test
+select element {'id':4,'gid':1,'val':tinyint('40'),'valplus':null};

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5af85d9e/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.3.query.sqlpp
new file mode 100644
index 0000000..5ed57e7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/serial_sum_int8_null/serial_sum_int8_null.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+use test;
+
+select gid, sum(t.valplus) as sum
+from Test as t
+/* +hash */
+group by t.gid as gid;