You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by yu...@apache.org on 2023/08/01 15:49:56 UTC

[pinot] branch master updated: Support st-union function in v2 (#11235)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d2789319d5 Support st-union function in v2 (#11235)
d2789319d5 is described below

commit d2789319d56886b29433e8e4594c3f309a2415c4
Author: Xiang Fu <xi...@gmail.com>
AuthorDate: Tue Aug 1 08:49:51 2023 -0700

    Support st-union function in v2 (#11235)
---
 .../tests/GeoSpatialClusterIntegrationTest.java      | 20 ++++++++++++++++++++
 .../pinot/segment/spi/AggregationFunctionType.java   |  3 ++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/GeoSpatialClusterIntegrationTest.java b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/GeoSpatialClusterIntegrationTest.java
index 8982988780..408a2191c7 100644
--- a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/GeoSpatialClusterIntegrationTest.java
+++ b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/GeoSpatialClusterIntegrationTest.java
@@ -362,4 +362,24 @@ public class GeoSpatialClusterIntegrationTest extends BaseClusterIntegrationTest
       Assert.assertEquals(actualResult, expectedResult);
     }
   }
+
+  @Test(dataProvider = "useBothQueryEngines")
+  public void testStUnionQuery(boolean useMultiStageQueryEngine)
+      throws Exception {
+    setUseMultiStageQueryEngine(useMultiStageQueryEngine);
+    String query =
+        String.format("Select STUnion(ST_GeogFromText(%s)) from %s",
+            AREA_GEOG_NAME, DEFAULT_TABLE_NAME);
+    JsonNode pinotResponse = postQuery(query);
+    JsonNode rows = pinotResponse.get("resultTable").get("rows");
+    String actualResult = rows.get(0).get(0).asText();
+    String expectedResult =
+        "850000000200000012000000000000000a0000000000000000000000000000000000000000000000003f826b0721dd331700000"
+            + "000000000003ff0000000000000000000000000000040568000000000003ff00000000000004056400000000000405640000000"
+            + "00003ff0000000000000405680000000000000000000000000003ff000000000000000000000000000003f826b0721dd3317000"
+            + "000000000000000000000000000000000000000000000c05e899ba1b196104042be385c67dfe3c05e898c8259e1f44042be491a"
+            + "fc04c9c05e89538ef34d6a4042be4840e1719fc05e8956cd6c2efd4042bdf26f1dc50dc05e898e864020814042bdc1e7967cafc"
+            + "05e89a7503b81b64042bddabe27179cc05e89a85caafbc24042be215336deb9c05e899ba1b196104042be385c67dfe3";
+    Assert.assertEquals(actualResult, expectedResult);
+  }
 }
diff --git a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/AggregationFunctionType.java b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/AggregationFunctionType.java
index 460bf61faf..5f7ed4a748 100644
--- a/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/AggregationFunctionType.java
+++ b/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/AggregationFunctionType.java
@@ -147,7 +147,8 @@ public enum AggregationFunctionType {
   AVGVALUEINTEGERSUMTUPLESKETCH("avgValueIntegerSumTupleSketch"),
 
   // Geo aggregation functions
-  STUNION("STUnion"),
+  STUNION("STUnion", ImmutableList.of("ST_UNION"), SqlKind.OTHER_FUNCTION, SqlFunctionCategory.USER_DEFINED_FUNCTION,
+      OperandTypes.BINARY, ReturnTypes.explicit(SqlTypeName.VARBINARY), ReturnTypes.explicit(SqlTypeName.OTHER)),
 
   // Aggregation functions for multi-valued columns
   COUNTMV("countMV", null, SqlKind.OTHER_FUNCTION, SqlFunctionCategory.USER_DEFINED_FUNCTION,


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org