MiYuyuyuyu commented on PR #66814:
URL: https://github.com/apache/doris/pull/66814#issuecomment-5310334226
Thank you for the guidance. Here is a clear description of this PR:
**What problem was fixed**
Doris does not provide the Trino-compatible bounding box accessor
functions `st_xmax` / `st_xmin` / `st_ymax` / `st_ymin`, which are
listed as open tasks in #48203 (Part III. Trino&Presto GEO FUNCTIONS).
Users migrating from Trino/Presto cannot run queries like
`SELECT ST_XMax(geom)` on Doris.
**How it was fixed**
- BE: added a `BoundingBox` struct and a virtual `GeoShape::bounding_box()`
accessor, implemented for GeoPoint, GeoLine, GeoPolygon,
GeoMultiPolygon and GeoCircle (treated as its center point, since the
exact bounding box depends on the projection). The four function
structs (`StXMax` etc.) were added in `functions_geo.cpp`, decoding
the input via `GeoShape::from_encoded` and returning NULL for invalid
input.
- FE: added the four Nereids scalar function signature classes
(`StXMax.java` etc.) and registered them in `BuiltinScalarFunctions`
and `ScalarFunctionVisitor`.
- Tests: regression suite `nereids_scalar_fn_st_bounding_box` (14 cases)
and BE unit tests `GeoTypesTest.bounding_box_*` (28 tests passed).
**Which behaviors were modified**
Before: the four functions did not exist; calling them produced a
"Can not found function" error. After: they return the bounding box
max/min X (longitude) / Y (latitude) of a geometry, and NULL for invalid
input or NULL input. No existing behavior is changed — all changes are
additive.
**What features were added and why**
Four new SQL functions compatible with Trino's geospatial functions
(see https://trino.io/docs/current/functions/geospatial.html), to ease
migration from Trino/Presto, as requested in #48203.
**Refactoring / optimization**
No existing code was refactored. The only shared change is the new
`GeoShape::bounding_box()` virtual accessor, designed as a single method
returning a `BoundingBox` struct to avoid duplicating the min/max
computation across the four functions.
Documentation PR: https://github.com/apache/doris-website/pull/4065
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]