Repository navigation
[GH-3511] Add ST_H3ToPoint - #3512
Merged
Merged
Conversation
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?
Yes, I have read the Contributor Rules and Contributor Development Guide.
Is this PR related to a ticket?
Closes #3511.
What changes were proposed in this PR?
Add
ST_H3ToPoint(cell)to return an H3 cell center as a point geometry in Spark SQL, the Scala and Python DataFrame APIs, and Flink SQL. This avoids converting the cell to a polygon and computing its centroid, which can differ from H3’s center.The implementation reuses
H3Utils.cellToCoordinate, returns longitude/latitude in degrees, and leaves SRID at 0 to matchST_H3ToGeom. Users can assign WGS 84 withST_SetSRID(..., 4326). Null input returns null; invalid H3 cell indexes raise an error.How was this patch tested?
FunctionsTest: 337 tests passed, including known center coordinates, all 16 resolutions, pentagons, SRID, polygon centroid differences, and invalid IDs.STH3Functions: 23 tests passed, including SQL registration, coordinate order, SRID, and null propagation.dataFrameAPITestScala: 268 tests passed, including column and literal overloads.FunctionTest#testH3ToPoint: passed, including SQL registration, coordinates, SRID, and null input.mvn spotless:apply, Python syntax checks, andgit diff --checkpassed.Did this PR include necessary documentation updates?
Yes. Added Spark SQL and Flink API documentation and function index entries using the current SNAPSHOT version,
v2.0.0, with SQL examples and SRID guidance.