Skip to content

[GH-2830] Adds Geography dual-dispatch to ST_GeometryType#2850

Merged
jiayuasu merged 4 commits intoapache:masterfrom
zhangfengcdt:feature/geography.support.st_geometrytype
Apr 26, 2026
Merged

[GH-2830] Adds Geography dual-dispatch to ST_GeometryType#2850
jiayuasu merged 4 commits intoapache:masterfrom
zhangfengcdt:feature/geography.support.st_geometrytype

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_GeometryType — returns type strings like ST_Point, ST_Polygon 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 "ST_" + getJTSGeometry().getGeometryType()).

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.

@zhangfengcdt zhangfengcdt requested a review from Copilot April 22, 2026 15:48
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

This PR adds Geography support to the existing ST_GeometryType Spark SQL expression via dual-dispatch, returning ST_<JTSGeometryType> strings consistently for both Geometry and Geography inputs.

Changes:

  • Add Geography implementation for geometryType in common ("ST_" + toJTS(g).getGeometryType()).
  • Update Spark SQL ST_GeometryType expression to dispatch to Geometry or Geography functions based on input type.
  • Add unit/integration tests plus new Geography SQL docs entry for ST_GeometryType.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/expressions/Functions.scala Enable dual-dispatch for ST_GeometryType to support Geography inputs.
common/src/main/java/org/apache/sedona/common/geography/Functions.java Add Geography geometryType implementation delegating through JTS.
common/src/test/java/org/apache/sedona/common/Geography/FunctionTest.java Add Geography unit tests for geometryType (including null handling).
spark/common/src/test/scala/org/apache/sedona/sql/geography/GeographyFunctionTest.scala Add Spark SQL integration tests for Geography ST_GeometryType.
docs/api/sql/geography/Geography-Functions.md / docs/api/sql/geography/Geography-Functions/ST_GeometryType.md Document Geography ST_GeometryType and add it to the function index.

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

Comment thread common/src/test/java/org/apache/sedona/common/Geography/FunctionTest.java Outdated
@zhangfengcdt zhangfengcdt marked this pull request as ready for review April 22, 2026 18:44
@zhangfengcdt zhangfengcdt requested a review from jiayuasu as a code owner April 22, 2026 18:44
@jiayuasu jiayuasu merged commit ca1be45 into apache:master Apr 26, 2026
44 checks passed
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