Repository navigation
[GH-1272] Return the containing pixel from ST_Pixelize for sub-pixel geometries - #3484
Merged
jiayuasu merged 3 commits intoOct 31, 2026
Merged
Conversation
…pixel geometries ST_Pixelize traced lines and polygon rings with Bresenham's algorithm, which draws a segment's start pixel but not its end pixel. When every vertex of a geometry fell in the same pixel, every segment drew nothing, and the expression failed on `assert(pixels.size() > 0)`. A line or polygon that traces to no pixels now returns the single pixel that contains it. Collections, including the Multi* types, are pixelized member by member, so a GeometryCollection no longer fails with a MatchError and each member keeps its own pixel. Empty geometries return no pixels instead of failing. Geometries spanning several pixels are traced exactly as before. VizTestBase now calls super.beforeAll(), so the viz suites register Sedona's SQL functions themselves instead of relying on an earlier suite having done it. Generated-by: Claude Code (Claude Opus 5.5)
…y geometries Generated-by: Claude Code (Claude Opus 5.5)
Contributor
Author
|
Hi @jiayuasu, when you get a chance, could you approve the CI workflows for this one? They're still waiting on maintainer approval. Happy to address any review comments once it's run. Thanks! |
Contributor
Author
|
Hi @jiayuasu, whenever you have time, this one is ready for review. CI is green, and it follows your comment on #1272 that ST_Pixelize should always return at least one pixel. While fixing it I found a related rasterization bug, which is in #3485 (also green). Happy to make any changes to either, or to close them if they're not something you want right now. Thanks for merging #3503! |
jiayuasu
approved these changes
Oct 31, 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 ST_Pixelize small polygon error #1272What changes were proposed in this PR?
ST_Pixelizetraces lines and polygon rings with Bresenham's algorithm, which draws a segment's start pixel but not its end. When every vertex of a geometry falls in the same pixel, every segment draws nothing and the expression fails onassert(pixels.size() > 0).Now:
GeometryCollectionno longer fails with aMatchErrorGeometries that span several pixels are traced exactly as before.
VizTestBasenow callssuper.beforeAll(), so the viz suites register Sedona's SQL functions themselves instead of relying on another suite running first.One visible change: a Multi* geometry with a member small enough to fit inside one pixel used to get no pixels for that member, and now gets that member's pixel. Geometries outside the boundary are not skipped; they keep their computed pixel, the same way
ST_Pixelizealready handles points.How was this patch tested?
New cases in
PixelizeTestfor tiny lines and polygons, collections and empty geometries. Ran the viz tests on Spark 3.5 / Scala 2.12 and Spark 4.1 / Scala 2.13, and compared the old and new code on 3,000 random shapes: everything that pixelized before gives the same pixels, apart from the Multi* case above.Did this PR include necessary documentation updates?
Assisted by Claude Code
Generated-by: Claude Code (Claude Opus 5.5)