You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by im...@apache.org on 2020/04/17 07:32:44 UTC

[asterixdb] 01/03: [ASTERIXDB-2709][COMP] Fix registration of st_union aggregates

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

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

commit 3d0897b6532b276d20fb7fc255f91de58002d7b8
Author: Dmitry Lychagin <dm...@couchbase.com>
AuthorDate: Fri Apr 10 11:20:49 2020 -0700

    [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 <je...@fulliautomatix.ics.uci.edu>
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>
    Reviewed-by: Ali Alsuliman <al...@gmail.com>
---
 .../two-geometries/aggregate.17.query.sqlpp        | 23 ++++++++++++++++++
 .../results/geojson/two-geometries/result.17.adm   |  1 +
 .../asterix/om/functions/BuiltinFunctions.java     | 28 ++++++++++++++++++----
 3 files changed, 48 insertions(+), 4 deletions(-)

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 class BuiltinFunctions {
     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 @@ public class BuiltinFunctions {
         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 @@ public class BuiltinFunctions {
         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 {