[GH-2830] Add Geography support for ST_Equals#2855
Merged
jiayuasu merged 3 commits intoapache:masterfrom Apr 29, 2026
Merged
Conversation
- Converts ST_Equals to InferredExpression for dual-dispatch (Geometry vs Geography) - Geography path: uses S2 spherical equality via Predicates.equals
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Geography support for ST_Equals by converting it to an InferredExpression (dual-dispatch Geometry vs Geography), while ensuring join planning remains Geometry-only and Geography joins fall back to Spark evaluation.
Changes:
- Convert
ST_EqualsfromST_PredicatetoInferredExpressionwired to both JTS (Predicates.equals) and S2 (geography.Functions.equals). - Update
JoinQueryDetectorto keep Geometry join optimization forST_Equalswhile skipping join planning when either side isGeographyUDT. - Add Geography equality implementation + unit/integration tests and publish new Geography SQL docs for
ST_Equals.
Reviewed changes
Copilot reviewed 7 out of 7 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/Predicates.scala | Switch ST_Equals to dual-dispatch via InferredExpression (Geometry + Geography). |
| common/src/main/java/org/apache/sedona/common/geography/Functions.java | Add S2-based Functions.equals(Geography, Geography) implementation. |
| spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/strategy/join/JoinQueryDetector.scala | Move ST_Equals join detection to top-level match with Geography guard (no Geography join planning). |
| common/src/test/java/org/apache/sedona/common/Geography/FunctionTest.java | Add unit tests for Functions.equals (points/polygon + null handling). |
| spark/common/src/test/scala/org/apache/sedona/sql/geography/GeographyFunctionTest.scala | Add Spark SQL integration tests for ST_Equals on Geography (point cases). |
| docs/api/sql/geography/Geography-Functions.md | Add ST_Equals to Geography function index. |
| docs/api/sql/geography/Geography-Functions/ST_Equals.md | New Geography SQL docs page for ST_Equals. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ge on the Geography path
jiayuasu
approved these changes
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Closes #<issue_number>What changes were proposed in this PR?
How was this patch tested?
Did this PR include necessary documentation updates?