[GH-2884] Add ST_Extent aggregate (returns Box2D)#2898
Merged
jiayuasu merged 1 commit intoapache:masterfrom May 4, 2026
Merged
[GH-2884] Add ST_Extent aggregate (returns Box2D)#2898jiayuasu merged 1 commit intoapache:masterfrom
jiayuasu merged 1 commit intoapache:masterfrom
Conversation
ST_Extent(geom) reduces a stream of geometries to the union of their bounding boxes, returning a Box2D. PostGIS-compatible. - Returns SQL NULL when there are no rows. - Returns SQL NULL when all rows are null or empty geometries. - Mixed null/empty/valid rows: null and empty are ignored; the result reflects the valid geometries only. Reuses the existing EnvelopeBuffer reducer/merger from ST_Envelope_Aggr; only the finish step differs (Box2D vs polygon Geometry). ST_Envelope_Aggr is left untouched for backwards compatibility. Closes apache#2884.
jiayuasu
added a commit
to jiayuasu/sedona
that referenced
this pull request
May 5, 2026
Mirrors the Phase 1 SQL surface added in apache#2890, apache#2895, apache#2897, apache#2898, apache#2899 in PySpark wrappers: - ST_Box2D in st_functions - ST_MakeBox2D and ST_GeomFromBox2D in st_constructors - ST_Extent in st_aggregates Accessor overloads (ST_XMin/XMax/YMin/YMax) and ST_AsText already worked with Box2D inputs through their existing wrappers; SQL overload resolution happens on the JVM side. The Python Box2DType UDT and Box2D value class were merged in apache#2878, so collected results materialize as Box2D Python objects with xmin/ymin/xmax/ymax attributes. Closes apache#2887.
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 Implement ST_Extent aggregate (returns Box2D) #2884What changes were proposed in this PR?
Adds the
ST_Extent(geom)aggregate, returning aBox2D(the union of all bounding boxes in the column). PostGIS-compatible.Reuses the existing
EnvelopeBufferreducer/merger fromST_Envelope_Aggr; only thefinishstep differs —Box2Dinstead of a polygonGeometry.ST_Envelope_Aggris left untouched for backwards compatibility.Behavior:
How was this patch tested?
aggregateFunctionTestScala:Did this PR include necessary documentation updates?
ST_Extentlands with the rest of the Phase 1 surface (Add a native Box2D type for bounding boxes #2877) once the cast/text functions exist. Scala DataFrame API wrappers tracked separately in Scala/Python DataFrame API wrappers for Box2D Phase 1 functions #2891.