Repository navigation
[GH-3020] Add ST_H3ToCenterChild - #3481
Merged
jiayuasu merged 2 commits intoOct 19, 2026
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?
Related to #3020. Continues the incremental H3 hierarchy APIs from #3310, #3470, and #3474. This PR targets master independently of the compact implementation in #3480.
What changes were proposed in this PR?
Add
ST_H3ToCenterChild(cell, resolution), backed by the existing H3cellToCenterChildAPI. It returns the center descendant at the requested resolution as a long cell ID. Equal resolutions return the input cell; coarser targets and resolutions outside 0–15 propagate H3 errors. Null cell or resolution arguments return null in Spark and Flink SQL.Expose the function through Spark SQL, the Scala and Python DataFrame APIs, and Flink SQL. Add Spark and Flink API pages and catalog entries for v2.0.0.
Tests cover known center-child IDs, skipping resolutions, consistency between direct and intermediate traversal, pentagons, equal resolutions, boundary resolutions 0 and 15, invalid targets, literal and column null arguments, and all Scala/Python wrapper overloads.
How was this patch tested?
Validated locally with Java 17, Spark 3.5.0 / Scala 2.12, Flink 1.19.0, and Python 3.11:
mvn -o spotless:applyandmvn -o spotless:check— passed.mvn -o -pl common -am '-Dtest=org.apache.sedona.common.FunctionsTest#h3ToCenterChild*' -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.javadoc.skip=true install— all 4 tests passed.mvn -o -pl spark/common -DskipTests test-compile— production and test sources compiled.mvn -o -pl spark/common -Dsuites=org.apache.sedona.sql.functions.STH3Functions,org.apache.sedona.sql.dataFrameAPITestScala org.scalatest:scalatest-maven-plugin:2.2.0:test— all 282 tests passed (17 H3 tests and 265 Scala DataFrame API tests).mvn -o -pl flink -Dtest=FunctionTest#testH3ToCenterChild test— passed, including nullable arguments supplied through table columns.python -m pytest tests/sql/test_function.py tests/sql/test_dataframe_api.py -k test_st_h3_to_center_child -q— both tests passed against the newly compiled JVM classes and Maven dependency classpath supplied throughSPARK_DIST_CLASSPATH.git diff --check— passed.Did this PR include necessary documentation updates?
Yes. Added Spark SQL and Flink function pages and updated both API catalogs, using the current SNAPSHOT version
v2.0.0.