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 2017/09/19 17:52:17 UTC
[7/7] asterixdb git commit: [ASTERIXDB-2078][SQL] DISTINCT modifier
for aggregate functions
[ASTERIXDB-2078][SQL] DISTINCT modifier for aggregate functions
- user model changes: yes
- storage format changes: no
- interface changes: no
Details:
- Adds support for DISTINCT modifier in aggregate functions:
AGG(DISTINCT expr), ARRAY_AGG(DISTINCT expr), COLL_AGG(DISTINCT expr)
where AGG = COUNT | SUM | AVG | MIN | MAX
Change-Id: I52772349cbcbfc68a3a1ff261d610871ca38748d
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1987
Sonar-Qube: Jenkins <je...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <je...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <ti...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/7a4b5681
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/7a4b5681
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/7a4b5681
Branch: refs/heads/master
Commit: 7a4b5681f376ce4f99cc4a6ee64187068d510332
Parents: e66346a
Author: Dmitry Lychagin <dm...@couchbase.com>
Authored: Mon Sep 11 18:53:07 2017 -0700
Committer: Dmitry Lychagin <dm...@couchbase.com>
Committed: Tue Sep 19 10:51:43 2017 -0700
----------------------------------------------------------------------
.../PushAggFuncIntoStandaloneAggregateRule.java | 16 +-
.../SqlppExpressionToPlanTranslator.java | 2 +-
.../results_parser_sqlpp/count-tweets.ast | 2 +-
.../results_parser_sqlpp/denorm-cust-order.ast | 2 +-
.../results_parser_sqlpp/distinct_aggregate.ast | 2 +-
.../results_parser_sqlpp/fj-phase1.ast | 4 +-
.../fj-phase2-with-hints.ast | 4 +-
.../inlined_q18_large_volume_customer.ast | 4 +-
.../results_parser_sqlpp/nest_aggregate.ast | 2 +-
.../results_parser_sqlpp/orders-aggreg.ast | 6 +-
.../q01_pricing_summary_report_nt.ast | 16 +-
.../q03_shipping_priority.ast | 2 +-
.../q05_local_supplier_volume.ast | 2 +-
.../optimizerts/results_parser_sqlpp/q2.ast | 4 +-
.../results_parser_sqlpp/query-issue562.ast | 8 +-
.../results_parser_sqlpp/query-issue601.ast | 2 +-
.../results_parser_sqlpp/query-issue697.ast | 2 +-
.../results_parser_sqlpp/query-issue785.ast | 2 +-
.../results_parser_sqlpp/query-issue810-2.ast | 8 +-
.../results_parser_sqlpp/query-issue810.ast | 4 +-
.../results_parser_sqlpp/query-issue827-2.ast | 16 +-
.../split-materialization-above-join.ast | 8 +-
.../split-materialization.ast | 4 +-
.../parserts/results_parser_sqlpp/2.ast | 4 +-
.../groupby_clause_count.ast | 2 +-
.../results_parser_sqlpp/nestedFLWOGR3.ast | 4 +-
.../avg_distinct/avg_distinct.1.query.sqlpp | 24 ++
.../count_distinct/count_distinct.1.query.sqlpp | 24 ++
.../max_distinct/max_distinct.1.query.sqlpp | 24 ++
.../min_distinct/min_distinct.1.query.sqlpp | 24 ++
.../sum_distinct/sum_distinct.1.query.sqlpp | 24 ++
.../avg_distinct/avg_distinct.1.query.sqlpp | 24 ++
.../count_distinct/count_distinct.1.query.sqlpp | 24 ++
.../max_distinct/max_distinct.1.query.sqlpp | 24 ++
.../min_distinct/min_distinct.1.query.sqlpp | 24 ++
.../sum_distinct/sum_distinct.1.query.sqlpp | 24 ++
.../sugar-06-distinct.1.ddl.sqlpp | 29 ++
.../sugar-06-distinct.2.update.sqlpp | 45 +++
.../sugar-06-distinct.3.query.sqlpp | 25 ++
.../sugar-06-distinct.4.query.sqlpp | 25 ++
.../sugar-06-distinct.5.query.sqlpp | 25 ++
.../sugar-06-distinct.6.query.sqlpp | 25 ++
.../sugar-06-distinct.7.query.sqlpp | 25 ++
.../sugar-06-distinct.8.query.sqlpp | 25 ++
.../avg_distinct/avg_distinct.1.adm | 1 +
.../count_distinct/count_distinct.1.adm | 1 +
.../max_distinct/max_distinct.1.adm | 1 +
.../min_distinct/min_distinct.1.adm | 1 +
.../sum_distinct/sum_distinct.1.adm | 1 +
.../aggregate/avg_distinct/avg_distinct.1.adm | 1 +
.../count_distinct/count_distinct.1.adm | 1 +
.../aggregate/max_distinct/max_distinct.1.adm | 1 +
.../aggregate/min_distinct/min_distinct.1.adm | 1 +
.../aggregate/sum_distinct/sum_distinct.1.adm | 1 +
.../sugar-06-distinct/sugar-06-distinct.3.adm | 4 +
.../sugar-06-distinct/sugar-06-distinct.4.adm | 4 +
.../sugar-06-distinct/sugar-06-distinct.5.adm | 4 +
.../sugar-06-distinct/sugar-06-distinct.6.adm | 4 +
.../sugar-06-distinct/sugar-06-distinct.7.adm | 4 +
.../sugar-06-distinct/sugar-06-distinct.8.adm | 4 +
.../aggregate-sql/agg_null/agg_null.3.ast | 20 +-
.../agg_null_rec/agg_null_rec.3.ast | 10 +-
.../agg_null_rec_1/agg_null_rec_1.3.ast | 10 +-
.../aggregate-sql/agg_number/agg_number.3.ast | 20 +-
.../agg_number_rec/agg_number_rec.3.ast | 10 +-
.../aggregate-sql/avg_double/avg_double.3.ast | 2 +-
.../avg_double_null/avg_double_null.3.ast | 2 +-
.../avg_empty_01/avg_empty_01.3.ast | 2 +-
.../avg_empty_02/avg_empty_02.3.ast | 2 +-
.../aggregate-sql/avg_float/avg_float.3.ast | 2 +-
.../avg_float_null/avg_float_nu.3.ast | 2 +-
.../aggregate-sql/avg_int16/avg_int16.3.ast | 2 +-
.../avg_int16_null/avg_int16_null.3.ast | 2 +-
.../aggregate-sql/avg_int32/avg_int32.3.ast | 2 +-
.../avg_int32_null/avg_int32_null.3.ast | 2 +-
.../aggregate-sql/avg_int64/avg_int64.3.ast | 2 +-
.../avg_int64_null/avg_int64_null.3.ast | 2 +-
.../aggregate-sql/avg_int8/avg_int8.3.ast | 2 +-
.../avg_int8_null/avg_int8_null.3.ast | 2 +-
.../aggregate-sql/avg_mixed/avg_mixed.3.ast | 2 +-
.../aggregate-sql/count_01/count_01.3.ast | 2 +-
.../count_empty_01/count_empty_01.3.ast | 2 +-
.../count_empty_02/count_empty_02.3.ast | 2 +-
.../aggregate-sql/count_null/count_null.3.ast | 2 +-
.../aggregate-sql/issue395/issue395.3.ast | 2 +-
.../aggregate-sql/issue412_0/issue412_0.3.ast | 2 +-
.../aggregate-sql/issue412_1/issue412_1.3.ast | 10 +-
.../issue425_min_hetero_list.3.ast | 2 +-
.../issue425_min_hetero_list_1.3.ast | 2 +-
.../issue425_sum_hetero_list.3.ast | 2 +-
.../issue425_sum_hetero_list_1.3.ast | 2 +-
.../issue531_string_min_max.3.ast | 4 +-
.../max_empty_01/max_empty_01.3.ast | 2 +-
.../max_empty_02/max_empty_02.3.ast | 2 +-
.../min_empty_01/min_empty_01.3.ast | 2 +-
.../min_empty_02/min_empty_02.3.ast | 2 +-
.../aggregate-sql/min_mixed/min_mixed.3.ast | 2 +-
.../query-issue400/query-issue400.3.ast | 2 +-
.../aggregate-sql/scalar_avg/scalar_avg.3.ast | 12 +-
.../scalar_avg_empty/scalar_avg_empty.3.ast | 2 +-
.../scalar_avg_null/scalar_avg_null.3.ast | 12 +-
.../scalar_count/scalar_count.3.ast | 14 +-
.../scalar_count_empty/scalar_count_empty.3.ast | 2 +-
.../scalar_count_null/scalar_count_null.3.ast | 14 +-
.../aggregate-sql/scalar_max/scalar_max.3.ast | 16 +-
.../scalar_max_empty/scalar_max_empty.3.ast | 2 +-
.../scalar_max_null/scalar_max_null.3.ast | 16 +-
.../aggregate-sql/scalar_min/scalar_min.3.ast | 16 +-
.../scalar_min_empty/scalar_min_empty.3.ast | 2 +-
.../scalar_min_null/scalar_min_null.3.ast | 16 +-
.../aggregate-sql/scalar_sum/scalar_sum.3.ast | 12 +-
.../scalar_sum_empty/scalar_sum_empty.3.ast | 2 +-
.../scalar_sum_null/scalar_sum_null.3.ast | 12 +-
.../aggregate-sql/sum_double/sum_double.3.ast | 2 +-
.../sum_double_null/sum_double_null.3.ast | 2 +-
.../sum_empty_01/sum_empty_01.3.ast | 2 +-
.../sum_empty_02/sum_empty_02.3.ast | 2 +-
.../aggregate-sql/sum_float/sum_float.3.ast | 2 +-
.../sum_float_null/sum_float_null.3.ast | 2 +-
.../aggregate-sql/sum_int16/sum_int16.3.ast | 2 +-
.../sum_int16_null/sum_int16_null.3.ast | 2 +-
.../aggregate-sql/sum_int32/sum_int32.3.ast | 2 +-
.../sum_int32_null/sum_int32_null.3.ast | 2 +-
.../aggregate-sql/sum_int64/sum_int64.3.ast | 2 +-
.../sum_int64_null/sum_int64_null.3.ast | 2 +-
.../aggregate-sql/sum_int8/sum_int8.3.ast | 2 +-
.../sum_int8_null/sum_int8_null.3.ast | 2 +-
.../aggregate-sql/sum_mixed/sum_mixed.3.ast | 2 +-
.../sum_null-with-pred/sum_null-with-pred.3.ast | 2 +-
.../sum_numeric_null/sum_numeric_null.3.ast | 2 +-
.../aggregate/agg_null/agg_null.3.ast | 20 +-
.../aggregate/agg_null_rec/agg_null_rec.3.ast | 10 +-
.../agg_null_rec_1/agg_null_rec_1.3.ast | 10 +-
.../aggregate/agg_number/agg_number.3.ast | 20 +-
.../agg_number_rec/agg_number_rec.3.ast | 10 +-
.../aggregate/avg_double/avg_double.3.ast | 2 +-
.../avg_double_null/avg_double_null.3.ast | 2 +-
.../aggregate/avg_empty_01/avg_empty_01.3.ast | 2 +-
.../aggregate/avg_empty_02/avg_empty_02.3.ast | 2 +-
.../aggregate/avg_float/avg_float.3.ast | 2 +-
.../aggregate/avg_float_null/avg_float_nu.3.ast | 2 +-
.../aggregate/avg_int16/avg_int16.3.ast | 2 +-
.../avg_int16_null/avg_int16_null.3.ast | 2 +-
.../aggregate/avg_int32/avg_int32.3.ast | 2 +-
.../avg_int32_null/avg_int32_null.3.ast | 2 +-
.../aggregate/avg_int64/avg_int64.3.ast | 2 +-
.../avg_int64_null/avg_int64_null.3.ast | 2 +-
.../aggregate/avg_int8/avg_int8.3.ast | 2 +-
.../aggregate/avg_int8_null/avg_int8_null.3.ast | 2 +-
.../aggregate/avg_mixed/avg_mixed.3.ast | 2 +-
.../aggregate/count_01/count_01.3.ast | 2 +-
.../count_empty_01/count_empty_01.3.ast | 2 +-
.../count_empty_02/count_empty_02.3.ast | 2 +-
.../aggregate/count_null/count_null.3.ast | 2 +-
.../aggregate/issue395/issue395.3.ast | 2 +-
.../aggregate/issue412_0/issue412_0.3.ast | 2 +-
.../aggregate/issue412_1/issue412_1.3.ast | 10 +-
.../issue425_min_hetero_list.3.ast | 2 +-
.../issue425_min_hetero_list_1.3.ast | 2 +-
.../issue425_sum_hetero_list.3.ast | 2 +-
.../issue425_sum_hetero_list_1.3.ast | 2 +-
.../issue531_string_min_max.3.ast | 4 +-
.../aggregate/max_empty_01/max_empty_01.3.ast | 2 +-
.../aggregate/max_empty_02/max_empty_02.3.ast | 2 +-
.../aggregate/min_empty_01/min_empty_01.3.ast | 2 +-
.../aggregate/min_empty_02/min_empty_02.3.ast | 2 +-
.../aggregate/min_mixed/min_mixed.3.ast | 2 +-
.../query-issue400/query-issue400.3.ast | 2 +-
.../aggregate/scalar_avg/scalar_avg.3.ast | 12 +-
.../scalar_avg_empty/scalar_avg_empty.3.ast | 2 +-
.../scalar_avg_null/scalar_avg_null.3.ast | 12 +-
.../aggregate/scalar_count/scalar_count.3.ast | 14 +-
.../scalar_count_empty/scalar_count_empty.3.ast | 2 +-
.../scalar_count_null/scalar_count_null.3.ast | 14 +-
.../aggregate/scalar_max/scalar_max.3.ast | 16 +-
.../scalar_max_empty/scalar_max_empty.3.ast | 2 +-
.../scalar_max_null/scalar_max_null.3.ast | 16 +-
.../aggregate/scalar_min/scalar_min.3.ast | 16 +-
.../scalar_min_empty/scalar_min_empty.3.ast | 2 +-
.../scalar_min_null/scalar_min_null.3.ast | 16 +-
.../aggregate/scalar_sum/scalar_sum.3.ast | 12 +-
.../scalar_sum_empty/scalar_sum_empty.3.ast | 2 +-
.../scalar_sum_null/scalar_sum_null.3.ast | 12 +-
.../aggregate/sum_double/sum_double.3.ast | 2 +-
.../sum_double_null/sum_double_null.3.ast | 2 +-
.../aggregate/sum_empty_01/sum_empty_01.3.ast | 2 +-
.../aggregate/sum_empty_02/sum_empty_02.3.ast | 2 +-
.../aggregate/sum_float/sum_float.3.ast | 2 +-
.../sum_float_null/sum_float_null.3.ast | 2 +-
.../aggregate/sum_int16/sum_int16.3.ast | 2 +-
.../sum_int16_null/sum_int16_null.3.ast | 2 +-
.../aggregate/sum_int32/sum_int32.3.ast | 2 +-
.../sum_int32_null/sum_int32_null.3.ast | 2 +-
.../aggregate/sum_int64/sum_int64.3.ast | 2 +-
.../sum_int64_null/sum_int64_null.3.ast | 2 +-
.../aggregate/sum_int8/sum_int8.3.ast | 2 +-
.../aggregate/sum_int8_null/sum_int8_null.3.ast | 2 +-
.../aggregate/sum_mixed/sum_mixed.3.ast | 2 +-
.../sum_null-with-pred/sum_null-with-pred.3.ast | 2 +-
.../sum_numeric_null/sum_numeric_null.3.ast | 2 +-
.../cross-dataverse/cross-dv03/cross-dv03.3.ast | 2 +-
.../results_parser_sqlpp/dapd/q2/q2.3.ast | 4 +-
.../dml/query-issue382/query-issue382.3.ast | 2 +-
.../fuzzyjoin/dblp-1_1/dblp-1_1.3.ast | 2 +-
.../fuzzyjoin/dblp-1_2.1.1/dblp-1_2.3.ast | 2 +-
.../fuzzyjoin/dblp-1_2.1/dblp-1_2.3.ast | 2 +-
.../fuzzyjoin/dblp-1_2/dblp-1_2.3.ast | 2 +-
.../fuzzyjoin/dblp-2.1_5.3.1/dblp-2.3.ast | 4 +-
.../fuzzyjoin/dblp-2_1/dblp-2_1.3.ast | 4 +-
.../fuzzyjoin/dblp-2_2/dblp-2_2.3.ast | 4 +-
.../fuzzyjoin/dblp-2_3/dblp-2_3.3.ast | 4 +-
.../fuzzyjoin/dblp-2_4/dblp-2_4.3.ast | 4 +-
.../fuzzyjoin/dblp-2_5.1/dblp-2_5.3.ast | 4 +-
.../fuzzyjoin/dblp-2_5.2/dblp-2_5.3.ast | 4 +-
.../fuzzyjoin/dblp-2_5.3.1/dblp-2_5.3.ast | 4 +-
.../fuzzyjoin/dblp-2_5.3/dblp-2_5.3.ast | 4 +-
.../fuzzyjoin/dblp-2_5/dblp-2_5.3.ast | 4 +-
.../fuzzyjoin/dblp-3_1.1/dblp-3_1.3.ast | 8 +-
.../fuzzyjoin/dblp-3_1.2/dblp-3_1.3.ast | 8 +-
.../fuzzyjoin/dblp-3_1/dblp-3_1.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-2_1/dblp-csx-2_1.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-2_2/dblp-csx-2_2.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-2_3/dblp-csx-2_3.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-2_4/dblp-csx-2_4.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-2_5.1/dblp-csx-2_5.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-2_5.2/dblp-csx-2_5.3.ast | 8 +-
.../dblp-csx-2_5.3.1/dblp-csx-2_5.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-2_5.3/dblp-csx-2_5.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-2_5/dblp-csx-2_5.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-3_1/dblp-csx-3_1.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-3_2/dblp-csx-3_2.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-3_3/dblp-csx-3_3.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-3_4/dblp-csx-3_4.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-3_5.1/dblp-csx-3_5.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-3_5.2/dblp-csx-3_5.3.ast | 8 +-
.../dblp-csx-3_5.3.1/dblp-csx-3_5.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-3_5.3/dblp-csx-3_5.3.ast | 8 +-
.../dblp-csx-3_5.4.1/dblp-csx-3_5.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-3_5.4/dblp-csx-3_5.3.ast | 8 +-
.../fuzzyjoin/dblp-csx-3_5/dblp-csx-3_5.3.ast | 8 +-
.../hdfs/hdfs_02/hdfs_02.3.ast | 2 +-
.../hdfs/hdfs_03/hdfs_03.3.ast | 2 +-
.../hdfs_shortcircuit/hdfs_shortcircuit.3.ast | 2 +-
.../issue_251_dataset_hint_6.3.ast | 2 +-
.../list/listify_03/listify_03.3.ast | 4 +-
.../load/issue289_query/issue289_query.3.ast | 2 +-
.../assign-reuse/assign-reuse.3.ast | 4 +-
.../groupby-orderby-count.3.ast | 4 +-
.../tiny-social-example-no-complex-types.9.ast | 2 +-
.../tiny-social-example-only-lists.9.ast | 2 +-
.../tiny-social-example-only-records.9.ast | 2 +-
.../query-issue208/query-issue208.3.ast | 2 +-
.../query-issue456/query-issue456.3.ast | 2 +-
.../query-proposal/query-proposal.3.ast | 2 +-
.../query-proposal02/query-proposal02.3.ast | 2 +-
.../count-nullable/count-nullable.3.ast | 2 +-
.../cell-aggregation-with-filtering.3.ast | 8 +-
.../cell-aggregation/cell-aggregation.3.ast | 2 +-
.../q01_pricing_summary_report_nt.3.ast | 16 +-
.../interval_bin_gby_0/interval_bin_gby_0.3.ast | 2 +-
.../interval_bin_gby_1/interval_bin_gby_1.3.ast | 2 +-
.../overlap_bins_gby_1/overlap_bins_gby_1.3.ast | 4 +-
.../overlap_bins_gby_3/overlap_bins_gby_3.3.ast | 8 +-
.../tinysocial-suite.14.ast | 2 +-
.../tinysocial-suite.15.ast | 2 +-
.../tinysocial-suite.16.ast | 2 +-
.../tinysocial-suite.17.ast | 2 +-
.../tinysocial-suite.22.ast | 2 +-
.../tinysocial-suite.23.ast | 4 +-
.../tinysocial-suite.25.ast | 2 +-
.../tinysocial-suite.26.ast | 10 +-
.../tinysocial-suite.27.ast | 10 +-
.../tinysocial-suite/tinysocial-suite.14.ast | 2 +-
.../tinysocial-suite/tinysocial-suite.15.ast | 2 +-
.../tinysocial-suite/tinysocial-suite.16.ast | 2 +-
.../tinysocial-suite/tinysocial-suite.17.ast | 2 +-
.../tinysocial-suite/tinysocial-suite.22.ast | 2 +-
.../tinysocial-suite/tinysocial-suite.23.ast | 4 +-
.../tinysocial-suite/tinysocial-suite.25.ast | 2 +-
.../q01_pricing_summary_report_nt.3.ast | 16 +-
.../q02_minimum_cost_supplier.3.ast | 2 +-
.../q03_shipping_priority_nt.3.ast | 2 +-
.../q04_order_priority/q04_order_priority.3.ast | 2 +-
.../q05_local_supplier_volume.3.ast | 2 +-
.../q06_forecast_revenue_change.3.ast | 2 +-
.../q07_volume_shipping.3.ast | 2 +-
.../q08_national_market_share.3.ast | 4 +-
.../q09_product_type_profit_nt.3.ast | 2 +-
.../q10_returned_item/q10_returned_item.3.ast | 2 +-
.../q10_returned_item_int64.3.ast | 2 +-
.../q11_important_stock.3.ast | 4 +-
.../q12_shipping/q12_shipping.3.ast | 4 +-
.../q13_customer_distribution.3.ast | 6 +-
.../q14_promotion_effect.3.ast | 4 +-
.../q15_top_supplier/q15_top_supplier.3.ast | 4 +-
.../q16_parts_supplier_relationship.3.ast | 2 +-
.../q17_large_gby_variant.3.ast | 22 +-
.../q17_small_quantity_order_revenue.3.ast | 4 +-
.../q18_large_volume_customer.3.ast | 4 +-
.../q19_discounted_revenue.3.ast | 2 +-
.../q20_potential_part_promotion.3.ast | 2 +-
.../q21_suppliers_who_kept_orders_waiting.3.ast | 10 +-
.../q22_global_sales_opportunity.3.ast | 6 +-
.../query-issue601/query-issue601.3.ast | 2 +-
.../query-issue638/query-issue638.3.ast | 2 +-
.../query-issue785-2/query-issue785-2.3.ast | 2 +-
.../query-issue785/query-issue785.3.ast | 4 +-
.../query-issue786/query-issue786.3.ast | 2 +-
.../tpch/nest_aggregate/nest_aggregate.3.ast | 2 +-
.../q01_pricing_summary_report_nt.3.ast | 16 +-
.../q02_minimum_cost_supplier.3.ast | 2 +-
.../q03_shipping_priority_nt.3.ast | 2 +-
.../q04_order_priority/q04_order_priority.3.ast | 2 +-
.../q05_local_supplier_volume.3.ast | 2 +-
.../q06_forecast_revenue_change.3.ast | 2 +-
.../q06_forecast_revenue_change.4.ast | 2 +-
.../q07_volume_shipping.3.ast | 2 +-
.../q08_national_market_share.3.ast | 4 +-
.../q09_product_type_profit_nt.3.ast | 2 +-
.../q10_returned_item/q10_returned_item.3.ast | 2 +-
.../q10_returned_item_int64.3.ast | 2 +-
.../q11_important_stock.3.ast | 4 +-
.../tpch/q12_shipping/q12_shipping.3.ast | 4 +-
.../q13_customer_distribution.3.ast | 6 +-
.../q14_promotion_effect.3.ast | 4 +-
.../q15_top_supplier/q15_top_supplier.3.ast | 4 +-
.../q16_parts_supplier_relationship.3.ast | 2 +-
.../q17_large_gby_variant.3.ast | 22 +-
.../q18_large_volume_customer.3.ast | 4 +-
.../q19_discounted_revenue.3.ast | 2 +-
.../q20_potential_part_promotion.3.ast | 2 +-
.../q21_suppliers_who_kept_orders_waiting.3.ast | 10 +-
.../q22_global_sales_opportunity.3.ast | 6 +-
.../tpch/query-issue562/query-issue562.3.ast | 8 +-
.../tpch/query-issue601/query-issue601.3.ast | 2 +-
.../tpch/query-issue638/query-issue638.3.ast | 2 +-
.../query-issue785-2/query-issue785-2.3.ast | 2 +-
.../tpch/query-issue785/query-issue785.3.ast | 4 +-
.../tpch/query-issue786/query-issue786.3.ast | 2 +-
.../query-issue810-2/query-issue810-2.3.ast | 4 +-
.../query-issue810-3/query-issue810-3.3.ast | 8 +-
.../tpch/query-issue810/query-issue810.3.ast | 4 +-
.../query-issue827-2/query-issue827-2.3.ast | 16 +-
.../tpch/query-issue827/query-issue827.3.ast | 4 +-
.../query-issue489/query-issue489.2.ast | 2 +-
.../query-issue489/query-issue489.4.ast | 2 +-
.../resources/runtimets/testsuite_sqlpp.xml | 55 ++++
.../lang/sqlpp/rewrites/SqlppQueryRewriter.java | 10 +
.../SqlppDistinctAggregationSugarVisitor.java | 96 ++++++
.../visitor/SqlppGroupBySugarVisitor.java | 6 +-
.../rewrites/visitor/SqlppGroupByVisitor.java | 4 +-
.../lang/sqlpp/util/FunctionMapUtil.java | 4 +-
.../asterix-lang-sqlpp/src/main/javacc/SQLPP.jj | 11 +-
.../functions/AbstractFunctionDescriptor.java | 10 +-
.../asterix/om/functions/BuiltinFunctions.java | 296 +++++++++++++++----
.../core/algebra/base/PhysicalOperatorTag.java | 1 +
.../AbstractFunctionCallExpression.java | 9 +-
.../AbstractPreSortedDistinctByPOperator.java | 108 +++++++
.../MicroPreSortedDistinctByPOperator.java | 80 +++++
.../physical/PreSortedDistinctByPOperator.java | 93 +-----
.../rules/AbstractIntroduceCombinerRule.java | 43 +--
.../SetAlgebricksPhysicalOperatorsRule.java | 8 +-
362 files changed, 1883 insertions(+), 909 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggFuncIntoStandaloneAggregateRule.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggFuncIntoStandaloneAggregateRule.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggFuncIntoStandaloneAggregateRule.java
index d8efbe4..abb8775 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggFuncIntoStandaloneAggregateRule.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/PushAggFuncIntoStandaloneAggregateRule.java
@@ -44,6 +44,7 @@ import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractBina
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AbstractLogicalOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AggregateOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.AssignOperator;
+import org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator;
import org.apache.hyracks.algebricks.core.algebra.operators.logical.visitors.VariableUtilities;
import org.apache.hyracks.algebricks.core.rewriter.base.IAlgebraicRewriteRule;
@@ -78,8 +79,7 @@ public class PushAggFuncIntoStandaloneAggregateRule implements IAlgebraicRewrite
AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op2;
// Tries to push aggregates through the join.
if (containsAggregate(assignOp.getExpressions()) && pushableThroughJoin(join)) {
- pushAggregateFunctionThroughJoin(join, assignOp, context);
- return true;
+ return pushAggregateFunctionThroughJoin(join, assignOp, context);
}
}
return false;
@@ -152,27 +152,29 @@ public class PushAggFuncIntoStandaloneAggregateRule implements IAlgebraicRewrite
* @param context
* @throws AlgebricksException
*/
- private void pushAggregateFunctionThroughJoin(AbstractBinaryJoinOperator join, AssignOperator assignOp,
+ private boolean pushAggregateFunctionThroughJoin(AbstractBinaryJoinOperator join, AssignOperator assignOp,
IOptimizationContext context) throws AlgebricksException {
+ boolean applied = false;
for (Mutable<ILogicalOperator> branchRef : join.getInputs()) {
AbstractLogicalOperator branch = (AbstractLogicalOperator) branchRef.getValue();
if (branch.getOperatorTag() == LogicalOperatorTag.AGGREGATE) {
AggregateOperator aggOp = (AggregateOperator) branch;
- pushAggregateFunction(aggOp, assignOp, context);
+ applied |= pushAggregateFunction(aggOp, assignOp, context);
} else if (branch.getOperatorTag() == LogicalOperatorTag.INNERJOIN
|| branch.getOperatorTag() == LogicalOperatorTag.LEFTOUTERJOIN) {
AbstractBinaryJoinOperator childJoin = (AbstractBinaryJoinOperator) branch;
- pushAggregateFunctionThroughJoin(childJoin, assignOp, context);
+ applied |= pushAggregateFunctionThroughJoin(childJoin, assignOp, context);
}
}
+ return applied;
}
private boolean pushAggregateFunction(AggregateOperator aggOp, AssignOperator assignOp, IOptimizationContext context)
throws AlgebricksException {
Mutable<ILogicalOperator> opRef3 = aggOp.getInputs().get(0);
AbstractLogicalOperator op3 = (AbstractLogicalOperator) opRef3.getValue();
- // If there's a group by below the agg, then we want to have the agg pushed into the group by.
- if (op3.getOperatorTag() == LogicalOperatorTag.GROUP) {
+ // If there's a group by below the agg, then we want to have the agg pushed into the group by
+ if (op3.getOperatorTag() == LogicalOperatorTag.GROUP && !((GroupByOperator) op3).getNestedPlans().isEmpty()) {
return false;
}
if (aggOp.getVariables().size() != 1) {
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
index 285a35e..d37c7af 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/SqlppExpressionToPlanTranslator.java
@@ -614,7 +614,7 @@ class SqlppExpressionToPlanTranslator extends LangExpressionToPlanTranslator imp
returnVar = context.getVar(varExpr.getVar().getId());
} else {
returnVar = context.newVar();
- returnOperator = new AssignOperator(returnVar, new MutableObject<ILogicalExpression>(eo.first));
+ returnOperator = new AssignOperator(returnVar, new MutableObject<>(eo.first));
returnOperator.getInputs().add(eo.second);
}
if (selectClause.distinct()) {
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
index 166b68e..133b650 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/count-tweets.ast
@@ -21,7 +21,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [count]
:
- FunctionCall twitter.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
index a517304..cf3721d 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/denorm-cust-order.ast
@@ -52,7 +52,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [cnt-orders]
:
- FunctionCall custorder.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast
index 134e968..7dfc9a1 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/distinct_aggregate.ast
@@ -37,7 +37,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [count_suppkey]
:
- FunctionCall tpch.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
index 1bb18a6..4d5fe2b 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase1.ast
@@ -80,7 +80,7 @@ Let Variable [ Name=$tokens ]
Let Variable [ Name=$count ]
:=
- FunctionCall rares03.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -99,7 +99,7 @@ Let Variable [ Name=$tokens ]
)
AS Variable [ Name=$token ]
- AT
+ AT
Variable [ Name=$i ]
]
Where
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
index 6ff1695..595e2cb 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/fj-phase2-with-hints.ast
@@ -78,7 +78,7 @@ Let Variable [ Name=$tokensDBLP ]
)
Orderby
- FunctionCall fuzzyjoin_078.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -97,7 +97,7 @@ Let Variable [ Name=$tokensDBLP ]
)
AS Variable [ Name=$tokenRanked ]
- AT
+ AT
Variable [ Name=$i ]
]
Where
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
index cab13e2..2f16552 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/inlined_q18_large_volume_customer.ast
@@ -79,7 +79,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [sum_quantity]
:
- FunctionCall inlined_q18_large_volume_customer.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -118,7 +118,7 @@ FROM [ FunctionCall Metadata.dataset@1[
(
LiteralExpr [STRING] [t_sum_quantity]
:
- FunctionCall inlined_q18_large_volume_customer.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
index 56a5172..bb1b519 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/nest_aggregate.ast
@@ -168,7 +168,7 @@ RecordConstructor [
Let Variable [ Name=$sum ]
:=
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
index 2c44738..f2c8872 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/orders-aggreg.ast
@@ -22,7 +22,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [ordpercust]
:
- FunctionCall orders-aggreg.count@1[
+ FunctionCall asterix.count@1[
FunctionCall Metadata.resolve@-1[
LiteralExpr [STRING] [o]
Variable [ Name=$cid ]
@@ -33,7 +33,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [totalcust]
:
- FunctionCall orders-aggreg.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -52,7 +52,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [avgcust]
:
- FunctionCall orders-aggreg.avg@1[
+ FunctionCall asterix.avg@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
index aa7ccbd..5e220fd 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q01_pricing_summary_report_nt.ast
@@ -37,7 +37,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [sum_qty]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -56,7 +56,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [sum_base_price]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -75,7 +75,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [sum_disc_price]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
OperatorExpr [
@@ -105,7 +105,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [sum_charge]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
OperatorExpr [
@@ -144,7 +144,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [ave_qty]
:
- FunctionCall tpch.avg@1[
+ FunctionCall asterix.avg@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -163,7 +163,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [ave_price]
:
- FunctionCall tpch.avg@1[
+ FunctionCall asterix.avg@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -182,7 +182,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [ave_disc]
:
- FunctionCall tpch.avg@1[
+ FunctionCall asterix.avg@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -201,7 +201,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [count_order]
:
- FunctionCall tpch.count@1[
+ FunctionCall asterix.count@1[
FunctionCall Metadata.resolve@-1[
LiteralExpr [STRING] [l]
Variable [ Name=$l_linestatus ]
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
index 7d54130..35a0f59 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q03_shipping_priority.ast
@@ -173,7 +173,7 @@ Groupby
Let Variable [ Name=$revenue ]
:=
- FunctionCall q3_shipping_priority.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
OperatorExpr [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
index a220cf6..6795260 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q05_local_supplier_volume.ast
@@ -394,7 +394,7 @@ Groupby
Let Variable [ Name=$revenue ]
:=
- FunctionCall q5_local_supplier.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
OperatorExpr [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
index adb9a05..cfeb5fc 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/q2.ast
@@ -91,7 +91,7 @@ Groupby
Let Variable [ Name=$sig_sponsorship_count ]
:=
- FunctionCall events.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FunctionCall Metadata.resolve@-1[
@@ -121,7 +121,7 @@ Let Variable [ Name=$by_chapter ]
(
LiteralExpr [STRING] [escount]
:
- FunctionCall events.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
index b588daa..d8f328a 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue562.ast
@@ -136,7 +136,7 @@ FunctionDecl q22_customer_tmp([]) {
Query:
Let Variable [ Name=$avg ]
:=
- FunctionCall tpch.avg@1[
+ FunctionCall asterix.avg@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -226,7 +226,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [numcust]
:
- FunctionCall tpch.count@1[
+ FunctionCall asterix.count@1[
FunctionCall Metadata.resolve@-1[
LiteralExpr [STRING] [ct]
Variable [ Name=$cntrycode ]
@@ -237,7 +237,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [totacctbal]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -261,7 +261,7 @@ FROM [ FunctionCall tpch.q22_customer_tmp@0[
]
Where
OperatorExpr [
- FunctionCall tpch.count@1[
+ FunctionCall asterix.count@1[
(
SELECT ELEMENT [
Variable [ Name=$o ]
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
index 5cffeb4..3f3558d 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue601.ast
@@ -31,7 +31,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [count_order]
:
- FunctionCall tpch.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
index c733869..b106711 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue697.ast
@@ -17,7 +17,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [avg]
:
- FunctionCall test.avg@1[
+ FunctionCall asterix.avg@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
index 8dc0e87..c383a04 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue785.ast
@@ -186,7 +186,7 @@ Let Variable [ Name=$X ]
Let Variable [ Name=$sum ]
:=
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
index c75e253..90336e2 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810-2.ast
@@ -36,28 +36,28 @@ RecordConstructor [
(
LiteralExpr [STRING] [count_cheaps]
:
- FunctionCall tpch.count@1[
+ FunctionCall asterix.count@1[
Variable [ Name=$cheaps ]
]
)
(
LiteralExpr [STRING] [avg_expensive_discounts]
:
- FunctionCall tpch.avg@1[
+ FunctionCall asterix.avg@1[
Variable [ Name=$expensives ]
]
)
(
LiteralExpr [STRING] [sum_disc_prices]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
Variable [ Name=$disc_prices ]
]
)
(
LiteralExpr [STRING] [total_charges]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
Variable [ Name=$charges ]
]
)
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
index 612bbfa..65d64bc 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue810.ast
@@ -36,14 +36,14 @@ RecordConstructor [
(
LiteralExpr [STRING] [count_cheaps]
:
- FunctionCall tpch.count@1[
+ FunctionCall asterix.count@1[
Variable [ Name=$cheap ]
]
)
(
LiteralExpr [STRING] [count_expensives]
:
- FunctionCall tpch.count@1[
+ FunctionCall asterix.count@1[
Variable [ Name=$expensive ]
]
)
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
index 61c78ef..50efae7 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/query-issue827-2.ast
@@ -25,7 +25,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [sum_qty_partial]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -53,7 +53,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [sum_base_price]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -72,7 +72,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [sum_disc_price]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
OperatorExpr [
@@ -102,7 +102,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [sum_charge]
:
- FunctionCall tpch.sum@1[
+ FunctionCall asterix.sum@1[
(
SELECT ELEMENT [
OperatorExpr [
@@ -141,7 +141,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [ave_qty]
:
- FunctionCall tpch.avg@1[
+ FunctionCall asterix.avg@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -169,7 +169,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [ave_price]
:
- FunctionCall tpch.avg@1[
+ FunctionCall asterix.avg@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -188,7 +188,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [ave_disc]
:
- FunctionCall tpch.avg@1[
+ FunctionCall asterix.avg@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -207,7 +207,7 @@ RecordConstructor [
(
LiteralExpr [STRING] [count_order]
:
- FunctionCall tpch.count@1[
+ FunctionCall asterix.count@1[
(
SELECT ELEMENT [
Variable [ Name=$l ]
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
index 76447cd..c5c32c6 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization-above-join.ast
@@ -179,7 +179,7 @@ FROM [ FunctionCall Metadata.dataset@1[
)
Orderby
- FunctionCall fuzzyjoin.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -198,7 +198,7 @@ FROM [ FunctionCall Metadata.dataset@1[
)
AS Variable [ Name=$tokenRanked ]
- AT
+ AT
Variable [ Name=$i ]
]
Where
@@ -264,7 +264,7 @@ Variable [ Name=$i ]
)
Orderby
- FunctionCall fuzzyjoin.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
@@ -283,7 +283,7 @@ Variable [ Name=$i ]
)
AS Variable [ Name=$tokenRanked ]
- AT
+ AT
Variable [ Name=$i ]
]
Where
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast
index 6927f09..1824e70 100644
--- a/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast
+++ b/asterixdb/asterix-app/src/test/resources/optimizerts/results_parser_sqlpp/split-materialization.ast
@@ -33,7 +33,7 @@ Let Variable [ Name=$lonelyusers ]
]
Where
OperatorExpr [
- FunctionCall TinySocial.count@1[
+ FunctionCall asterix.count@1[
FieldAccessor [
Variable [ Name=$d ]
Field=friend-ids
@@ -56,7 +56,7 @@ Let Variable [ Name=$lonelyusers2 ]
]
Where
OperatorExpr [
- FunctionCall TinySocial.count@1[
+ FunctionCall asterix.count@1[
FieldAccessor [
Variable [ Name=$d ]
Field=friend-ids
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
index 9e50f02..0ee0fbd 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/2.ast
@@ -58,7 +58,7 @@ Groupby
Let Variable [ Name=$sig_sponsorship_count ]
:=
- FunctionCall null.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FunctionCall Metadata.resolve@-1[
@@ -88,7 +88,7 @@ Let Variable [ Name=$by_chapter ]
(
LiteralExpr [STRING] [escount]
:
- FunctionCall null.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FunctionCall Metadata.resolve@-1[
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast
index 1f46935..5e45f4e 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/groupby_clause_count.ast
@@ -1,6 +1,6 @@
Query:
SELECT ELEMENT [
-FunctionCall null.sql-count@1[
+FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FieldAccessor [
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
index 9c4682d..f9be2c5 100644
--- a/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
+++ b/asterixdb/asterix-app/src/test/resources/parserts/results_parser_sqlpp/nestedFLWOGR3.ast
@@ -58,7 +58,7 @@ Groupby
Let Variable [ Name=$sig_sponsorship_count ]
:=
- FunctionCall null.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FunctionCall Metadata.resolve@-1[
@@ -88,7 +88,7 @@ Let Variable [ Name=$by_chapter ]
(
LiteralExpr [STRING] [escount]
:
- FunctionCall null.sql-count@1[
+ FunctionCall asterix.sql-count@1[
(
SELECT ELEMENT [
FunctionCall Metadata.resolve@-1[
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_distinct/avg_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_distinct/avg_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_distinct/avg_distinct.1.query.sqlpp
new file mode 100644
index 0000000..cae2b8f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/avg_distinct/avg_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': to_bigint(array_avg(distinct [10,20,30,10,20,30,10])),
+ 't2': to_bigint(array_avg(distinct [null,missing,null,missing])),
+ 't3': to_bigint(array_avg(distinct [40,null,missing,50,40,null,missing,50,40])),
+ 't4': to_bigint(array_avg(distinct []))
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_distinct/count_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_distinct/count_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_distinct/count_distinct.1.query.sqlpp
new file mode 100644
index 0000000..80dc741
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/count_distinct/count_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': array_count(distinct [10,20,30,10,20,30,10]),
+ 't2': array_count(distinct [null,missing,null,missing]),
+ 't3': array_count(distinct [40,null,missing,50,40,null,missing,50,40]),
+ 't4': array_count(distinct [])
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_distinct/max_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_distinct/max_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_distinct/max_distinct.1.query.sqlpp
new file mode 100644
index 0000000..0f381f7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/max_distinct/max_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': array_max(distinct [10,20,30,10,20,30,10]),
+ 't2': array_max(distinct [null,missing,null,missing]),
+ 't3': array_max(distinct [40,null,missing,50,40,null,missing,50,40]),
+ 't4': array_max(distinct [])
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_distinct/min_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_distinct/min_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_distinct/min_distinct.1.query.sqlpp
new file mode 100644
index 0000000..8a25c31
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/min_distinct/min_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': array_min(distinct [10,20,30,10,20,30,10]),
+ 't2': array_min(distinct [null,missing,null,missing]),
+ 't3': array_min(distinct [40,null,missing,50,40,null,missing,50,40]),
+ 't4': array_min(distinct [])
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_distinct/sum_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_distinct/sum_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_distinct/sum_distinct.1.query.sqlpp
new file mode 100644
index 0000000..53aacdf
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate-sql/sum_distinct/sum_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': array_sum(distinct [10,20,30,10,20,30,10]),
+ 't2': array_sum(distinct [null,missing,null,missing]),
+ 't3': array_sum(distinct [40,null,missing,50,40,null,missing,50,40]),
+ 't4': array_sum(distinct [])
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_distinct/avg_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_distinct/avg_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_distinct/avg_distinct.1.query.sqlpp
new file mode 100644
index 0000000..c9a79fb
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/avg_distinct/avg_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': to_bigint(coll_avg(distinct [10,20,30,10,20,30,10])),
+ 't2': to_bigint(coll_avg(distinct [null,missing,null,missing])),
+ 't3': to_bigint(coll_avg(distinct [40,null,missing,50,40,null,missing,50,40])),
+ 't4': to_bigint(coll_avg(distinct []))
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_distinct/count_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_distinct/count_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_distinct/count_distinct.1.query.sqlpp
new file mode 100644
index 0000000..a7d9b90
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/count_distinct/count_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': coll_count(distinct [10,20,30,10,20,30,10]),
+ 't2': coll_count(distinct [null,missing,null,missing]),
+ 't3': coll_count(distinct [40,null,missing,50,40,null,missing,50,40]),
+ 't4': coll_count(distinct [])
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_distinct/max_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_distinct/max_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_distinct/max_distinct.1.query.sqlpp
new file mode 100644
index 0000000..70f273f
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/max_distinct/max_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': coll_max(distinct [10,20,30,10,20,30,10]),
+ 't2': coll_max(distinct [null,missing,null,missing]),
+ 't3': coll_max(distinct [40,null,missing,50,40,null,missing,50,40]),
+ 't4': coll_max(distinct [])
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_distinct/min_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_distinct/min_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_distinct/min_distinct.1.query.sqlpp
new file mode 100644
index 0000000..77684a0
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/min_distinct/min_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': coll_min(distinct [10,20,30,10,20,30,10]),
+ 't2': coll_min(distinct [null,missing,null,missing]),
+ 't3': coll_min(distinct [40,null,missing,50,40,null,missing,50,40]),
+ 't4': coll_min(distinct [])
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_distinct/sum_distinct.1.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_distinct/sum_distinct.1.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_distinct/sum_distinct.1.query.sqlpp
new file mode 100644
index 0000000..6991a74
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/aggregate/sum_distinct/sum_distinct.1.query.sqlpp
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+ {
+ 't1': coll_sum(distinct [10,20,30,10,20,30,10]),
+ 't2': coll_sum(distinct [null,missing,null,missing]),
+ 't3': coll_sum(distinct [40,null,missing,50,40,null,missing,50,40]),
+ 't4': coll_sum(distinct [])
+ }
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.1.ddl.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.1.ddl.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.1.ddl.sqlpp
new file mode 100644
index 0000000..0330592
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.1.ddl.sqlpp
@@ -0,0 +1,29 @@
+/*
+ * 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 gby IF EXISTS;
+CREATE DATAVERSE gby;
+
+USE gby;
+
+CREATE TYPE EmpType AS {
+ name : string
+};
+
+CREATE DATASET Employee(EmpType) PRIMARY KEY name;
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.2.update.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.2.update.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.2.update.sqlpp
new file mode 100644
index 0000000..3fe9478
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.2.update.sqlpp
@@ -0,0 +1,45 @@
+/*
+ * 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 gby;
+
+INSERT INTO Employee (
+[
+ { 'name': 'a', 'deptno': 1, 'salary': 2000 },
+ { 'name': 'b', 'deptno': 1, 'salary': 3000 },
+ { 'name': 'c', 'deptno': 1, 'salary': 2000 },
+ { 'name': 'd', 'deptno': 1, 'salary': 3000 },
+ { 'name': 'e', 'deptno': 1, 'salary': 2000 },
+
+ { 'name': 'f', 'deptno': 2, 'salary': 4000 },
+ { 'name': 'g', 'deptno': 2, 'salary': 5000 },
+ { 'name': 'h', 'deptno': 2, 'salary': 4000 },
+ { 'name': 'i', 'deptno': 2, 'salary': 5000 },
+ { 'name': 'j', 'deptno': 2, 'salary': 4000 },
+
+ { 'name': 'k', 'deptno': 3, 'salary': null },
+ { 'name': 'l', 'deptno': 3, 'salary': 6000 },
+ { 'name': 'm', 'deptno': 3 },
+ { 'name': 'n', 'deptno': 3, 'salary': null },
+ { 'name': 'o', 'deptno': 3, 'salary': 6000 },
+ { 'name': 'p', 'deptno': 3 },
+
+ { 'name': 'q', 'deptno': 4 }
+]
+);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.3.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.3.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.3.query.sqlpp
new file mode 100644
index 0000000..4c64f14
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.3.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM gby.Employee e
+GROUP BY e.deptno AS deptno
+SELECT VALUE [ deptno, COUNT(DISTINCT e.salary) ]
+ORDER BY deptno;
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.4.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.4.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.4.query.sqlpp
new file mode 100644
index 0000000..524a88b
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.4.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM gby.Employee e
+GROUP BY e.deptno AS deptno
+SELECT VALUE [ deptno, SUM(DISTINCT e.salary) ]
+ORDER BY deptno;
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.5.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.5.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.5.query.sqlpp
new file mode 100644
index 0000000..d0a2aaf
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.5.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM gby.Employee e
+GROUP BY e.deptno AS deptno
+SELECT VALUE [ deptno, TO_BIGINT(AVG(DISTINCT e.salary)) ]
+ORDER BY deptno;
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.6.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.6.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.6.query.sqlpp
new file mode 100644
index 0000000..867ca3a
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.6.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM gby.Employee e
+GROUP BY e.deptno AS deptno
+SELECT VALUE [ deptno, MAX(DISTINCT e.salary) ]
+ORDER BY deptno;
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.7.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.7.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.7.query.sqlpp
new file mode 100644
index 0000000..6ab01d7
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.7.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM gby.Employee e
+GROUP BY e.deptno AS deptno
+SELECT VALUE [ deptno, MIN(DISTINCT e.salary) ]
+ORDER BY deptno;
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.8.query.sqlpp
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.8.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.8.query.sqlpp
new file mode 100644
index 0000000..69d95bc
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/group-by/sugar-06-distinct/sugar-06-distinct.8.query.sqlpp
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+USE gby;
+
+FROM gby.Employee e
+GROUP BY e.deptno AS deptno GROUP AS g
+SELECT VALUE [ deptno, ARRAY_SUM((SELECT DISTINCT VALUE g.e.salary FROM g )) ]
+ORDER BY deptno;
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/7a4b5681/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_distinct/avg_distinct.1.adm
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_distinct/avg_distinct.1.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_distinct/avg_distinct.1.adm
new file mode 100644
index 0000000..a7b36e6
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/aggregate-sql/avg_distinct/avg_distinct.1.adm
@@ -0,0 +1 @@
+{ "t1": 20, "t2": null, "t3": 45, "t4": null }
\ No newline at end of file