[ASTERIXDB-2709][COMP] Fix registration of st_union aggregates
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Fix registration of st_union() aggregate function
in BuiltinFunctions
Change-Id: Iff0e141a5874b87916bd07335594fb6350ed93c7
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/5704
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Dmitry Lychagin <dmitry.lychagin@couchbase.com>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/two-geometries/aggregate.17.query.sqlpp b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/two-geometries/aggregate.17.query.sqlpp
new file mode 100644
index 0000000..578ba95
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/queries_sqlpp/geojson/two-geometries/aggregate.17.query.sqlpp
@@ -0,0 +1,23 @@
+/*
+ * 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 GeoJSON1;
+
+strict_st_union((
+ SELECT VALUE gbu FROM [st_make_point(1.0,1.0),st_make_point(1.0,2.0)] as gbu
+));
\ No newline at end of file
diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/two-geometries/result.17.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/two-geometries/result.17.adm
new file mode 100644
index 0000000..5123e09
--- /dev/null
+++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/geojson/two-geometries/result.17.adm
@@ -0,0 +1 @@
+{"type":"MultiPoint","coordinates":[[1,1],[1,2]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}
\ No newline at end of file
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 3570aff..19c1b51 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
@@ -1326,13 +1326,22 @@
public static final FunctionIdentifier ST_LENGTH =
new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "st-length", 1);
public static final FunctionIdentifier SCALAR_ST_UNION_AGG =
- new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "st-union", 1);
+ new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "st_union", 1);
public static final FunctionIdentifier SCALAR_ST_UNION_AGG_DISTINCT =
- new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "st-union-distinct", 1);
+ new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "st_union-distinct", 1);
public static final FunctionIdentifier ST_UNION_AGG =
- new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "st-union-agg", 1);
+ new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-st_union", 1);
public static final FunctionIdentifier ST_UNION_AGG_DISTINCT =
- new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "st-union-agg-distinct", 1);
+ new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-st_union-distinct", 1);
+ public static final FunctionIdentifier SCALAR_ST_UNION_SQL_AGG =
+ new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-st_union", 1);
+ public static final FunctionIdentifier SCALAR_ST_UNION_SQL_AGG_DISTINCT =
+ new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "sql-st_union-distinct", 1);
+ public static final FunctionIdentifier ST_UNION_SQL_AGG =
+ new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-sql-st_union", 1);
+ public static final FunctionIdentifier ST_UNION_SQL_AGG_DISTINCT =
+ new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "agg-sql-st_union-distinct", 1);
+
public static final FunctionIdentifier ST_GEOM_FROM_TEXT =
new FunctionIdentifier(FunctionConstants.ASTERIX_NS, "st-geom-from-text", 1);
public static final FunctionIdentifier ST_GEOM_FROM_TEXT_SRID =
@@ -2207,7 +2216,10 @@
addFunction(ST_SYM_DIFFERENCE, AGeometryTypeComputer.INSTANCE, true);
addFunction(SCALAR_ST_UNION_AGG, AGeometryTypeComputer.INSTANCE, true);
addFunction(SCALAR_ST_UNION_AGG_DISTINCT, AGeometryTypeComputer.INSTANCE, true);
+ addFunction(SCALAR_ST_UNION_SQL_AGG, AGeometryTypeComputer.INSTANCE, true);
+ addFunction(SCALAR_ST_UNION_SQL_AGG_DISTINCT, AGeometryTypeComputer.INSTANCE, true);
addPrivateFunction(ST_UNION_AGG, AGeometryTypeComputer.INSTANCE, true);
+ addPrivateFunction(ST_UNION_SQL_AGG, AGeometryTypeComputer.INSTANCE, true);
addFunction(ST_POLYGONIZE, AGeometryTypeComputer.INSTANCE, true);
// Binary functions
@@ -3011,6 +3023,14 @@
addScalarAgg(ST_UNION_AGG, SCALAR_ST_UNION_AGG);
addDistinctAgg(ST_UNION_AGG_DISTINCT, ST_UNION_AGG);
addScalarAgg(ST_UNION_AGG_DISTINCT, SCALAR_ST_UNION_AGG_DISTINCT);
+
+ addAgg(ST_UNION_SQL_AGG);
+ addLocalAgg(ST_UNION_SQL_AGG, ST_UNION_SQL_AGG);
+ addIntermediateAgg(ST_UNION_SQL_AGG, ST_UNION_SQL_AGG);
+ addGlobalAgg(ST_UNION_SQL_AGG, ST_UNION_SQL_AGG);
+ addScalarAgg(ST_UNION_SQL_AGG, SCALAR_ST_UNION_SQL_AGG);
+ addDistinctAgg(ST_UNION_SQL_AGG_DISTINCT, ST_UNION_SQL_AGG);
+ addScalarAgg(ST_UNION_SQL_AGG_DISTINCT, SCALAR_ST_UNION_SQL_AGG_DISTINCT);
}
interface BuiltinFunctionProperty {