[GH-2640] Simplify warning messages of SedonaContext.create()#2698
Merged
[GH-2640] Simplify warning messages of SedonaContext.create()#2698
Conversation
Skip duplicate registration of UDT types and raster aggregate functions when SedonaContext.create() is called multiple times, eliminating spurious warning messages.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses repeated-registration warnings emitted when SedonaContext.create() is invoked multiple times by adding “already registered” guards for raster aggregate UDFs and several UDT registrations.
Changes:
- Guard Sedona Viz UDT registration (ImageSerializableWrapper, Pixel) with
UDTRegistration.exists. - Refactor Sedona SQL UDT registration (Geometry, Geography, SpatialIndex) to register only if missing.
- Guard raster UDT registration and raster aggregate UDAF registration to avoid duplicate function registration warnings.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| spark/common/src/main/scala/org/apache/spark/sql/sedona_viz/UDT/UdtRegistratorWrapper.scala | Adds UDTRegistration.exists checks before registering viz UDTs. |
| spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/UDT/UdtRegistratorWrapper.scala | Adds a helper to conditionally register core Sedona SQL UDTs only when missing. |
| spark/common/src/main/scala/org/apache/spark/sql/sedona_sql/UDT/RasterUdtRegistratorWrapper.scala | Adds UDTRegistration.exists guard for raster UDT registration. |
| spark/common/src/main/scala/org/apache/sedona/sql/RasterRegistrator.scala | Checks the function registry before registering the raster aggregate UDAF to avoid duplicate-registration warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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 Simply the warning messages of SedonaContext.create() #2640What changes were proposed in this PR?
When
SedonaContext.create()is called a second time, it prints warning messages about functions and UDTs being already registered. This was partially fixed for ST functions but RS functions and UDT registrations still produced warnings.This PR adds existence checks before registering:
How was this patch tested?
Tested by calling SedonaContext.create() twice and verifying no warning messages are produced. Also ran all 166 raster algebra tests to ensure RS functions remain functional.
Did this PR include necessary documentation updates?