Skip to content

[GH-2830] Adds Geography dual-dispatch to ST_NumGeometries#2851

Merged
jiayuasu merged 5 commits intoapache:masterfrom
zhangfengcdt:feature/geography.support.st_numgeometries
Apr 28, 2026
Merged

[GH-2830] Adds Geography dual-dispatch to ST_NumGeometries#2851
jiayuasu merged 5 commits intoapache:masterfrom
zhangfengcdt:feature/geography.support.st_numgeometries

Conversation

@zhangfengcdt
Copy link
Copy Markdown
Member

Did you read the Contributor Guide?

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 [GH-2830] Improve Geography query support - core #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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Geography support for ST_NumGeometries by dual-dispatching the Spark SQL expression to the Geography implementation in common, with accompanying unit/integration tests and Geography SQL docs.

Changes:

  • Implement Geography numGeometries in common and add Java unit tests.
  • Update Spark SQL ST_NumGeometries expression to resolve between Geometry vs Geography implementations.
  • Add Spark SQL Geography integration tests and new Geography API docs page + index entry.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spark/common/src/test/scala/org/apache/sedona/sql/geography/GeographyFunctionTest.scala Adds Spark SQL test cases validating ST_NumGeometries on Geography inputs.
spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala Switches ST_NumGeometries to dual-dispatch (Geometry + Geography) using inferrableFunction1.
docs/api/sql/geography/Geography-Functions/ST_NumGeometries.md Adds Geography-specific SQL documentation for ST_NumGeometries.
docs/api/sql/geography/Geography-Functions.md Adds ST_NumGeometries to the Geography functions index table.
common/src/test/java/org/apache/sedona/common/Geography/FunctionTest.java Adds Java unit tests for Geography numGeometries.
common/src/main/java/org/apache/sedona/common/geography/Functions.java Introduces Geography numGeometries delegating to JTS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/api/sql/geography/Geography-Functions.md
@zhangfengcdt zhangfengcdt marked this pull request as ready for review April 22, 2026 19:33
@zhangfengcdt zhangfengcdt requested a review from jiayuasu as a code owner April 22, 2026 19:33
@jiayuasu
Copy link
Copy Markdown
Member

please resolve conflicts

@jiayuasu
Copy link
Copy Markdown
Member

Conflict again

@jiayuasu jiayuasu merged commit 8c65dc4 into apache:master Apr 28, 2026
44 checks passed
@jiayuasu jiayuasu added this to the sedona-1.9.1 milestone Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants