jiayuasu opened a new pull request, #2890: URL: https://github.com/apache/sedona/pull/2890
## Did you read the Contributor Guide? - Yes, I have read the [Contributor Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor Development Guide](https://sedona.apache.org/latest/community/develop/) ## Is this PR related to a ticket? - Yes, and the PR name follows the format \`[GH-XXX] my subject\`. Closes #2881 ## What changes were proposed in this PR? Adds the \`ST_Box2D(geom) -> Box2D\` scalar function. Returns the planar bounding box of the input geometry as a \`Box2D\`, or SQL NULL for null/empty input (PostGIS-compatible). This is the first user-facing function on top of the \`Box2D\` type and UDT introduced in #2878. - \`common/.../Functions.java\` — adds \`box2D(Geometry)\` static helper that delegates to \`Box2D.fromGeometry\` (already merged). - \`spark/common/.../expressions/InferredExpression.scala\` — registers \`Box2D\` as an inferrable return type. Adds the \`InferrableType[Box2D]\` instance, the struct-row serializer (via \`Box2DUDT.serialize\`), and the Spark return-type mapping (\`Box2D → Box2DUDT\`). Future Box2D-returning functions plug in for free. - \`spark/common/.../expressions/Functions.scala\` — \`ST_Box2D\` case class extending \`InferredExpression(Functions.box2D _)\`. - \`spark/common/.../UDF/Catalog.scala\` — registers in the \`boundingBoxExprs\` group alongside \`ST_Envelope\`. ## How was this patch tested? \`functionTestScala\` (added \"Passed ST_Box2D\"): - Polygon input → expected xmin/ymin/xmax/ymax via \`row.getAs[Box2D](\"bbox\")\`. - \`POINT EMPTY\` input → NULL. - \`CAST(NULL AS GEOMETRY)\` input → NULL. ## Did this PR include necessary documentation updates? - Yes, I am adding a new API. I am using the [current SNAPSHOT version number](https://github.com/apache/sedona/blob/master/pom.xml) in \`vX.Y.Z\` format. — documentation update for \`ST_Box2D\` lands with the rest of the Phase 1 surface (#2877) once \`ST_MakeBox2D\`, \`ST_Extent\`, accessor overloads, and the cast/text functions exist; documenting one isolated function before the rest read awkwardly. Tracking under #2877. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
