[GH-2973] Box3D foundation: value class + UDT + Catalyst plumbing#2978
Open
jiayuasu wants to merge 1 commit into
Open
[GH-2973] Box3D foundation: value class + UDT + Catalyst plumbing#2978jiayuasu wants to merge 1 commit into
jiayuasu wants to merge 1 commit into
Conversation
First slice of the Box3D Phase 1 epic. Lays down the value class and the UDT so subsequent slices (scalar constructors, accessors, predicates, aggregate) can be reviewed independently. - `Box3D` value class in `common` (six doubles in PostGIS order: xmin, ymin, zmin, xmax, ymax, zmax). NaN-Z folds into the z=0 plane per coordinate, matching PostGIS's flat-XY-treated-as-XY[Z=0] convention. - `Box3DUDT` (struct of six non-nullable doubles) + UDT registration via `UdtRegistratorWrapper`. - Catalyst plumbing in `InferredExpression`: Box3D as an `InferrableType` with matching argument-extractor, serializer, and Spark-DataType paths. - `implicits.toBox3D` extension method to deserialise a Box3D from an InternalRow. - `Box3DUDTSuite`: UDT round-trip, JSON schema, and Parquet write/read. No new SQL functions yet — those land in follow-up slices on this same issue. Phase 1 is split into 5 PRs (foundation, constructors, accessors + AsText, predicates, ST_3DExtent aggregate) to keep each review small.
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. First of 5 slices for Add a native Box3D type for 3D bounding boxes (PostGIS-compatible) #2973.What changes were proposed in this PR?
Foundation slice for the Box3D type. Lands the value class and the UDT so the rest of Phase 1 can be reviewed independently.
What's in this PR
Box3Dvalue class incommon/.../geometryObjects/Box3D.java. Stores six doubles in PostGIS box3d order:xmin, ymin, zmin, xmax, ymax, zmax. 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.Box3DUDT(struct of six non-nullable doubles) + UDT registration viaUdtRegistratorWrapper.InferredExpression:Box3Das anInferrableType, with the matching argument-extractor, serializer, and SparkDataTypemapping (Box3DUDT()).implicits.toBox3Dextension method to deserialise aBox3Dfrom anInternalRow.Box3DUDTSuitecovering: registration viaUdtRegistratorWrapper, JSON schema round-trip, UDT serialize/deserialize, case-object equality with a fresh instance, and Parquet write/read.What's not in this PR
Everything else from Phase 1 lands as separate slices on the same issue:
ST_Box3D(geom)+ST_3DMakeBox(p1, p2)ST_XMin/YMin/ZMin/XMax/YMax/ZMax(box3d)overloads +ST_AsText(box3d)ST_3DBoxIntersects/ST_3DBoxContainsST_3DExtentaggregateHow was this patch tested?
Box3DUDTSuite— 5 tests, all passing locally on Spark 3.5 / Scala 2.12.spark/commonclean with the new type wired through Catalyst.Did this PR include necessary documentation updates?
/zh/viafallback_to_default.