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

jiayu pushed a commit to branch fix/2390-geometry-type-empty
in repository https://gitbox.apache.org/repos/asf/sedona.git

commit 4501ef562c5e2bd5c6195d306499b6d7872ac489
Author: Jia Yu <[email protected]>
AuthorDate: Sat Feb 7 00:57:00 2026 -0800

    test(GeometryType): add regression test for EMPTY geometries
    
    The NPE was already fixed incidentally in PR #2380 (null check in
    isMeasuredGeometry). This commit adds explicit test coverage for all
    seven empty geometry types to prevent regression.
    
    Fixes #2390
---
 .../org/apache/sedona/common/FunctionsTest.java    | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/common/src/test/java/org/apache/sedona/common/FunctionsTest.java 
b/common/src/test/java/org/apache/sedona/common/FunctionsTest.java
index e379e67d6d..2d3a66b4e8 100644
--- a/common/src/test/java/org/apache/sedona/common/FunctionsTest.java
+++ b/common/src/test/java/org/apache/sedona/common/FunctionsTest.java
@@ -3952,6 +3952,28 @@ public class FunctionsTest extends TestBase {
     assertEquals(expected4, actual4);
   }
 
+  @Test
+  public void geometryTypeWithMeasuredEmpty() {
+    // Regression test for GH-2390: GeometryType fails on all EMPTY geometries
+    assertEquals("POINT", 
Functions.geometryTypeWithMeasured(GEOMETRY_FACTORY.createEmpty(0)));
+    assertEquals(
+        "LINESTRING", 
Functions.geometryTypeWithMeasured(GEOMETRY_FACTORY.createLineString()));
+    assertEquals(
+        "POLYGON",
+        Functions.geometryTypeWithMeasured(
+            
GEOMETRY_FACTORY.createPolygon(GEOMETRY_FACTORY.createLinearRing())));
+    assertEquals(
+        "MULTIPOINT", 
Functions.geometryTypeWithMeasured(GEOMETRY_FACTORY.createMultiPoint()));
+    assertEquals(
+        "MULTILINESTRING",
+        
Functions.geometryTypeWithMeasured(GEOMETRY_FACTORY.createMultiLineString()));
+    assertEquals(
+        "MULTIPOLYGON", 
Functions.geometryTypeWithMeasured(GEOMETRY_FACTORY.createMultiPolygon()));
+    assertEquals(
+        "GEOMETRYCOLLECTION",
+        
Functions.geometryTypeWithMeasured(GEOMETRY_FACTORY.createGeometryCollection()));
+  }
+
   @Test
   public void closestPoint() {
     Point point1 = GEOMETRY_FACTORY.createPoint(new Coordinate(1, 1));

Reply via email to