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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2522329d04 [SEDONA-687] Fix Snowflake registration of ST_LabelPoint 
(#1731)
2522329d04 is described below

commit 2522329d04b915c23f7273e13c47218b0bf186ab
Author: Furqaan Khan <[email protected]>
AuthorDate: Wed Dec 18 23:14:49 2024 -0500

    [SEDONA-687] Fix Snowflake registration of ST_LabelPoint (#1731)
---
 .../sedona/snowflake/snowsql/TestFunctionsV2.java     | 19 ++++++++++---------
 .../org/apache/sedona/snowflake/snowsql/UDFsV2.java   |  9 ++++++---
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git 
a/snowflake-tester/src/test/java/org/apache/sedona/snowflake/snowsql/TestFunctionsV2.java
 
b/snowflake-tester/src/test/java/org/apache/sedona/snowflake/snowsql/TestFunctionsV2.java
index 82649398ff..25a4006690 100644
--- 
a/snowflake-tester/src/test/java/org/apache/sedona/snowflake/snowsql/TestFunctionsV2.java
+++ 
b/snowflake-tester/src/test/java/org/apache/sedona/snowflake/snowsql/TestFunctionsV2.java
@@ -83,17 +83,18 @@ public class TestFunctionsV2 extends TestBase {
   @Test
   public void test_ST_LabelPoint() {
     registerUDFV2("ST_LabelPoint", String.class, int.class, double.class);
-    verifyGeometry(
-        "SELECT 
ST_AsText(ST_ReducePrecision(sedona.ST_LabelPoint(ST_GeometryFromWKT('POLYGON 
((-112.637484 33.440546, -112.546852 33.477209, -112.489177 33.550488, 
-112.41777 33.751684, -111.956371 33.719707, -111.766868 33.616843, -111.775107 
33.527595, -111.640533 33.504695, -111.440044 33.463462, -111.415326 33.374055, 
-111.514197 33.309809, -111.643279 33.222542, -111.893203 33.174278, -111.96461 
33.250109, -112.123903 33.261593, -112.252985 33.35341, -112.406784 33.346527, 
-112.667 [...]
-        "POINT (-112.0428 33.4642)");
+    registerUDFV2("ST_ReducePrecision", String.class, int.class);
+    verifySqlSingleRes(
+        "SELECT 
ST_AsText(sedona.ST_ReducePrecision(sedona.ST_LabelPoint(ST_GeometryFromWKT('POLYGON
 ((-112.637484 33.440546, -112.546852 33.477209, -112.489177 33.550488, 
-112.41777 33.751684, -111.956371 33.719707, -111.766868 33.616843, -111.775107 
33.527595, -111.640533 33.504695, -111.440044 33.463462, -111.415326 33.374055, 
-111.514197 33.309809, -111.643279 33.222542, -111.893203 33.174278, -111.96461 
33.250109, -112.123903 33.261593, -112.252985 33.35341, -112.406784 33.346527, 
- [...]
+        "POINT(-112.0428 33.4642)");
     registerUDFV2("ST_LabelPoint", String.class, int.class);
-    verifyGeometry(
-        "SELECT 
ST_AsText(ST_ReducePrecision(sedona.ST_LabelPoint(ST_GeometryFromWKT('GEOMETRYCOLLECTION(POLYGON
 ((-112.840785 33.435962, -112.840785 33.708284, -112.409597 33.708284, 
-112.409597 33.435962, -112.840785 33.435962)), POLYGON ((-112.309264 
33.398167, -112.309264 33.746007, -111.787444 33.746007, -111.787444 33.398167, 
-112.309264 33.398167)))'), 4), 4))",
-        "POINT (-112.0484 33.5721)");
+    verifySqlSingleRes(
+        "SELECT 
ST_AsText(sedona.ST_ReducePrecision(sedona.ST_LabelPoint(ST_GeometryFromWKT('GEOMETRYCOLLECTION(POLYGON
 ((-112.840785 33.435962, -112.840785 33.708284, -112.409597 33.708284, 
-112.409597 33.435962, -112.840785 33.435962)), POLYGON ((-112.309264 
33.398167, -112.309264 33.746007, -111.787444 33.746007, -111.787444 33.398167, 
-112.309264 33.398167)))'), 4), 4))",
+        "POINT(-112.0484 33.5721)");
     registerUDFV2("ST_LabelPoint", String.class);
-    verifyGeometry(
-        "SELECT 
ST_AsText(ST_ReducePrecision(sedona.ST_LabelPoint(ST_GeometryFromWKT('POLYGON 
((-112.654072 33.114485, -112.313516 33.653431, -111.63515 33.314399, 
-111.497829 33.874913, -111.692825 33.431378, -112.376684 33.788215, 
-112.654072 33.114485))')), 4))",
-        "POINT (-112.0723 33.5391)");
+    verifySqlSingleRes(
+        "SELECT 
ST_AsText(sedona.ST_ReducePrecision(sedona.ST_LabelPoint(ST_GeometryFromWKT('POLYGON
 ((-112.654072 33.114485, -112.313516 33.653431, -111.63515 33.314399, 
-111.497829 33.874913, -111.692825 33.431378, -112.376684 33.788215, 
-112.654072 33.114485))')), 4))",
+        "POINT(-112.0723 33.5391)");
   }
 
   @Test
diff --git 
a/snowflake/src/main/java/org/apache/sedona/snowflake/snowsql/UDFsV2.java 
b/snowflake/src/main/java/org/apache/sedona/snowflake/snowsql/UDFsV2.java
index c7aadd935f..f135a51881 100644
--- a/snowflake/src/main/java/org/apache/sedona/snowflake/snowsql/UDFsV2.java
+++ b/snowflake/src/main/java/org/apache/sedona/snowflake/snowsql/UDFsV2.java
@@ -103,14 +103,16 @@ public class UDFsV2 {
 
   @UDFAnnotations.ParamMeta(
       argNames = {"geom"},
-      argTypes = {"Geometry"})
+      argTypes = {"Geometry"},
+      returnTypes = "Geometry")
   public static String ST_LabelPoint(String geom) {
     return 
GeometrySerde.serGeoJson(Functions.labelPoint(GeometrySerde.deserGeoJson(geom)));
   }
 
   @UDFAnnotations.ParamMeta(
       argNames = {"geom", "gridResolution"},
-      argTypes = {"Geometry", "int"})
+      argTypes = {"Geometry", "int"},
+      returnTypes = "Geometry")
   public static String ST_LabelPoint(String geom, int gridResolution) {
     return GeometrySerde.serGeoJson(
         Functions.labelPoint(GeometrySerde.deserGeoJson(geom), 
gridResolution));
@@ -118,7 +120,8 @@ public class UDFsV2 {
 
   @UDFAnnotations.ParamMeta(
       argNames = {"geom", "gridResolution", "goodnessThreshold"},
-      argTypes = {"Geometry", "int", "double"})
+      argTypes = {"Geometry", "int", "double"},
+      returnTypes = "Geometry")
   public static String ST_LabelPoint(String geom, int gridResolution, double 
goodnessThreshold) {
     return GeometrySerde.serGeoJson(
         Functions.labelPoint(GeometrySerde.deserGeoJson(geom), gridResolution, 
goodnessThreshold));

Reply via email to