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 2019/06/11 22:33:10 UTC

[asterixdb] branch master updated: [NO ISSUE][FUN] Remove unused scalar aggregates

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9e05826  [NO ISSUE][FUN] Remove unused scalar aggregates
9e05826 is described below

commit 9e05826891255fd44c7e239f37eaf39b96423fe9
Author: Dmitry Lychagin <dm...@couchbase.com>
AuthorDate: Tue Jun 11 11:05:43 2019 -0700

    [NO ISSUE][FUN] Remove unused scalar aggregates
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    - Remove unused function definitions for scalar global/local
      aggregate functions
    - Cleanup testcases for avg function
    - Removed unused testcases
    
    Change-Id: I2c1274876c884f16bcbee0e3f7aaba4d91b271ce
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/3429
    Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Dmitry Lychagin <dm...@couchbase.com>
    Reviewed-by: Ali Alsuliman <al...@gmail.com>
---
 .../avg_double/avg_double.1.ddl.sqlpp              |  11 ++
 .../avg_double/avg_double.2.update.sqlpp           |   3 +
 .../avg_double/avg_double.3.query.sqlpp            |  12 ++-
 .../avg_double/avg_double.4.query.sqlpp}           |  10 +-
 .../avg_double_null/avg_double_null.1.ddl.sqlpp    |   4 +-
 .../avg_double_null/avg_double_null.2.update.sqlpp |   3 +
 .../avg_double_null/avg_double_null.3.query.sqlpp  |  12 ++-
 .../avg_double_null/avg_double_null.4.query.sqlpp} |  12 ++-
 .../avg_empty_01/avg_empty_01.1.ddl.sqlpp          |  10 ++
 .../avg_empty_01/avg_empty_01.2.update.sqlpp       |   4 +
 .../avg_empty_01/avg_empty_01.3.query.sqlpp        |   8 +-
 .../avg_empty_02/avg_empty_02.3.query.sqlpp        |   3 +-
 .../aggregate-sql/avg_float/avg_float.1.ddl.sqlpp  |  14 +++
 .../avg_float/avg_float.2.update.sqlpp             |   3 +
 .../avg_float/avg_float.3.query.sqlpp              |  13 ++-
 .../avg_float/avg_float.4.query.sqlpp}             |  10 +-
 .../avg_float_null/avg_float_nu.2.update.sqlpp     |  19 ----
 ...t_nu.1.ddl.sqlpp => avg_float_null.1.ddl.sqlpp} |   4 +-
 ...3.query.sqlpp => avg_float_null.2.update.sqlpp} |   6 +-
 .../avg_float_null/avg_float_null.3.query.sqlpp}   |  12 ++-
 .../avg_float_null/avg_float_null.4.query.sqlpp}   |  12 ++-
 .../aggregate-sql/avg_int16/avg_int16.1.ddl.sqlpp  |  14 +++
 .../avg_int16/avg_int16.2.update.sqlpp             |   3 +
 .../avg_int16/avg_int16.3.query.sqlpp              |  13 ++-
 .../avg_int16/avg_int16.4.query.sqlpp}             |  10 +-
 .../avg_int16_null/avg_int16_null.1.ddl.sqlpp      |   4 +-
 .../avg_int16_null/avg_int16_null.2.update.sqlpp   |   3 +
 .../avg_int16_null/avg_int16_null.3.query.sqlpp    |  12 ++-
 .../avg_int16_null/avg_int16_null.4.query.sqlpp}   |  12 ++-
 .../aggregate-sql/avg_int32/avg_int32.1.ddl.sqlpp  |  14 +++
 .../avg_int32/avg_int32.2.update.sqlpp             |   3 +
 .../avg_int32/avg_int32.3.query.sqlpp              |  13 ++-
 .../avg_int32/avg_int32.4.query.sqlpp}             |  10 +-
 .../avg_int32_null/avg_int32_null.1.ddl.sqlpp      |   4 +-
 .../avg_int32_null/avg_int32_null.2.update.sqlpp   |   3 +
 .../avg_int32_null/avg_int32_null.3.query.sqlpp    |  12 ++-
 .../avg_int32_null/avg_int32_null.4.query.sqlpp}   |  12 ++-
 .../aggregate-sql/avg_int64/avg_int64.1.ddl.sqlpp  |  14 +++
 .../avg_int64/avg_int64.2.update.sqlpp             |   3 +
 .../avg_int64/avg_int64.3.query.sqlpp              |  13 ++-
 .../avg_int64/avg_int64.4.query.sqlpp}             |  10 +-
 .../avg_int64_null/avg_int64_null.1.ddl.sqlpp      |   4 +-
 .../avg_int64_null/avg_int64_null.2.update.sqlpp   |   3 +
 .../avg_int64_null/avg_int64_null.3.query.sqlpp    |  12 ++-
 .../avg_int64_null/avg_int64_null.4.query.sqlpp}   |  12 ++-
 .../aggregate-sql/avg_int8/avg_int8.1.ddl.sqlpp    |  14 +++
 .../aggregate-sql/avg_int8/avg_int8.2.update.sqlpp |   3 +
 .../aggregate-sql/avg_int8/avg_int8.3.query.sqlpp  |  13 ++-
 .../avg_int8/avg_int8.4.query.sqlpp}               |  10 +-
 .../avg_int8_null/avg_int8_null.1.ddl.sqlpp        |   4 +-
 .../avg_int8_null/avg_int8_null.2.update.sqlpp     |   3 +
 .../avg_int8_null/avg_int8_null.3.query.sqlpp      |  12 ++-
 .../avg_int8_null/avg_int8_null.4.query.sqlpp}     |  12 ++-
 .../aggregate/avg_double/avg_double.1.ddl.sqlpp    |  11 ++
 .../aggregate/avg_double/avg_double.2.update.sqlpp |   3 +
 .../aggregate/avg_double/avg_double.3.query.sqlpp  |  12 ++-
 .../avg_double.4.query.sqlpp}                      |  10 +-
 .../avg_double_null/avg_double_null.1.ddl.sqlpp    |   3 +-
 .../avg_double_null/avg_double_null.2.update.sqlpp |   3 +
 .../avg_double_null/avg_double_null.3.query.sqlpp  |  12 ++-
 .../avg_double_null.4.query.sqlpp}                 |  12 ++-
 .../avg_empty_01/avg_empty_01.1.ddl.sqlpp          |  10 ++
 .../avg_empty_01/avg_empty_01.2.update.sqlpp       |   4 +
 .../avg_empty_01/avg_empty_01.3.query.sqlpp        |   8 +-
 .../avg_empty_02/avg_empty_02.3.query.sqlpp        |   2 +-
 .../aggregate/avg_float/avg_float.1.ddl.sqlpp      |  14 +++
 .../aggregate/avg_float/avg_float.2.update.sqlpp   |   3 +
 .../aggregate/avg_float/avg_float.3.query.sqlpp    |  13 ++-
 .../avg_float.4.query.sqlpp}                       |  10 +-
 .../avg_float_null/avg_float_nu.2.update.sqlpp     |  19 ----
 ...t_nu.1.ddl.sqlpp => avg_float_null.1.ddl.sqlpp} |   3 +-
 .../avg_float_null/avg_float_null.2.update.sqlpp}  |   5 +-
 ....3.query.sqlpp => avg_float_null.3.query.sqlpp} |   7 +-
 .../avg_float_null.4.query.sqlpp}                  |  12 ++-
 .../aggregate/avg_int16/avg_int16.1.ddl.sqlpp      |  14 +++
 .../aggregate/avg_int16/avg_int16.2.update.sqlpp   |   3 +
 .../aggregate/avg_int16/avg_int16.3.query.sqlpp    |  13 ++-
 .../avg_int16.4.query.sqlpp}                       |  10 +-
 .../avg_int16_null/avg_int16_null.1.ddl.sqlpp      |   3 +-
 .../avg_int16_null/avg_int16_null.2.update.sqlpp   |   3 +
 .../avg_int16_null/avg_int16_null.3.query.sqlpp    |  12 ++-
 .../avg_int16_null.4.query.sqlpp}                  |  12 ++-
 .../aggregate/avg_int32/avg_int32.1.ddl.sqlpp      |  14 +++
 .../aggregate/avg_int32/avg_int32.2.update.sqlpp   |   3 +
 .../aggregate/avg_int32/avg_int32.3.query.sqlpp    |  13 ++-
 .../avg_int32.4.query.sqlpp}                       |  10 +-
 .../avg_int32_null/avg_int32_null.1.ddl.sqlpp      |   3 +-
 .../avg_int32_null/avg_int32_null.2.update.sqlpp   |   3 +
 .../avg_int32_null/avg_int32_null.3.query.sqlpp    |  12 ++-
 .../avg_int32_null.4.query.sqlpp}                  |  12 ++-
 .../aggregate/avg_int64/avg_int64.1.ddl.sqlpp      |  14 +++
 .../aggregate/avg_int64/avg_int64.2.update.sqlpp   |   3 +
 .../aggregate/avg_int64/avg_int64.3.query.sqlpp    |  13 ++-
 .../avg_int64.4.query.sqlpp}                       |  10 +-
 .../avg_int64_null/avg_int64_null.1.ddl.sqlpp      |   3 +-
 .../avg_int64_null/avg_int64_null.2.update.sqlpp   |   3 +
 .../avg_int64_null/avg_int64_null.3.query.sqlpp    |  12 ++-
 .../avg_int64_null.4.query.sqlpp}                  |  12 ++-
 .../aggregate/avg_int8/avg_int8.1.ddl.sqlpp        |  14 +++
 .../aggregate/avg_int8/avg_int8.2.update.sqlpp     |   3 +
 .../aggregate/avg_int8/avg_int8.3.query.sqlpp      |  13 ++-
 .../avg_int8.4.query.sqlpp}                        |  10 +-
 .../avg_int8_null/avg_int8_null.1.ddl.sqlpp        |   3 +-
 .../avg_int8_null/avg_int8_null.2.update.sqlpp     |   3 +
 .../avg_int8_null/avg_int8_null.3.query.sqlpp      |  12 ++-
 .../avg_int8_null.4.query.sqlpp}                   |  12 ++-
 .../aggregate/droptype/droptype.1.ddl.sqlpp        |  42 --------
 .../aggregate/droptype/droptype.2.update.sqlpp     |  25 -----
 .../aggregate/droptype/droptype.3.query.sqlpp      |  25 -----
 .../global-avg_01/global-avg_01.1.ddl.sqlpp        |  22 ----
 .../global-avg_01/global-avg_01.2.update.sqlpp     |  19 ----
 .../global-avg_01/global-avg_01.3.query.sqlpp      |  26 -----
 .../global-avg_null/global-avg_null.1.ddl.sqlpp    |  38 -------
 .../global-avg_null/global-avg_null.2.update.sqlpp |  19 ----
 .../global-avg_null/global-avg_null.3.query.sqlpp  |  26 -----
 .../local-avg_double/local-avg_double.1.ddl.sqlpp  |  22 ----
 .../local-avg_double.2.update.sqlpp                |  19 ----
 .../local-avg_double.3.query.sqlpp                 |  26 -----
 .../local-avg_double_null.1.ddl.sqlpp              |  38 -------
 .../local-avg_double_null.2.update.sqlpp           |  19 ----
 .../local-avg_double_null.3.query.sqlpp            |  26 -----
 .../local-avg_float/local-avg_float.1.ddl.sqlpp    |  22 ----
 .../local-avg_float/local-avg_float.2.update.sqlpp |  19 ----
 .../local-avg_float/local-avg_float.3.query.sqlpp  |  26 -----
 .../local-avg_float_null.1.ddl.sqlpp               |  38 -------
 .../local-avg_float_null.2.update.sqlpp            |  19 ----
 .../local-avg_int16/local-avg_int16.1.ddl.sqlpp    |  29 ------
 .../local-avg_int16/local-avg_int16.2.update.sqlpp |  19 ----
 .../local-avg_int16/local-avg_int16.3.query.sqlpp  |  26 -----
 .../local-avg_int16_null.1.ddl.sqlpp               |  38 -------
 .../local-avg_int16_null.2.update.sqlpp            |  19 ----
 .../local-avg_int16_null.3.query.sqlpp             |  26 -----
 .../local-avg_int32/local-avg_int32.1.ddl.sqlpp    |  22 ----
 .../local-avg_int32/local-avg_int32.2.update.sqlpp |  19 ----
 .../local-avg_int32/local-avg_int32.3.query.sqlpp  |  26 -----
 .../local-avg_int32_null.1.ddl.sqlpp               |  38 -------
 .../local-avg_int32_null.2.update.sqlpp            |  19 ----
 .../local-avg_int32_null.3.query.sqlpp             |  26 -----
 .../local-avg_int64/local-avg_int64.1.ddl.sqlpp    |  22 ----
 .../local-avg_int64/local-avg_int64.2.update.sqlpp |  19 ----
 .../local-avg_int64/local-avg_int64.3.query.sqlpp  |  26 -----
 .../local-avg_int64_null.1.ddl.sqlpp               |  38 -------
 .../local-avg_int64_null.2.update.sqlpp            |  19 ----
 .../local-avg_int64_null.3.query.sqlpp             |  26 -----
 .../local-avg_int8/local-avg_int8.1.ddl.sqlpp      |  22 ----
 .../local-avg_int8/local-avg_int8.2.update.sqlpp   |  19 ----
 .../local-avg_int8/local-avg_int8.3.query.sqlpp    |  26 -----
 .../local-avg_int8_null.1.ddl.sqlpp                |  38 -------
 .../local-avg_int8_null.2.update.sqlpp             |  19 ----
 .../local-avg_int8_null.3.query.sqlpp              |  26 -----
 .../aggregate-sql/avg_double/avg_double.1.adm      |   1 -
 .../aggregate-sql/avg_double/avg_double.3.adm      |   1 +
 .../aggregate-sql/avg_double/avg_double.4.adm      |   1 +
 .../avg_double_null.3.adm}                         |   0
 .../avg_double_null/avg_double_null.4.adm          |   1 +
 .../aggregate-sql/avg_float/avg_float.1.adm        |   1 -
 .../aggregate-sql/avg_float/avg_float.3.adm        |   1 +
 .../aggregate-sql/avg_float/avg_float.4.adm        |   1 +
 .../avg_float_null.3.adm}                          |   0
 .../avg_float_null/avg_float_null.4.adm            |   1 +
 .../aggregate-sql/avg_int16/avg_int16.1.adm        |   1 -
 .../aggregate-sql/avg_int16/avg_int16.3.adm        |   1 +
 .../aggregate-sql/avg_int16/avg_int16.4.adm        |   1 +
 .../{avg_int16_null.1.adm => avg_int16_null.3.adm} |   0
 .../avg_int16_null/avg_int16_null.4.adm            |   1 +
 .../aggregate-sql/avg_int32/avg_int32.1.adm        |   1 -
 .../aggregate-sql/avg_int32/avg_int32.3.adm        |   1 +
 .../aggregate-sql/avg_int32/avg_int32.4.adm        |   1 +
 .../{avg_int32_null.1.adm => avg_int32_null.3.adm} |   0
 .../avg_int32_null/avg_int32_null.4.adm            |   1 +
 .../aggregate-sql/avg_int64/avg_int64.1.adm        |   1 -
 .../aggregate-sql/avg_int64/avg_int64.3.adm        |   1 +
 .../aggregate-sql/avg_int64/avg_int64.4.adm        |   1 +
 .../{avg_int64_null.1.adm => avg_int64_null.3.adm} |   0
 .../avg_int64_null/avg_int64_null.4.adm            |   1 +
 .../results/aggregate-sql/avg_int8/avg_int8.1.adm  |   1 -
 .../results/aggregate-sql/avg_int8/avg_int8.3.adm  |   1 +
 .../results/aggregate-sql/avg_int8/avg_int8.4.adm  |   1 +
 .../{avg_int8_null.1.adm => avg_int8_null.3.adm}   |   0
 .../avg_int8_null/avg_int8_null.4.adm              |   1 +
 .../results/aggregate/avg_double/avg_double.1.adm  |   1 -
 .../results/aggregate/avg_double/avg_double.3.adm  |   1 +
 .../results/aggregate/avg_double/avg_double.4.adm  |   1 +
 .../avg_double_null.3.adm}                         |   0
 .../avg_double_null/avg_double_null.4.adm          |   1 +
 .../results/aggregate/avg_float/avg_float.1.adm    |   1 -
 .../results/aggregate/avg_float/avg_float.3.adm    |   1 +
 .../results/aggregate/avg_float/avg_float.4.adm    |   1 +
 .../avg_float_null.3.adm}                          |   0
 .../aggregate/avg_float_null/avg_float_null.4.adm  |   1 +
 .../results/aggregate/avg_int16/avg_int16.1.adm    |   1 -
 .../results/aggregate/avg_int16/avg_int16.3.adm    |   1 +
 .../results/aggregate/avg_int16/avg_int16.4.adm    |   1 +
 .../avg_int16_null.3.adm}                          |   0
 .../aggregate/avg_int16_null/avg_int16_null.4.adm  |   1 +
 .../results/aggregate/avg_int32/avg_int32.1.adm    |   1 -
 .../results/aggregate/avg_int32/avg_int32.3.adm    |   1 +
 .../results/aggregate/avg_int32/avg_int32.4.adm    |   1 +
 .../avg_int32_null.3.adm}                          |   0
 .../aggregate/avg_int32_null/avg_int32_null.4.adm  |   1 +
 .../results/aggregate/avg_int64/avg_int64.1.adm    |   1 -
 .../results/aggregate/avg_int64/avg_int64.3.adm    |   1 +
 .../results/aggregate/avg_int64/avg_int64.4.adm    |   1 +
 .../avg_int64_null.3.adm}                          |   0
 .../aggregate/avg_int64_null/avg_int64_null.4.adm  |   1 +
 .../results/aggregate/avg_int8/avg_int8.1.adm      |   1 -
 .../results/aggregate/avg_int8/avg_int8.3.adm      |   1 +
 .../results/aggregate/avg_int8/avg_int8.4.adm      |   1 +
 .../avg_int8_null.3.adm}                           |   0
 .../aggregate/avg_int8_null/avg_int8_null.4.adm    |   1 +
 .../aggregate/global-avg_01/global-avg_01.1.adm    |   1 -
 .../global-avg_null/global-avg_null.1.adm          |   1 -
 .../local-avg_double/local-avg_double.1.adm        |   1 -
 .../local-avg_double_null.1.adm                    |   1 -
 .../local-avg_float/local-avg_float.1.adm          |   1 -
 .../local-avg_float_null.1.adm                     |   1 -
 .../local-avg_int16/local-avg_int16.1.adm          |   1 -
 .../local-avg_int16_null.1.adm                     |   1 -
 .../local-avg_int32/local-avg_int32.1.adm          |   1 -
 .../local-avg_int32_null.1.adm                     |   1 -
 .../local-avg_int64/local-avg_int64.1.adm          |   1 -
 .../local-avg_int64_null.1.adm                     |   1 -
 .../aggregate/local-avg_int8/local-avg_int8.1.adm  |   1 -
 .../local-avg_int8_null/local-avg_int8_null.1.adm  |   1 -
 .../aggregate-sql/avg_double/avg_double.1.ast      |  12 +++
 .../aggregate-sql/avg_double/avg_double.2.ast      |   1 +
 .../aggregate-sql/avg_double/avg_double.3.ast      |  23 +++--
 .../aggregate-sql/avg_double/avg_double.4.ast      |  37 +++++++
 .../avg_double_null/avg_double_null.1.ast          |   2 +-
 .../avg_double_null/avg_double_null.2.ast          |   1 +
 .../avg_double_null/avg_double_null.4.ast          |  36 +++++++
 .../aggregate-sql/avg_empty_01/avg_empty_01.1.ast  |   8 ++
 .../aggregate-sql/avg_empty_01/avg_empty_01.2.ast  |   1 +
 .../aggregate-sql/avg_empty_01/avg_empty_01.3.ast  |  38 +++++--
 .../aggregate-sql/avg_float/avg_float.1.ast        |  13 +++
 .../aggregate-sql/avg_float/avg_float.2.ast        |   1 +
 .../aggregate-sql/avg_float/avg_float.3.ast        |  26 +++--
 .../aggregate-sql/avg_float/avg_float.4.ast        |  37 +++++++
 .../avg_float_null/avg_float_nu.2.ast              |   0
 .../{avg_float_nu.1.ast => avg_float_null.1.ast}   |   2 +-
 .../avg_float_null/avg_float_null.2.ast}           |   0
 .../{avg_float_nu.3.ast => avg_float_null.3.ast}   |   0
 .../avg_float_null/avg_float_null.4.ast            |  36 +++++++
 .../aggregate-sql/avg_int16/avg_int16.1.ast        |  13 +++
 .../aggregate-sql/avg_int16/avg_int16.2.ast        |   1 +
 .../aggregate-sql/avg_int16/avg_int16.3.ast        |  26 +++--
 .../aggregate-sql/avg_int16/avg_int16.4.ast        |  37 +++++++
 .../avg_int16_null/avg_int16_null.1.ast            |   2 +-
 .../avg_int16_null/avg_int16_null.2.ast            |   1 +
 .../avg_int16_null/avg_int16_null.4.ast            |  36 +++++++
 .../aggregate-sql/avg_int32/avg_int32.1.ast        |  13 +++
 .../aggregate-sql/avg_int32/avg_int32.2.ast        |   1 +
 .../aggregate-sql/avg_int32/avg_int32.3.ast        |  26 +++--
 .../aggregate-sql/avg_int32/avg_int32.4.ast        |  37 +++++++
 .../avg_int32_null/avg_int32_null.1.ast            |   2 +-
 .../avg_int32_null/avg_int32_null.2.ast            |   1 +
 .../avg_int32_null/avg_int32_null.4.ast            |  36 +++++++
 .../aggregate-sql/avg_int64/avg_int64.1.ast        |  13 +++
 .../aggregate-sql/avg_int64/avg_int64.2.ast        |   1 +
 .../aggregate-sql/avg_int64/avg_int64.3.ast        |  26 +++--
 .../aggregate-sql/avg_int64/avg_int64.4.ast        |  37 +++++++
 .../avg_int64_null/avg_int64_null.1.ast            |   2 +-
 .../avg_int64_null/avg_int64_null.2.ast            |   1 +
 .../avg_int64_null/avg_int64_null.4.ast            |  36 +++++++
 .../aggregate-sql/avg_int8/avg_int8.1.ast          |  13 +++
 .../aggregate-sql/avg_int8/avg_int8.2.ast          |   1 +
 .../aggregate-sql/avg_int8/avg_int8.3.ast          |  26 +++--
 .../aggregate-sql/avg_int8/avg_int8.4.ast          |  37 +++++++
 .../avg_int8_null/avg_int8_null.1.ast              |   2 +-
 .../avg_int8_null/avg_int8_null.2.ast              |   1 +
 .../avg_int8_null/avg_int8_null.4.ast              |  36 +++++++
 .../aggregate/avg_double/avg_double.1.ast          |  12 +++
 .../aggregate/avg_double/avg_double.2.ast          |   1 +
 .../aggregate/avg_double/avg_double.3.ast          |  23 +++--
 .../aggregate/avg_double/avg_double.4.ast          |  37 +++++++
 .../avg_double_null/avg_double_null.1.ast          |   2 +-
 .../avg_double_null/avg_double_null.2.ast          |   1 +
 .../avg_double_null/avg_double_null.4.ast          |  36 +++++++
 .../aggregate/avg_empty_01/avg_empty_01.1.ast      |   8 ++
 .../aggregate/avg_empty_01/avg_empty_01.2.ast      |   1 +
 .../aggregate/avg_empty_01/avg_empty_01.3.ast      |  38 +++++--
 .../aggregate/avg_float/avg_float.1.ast            |  13 +++
 .../aggregate/avg_float/avg_float.2.ast            |   1 +
 .../aggregate/avg_float/avg_float.3.ast            |  26 +++--
 .../aggregate/avg_float/avg_float.4.ast            |  37 +++++++
 .../aggregate/avg_float_null/avg_float_nu.2.ast    |   0
 .../{avg_float_nu.1.ast => avg_float_null.1.ast}   |   2 +-
 .../avg_float_null.2.ast}                          |   0
 .../{avg_float_nu.3.ast => avg_float_null.3.ast}   |   0
 .../aggregate/avg_float_null/avg_float_null.4.ast  |  36 +++++++
 .../aggregate/avg_int16/avg_int16.1.ast            |  13 +++
 .../aggregate/avg_int16/avg_int16.2.ast            |   1 +
 .../aggregate/avg_int16/avg_int16.3.ast            |  26 +++--
 .../aggregate/avg_int16/avg_int16.4.ast            |  37 +++++++
 .../aggregate/avg_int16_null/avg_int16_null.1.ast  |   2 +-
 .../aggregate/avg_int16_null/avg_int16_null.2.ast  |   1 +
 .../aggregate/avg_int16_null/avg_int16_null.3.ast  |   1 +
 .../aggregate/avg_int16_null/avg_int16_null.4.ast  |  36 +++++++
 .../aggregate/avg_int32/avg_int32.1.ast            |  13 +++
 .../aggregate/avg_int32/avg_int32.2.ast            |   1 +
 .../aggregate/avg_int32/avg_int32.3.ast            |  20 +++-
 .../aggregate/avg_int32/avg_int32.4.ast            |  37 +++++++
 .../aggregate/avg_int32_null/avg_int32_null.1.ast  |   2 +-
 .../aggregate/avg_int32_null/avg_int32_null.2.ast  |   1 +
 .../aggregate/avg_int32_null/avg_int32_null.3.ast  |   1 +
 .../aggregate/avg_int32_null/avg_int32_null.4.ast  |  36 +++++++
 .../aggregate/avg_int64/avg_int64.1.ast            |  13 +++
 .../aggregate/avg_int64/avg_int64.2.ast            |   1 +
 .../aggregate/avg_int64/avg_int64.3.ast            |  26 +++--
 .../aggregate/avg_int64/avg_int64.4.ast            |  37 +++++++
 .../aggregate/avg_int64_null/avg_int64_null.1.ast  |   2 +-
 .../aggregate/avg_int64_null/avg_int64_null.2.ast  |   1 +
 .../aggregate/avg_int64_null/avg_int64_null.3.ast  |   1 +
 .../aggregate/avg_int64_null/avg_int64_null.4.ast  |  36 +++++++
 .../aggregate/avg_int8/avg_int8.1.ast              |  13 +++
 .../aggregate/avg_int8/avg_int8.2.ast              |   1 +
 .../aggregate/avg_int8/avg_int8.3.ast              |  26 +++--
 .../aggregate/avg_int8/avg_int8.4.ast              |  37 +++++++
 .../aggregate/avg_int8_null/avg_int8_null.1.ast    |   2 +-
 .../aggregate/avg_int8_null/avg_int8_null.2.ast    |   1 +
 .../aggregate/avg_int8_null/avg_int8_null.4.ast    |  36 +++++++
 .../test/resources/runtimets/testsuite_sqlpp.xml   |  81 ---------------
 .../asterix/om/functions/BuiltinFunctions.java     | 112 ---------------------
 323 files changed, 2017 insertions(+), 1759 deletions(-)

diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.1.ddl.sqlpp
index ad97753..6b04b1a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.1.ddl.sqlpp
@@ -22,4 +22,15 @@ create  dataverse test;
 
 use test;
 
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
 
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.3.query.sqlpp
index 9c8daf3..e518caf 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.3.query.sqlpp
@@ -17,7 +17,15 @@
  * under the License.
  */
 
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
+
+use test;
+
 select element array_avg((
-    select element x
-    from  [1.0,2.0,double('3.0')] as x
+  select element x.doubleField
+  from  Numeric as x
+  where x.doubleField is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.4.query.sqlpp
index 2ae248a..da41f91 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value array_avg((from w select value w.x.doubleField)) over w as ()
+from Numeric as x
+where x.doubleField is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.1.ddl.sqlpp
index 3f2c5bf..6b04b1a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : integer,
@@ -34,5 +33,4 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.query.sqlpp
index 8d2b48d..2c344dd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.3.query.sqlpp
@@ -17,10 +17,16 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-{'average':test.array_avg((
+{'average':
+  array_avg((
     select element x.doubleField
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.4.query.sqlpp
index 2ae248a..33caa8d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double_null/avg_double_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value array_avg((from w select value w.x.doubleField)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ddl.sqlpp
index a6590c5..4a37cf0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ddl.sqlpp
@@ -25,3 +25,13 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+
+create type test.TestType as
+ closed {
+  id : integer,
+  val : double
+};
+
+create  dataset Test(TestType) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.update.sqlpp
index 06819ab..3bf5c0d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.update.sqlpp
@@ -22,3 +22,7 @@
  * Success        : Yes
  */
 
+use test;
+
+insert into Test
+select element {'id':0,'val':1.0};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.query.sqlpp
index ff74000..2f1c638 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.query.sqlpp
@@ -24,9 +24,5 @@
 
 use test;
 
-
-select element test.array_avg((
-    select element x
-    from  [1,2,3] as x
-    where (x > 10)
-));
+select value array_avg((from w where w.x.val < 0 select value w.x.val)) over w as ()
+from Test as x;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.query.sqlpp
index e2782ec..1925c08 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_empty_02/avg_empty_02.3.query.sqlpp
@@ -24,8 +24,7 @@
 
 use test;
 
-
-select element test.array_avg((
+select element array_avg((
     select element x.val
     from  Test as x
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.1.ddl.sqlpp
index 21479a2..6b04b1a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.3.query.sqlpp
index 1d6bc90..bcfe742 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.array_avg((
-    select element x
-    from  [test.float('1'),test.float('2'),test.float('3')] as x
+select element array_avg((
+  select element x.floatField
+  from  Numeric as x
+  where x.floatField is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.4.query.sqlpp
index 2ae248a..48681e0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float/avg_float.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value array_avg((from w select value w.x.floatField)) over w as ()
+from Numeric as x
+where x.floatField is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.1.ddl.sqlpp
similarity index 88%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.1.ddl.sqlpp
index 6788afc..9af403d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : bigint,
@@ -34,5 +33,4 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.2.update.sqlpp
similarity index 88%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.2.update.sqlpp
index 40dd090..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.2.update.sqlpp
@@ -19,8 +19,4 @@
 
 use test;
 
-
-{'average':test.array_avg((
-    select element x.floatField
-    from  Numeric as x
-))};
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float_null/local-avg_float_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.3.query.sqlpp
similarity index 87%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float_null/local-avg_float_null.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.3.query.sqlpp
index dc1b5cc..046119b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float_null/local-avg_float_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.3.query.sqlpp
@@ -17,10 +17,16 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.`local-avg`((
+{'average':
+  array_avg((
     select element x.floatField
     from  Numeric as x
-));
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.4.query.sqlpp
index 2ae248a..bf39414 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_float_null/avg_float_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value array_avg((from w select value w.x.floatField)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.1.ddl.sqlpp
index 21479a2..6b04b1a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.3.query.sqlpp
index 1ccd597..87d2262 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.array_avg((
-    select element x
-    from  [test.smallint('1'),test.smallint('2'),test.smallint('3')] as x
+select element array_avg((
+  select element x.int16Field
+  from  Numeric as x
+  where x.int16Field is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.4.query.sqlpp
index 2ae248a..6a03b41 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16/avg_int16.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value array_avg((from w select value w.x.int16Field)) over w as ()
+from Numeric as x
+where x.int16Field is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.1.ddl.sqlpp
index 6788afc..9af403d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : bigint,
@@ -34,5 +33,4 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.query.sqlpp
index 69119d7..7dde655 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.3.query.sqlpp
@@ -17,10 +17,16 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-{'average':test.array_avg((
+{'average':
+  array_avg((
     select element x.int16Field
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.4.query.sqlpp
index 2ae248a..a2cc134 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value array_avg((from w select value w.x.int16Field)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.1.ddl.sqlpp
index 21479a2..6b04b1a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.3.query.sqlpp
index 335e437..43297b3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.array_avg((
-    select element x
-    from  [test.integer('1'),test.integer('2'),test.integer('3')] as x
+select element array_avg((
+  select element x.int32Field
+  from  Numeric as x
+  where x.int32Field is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.4.query.sqlpp
index 2ae248a..b739e40 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32/avg_int32.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value array_avg((from w select value w.x.int32Field)) over w as ()
+from Numeric as x
+where x.int32Field is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.1.ddl.sqlpp
index 6788afc..9af403d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : bigint,
@@ -34,5 +33,4 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.query.sqlpp
index 466ab1e..bf87edc 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.3.query.sqlpp
@@ -17,10 +17,16 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-{'average':test.array_avg((
+{'average':
+  array_avg((
     select element x.int32Field
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.4.query.sqlpp
index 2ae248a..632b4df 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value array_avg((from w select value w.x.int32Field)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.1.ddl.sqlpp
index 21479a2..6b04b1a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.3.query.sqlpp
index d6e9502..0c31da8 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.array_avg((
-    select element x
-    from  [test.bigint('1'),test.bigint('2'),test.bigint('3')] as x
+select element array_avg((
+  select element x.int64Field
+  from  Numeric as x
+  where x.int64Field is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.4.query.sqlpp
index 2ae248a..2a4454b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64/avg_int64.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value array_avg((from w select value w.x.int64Field)) over w as ()
+from Numeric as x
+where x.int64Field is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.1.ddl.sqlpp
index 6788afc..9af403d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : bigint,
@@ -34,5 +33,4 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.query.sqlpp
index 074e9d2..a5acb50 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.3.query.sqlpp
@@ -17,10 +17,16 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-{'average':test.array_avg((
+{'average':
+  array_avg((
     select element x.int64Field
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.4.query.sqlpp
index 2ae248a..1dd667e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value array_avg((from w select value w.x.int64Field)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.1.ddl.sqlpp
index 21479a2..6b04b1a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.3.query.sqlpp
index 1544c70..3ac7823 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.array_avg((
-    select element x
-    from  [test.tinyint('1'),test.tinyint('2'),test.tinyint('3')] as x
+select element array_avg((
+  select element x.int8Field
+  from  Numeric as x
+  where x.int8Field is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.4.query.sqlpp
index 2ae248a..61694c3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8/avg_int8.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value array_avg((from w select value w.x.int8Field)) over w as ()
+from Numeric as x
+where x.int8Field is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.1.ddl.sqlpp
index 6788afc..9af403d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : bigint,
@@ -34,5 +33,4 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
+create internal dataset Numeric(NumericType) primary key id;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.query.sqlpp
index 19ad97c..af479c4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.3.query.sqlpp
@@ -17,10 +17,16 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests array_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-{'average':test.array_avg((
+{'average':
+  array_avg((
     select element x.int8Field
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.4.query.sqlpp
index 2ae248a..893870b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests array_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value array_avg((from w select value w.x.int8Field)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.1.ddl.sqlpp
index ad97753..c8ea344 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.1.ddl.sqlpp
@@ -22,4 +22,15 @@ create  dataverse test;
 
 use test;
 
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
 
+create internal dataset Numeric(NumericType) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.3.query.sqlpp
index a10da57..dc83c4a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.3.query.sqlpp
@@ -17,7 +17,15 @@
  * under the License.
  */
 
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
+
+use test;
+
 select element strict_avg((
-    select element x
-    from  [1.0,2.0,double('3.0')] as x
+  select element x.doubleField
+  from  Numeric as x
+  where x.doubleField is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.4.query.sqlpp
index 2ae248a..ea825c0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double/avg_double.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value strict_avg((from w select value w.x.doubleField)) over w as ()
+from Numeric as x
+where x.doubleField is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.1.ddl.sqlpp
index 3f2c5bf..ffaf2f3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : integer,
@@ -34,5 +33,5 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+create internal dataset Numeric(NumericType) primary key id;
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.3.query.sqlpp
index a6a4537..83a99bd 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.3.query.sqlpp
@@ -17,10 +17,16 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-{'average':test.strict_avg((
+{'average':
+  strict_avg((
     select element x.doubleField
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.4.query.sqlpp
index 2ae248a..997d859 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_double_null/avg_double_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value strict_avg((from w select value w.x.doubleField)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
index 2ae248a..9d87f72 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
@@ -25,3 +25,13 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+
+create type test.TestType as
+ closed {
+  id : integer,
+  val : double
+};
+
+create  dataset Test(TestType) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.2.update.sqlpp
index cf6e09b..13e3948 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.2.update.sqlpp
@@ -22,3 +22,7 @@
  * Success        : Yes
  */
 
+use test;
+
+insert into Test
+select element {'id':0,'val':1.0};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.query.sqlpp
index 05d6092..4cbd378 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.query.sqlpp
@@ -24,9 +24,5 @@
 
 use test;
 
-
-select element test.strict_avg((
-    select element x
-    from  [1,2,3] as x
-    where (x > 10)
-));
+select value strict_avg((from w where w.x.val < 0 select value w.x.val)) over w as ()
+from Test as x;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.query.sqlpp
index 7eb6e35..f158e4c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_02/avg_empty_02.3.query.sqlpp
@@ -25,7 +25,7 @@
 use test;
 
 
-select element test.strict_avg((
+select element strict_avg((
     select element x.val
     from  Test as x
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.1.ddl.sqlpp
index 21479a2..c8ea344 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.3.query.sqlpp
index c13d9a1..e310bd0 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.strict_avg((
-    select element x
-    from  [test.float('1'),test.float('2'),test.float('3')] as x
+select element strict_avg((
+  select element x.floatField
+  from  Numeric as x
+  where x.floatField is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.4.query.sqlpp
index 2ae248a..70f9e81 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float/avg_float.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value strict_avg((from w select value w.x.floatField)) over w as ()
+from Numeric as x
+where x.floatField is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.1.ddl.sqlpp
similarity index 88%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.1.ddl.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.1.ddl.sqlpp
index 3f2c5bf..ffaf2f3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : integer,
@@ -34,5 +33,5 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+create internal dataset Numeric(NumericType) primary key id;
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.2.update.sqlpp
similarity index 88%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.2.update.sqlpp
index ad97753..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_double/avg_double.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.2.update.sqlpp
@@ -17,9 +17,6 @@
  * under the License.
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
-
 use test;
 
-
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.3.query.sqlpp
similarity index 96%
rename from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.3.query.sqlpp
rename to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.3.query.sqlpp
index a694993..5949be4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_nu.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.3.query.sqlpp
@@ -19,8 +19,9 @@
 
 use test;
 
-
-{'average':test.strict_avg((
+{'average':
+  strict_avg((
     select element x.floatField
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.4.query.sqlpp
index 2ae248a..14f8140 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_float_null/avg_float_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value strict_avg((from w select value w.x.floatField)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.1.ddl.sqlpp
index 21479a2..c8ea344 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.3.query.sqlpp
index 90f54cf..9bda5a3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.strict_avg((
-    select element x
-    from  [test.smallint('1'),test.smallint('2'),test.smallint('3')] as x
+select element strict_avg((
+  select element x.int16Field
+  from  Numeric as x
+  where x.int16Field is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.4.query.sqlpp
index 2ae248a..afc8956 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16/avg_int16.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value strict_avg((from w select value w.x.int16Field)) over w as ()
+from Numeric as x
+where x.int16Field is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.1.ddl.sqlpp
index 3f2c5bf..ffaf2f3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : integer,
@@ -34,5 +33,5 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+create internal dataset Numeric(NumericType) primary key id;
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.query.sqlpp
index 4e2e8c4..9c77826 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.query.sqlpp
@@ -19,8 +19,16 @@
 
 use test;
 
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
+
+use test;
 
-{'average':test.strict_avg((
+{'average':
+  strict_avg((
     select element x.int16Field
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.4.query.sqlpp
index 2ae248a..feb1e3f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int16_null/avg_int16_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value strict_avg((from w select value w.x.int16Field)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.1.ddl.sqlpp
index 21479a2..c8ea344 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.3.query.sqlpp
index d52ebde..b5e1277 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.strict_avg((
-    select element x
-    from  [1,2,3] as x
+select element strict_avg((
+  select element x.int32Field
+  from  Numeric as x
+  where x.int32Field is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.4.query.sqlpp
index 2ae248a..e2c3188 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32/avg_int32.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value strict_avg((from w select value w.x.int32Field)) over w as ()
+from Numeric as x
+where x.int32Field is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.1.ddl.sqlpp
index 3f2c5bf..ffaf2f3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : integer,
@@ -34,5 +33,5 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+create internal dataset Numeric(NumericType) primary key id;
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.query.sqlpp
index 34c5c68..926a21a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.query.sqlpp
@@ -19,8 +19,16 @@
 
 use test;
 
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
+
+use test;
 
-{'average':test.strict_avg((
+{'average':
+  strict_avg((
     select element x.int32Field
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.4.query.sqlpp
index 2ae248a..a294bf7 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int32_null/avg_int32_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value strict_avg((from w select value w.x.int32Field)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.1.ddl.sqlpp
index 21479a2..c8ea344 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.3.query.sqlpp
index 5afa4e6..c57600b 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.strict_avg((
-    select element x
-    from  [test.bigint('1'),test.bigint('2'),test.bigint('3')] as x
+select element strict_avg((
+  select element x.int64Field
+  from  Numeric as x
+  where x.int64Field is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.4.query.sqlpp
index 2ae248a..eb2a3c6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64/avg_int64.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value strict_avg((from w select value w.x.int64Field)) over w as ()
+from Numeric as x
+where x.int64Field is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.1.ddl.sqlpp
index 3f2c5bf..ffaf2f3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : integer,
@@ -34,5 +33,5 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+create internal dataset Numeric(NumericType) primary key id;
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.query.sqlpp
index 230913f..b4cce71 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.query.sqlpp
@@ -19,8 +19,16 @@
 
 use test;
 
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
+
+use test;
 
-{'average':test.strict_avg((
+{'average':
+  strict_avg((
     select element x.int64Field
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.4.query.sqlpp
index 2ae248a..17c7594 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int64_null/avg_int64_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value strict_avg((from w select value w.x.int64Field)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.1.ddl.sqlpp
index 21479a2..c8ea344 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.1.ddl.sqlpp
@@ -20,3 +20,17 @@
 drop  dataverse test if exists;
 create  dataverse test;
 
+use test;
+
+create type test.NumericType as
+{
+  id : integer,
+  int8Field : tinyint?,
+  int16Field : smallint?,
+  int32Field : integer?,
+  int64Field : bigint?,
+  floatField : float?,
+  doubleField : double?
+};
+
+create internal dataset Numeric(NumericType) primary key id;
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.3.query.sqlpp
index 57ffb31..8ca4c6f 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.3.query.sqlpp
@@ -17,10 +17,15 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-select element test.strict_avg((
-    select element x
-    from  [test.tinyint('1'),test.tinyint('2'),test.tinyint('3')] as x
+select element strict_avg((
+  select element x.int8Field
+  from  Numeric as x
+  where x.int8Field is known
 ));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.4.query.sqlpp
index 2ae248a..dcec7a6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8/avg_int8.4.query.sqlpp
@@ -16,12 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+select distinct value strict_avg((from w select value w.x.int8Field)) over w as ()
+from Numeric as x
+where x.int8Field is known;
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.1.ddl.sqlpp
index 3f2c5bf..ffaf2f3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.1.ddl.sqlpp
@@ -22,7 +22,6 @@ create  dataverse test;
 
 use test;
 
-
 create type test.NumericType as
 {
   id : integer,
@@ -34,5 +33,5 @@ create type test.NumericType as
   doubleField : double?
 };
 
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
+create internal dataset Numeric(NumericType) primary key id;
 
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.2.update.sqlpp
index bd244d0..1e98405 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.2.update.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.2.update.sqlpp
@@ -17,3 +17,6 @@
  * under the License.
  */
 
+use test;
+
+load dataset Numeric using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.query.sqlpp
index 64b91ea..3d4f6db 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.query.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.3.query.sqlpp
@@ -17,10 +17,16 @@
  * under the License.
  */
 
-use test;
+/*
+ * Description    : Tests strict_avg() with aggregate combiner
+ * Success        : Yes
+ */
 
+use test;
 
-{'average':test.strict_avg((
+{'average':
+  strict_avg((
     select element x.int8Field
     from  Numeric as x
-))};
+  ))
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.4.query.sqlpp
similarity index 80%
copy from asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
copy to asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.4.query.sqlpp
index 2ae248a..9ba0d92 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ddl.sqlpp
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_int8_null/avg_int8_null.4.query.sqlpp
@@ -16,12 +16,16 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 /*
- * Description    : Tests that avg aggregation correctly returns null for an empty stream,
- *                  without an aggregate combiner.
+ * Description    : Tests strict_avg() without aggregate combiner
  * Success        : Yes
  */
 
-drop  dataverse test if exists;
-create  dataverse test;
+use test;
 
+{'average': (
+    select distinct value strict_avg((from w select value w.x.int8Field)) over w as ()
+    from Numeric as x
+  )
+};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/droptype/droptype.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/droptype/droptype.1.ddl.sqlpp
deleted file mode 100644
index 4417460..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/droptype/droptype.1.ddl.sqlpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-/*
- * Description  : Test to cover =>  create type - drop type - recreate that dropped type
- * Expected Res : Success
- * Date         : 13 Sep 2012
- * Issue        : 188
- */
-
-drop  dataverse test if exists;
-create  dataverse test;
-
-use test;
-
-
-create type test.footype as
-{
-  bar : integer?
-};
-
-drop type test.footype;
-create type test.footype as
-{
-  bar : integer?
-};
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/droptype/droptype.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/droptype/droptype.2.update.sqlpp
deleted file mode 100644
index de64bf8..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/droptype/droptype.2.update.sqlpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-/*
- * Description  : Test to cover =>  create type - drop type - recreate that dropped type
- * Expected Res : Success
- * Date         : 13 Sep 2012
- * Issue        : 188
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/droptype/droptype.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/droptype/droptype.3.query.sqlpp
deleted file mode 100644
index de64bf8..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/droptype/droptype.3.query.sqlpp
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-/*
- * Description  : Test to cover =>  create type - drop type - recreate that dropped type
- * Expected Res : Success
- * Date         : 13 Sep 2012
- * Issue        : 188
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_01/global-avg_01.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_01/global-avg_01.1.ddl.sqlpp
deleted file mode 100644
index 21479a2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_01/global-avg_01.1.ddl.sqlpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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;
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_01/global-avg_01.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_01/global-avg_01.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_01/global-avg_01.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_01/global-avg_01.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_01/global-avg_01.3.query.sqlpp
deleted file mode 100644
index e9f4ed0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_01/global-avg_01.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`global-avg`((
-    select element {'sum':x,'count':1}
-    from  [1.0,2.0,test.double('3.0')] as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_null/global-avg_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_null/global-avg_null.1.ddl.sqlpp
deleted file mode 100644
index 3f2c5bf..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_null/global-avg_null.1.ddl.sqlpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.NumericType as
-{
-  id : integer,
-  int8Field : tinyint?,
-  int16Field : smallint?,
-  int32Field : integer?,
-  int64Field : bigint?,
-  floatField : float?,
-  doubleField : double?
-};
-
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_null/global-avg_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_null/global-avg_null.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_null/global-avg_null.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_null/global-avg_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_null/global-avg_null.3.query.sqlpp
deleted file mode 100644
index d6926ac..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/global-avg_null/global-avg_null.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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;
-
-
-{'global-average':test.`global-avg`((
-    select element {'sum':x.doubleField,'count':x.int32Field}
-    from  Numeric as x
-))};
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double/local-avg_double.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double/local-avg_double.1.ddl.sqlpp
deleted file mode 100644
index 21479a2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double/local-avg_double.1.ddl.sqlpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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;
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double/local-avg_double.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double/local-avg_double.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double/local-avg_double.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double/local-avg_double.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double/local-avg_double.3.query.sqlpp
deleted file mode 100644
index f7d5c89..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double/local-avg_double.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x
-    from  [1.0,2.0,test.double('3.0')] as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double_null/local-avg_double_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double_null/local-avg_double_null.1.ddl.sqlpp
deleted file mode 100644
index 3f2c5bf..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double_null/local-avg_double_null.1.ddl.sqlpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.NumericType as
-{
-  id : integer,
-  int8Field : tinyint?,
-  int16Field : smallint?,
-  int32Field : integer?,
-  int64Field : bigint?,
-  floatField : float?,
-  doubleField : double?
-};
-
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double_null/local-avg_double_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double_null/local-avg_double_null.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double_null/local-avg_double_null.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double_null/local-avg_double_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double_null/local-avg_double_null.3.query.sqlpp
deleted file mode 100644
index c6154fe..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_double_null/local-avg_double_null.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x.doubleField
-    from  Numeric as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float/local-avg_float.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float/local-avg_float.1.ddl.sqlpp
deleted file mode 100644
index 21479a2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float/local-avg_float.1.ddl.sqlpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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;
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float/local-avg_float.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float/local-avg_float.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float/local-avg_float.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float/local-avg_float.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float/local-avg_float.3.query.sqlpp
deleted file mode 100644
index 61ec467..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float/local-avg_float.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x
-    from  [test.float('1'),test.float('2'),test.float('3')] as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float_null/local-avg_float_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float_null/local-avg_float_null.1.ddl.sqlpp
deleted file mode 100644
index 3f2c5bf..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float_null/local-avg_float_null.1.ddl.sqlpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.NumericType as
-{
-  id : integer,
-  int8Field : tinyint?,
-  int16Field : smallint?,
-  int32Field : integer?,
-  int64Field : bigint?,
-  floatField : float?,
-  doubleField : double?
-};
-
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float_null/local-avg_float_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float_null/local-avg_float_null.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_float_null/local-avg_float_null.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16/local-avg_int16.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16/local-avg_int16.1.ddl.sqlpp
deleted file mode 100644
index 7517cc2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16/local-avg_int16.1.ddl.sqlpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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;
-
-
-select element test.`local-avg`((
-    select element x
-    from  [test.smallint('1'),test.smallint('2'),test.smallint('3')] as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16/local-avg_int16.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16/local-avg_int16.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16/local-avg_int16.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16/local-avg_int16.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16/local-avg_int16.3.query.sqlpp
deleted file mode 100644
index 544bcf3..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16/local-avg_int16.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x
-    from  [test.smallint('1'),test.smallint('2'),test.smallint('3')] as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16_null/local-avg_int16_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16_null/local-avg_int16_null.1.ddl.sqlpp
deleted file mode 100644
index 3f2c5bf..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16_null/local-avg_int16_null.1.ddl.sqlpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.NumericType as
-{
-  id : integer,
-  int8Field : tinyint?,
-  int16Field : smallint?,
-  int32Field : integer?,
-  int64Field : bigint?,
-  floatField : float?,
-  doubleField : double?
-};
-
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16_null/local-avg_int16_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16_null/local-avg_int16_null.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16_null/local-avg_int16_null.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16_null/local-avg_int16_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16_null/local-avg_int16_null.3.query.sqlpp
deleted file mode 100644
index 9362f54..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int16_null/local-avg_int16_null.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x.int16Field
-    from  Numeric as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32/local-avg_int32.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32/local-avg_int32.1.ddl.sqlpp
deleted file mode 100644
index 21479a2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32/local-avg_int32.1.ddl.sqlpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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;
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32/local-avg_int32.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32/local-avg_int32.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32/local-avg_int32.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32/local-avg_int32.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32/local-avg_int32.3.query.sqlpp
deleted file mode 100644
index ee829f8..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32/local-avg_int32.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x
-    from  [1,2,3] as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32_null/local-avg_int32_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32_null/local-avg_int32_null.1.ddl.sqlpp
deleted file mode 100644
index 3f2c5bf..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32_null/local-avg_int32_null.1.ddl.sqlpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.NumericType as
-{
-  id : integer,
-  int8Field : tinyint?,
-  int16Field : smallint?,
-  int32Field : integer?,
-  int64Field : bigint?,
-  floatField : float?,
-  doubleField : double?
-};
-
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32_null/local-avg_int32_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32_null/local-avg_int32_null.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32_null/local-avg_int32_null.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32_null/local-avg_int32_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32_null/local-avg_int32_null.3.query.sqlpp
deleted file mode 100644
index 5a2017e..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int32_null/local-avg_int32_null.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x.int32Field
-    from  Numeric as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64/local-avg_int64.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64/local-avg_int64.1.ddl.sqlpp
deleted file mode 100644
index 21479a2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64/local-avg_int64.1.ddl.sqlpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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;
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64/local-avg_int64.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64/local-avg_int64.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64/local-avg_int64.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64/local-avg_int64.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64/local-avg_int64.3.query.sqlpp
deleted file mode 100644
index 9a6e042..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64/local-avg_int64.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x
-    from  [test.bigint('1'),test.bigint('2'),test.bigint('3')] as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64_null/local-avg_int64_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64_null/local-avg_int64_null.1.ddl.sqlpp
deleted file mode 100644
index 3f2c5bf..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64_null/local-avg_int64_null.1.ddl.sqlpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.NumericType as
-{
-  id : integer,
-  int8Field : tinyint?,
-  int16Field : smallint?,
-  int32Field : integer?,
-  int64Field : bigint?,
-  floatField : float?,
-  doubleField : double?
-};
-
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64_null/local-avg_int64_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64_null/local-avg_int64_null.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64_null/local-avg_int64_null.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64_null/local-avg_int64_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64_null/local-avg_int64_null.3.query.sqlpp
deleted file mode 100644
index f22a1a1..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int64_null/local-avg_int64_null.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x.int64Field
-    from  Numeric as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8/local-avg_int8.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8/local-avg_int8.1.ddl.sqlpp
deleted file mode 100644
index 21479a2..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8/local-avg_int8.1.ddl.sqlpp
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * 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;
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8/local-avg_int8.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8/local-avg_int8.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8/local-avg_int8.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8/local-avg_int8.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8/local-avg_int8.3.query.sqlpp
deleted file mode 100644
index dc6f66e..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8/local-avg_int8.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x
-    from  [test.tinyint('1'),test.tinyint('2'),test.tinyint('3')] as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8_null/local-avg_int8_null.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8_null/local-avg_int8_null.1.ddl.sqlpp
deleted file mode 100644
index 3f2c5bf..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8_null/local-avg_int8_null.1.ddl.sqlpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.NumericType as
-{
-  id : integer,
-  int8Field : tinyint?,
-  int16Field : smallint?,
-  int32Field : integer?,
-  int64Field : bigint?,
-  floatField : float?,
-  doubleField : double?
-};
-
-create external  dataset Numeric(NumericType) using localfs((`path`=`asterix_nc1://data/nontagged/numericData.json`),(`format`=`adm`));
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8_null/local-avg_int8_null.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8_null/local-avg_int8_null.2.update.sqlpp
deleted file mode 100644
index bd244d0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8_null/local-avg_int8_null.2.update.sqlpp
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8_null/local-avg_int8_null.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8_null/local-avg_int8_null.3.query.sqlpp
deleted file mode 100644
index 6e28e1d..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/local-avg_int8_null/local-avg_int8_null.3.query.sqlpp
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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 element test.`local-avg`((
-    select element x.int8Field
-    from  Numeric as x
-));
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double/avg_double.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double/avg_double.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double/avg_double.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double/avg_double.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double/avg_double.3.adm
new file mode 100644
index 0000000..669ca30
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double/avg_double.3.adm
@@ -0,0 +1 @@
+64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double/avg_double.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double/avg_double.4.adm
new file mode 100644
index 0000000..669ca30
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double/avg_double.4.adm
@@ -0,0 +1 @@
+64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float_null/avg_float_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double_null/avg_double_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float_null/avg_float_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double_null/avg_double_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double_null/avg_double_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double_null/avg_double_null.4.adm
new file mode 100644
index 0000000..0e33f2f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double_null/avg_double_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ 64.0 ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float/avg_float.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float/avg_float.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float/avg_float.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float/avg_float.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float/avg_float.3.adm
new file mode 100644
index 0000000..669ca30
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float/avg_float.3.adm
@@ -0,0 +1 @@
+64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float/avg_float.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float/avg_float.4.adm
new file mode 100644
index 0000000..669ca30
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float/avg_float.4.adm
@@ -0,0 +1 @@
+64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double_null/avg_double_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float_null/avg_float_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_double_null/avg_double_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float_null/avg_float_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float_null/avg_float_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float_null/avg_float_null.4.adm
new file mode 100644
index 0000000..0e33f2f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_float_null/avg_float_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ 64.0 ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16/avg_int16.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16/avg_int16.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16/avg_int16.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16/avg_int16.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16/avg_int16.3.adm
new file mode 100644
index 0000000..a9ea08d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16/avg_int16.3.adm
@@ -0,0 +1 @@
+-16.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16/avg_int16.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16/avg_int16.4.adm
new file mode 100644
index 0000000..c21d44e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16/avg_int16.4.adm
@@ -0,0 +1 @@
+-16.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16_null/avg_int16_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16_null/avg_int16_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16_null/avg_int16_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16_null/avg_int16_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16_null/avg_int16_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16_null/avg_int16_null.4.adm
new file mode 100644
index 0000000..cb8c061
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int16_null/avg_int16_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ -16.0 ] }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32/avg_int32.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32/avg_int32.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32/avg_int32.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32/avg_int32.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32/avg_int32.3.adm
new file mode 100644
index 0000000..1fa4f06
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32/avg_int32.3.adm
@@ -0,0 +1 @@
+-32.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32/avg_int32.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32/avg_int32.4.adm
new file mode 100644
index 0000000..1fa4f06
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32/avg_int32.4.adm
@@ -0,0 +1 @@
+-32.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32_null/avg_int32_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32_null/avg_int32_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32_null/avg_int32_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32_null/avg_int32_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32_null/avg_int32_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32_null/avg_int32_null.4.adm
new file mode 100644
index 0000000..c8bece3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int32_null/avg_int32_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ -32.0 ] }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64/avg_int64.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64/avg_int64.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64/avg_int64.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64/avg_int64.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64/avg_int64.3.adm
new file mode 100644
index 0000000..af53d37
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64/avg_int64.3.adm
@@ -0,0 +1 @@
+-64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64/avg_int64.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64/avg_int64.4.adm
new file mode 100644
index 0000000..af53d37
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64/avg_int64.4.adm
@@ -0,0 +1 @@
+-64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64_null/avg_int64_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64_null/avg_int64_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64_null/avg_int64_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64_null/avg_int64_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64_null/avg_int64_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64_null/avg_int64_null.4.adm
new file mode 100644
index 0000000..3bda1a2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int64_null/avg_int64_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ -64.0 ] }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8/avg_int8.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8/avg_int8.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8/avg_int8.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8/avg_int8.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8/avg_int8.3.adm
new file mode 100644
index 0000000..fc004cb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8/avg_int8.3.adm
@@ -0,0 +1 @@
+18.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8/avg_int8.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8/avg_int8.4.adm
new file mode 100644
index 0000000..fc004cb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8/avg_int8.4.adm
@@ -0,0 +1 @@
+18.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8_null/avg_int8_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8_null/avg_int8_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8_null/avg_int8_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8_null/avg_int8_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8_null/avg_int8_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8_null/avg_int8_null.4.adm
new file mode 100644
index 0000000..801104a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_int8_null/avg_int8_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ 18.0 ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double/avg_double.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double/avg_double.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double/avg_double.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double/avg_double.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double/avg_double.3.adm
new file mode 100644
index 0000000..d28b910
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double/avg_double.3.adm
@@ -0,0 +1 @@
+64.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double/avg_double.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double/avg_double.4.adm
new file mode 100644
index 0000000..669ca30
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double/avg_double.4.adm
@@ -0,0 +1 @@
+64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8_null/avg_int8_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double_null/avg_double_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8_null/avg_int8_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double_null/avg_double_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double_null/avg_double_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double_null/avg_double_null.4.adm
new file mode 100644
index 0000000..a00f59d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double_null/avg_double_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ null ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float/avg_float.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float/avg_float.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float/avg_float.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float/avg_float.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float/avg_float.3.adm
new file mode 100644
index 0000000..d28b910
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float/avg_float.3.adm
@@ -0,0 +1 @@
+64.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float/avg_float.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float/avg_float.4.adm
new file mode 100644
index 0000000..669ca30
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float/avg_float.4.adm
@@ -0,0 +1 @@
+64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64_null/avg_int64_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float_null/avg_float_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64_null/avg_int64_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float_null/avg_float_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float_null/avg_float_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float_null/avg_float_null.4.adm
new file mode 100644
index 0000000..a00f59d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float_null/avg_float_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ null ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16/avg_int16.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16/avg_int16.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16/avg_int16.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16/avg_int16.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16/avg_int16.3.adm
new file mode 100644
index 0000000..a9ea08d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16/avg_int16.3.adm
@@ -0,0 +1 @@
+-16.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16/avg_int16.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16/avg_int16.4.adm
new file mode 100644
index 0000000..c21d44e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16/avg_int16.4.adm
@@ -0,0 +1 @@
+-16.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32_null/avg_int32_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16_null/avg_int16_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32_null/avg_int32_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16_null/avg_int16_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16_null/avg_int16_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16_null/avg_int16_null.4.adm
new file mode 100644
index 0000000..a00f59d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16_null/avg_int16_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ null ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32/avg_int32.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32/avg_int32.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32/avg_int32.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32/avg_int32.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32/avg_int32.3.adm
new file mode 100644
index 0000000..1fa4f06
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32/avg_int32.3.adm
@@ -0,0 +1 @@
+-32.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32/avg_int32.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32/avg_int32.4.adm
new file mode 100644
index 0000000..1fa4f06
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32/avg_int32.4.adm
@@ -0,0 +1 @@
+-32.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16_null/avg_int16_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32_null/avg_int32_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int16_null/avg_int16_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32_null/avg_int32_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32_null/avg_int32_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32_null/avg_int32_null.4.adm
new file mode 100644
index 0000000..a00f59d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int32_null/avg_int32_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ null ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64/avg_int64.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64/avg_int64.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64/avg_int64.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64/avg_int64.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64/avg_int64.3.adm
new file mode 100644
index 0000000..af53d37
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64/avg_int64.3.adm
@@ -0,0 +1 @@
+-64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64/avg_int64.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64/avg_int64.4.adm
new file mode 100644
index 0000000..af53d37
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64/avg_int64.4.adm
@@ -0,0 +1 @@
+-64.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float_null/avg_float_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64_null/avg_int64_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_float_null/avg_float_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64_null/avg_int64_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64_null/avg_int64_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64_null/avg_int64_null.4.adm
new file mode 100644
index 0000000..a00f59d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int64_null/avg_int64_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ null ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8/avg_int8.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8/avg_int8.1.adm
deleted file mode 100644
index cd5ac03..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8/avg_int8.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8/avg_int8.3.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8/avg_int8.3.adm
new file mode 100644
index 0000000..fc004cb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8/avg_int8.3.adm
@@ -0,0 +1 @@
+18.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8/avg_int8.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8/avg_int8.4.adm
new file mode 100644
index 0000000..fc004cb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8/avg_int8.4.adm
@@ -0,0 +1 @@
+18.0
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double_null/avg_double_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8_null/avg_int8_null.3.adm
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_double_null/avg_double_null.1.adm
rename to asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8_null/avg_int8_null.3.adm
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8_null/avg_int8_null.4.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8_null/avg_int8_null.4.adm
new file mode 100644
index 0000000..a00f59d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/avg_int8_null/avg_int8_null.4.adm
@@ -0,0 +1 @@
+{ "average": [ null ] }
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/global-avg_01/global-avg_01.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/global-avg_01/global-avg_01.1.adm
deleted file mode 100644
index e64425e..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/global-avg_01/global-avg_01.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-2.0d
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/global-avg_null/global-avg_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/global-avg_null/global-avg_null.1.adm
deleted file mode 100644
index bea6ce0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/global-avg_null/global-avg_null.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "global-average": null }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_double/local-avg_double.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_double/local-avg_double.1.adm
deleted file mode 100644
index 481e1c0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_double/local-avg_double.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": 6.0d, "count": 3 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_double_null/local-avg_double_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_double_null/local-avg_double_null.1.adm
deleted file mode 100644
index b603e65..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_double_null/local-avg_double_null.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": null, "count": 1 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_float/local-avg_float.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_float/local-avg_float.1.adm
deleted file mode 100644
index 481e1c0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_float/local-avg_float.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": 6.0d, "count": 3 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_float_null/local-avg_float_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_float_null/local-avg_float_null.1.adm
deleted file mode 100644
index b603e65..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_float_null/local-avg_float_null.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": null, "count": 1 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int16/local-avg_int16.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int16/local-avg_int16.1.adm
deleted file mode 100644
index 481e1c0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int16/local-avg_int16.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": 6.0d, "count": 3 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int16_null/local-avg_int16_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int16_null/local-avg_int16_null.1.adm
deleted file mode 100644
index b603e65..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int16_null/local-avg_int16_null.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": null, "count": 1 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int32/local-avg_int32.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int32/local-avg_int32.1.adm
deleted file mode 100644
index 481e1c0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int32/local-avg_int32.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": 6.0d, "count": 3 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int32_null/local-avg_int32_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int32_null/local-avg_int32_null.1.adm
deleted file mode 100644
index b603e65..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int32_null/local-avg_int32_null.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": null, "count": 1 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int64/local-avg_int64.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int64/local-avg_int64.1.adm
deleted file mode 100644
index 481e1c0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int64/local-avg_int64.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": 6.0d, "count": 3 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int64_null/local-avg_int64_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int64_null/local-avg_int64_null.1.adm
deleted file mode 100644
index b603e65..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int64_null/local-avg_int64_null.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": null, "count": 1 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int8/local-avg_int8.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int8/local-avg_int8.1.adm
deleted file mode 100644
index 481e1c0..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int8/local-avg_int8.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": 6.0d, "count": 3 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int8_null/local-avg_int8_null.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int8_null/local-avg_int8_null.1.adm
deleted file mode 100644
index b603e65..0000000
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate/local-avg_int8_null/local-avg_int8_null.1.adm
+++ /dev/null
@@ -1 +0,0 @@
-{ "sum": null, "count": 1 }
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.1.ast
index 916a59e..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.1.ast
@@ -1 +1,13 @@
 DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.3.ast
index ddb57dc..6917b12 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.3.ast
@@ -1,19 +1,28 @@
+DataverseUse test
 Query:
 SELECT ELEMENT [
 FunctionCall asterix.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=doubleField
     ]
-    FROM [      OrderedListConstructor [
-        LiteralExpr [DOUBLE] [1.0]
-        LiteralExpr [DOUBLE] [2.0]
-        FunctionCall null.double@1[
-          LiteralExpr [STRING] [3.0]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=doubleField
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.4.ast
new file mode 100644
index 0000000..6ed2da5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double/avg_double.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.array_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=doubleField
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=doubleField
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.1.ast
index 2b387f8..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.4.ast
new file mode 100644
index 0000000..b7ab21d
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_double_null/avg_double_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.array_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=doubleField
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ast
index e69de29..babcce4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.1.ast
@@ -0,0 +1,8 @@
+DataverseUse test
+TypeDecl TestType [
+  closed RecordType {
+    id : integer,
+    val : double
+  }
+]
+DatasetDecl Test(TestType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.ast
index f70d26a..c2f543d 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_empty_01/avg_empty_01.3.ast
@@ -1,24 +1,40 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-FunctionCall asterix.sql-avg@1[
+WINDOW test.array_avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
-    ]
-    FROM [      OrderedListConstructor [
-        LiteralExpr [LONG] [1]
-        LiteralExpr [LONG] [2]
-        LiteralExpr [LONG] [3]
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
       ]
-      AS Variable [ Name=$x ]
+      Field=val
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=$x ]
-        >
-        LiteralExpr [LONG] [10]
+        FieldAccessor [
+          FieldAccessor [
+            Variable [ Name=$w ]
+            Field=x
+          ]
+          Field=val
+        ]
+        <
+        LiteralExpr [LONG] [0]
       ]
   )
 ]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Test]
+  ]
+  AS Variable [ Name=$x ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.3.ast
index 15229e0..b5c185a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.3.ast
@@ -4,21 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=floatField
     ]
-    FROM [      OrderedListConstructor [
-        FunctionCall test.float@1[
-          LiteralExpr [STRING] [1]
-        ]
-        FunctionCall test.float@1[
-          LiteralExpr [STRING] [2]
-        ]
-        FunctionCall test.float@1[
-          LiteralExpr [STRING] [3]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=floatField
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.4.ast
new file mode 100644
index 0000000..3351633
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float/avg_float.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.array_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=floatField
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=floatField
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.2.ast
deleted file mode 100644
index e69de29..0000000
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.1.ast
similarity index 81%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.1.ast
rename to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.1.ast
index b01283e..d3d217c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.2.ast
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.1.ast
copy to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.2.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.3.ast
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_nu.3.ast
rename to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.3.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.4.ast
new file mode 100644
index 0000000..f8904be
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_float_null/avg_float_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.array_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=floatField
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.3.ast
index ca94dfe..f3c8254 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.3.ast
@@ -4,21 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=int16Field
     ]
-    FROM [      OrderedListConstructor [
-        FunctionCall test.int16@1[
-          LiteralExpr [STRING] [1]
-        ]
-        FunctionCall test.int16@1[
-          LiteralExpr [STRING] [2]
-        ]
-        FunctionCall test.int16@1[
-          LiteralExpr [STRING] [3]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=int16Field
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.4.ast
new file mode 100644
index 0000000..09b14c2
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16/avg_int16.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.array_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=int16Field
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=int16Field
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.1.ast
index b01283e..d3d217c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.4.ast
new file mode 100644
index 0000000..39ec752
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int16_null/avg_int16_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.array_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=int16Field
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.3.ast
index 7958cad..d7ecde9 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.3.ast
@@ -4,21 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=int32Field
     ]
-    FROM [      OrderedListConstructor [
-        FunctionCall test.int32@1[
-          LiteralExpr [STRING] [1]
-        ]
-        FunctionCall test.int32@1[
-          LiteralExpr [STRING] [2]
-        ]
-        FunctionCall test.int32@1[
-          LiteralExpr [STRING] [3]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=int32Field
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.4.ast
new file mode 100644
index 0000000..08e7eef
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32/avg_int32.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.array_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=int32Field
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=int32Field
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.1.ast
index b01283e..d3d217c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.4.ast
new file mode 100644
index 0000000..1143883
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int32_null/avg_int32_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.array_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=int32Field
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.3.ast
index 582834c..0233829 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.3.ast
@@ -4,21 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=int64Field
     ]
-    FROM [      OrderedListConstructor [
-        FunctionCall test.int64@1[
-          LiteralExpr [STRING] [1]
-        ]
-        FunctionCall test.int64@1[
-          LiteralExpr [STRING] [2]
-        ]
-        FunctionCall test.int64@1[
-          LiteralExpr [STRING] [3]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=int64Field
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.4.ast
new file mode 100644
index 0000000..f156a1b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64/avg_int64.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.array_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=int64Field
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=int64Field
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.1.ast
index b01283e..d3d217c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.4.ast
new file mode 100644
index 0000000..35979d4
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int64_null/avg_int64_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.array_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=int64Field
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.3.ast
index 784cd52..5bd596c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.3.ast
@@ -4,21 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.sql-avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=int8Field
     ]
-    FROM [      OrderedListConstructor [
-        FunctionCall test.int8@1[
-          LiteralExpr [STRING] [1]
-        ]
-        FunctionCall test.int8@1[
-          LiteralExpr [STRING] [2]
-        ]
-        FunctionCall test.int8@1[
-          LiteralExpr [STRING] [3]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=int8Field
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.4.ast
new file mode 100644
index 0000000..29133cb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8/avg_int8.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.array_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=int8Field
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=int8Field
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.1.ast
index b01283e..d3d217c 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.4.ast
new file mode 100644
index 0000000..14ceeb5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate-sql/avg_int8_null/avg_int8_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.array_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=int8Field
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.1.ast
index 916a59e..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.1.ast
@@ -1 +1,13 @@
 DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.3.ast
index 028db6b..b02e4de 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.3.ast
@@ -1,19 +1,28 @@
+DataverseUse test
 Query:
 SELECT ELEMENT [
 FunctionCall asterix.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=doubleField
     ]
-    FROM [      OrderedListConstructor [
-        LiteralExpr [DOUBLE] [1.0]
-        LiteralExpr [DOUBLE] [2.0]
-        FunctionCall null.double@1[
-          LiteralExpr [STRING] [3.0]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=doubleField
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.4.ast
new file mode 100644
index 0000000..c6e5f00
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.strict_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=doubleField
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=doubleField
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.1.ast
index 2b387f8..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.4.ast
new file mode 100644
index 0000000..b5910c3
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double_null/avg_double_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.strict_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=doubleField
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ast
index e69de29..babcce4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.1.ast
@@ -0,0 +1,8 @@
+DataverseUse test
+TypeDecl TestType [
+  closed RecordType {
+    id : integer,
+    val : double
+  }
+]
+DatasetDecl Test(TestType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.ast
index 4355ee7..be4e9f4 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_empty_01/avg_empty_01.3.ast
@@ -1,24 +1,40 @@
 DataverseUse test
 Query:
 SELECT ELEMENT [
-FunctionCall asterix.avg@1[
+WINDOW test.strict_avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
-    ]
-    FROM [      OrderedListConstructor [
-        LiteralExpr [LONG] [1]
-        LiteralExpr [LONG] [2]
-        LiteralExpr [LONG] [3]
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
       ]
-      AS Variable [ Name=$x ]
+      Field=val
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
     ]
     Where
       OperatorExpr [
-        Variable [ Name=$x ]
-        >
-        LiteralExpr [LONG] [10]
+        FieldAccessor [
+          FieldAccessor [
+            Variable [ Name=$w ]
+            Field=x
+          ]
+          Field=val
+        ]
+        <
+        LiteralExpr [LONG] [0]
       ]
   )
 ]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Test]
+  ]
+  AS Variable [ Name=$x ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.3.ast
index 3d12de5..704fd19 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.3.ast
@@ -4,21 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=floatField
     ]
-    FROM [      OrderedListConstructor [
-        FunctionCall test.float@1[
-          LiteralExpr [STRING] [1]
-        ]
-        FunctionCall test.float@1[
-          LiteralExpr [STRING] [2]
-        ]
-        FunctionCall test.float@1[
-          LiteralExpr [STRING] [3]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=floatField
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.4.ast
new file mode 100644
index 0000000..e388212
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float/avg_float.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.strict_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=floatField
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=floatField
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.2.ast
deleted file mode 100644
index e69de29..0000000
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.1.ast
similarity index 81%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.1.ast
rename to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.1.ast
index 2b387f8..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.2.ast
similarity index 100%
copy from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_double/avg_double.1.ast
copy to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.2.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.3.ast
similarity index 100%
rename from asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_nu.3.ast
rename to asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.3.ast
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.4.ast
new file mode 100644
index 0000000..a27474e
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_float_null/avg_float_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.strict_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=floatField
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.3.ast
index 7854b3c..5ebc006 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.3.ast
@@ -4,21 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=int16Field
     ]
-    FROM [      OrderedListConstructor [
-        FunctionCall test.int16@1[
-          LiteralExpr [STRING] [1]
-        ]
-        FunctionCall test.int16@1[
-          LiteralExpr [STRING] [2]
-        ]
-        FunctionCall test.int16@1[
-          LiteralExpr [STRING] [3]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=int16Field
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.4.ast
new file mode 100644
index 0000000..93ac851
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16/avg_int16.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.strict_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=int16Field
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=int16Field
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.1.ast
index 2b387f8..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.ast
index 8dc5470..65be16a 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.3.ast
@@ -1,4 +1,5 @@
 DataverseUse test
+DataverseUse test
 Query:
 RecordConstructor [
   (
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.4.ast
new file mode 100644
index 0000000..a8eeec5
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int16_null/avg_int16_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.strict_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=int16Field
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.3.ast
index 4ad8587..78f5341 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.3.ast
@@ -4,15 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=int32Field
     ]
-    FROM [      OrderedListConstructor [
-        LiteralExpr [LONG] [1]
-        LiteralExpr [LONG] [2]
-        LiteralExpr [LONG] [3]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=int32Field
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.4.ast
new file mode 100644
index 0000000..305ef7b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32/avg_int32.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.strict_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=int32Field
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=int32Field
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.1.ast
index 2b387f8..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.ast
index d27467f..c472eb3 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.3.ast
@@ -1,4 +1,5 @@
 DataverseUse test
+DataverseUse test
 Query:
 RecordConstructor [
   (
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.4.ast
new file mode 100644
index 0000000..342ef66
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int32_null/avg_int32_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.strict_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=int32Field
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.3.ast
index f47c1ad..ca79e78 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.3.ast
@@ -4,21 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=int64Field
     ]
-    FROM [      OrderedListConstructor [
-        FunctionCall test.int64@1[
-          LiteralExpr [STRING] [1]
-        ]
-        FunctionCall test.int64@1[
-          LiteralExpr [STRING] [2]
-        ]
-        FunctionCall test.int64@1[
-          LiteralExpr [STRING] [3]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=int64Field
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.4.ast
new file mode 100644
index 0000000..d81470b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64/avg_int64.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.strict_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=int64Field
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=int64Field
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.1.ast
index 2b387f8..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.ast
index acc6550..b8f4805 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.3.ast
@@ -1,4 +1,5 @@
 DataverseUse test
+DataverseUse test
 Query:
 RecordConstructor [
   (
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.4.ast
new file mode 100644
index 0000000..f6e324a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int64_null/avg_int64_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.strict_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=int64Field
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.1.ast
index e69de29..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.1.ast
@@ -0,0 +1,13 @@
+DataverseUse test
+TypeDecl NumericType [
+  open RecordType {
+    id : integer,
+    int8Field : tinyint?,
+    int16Field : smallint?,
+    int32Field : integer?,
+    int64Field : bigint?,
+    floatField : float?,
+    doubleField : double?
+  }
+]
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.3.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.3.ast
index 71e2d1d..652f427 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.3.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.3.ast
@@ -4,21 +4,25 @@ SELECT ELEMENT [
 FunctionCall asterix.avg@1[
   (
     SELECT ELEMENT [
-    Variable [ Name=$x ]
+    FieldAccessor [
+      Variable [ Name=$x ]
+      Field=int8Field
     ]
-    FROM [      OrderedListConstructor [
-        FunctionCall test.int8@1[
-          LiteralExpr [STRING] [1]
-        ]
-        FunctionCall test.int8@1[
-          LiteralExpr [STRING] [2]
-        ]
-        FunctionCall test.int8@1[
-          LiteralExpr [STRING] [3]
-        ]
+    ]
+    FROM [      FunctionCall asterix.dataset@1[
+        LiteralExpr [STRING] [test.Numeric]
       ]
       AS Variable [ Name=$x ]
     ]
+    Where
+      FunctionCall algebricks.not@1[
+        FunctionCall asterix.is-unknown@1[
+          FieldAccessor [
+            Variable [ Name=$x ]
+            Field=int8Field
+          ]
+        ]
+      ]
   )
 ]
 ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.4.ast
new file mode 100644
index 0000000..a42531f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8/avg_int8.4.ast
@@ -0,0 +1,37 @@
+DataverseUse test
+Query:
+SELECT ELEMENT [
+WINDOW test.strict_avg@1[
+  (
+    SELECT ELEMENT [
+    FieldAccessor [
+      FieldAccessor [
+        Variable [ Name=$w ]
+        Field=x
+      ]
+      Field=int8Field
+    ]
+    ]
+    FROM [      Variable [ Name=$w ]
+      AS Variable [ Name=$w ]
+    ]
+  )
+]
+  AS Variable [ Name=$w ]
+OVER (
+)
+]
+FROM [  FunctionCall asterix.dataset@1[
+    LiteralExpr [STRING] [test.Numeric]
+  ]
+  AS Variable [ Name=$x ]
+]
+Where
+  FunctionCall algebricks.not@1[
+    FunctionCall asterix.is-unknown@1[
+      FieldAccessor [
+        Variable [ Name=$x ]
+        Field=int8Field
+      ]
+    ]
+  ]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.1.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.1.ast
index 2b387f8..81aa9f6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.1.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.1.ast
@@ -10,4 +10,4 @@ TypeDecl NumericType [
     doubleField : double?
   }
 ]
-DatasetDecl Numeric(NumericType)is an external dataset
+DatasetDecl Numeric(NumericType) partitioned by [[id]]
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.2.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.2.ast
index e69de29..916a59e 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.2.ast
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.2.ast
@@ -0,0 +1 @@
+DataverseUse test
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.4.ast b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.4.ast
new file mode 100644
index 0000000..d39b019
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results_parser_sqlpp/aggregate/avg_int8_null/avg_int8_null.4.ast
@@ -0,0 +1,36 @@
+DataverseUse test
+Query:
+RecordConstructor [
+  (
+    LiteralExpr [STRING] [average]
+    :
+    (
+      SELECT ELEMENT [
+      WINDOW test.strict_avg@1[
+        (
+          SELECT ELEMENT [
+          FieldAccessor [
+            FieldAccessor [
+              Variable [ Name=$w ]
+              Field=x
+            ]
+            Field=int8Field
+          ]
+          ]
+          FROM [            Variable [ Name=$w ]
+            AS Variable [ Name=$w ]
+          ]
+        )
+      ]
+        AS Variable [ Name=$w ]
+      OVER (
+      )
+      ]
+      FROM [        FunctionCall asterix.dataset@1[
+          LiteralExpr [STRING] [test.Numeric]
+        ]
+        AS Variable [ Name=$x ]
+      ]
+    )
+  )
+]
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 a2e47d6..1d924e6 100644
--- a/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/testsuite_sqlpp.xml
@@ -464,87 +464,6 @@
         <output-dir compare="Text">count_distinct</output-dir>
       </compilation-unit>
     </test-case>
-    <!--
-        <test-case FilePath="aggregate">
-          <compilation-unit name="droptype">
-            <output-dir compare="Text">droptype</output-dir>
-          </compilation-unit>
-        </test-case>
-        -->
-    <!-- TODO(madhusudancs): These tests that test for local_<agg>/global_<agg> functions should be removed, but
-        before that we should modify the code to make sure those built-in functions are still defined but not exposed
-        by AQL, so leaving these test cases commented.
-        <test-case FilePath="aggregate">
-          <compilation-unit name="global-avg_01">
-            <output-dir compare="Text">global-avg_01</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="global-avg_null">
-            <output-dir compare="Text">global-avg_null</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_double">
-            <output-dir compare="Text">local-avg_double</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_double_null">
-            <output-dir compare="Text">local-avg_double_null</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_float">
-            <output-dir compare="Text">local-avg_float</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_float_null">
-            <output-dir compare="Text">local-avg_float_null</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_int16">
-            <output-dir compare="Text">local-avg_int16</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_int16_null">
-            <output-dir compare="Text">local-avg_int16_null</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_int32">
-            <output-dir compare="Text">local-avg_int32</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_int32_null">
-            <output-dir compare="Text">local-avg_int32_null</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_int64">
-            <output-dir compare="Text">local-avg_int64</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_int64_null">
-            <output-dir compare="Text">local-avg_int64_null</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_int8">
-            <output-dir compare="Text">local-avg_int8</output-dir>
-          </compilation-unit>
-        </test-case>
-        <test-case FilePath="aggregate">
-          <compilation-unit name="local-avg_int8_null">
-            <output-dir compare="Text">local-avg_int8_null</output-dir>
-          </compilation-unit>
-        </test-case>
-        -->
     <test-case FilePath="aggregate">
       <compilation-unit name="kurtosis_double">
         <output-dir compare="Text">kurtosis_double</output-dir>
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
index 8385730..8ab1894 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/om/functions/BuiltinFunctions.java
@@ -603,10 +603,6 @@ public class BuiltinFunctions {
     public static final FunctionIdentifier SCALAR_SUM = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sum", 1);
     public static final FunctionIdentifier SCALAR_MAX = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "max", 1);
     public static final FunctionIdentifier SCALAR_MIN = new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "min", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_AVG =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-avg", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_AVG =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-avg", 1);
     public static final FunctionIdentifier SCALAR_FIRST_ELEMENT =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "first-element", 1);
     public static final FunctionIdentifier SCALAR_LOCAL_FIRST_ELEMENT =
@@ -615,40 +611,16 @@ public class BuiltinFunctions {
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "last-element", 1);
     public static final FunctionIdentifier SCALAR_STDDEV_SAMP =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "stddev_samp", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_STDDEV_SAMP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-stddev_samp", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_STDDEV_SAMP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-stddev_samp", 1);
     public static final FunctionIdentifier SCALAR_STDDEV_POP =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "stddev_pop", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_STDDEV_POP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-stddev_pop", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_STDDEV_POP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-stddev_pop", 1);
     public static final FunctionIdentifier SCALAR_VAR_SAMP =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "var_samp", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_VAR_SAMP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-var_samp", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_VAR_SAMP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-var_samp", 1);
     public static final FunctionIdentifier SCALAR_VAR_POP =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "var_pop", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_VAR_POP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-var_pop", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_VAR_POP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-var_pop", 1);
     public static final FunctionIdentifier SCALAR_SKEWNESS =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "skewness", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_SKEWNESS =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-skewness", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_SKEWNESS =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-skewness", 1);
     public static final FunctionIdentifier SCALAR_KURTOSIS =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "kurtosis", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_KURTOSIS =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-kurtosis", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_KURTOSIS =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-kurtosis", 1);
 
     // serializable aggregate functions
     public static final FunctionIdentifier SERIAL_AVG =
@@ -862,46 +834,18 @@ public class BuiltinFunctions {
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-max", 1);
     public static final FunctionIdentifier SCALAR_SQL_MIN =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-min", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_SQL_AVG =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sql-avg", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_SQL_AVG =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-sql-avg", 1);
     public static final FunctionIdentifier SCALAR_SQL_STDDEV_SAMP =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-stddev_samp", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_SQL_STDDEV_SAMP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sql-stddev_samp", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_SQL_STDDEV_SAMP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-sql-stddev_samp", 1);
     public static final FunctionIdentifier SCALAR_SQL_STDDEV_POP =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-stddev_pop", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_SQL_STDDEV_POP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sql-stddev_pop", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_SQL_STDDEV_POP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-sql-stddev_pop", 1);
     public static final FunctionIdentifier SCALAR_SQL_VAR_SAMP =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-var_samp", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_SQL_VAR_SAMP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sql-var_samp", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_SQL_VAR_SAMP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-sql-var_samp", 1);
     public static final FunctionIdentifier SCALAR_SQL_VAR_POP =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-var_pop", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_SQL_VAR_POP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sql-var_pop", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_SQL_VAR_POP =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-sql-var_pop", 1);
     public static final FunctionIdentifier SCALAR_SQL_SKEWNESS =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-skewness", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_SQL_SKEWNESS =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sql-skewness", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_SQL_SKEWNESS =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-sql-skewness", 1);
     public static final FunctionIdentifier SCALAR_SQL_KURTOSIS =
             new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-kurtosis", 1);
-    public static final FunctionIdentifier SCALAR_GLOBAL_SQL_KURTOSIS =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "global-sql-kurtosis", 1);
-    public static final FunctionIdentifier SCALAR_LOCAL_SQL_KURTOSIS =
-            new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "local-sql-kurtosis", 1);
 
     // serializable sql aggregate functions
     public static final FunctionIdentifier SERIAL_SQL_AVG =
@@ -1878,54 +1822,40 @@ public class BuiltinFunctions {
         addPrivateFunction(SERIAL_INTERMEDIATE_SQL_AVG, LocalAvgTypeComputer.INSTANCE, true);
         addFunction(SCALAR_AVG, NullableDoubleTypeComputer.INSTANCE, true);
         addFunction(SCALAR_COUNT, AInt64TypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_AVG, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_AVG, NullableDoubleTypeComputer.INSTANCE, true);
         addFunction(SCALAR_MAX, ScalarVersionOfAggregateResultType.INSTANCE, true);
         addFunction(SCALAR_MIN, ScalarVersionOfAggregateResultType.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_AVG, LocalAvgTypeComputer.INSTANCE, true);
         addFunction(SCALAR_STDDEV_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_STDDEV_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_STDDEV_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_STDDEV_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_SQL_STDDEV_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_GLOBAL_SQL_STDDEV_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_LOCAL_SQL_STDDEV_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_INTERMEDIATE_SQL_STDDEV_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_STDDEV_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_SQL_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_GLOBAL_SQL_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_LOCAL_SQL_STDDEV_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_INTERMEDIATE_SQL_STDDEV_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_VAR_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_SQL_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_GLOBAL_SQL_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_LOCAL_SQL_VAR_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_INTERMEDIATE_SQL_VAR_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_VAR_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_SQL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_GLOBAL_SQL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_LOCAL_SQL_VAR_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_INTERMEDIATE_SQL_VAR_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_SKEWNESS, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_SQL_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_GLOBAL_SQL_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_LOCAL_SQL_SKEWNESS, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_INTERMEDIATE_SQL_SKEWNESS, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_KURTOSIS, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_SQL_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_GLOBAL_SQL_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
@@ -1958,8 +1888,6 @@ public class BuiltinFunctions {
         addPrivateFunction(GLOBAL_SQL_MIN, MinMaxAggTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SQL_COUNT, AInt64TypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_SQL_AVG, NullableDoubleTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SQL_MAX, ScalarVersionOfAggregateResultType.INSTANCE, true);
         addFunction(SCALAR_SQL_MIN, ScalarVersionOfAggregateResultType.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_SQL_AVG, LocalAvgTypeComputer.INSTANCE, true);
@@ -1968,43 +1896,31 @@ public class BuiltinFunctions {
         addPrivateFunction(LOCAL_SQL_STDDEV_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_SQL_STDDEV_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SQL_STDDEV_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_SQL_STDDEV_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_SQL_STDDEV_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addFunction(SQL_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(GLOBAL_SQL_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(LOCAL_SQL_STDDEV_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_SQL_STDDEV_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SQL_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_SQL_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_SQL_STDDEV_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addFunction(SQL_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(GLOBAL_SQL_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(LOCAL_SQL_VAR_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_SQL_VAR_SAMP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SQL_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_SQL_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_SQL_VAR_SAMP, NullableDoubleTypeComputer.INSTANCE, true);
         addFunction(SQL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(GLOBAL_SQL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(LOCAL_SQL_VAR_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_SQL_VAR_POP, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SQL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_SQL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_SQL_VAR_POP, NullableDoubleTypeComputer.INSTANCE, true);
         addFunction(SQL_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(GLOBAL_SQL_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(LOCAL_SQL_SKEWNESS, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_SQL_SKEWNESS, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SQL_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_SQL_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_SQL_SKEWNESS, NullableDoubleTypeComputer.INSTANCE, true);
         addFunction(SQL_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(GLOBAL_SQL_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(LOCAL_SQL_KURTOSIS, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addPrivateFunction(INTERMEDIATE_SQL_KURTOSIS, LocalSingleVarStatisticsTypeComputer.INSTANCE, true);
         addFunction(SCALAR_SQL_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_GLOBAL_SQL_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
-        addPrivateFunction(SCALAR_LOCAL_SQL_KURTOSIS, NullableDoubleTypeComputer.INSTANCE, true);
 
         addPrivateFunction(SERIAL_AVG, NullableDoubleTypeComputer.INSTANCE, true);
         addPrivateFunction(SERIAL_COUNT, AInt64TypeComputer.INSTANCE, true);
@@ -2396,8 +2312,6 @@ public class BuiltinFunctions {
         addGlobalAgg(AVG, GLOBAL_AVG);
 
         addScalarAgg(AVG, SCALAR_AVG);
-        addScalarAgg(GLOBAL_AVG, SCALAR_GLOBAL_AVG);
-        addScalarAgg(LOCAL_AVG, SCALAR_LOCAL_AVG);
 
         addSerialAgg(AVG, SERIAL_AVG);
         addSerialAgg(LOCAL_AVG, SERIAL_LOCAL_AVG);
@@ -2464,8 +2378,6 @@ public class BuiltinFunctions {
         addGlobalAgg(STDDEV_SAMP, GLOBAL_STDDEV_SAMP);
 
         addScalarAgg(STDDEV_SAMP, SCALAR_STDDEV_SAMP);
-        addScalarAgg(GLOBAL_STDDEV_SAMP, SCALAR_GLOBAL_STDDEV_SAMP);
-        addScalarAgg(LOCAL_STDDEV_SAMP, SCALAR_LOCAL_STDDEV_SAMP);
 
         addSerialAgg(STDDEV_SAMP, SERIAL_STDDEV_SAMP);
         addSerialAgg(LOCAL_STDDEV_SAMP, SERIAL_LOCAL_STDDEV_SAMP);
@@ -2496,8 +2408,6 @@ public class BuiltinFunctions {
         addGlobalAgg(STDDEV_POP, GLOBAL_STDDEV_POP);
 
         addScalarAgg(STDDEV_POP, SCALAR_STDDEV_POP);
-        addScalarAgg(GLOBAL_STDDEV_POP, SCALAR_GLOBAL_STDDEV_POP);
-        addScalarAgg(LOCAL_STDDEV_POP, SCALAR_LOCAL_STDDEV_POP);
 
         addSerialAgg(STDDEV_POP, SERIAL_STDDEV_POP);
         addSerialAgg(LOCAL_STDDEV_POP, SERIAL_LOCAL_STDDEV_POP);
@@ -2528,8 +2438,6 @@ public class BuiltinFunctions {
         addGlobalAgg(VAR_SAMP, GLOBAL_VAR_SAMP);
 
         addScalarAgg(VAR_SAMP, SCALAR_VAR_SAMP);
-        addScalarAgg(GLOBAL_VAR_SAMP, SCALAR_GLOBAL_VAR_SAMP);
-        addScalarAgg(LOCAL_VAR_SAMP, SCALAR_LOCAL_VAR_SAMP);
 
         addSerialAgg(VAR_SAMP, SERIAL_VAR_SAMP);
         addSerialAgg(LOCAL_VAR_SAMP, SERIAL_LOCAL_VAR_SAMP);
@@ -2560,8 +2468,6 @@ public class BuiltinFunctions {
         addGlobalAgg(VAR_POP, GLOBAL_VAR_POP);
 
         addScalarAgg(VAR_POP, SCALAR_VAR_POP);
-        addScalarAgg(GLOBAL_VAR_POP, SCALAR_GLOBAL_VAR_POP);
-        addScalarAgg(LOCAL_VAR_POP, SCALAR_LOCAL_VAR_POP);
 
         addSerialAgg(VAR_POP, SERIAL_VAR_POP);
         addSerialAgg(LOCAL_VAR_POP, SERIAL_LOCAL_VAR_POP);
@@ -2592,8 +2498,6 @@ public class BuiltinFunctions {
         addGlobalAgg(SKEWNESS, GLOBAL_SKEWNESS);
 
         addScalarAgg(SKEWNESS, SCALAR_SKEWNESS);
-        addScalarAgg(GLOBAL_SKEWNESS, SCALAR_GLOBAL_SKEWNESS);
-        addScalarAgg(LOCAL_SKEWNESS, SCALAR_LOCAL_SKEWNESS);
 
         addSerialAgg(SKEWNESS, SERIAL_SKEWNESS);
         addSerialAgg(LOCAL_SKEWNESS, SERIAL_LOCAL_SKEWNESS);
@@ -2624,8 +2528,6 @@ public class BuiltinFunctions {
         addGlobalAgg(KURTOSIS, GLOBAL_KURTOSIS);
 
         addScalarAgg(KURTOSIS, SCALAR_KURTOSIS);
-        addScalarAgg(GLOBAL_KURTOSIS, SCALAR_GLOBAL_KURTOSIS);
-        addScalarAgg(LOCAL_KURTOSIS, SCALAR_LOCAL_KURTOSIS);
 
         addSerialAgg(KURTOSIS, SERIAL_KURTOSIS);
         addSerialAgg(LOCAL_KURTOSIS, SERIAL_LOCAL_KURTOSIS);
@@ -2741,8 +2643,6 @@ public class BuiltinFunctions {
         addGlobalAgg(SQL_AVG, GLOBAL_SQL_AVG);
 
         addScalarAgg(SQL_AVG, SCALAR_SQL_AVG);
-        addScalarAgg(GLOBAL_SQL_AVG, SCALAR_GLOBAL_SQL_AVG);
-        addScalarAgg(LOCAL_SQL_AVG, SCALAR_LOCAL_SQL_AVG);
 
         addSerialAgg(SQL_AVG, SERIAL_SQL_AVG);
         addSerialAgg(LOCAL_SQL_AVG, SERIAL_LOCAL_SQL_AVG);
@@ -2768,8 +2668,6 @@ public class BuiltinFunctions {
         addGlobalAgg(SQL_STDDEV_SAMP, GLOBAL_SQL_STDDEV_SAMP);
 
         addScalarAgg(SQL_STDDEV_SAMP, SCALAR_SQL_STDDEV_SAMP);
-        addScalarAgg(GLOBAL_SQL_STDDEV_SAMP, SCALAR_GLOBAL_SQL_STDDEV_SAMP);
-        addScalarAgg(LOCAL_SQL_STDDEV_SAMP, SCALAR_LOCAL_SQL_STDDEV_SAMP);
 
         addSerialAgg(SQL_STDDEV_SAMP, SERIAL_SQL_STDDEV_SAMP);
         addSerialAgg(LOCAL_SQL_STDDEV_SAMP, SERIAL_LOCAL_SQL_STDDEV_SAMP);
@@ -2795,8 +2693,6 @@ public class BuiltinFunctions {
         addGlobalAgg(SQL_STDDEV_POP, GLOBAL_SQL_STDDEV_POP);
 
         addScalarAgg(SQL_STDDEV_POP, SCALAR_SQL_STDDEV_POP);
-        addScalarAgg(GLOBAL_SQL_STDDEV_POP, SCALAR_GLOBAL_SQL_STDDEV_POP);
-        addScalarAgg(LOCAL_SQL_STDDEV_POP, SCALAR_LOCAL_SQL_STDDEV_POP);
 
         addSerialAgg(SQL_STDDEV_POP, SERIAL_SQL_STDDEV_POP);
         addSerialAgg(LOCAL_SQL_STDDEV_POP, SERIAL_LOCAL_SQL_STDDEV_POP);
@@ -2822,8 +2718,6 @@ public class BuiltinFunctions {
         addGlobalAgg(SQL_VAR_SAMP, GLOBAL_SQL_VAR_SAMP);
 
         addScalarAgg(SQL_VAR_SAMP, SCALAR_SQL_VAR_SAMP);
-        addScalarAgg(GLOBAL_SQL_VAR_SAMP, SCALAR_GLOBAL_SQL_VAR_SAMP);
-        addScalarAgg(LOCAL_SQL_VAR_SAMP, SCALAR_LOCAL_SQL_VAR_SAMP);
 
         addSerialAgg(SQL_VAR_SAMP, SERIAL_SQL_VAR_SAMP);
         addSerialAgg(LOCAL_SQL_VAR_SAMP, SERIAL_LOCAL_SQL_VAR_SAMP);
@@ -2849,8 +2743,6 @@ public class BuiltinFunctions {
         addGlobalAgg(SQL_VAR_POP, GLOBAL_SQL_VAR_POP);
 
         addScalarAgg(SQL_VAR_POP, SCALAR_SQL_VAR_POP);
-        addScalarAgg(GLOBAL_SQL_VAR_POP, SCALAR_GLOBAL_SQL_VAR_POP);
-        addScalarAgg(LOCAL_SQL_VAR_POP, SCALAR_LOCAL_SQL_VAR_POP);
 
         addSerialAgg(SQL_VAR_POP, SERIAL_SQL_VAR_POP);
         addSerialAgg(LOCAL_SQL_VAR_POP, SERIAL_LOCAL_SQL_VAR_POP);
@@ -2876,8 +2768,6 @@ public class BuiltinFunctions {
         addGlobalAgg(SQL_SKEWNESS, GLOBAL_SQL_SKEWNESS);
 
         addScalarAgg(SQL_SKEWNESS, SCALAR_SQL_SKEWNESS);
-        addScalarAgg(GLOBAL_SQL_SKEWNESS, SCALAR_GLOBAL_SQL_SKEWNESS);
-        addScalarAgg(LOCAL_SQL_SKEWNESS, SCALAR_LOCAL_SQL_SKEWNESS);
 
         addSerialAgg(SQL_SKEWNESS, SERIAL_SQL_SKEWNESS);
         addSerialAgg(LOCAL_SQL_SKEWNESS, SERIAL_LOCAL_SQL_SKEWNESS);
@@ -2903,8 +2793,6 @@ public class BuiltinFunctions {
         addGlobalAgg(SQL_KURTOSIS, GLOBAL_SQL_KURTOSIS);
 
         addScalarAgg(SQL_KURTOSIS, SCALAR_SQL_KURTOSIS);
-        addScalarAgg(GLOBAL_SQL_KURTOSIS, SCALAR_GLOBAL_SQL_KURTOSIS);
-        addScalarAgg(LOCAL_SQL_KURTOSIS, SCALAR_LOCAL_SQL_KURTOSIS);
 
         addSerialAgg(SQL_KURTOSIS, SERIAL_SQL_KURTOSIS);
         addSerialAgg(LOCAL_SQL_KURTOSIS, SERIAL_LOCAL_SQL_KURTOSIS);