You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "zhangfengcdt (via GitHub)" <gi...@apache.org> on 2026/04/22 16:15:05 UTC

[PR] [GH-2830] Adds Geography dual-dispatch to ST_NumGeometries [sedona]

zhangfengcdt opened a new pull request, #2851:
URL: https://github.com/apache/sedona/pull/2851

   ## Did you read the Contributor Guide?
   
   - Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/)
   
   ## Is this PR related to a ticket?
   
   - Yes, and the PR name follows the format `[GH-XXX] my subject`. Closes #<issue_number>
   
   ## What changes were proposed in this PR?
     - Adds Geography dual-dispatch to ST_NumGeometries — returns the count of sub-geometries for both Geometry and Geography inputs.
     - Follow-up to #2831; L1 tier (Geography path delegates to JTS via getJTSGeometry().getNumGeometries()).
   
   ## How was this patch tested?
     - mvn -pl common -am test -Dtest=FunctionTest
     - New Spark SQL cases in GeographyFunctionTest
   
   ## Did this PR include necessary documentation updates?
   
   - Yes, I have updated the documentation.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [GH-2830] Adds Geography dual-dispatch to ST_NumGeometries [sedona]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #2851:
URL: https://github.com/apache/sedona/pull/2851#issuecomment-4322830064

   Conflict again


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [GH-2830] Adds Geography dual-dispatch to ST_NumGeometries [sedona]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2851:
URL: https://github.com/apache/sedona/pull/2851#discussion_r3125367922


##########
docs/api/sql/geography/Geography-Functions.md:
##########
@@ -43,6 +43,7 @@ These functions operate on geography type objects.
 | :--- | :--- | :--- | :--- |
 | [ST_AsEWKT](Geography-Functions/ST_AsEWKT.md) | String | Return the Extended Well-Known Text representation of a geography. | v1.8.0 |
 | [ST_Envelope](Geography-Functions/ST_Envelope.md) | Geography | Return the bounding box (envelope) of a geography. Supports anti-meridian splitting. | v1.8.0 |
+| [ST_NumGeometries](Geography-Functions/ST_NumGeometries.md) | Integer | Return the number of sub-geometries in a geography (1 for single geometries). | v1.9.1 |
 | [ST_NPoints](Geography-Functions/ST_NPoints.md) | Integer | Return the number of points (vertices) in a geography. | v1.9.0 |
 | [ST_Distance](Geography-Functions/ST_Distance.md) | Double | Return the minimum geodesic distance between two geographies in meters. | v1.9.0 |
 | [ST_Contains](Geography-Functions/ST_Contains.md) | Boolean | Test whether geography A fully contains geography B. | v1.9.0 |

Review Comment:
   The "Since" versions in this Geography functions table are inconsistent with the linked per-function docs (e.g., ST_NPoints/ST_Distance/ST_Contains pages say v1.9.1, but the table still shows v1.9.0). Since this PR is already updating this table, please align the "Since" column values so the index matches the individual function pages.
   ```suggestion
   | [ST_NPoints](Geography-Functions/ST_NPoints.md) | Integer | Return the number of points (vertices) in a geography. | v1.9.1 |
   | [ST_Distance](Geography-Functions/ST_Distance.md) | Double | Return the minimum geodesic distance between two geographies in meters. | v1.9.1 |
   | [ST_Contains](Geography-Functions/ST_Contains.md) | Boolean | Test whether geography A fully contains geography B. | v1.9.1 |
   ```



##########
spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala:
##########
@@ -1060,7 +1060,9 @@ private[apache] object ST_IsRing {
  *   Geometry
  */
 private[apache] case class ST_NumGeometries(inputExpressions: Seq[Expression])
-    extends InferredExpression(Functions.numGeometries _) {
+    extends InferredExpression(
+      inferrableFunction1(Functions.numGeometries),
+      inferrableFunction1(org.apache.sedona.common.geography.Functions.numGeometries)) {

Review Comment:
   The scaladoc for ST_NumGeometries still documents the input as "Geometry" and references the SQL/MM spec for geometry only, but the expression now also supports Geography via dual-dispatch. Please update the scaladoc to reflect both supported input types (Geometry and Geography) to avoid misleading API docs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [GH-2830] Adds Geography dual-dispatch to ST_NumGeometries [sedona]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu commented on PR #2851:
URL: https://github.com/apache/sedona/pull/2851#issuecomment-4301922802

   please resolve conflicts


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [GH-2830] Adds Geography dual-dispatch to ST_NumGeometries [sedona]

Posted by "jiayuasu (via GitHub)" <gi...@apache.org>.
jiayuasu merged PR #2851:
URL: https://github.com/apache/sedona/pull/2851


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@sedona.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org