[GH-2973] Box3D constructors: ST_Box3D and ST_3DMakeBox#2984
Open
jiayuasu wants to merge 1 commit into
Open
Conversation
Second slice of the Box3D Phase 1 epic. Builds on the foundation (value class + UDT + Catalyst plumbing) merged in the previous slice. - `Functions.box3D(geom)`: returns the 3D bbox of a Geometry. Geometries whose coordinates have NaN Z fold into the z=0 plane (PostGIS- compatible). - `Constructors.make3DBox(p1, p2)`: builds a Box3D from two corner POINTZ geometries; missing-Z points contribute z=0. - `ST_Box3D` and `ST_3DMakeBox` Catalyst case classes wired through `InferredExpression`, registered in the Catalog. - `Box3DConstructorSuite`: covers ST_Box3D for XY, XYZ, null, and empty inputs; ST_3DMakeBox for POINTZ, XY-only points (Z folds to zero), and null point input. PostGIS-compatible semantics throughout. Phase 1 is split into 5 PRs; remaining slices: accessors+AsText, predicates, ST_3DExtent aggregate.
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. Second of 5 slices for Add a native Box3D type for 3D bounding boxes (PostGIS-compatible) #2973. Builds on the foundation that landed in [GH-2973] Box3D foundation: value class + UDT + Catalyst plumbing #2978.What changes were proposed in this PR?
Adds the two scalar constructors that produce a
Box3Dfrom a Geometry or two corner points. MirrorsST_Box2D/ST_MakeBox2Dand PostGIS'sBox3D(geometry)/ST_3DMakeBox.Functions.box3D(geom): returns the 3D bbox of a Geometry. Geometries whose coordinates have NaN Z fold into thez = 0plane on a per-coordinate basis, matching PostGIS's flat-XY-treated-as-XY[Z=0] convention.Constructors.make3DBox(p1, p2): builds a Box3D from two corner POINTZ geometries. Missing-Z point inputs contributez = 0. Non-POINT input raisesIllegalArgumentException(same asST_MakeBox2D).ST_Box3DandST_3DMakeBoxCatalyst case classes wired throughInferredExpressionand registered inCatalog.boundingBoxExprs/Catalog.geometryConstructorExprs.How was this patch tested?
Box3DConstructorSuite(5 tests, all passing locally on Spark 3.5 / Scala 2.12):ST_Box3Don XY input (zmin/zmax = 0) and XYZ input.ST_Box3Dreturns NULL for null and empty geometry input.ST_3DMakeBoxfrom two POINTZ corners.ST_3DMakeBoxfrom XY-only points (Z folds to zero).ST_3DMakeBoxreturns NULL for null point input.Did this PR include necessary documentation updates?