[feature](geo) Add st_xmax/st_xmin/st_ymax/st_ymin functions - #66814
[feature](geo) Add st_xmax/st_xmin/st_ymax/st_ymin functions#66814MiYuyuyuyu wants to merge 10 commits into
Conversation
### What problem does this PR solve? Issue Number: close apache#48203 Problem Summary: Add a virtual bounding_box() accessor to GeoShape so that the Trino compatible ST_XMax/ST_XMin/ST_YMax/ST_YMin functions can be implemented on top of it. Implemented for GeoPoint, GeoLine, GeoPolygon, GeoMultiPolygon and GeoCircle (circle treated as its center point). ### Release note None ### Check List (For Author) - Test: No need to test (accessor only, functions come in later commits) - Behavior changed: No - Does this need documentation: No
### What problem does this PR solve? Issue Number: close apache#48203 Problem Summary: Add the four Trino compatible bounding box accessor functions. Each function decodes the input geometry via GeoShape::from_encoded and returns the corresponding field of GeoShape::bounding_box(); NULL is returned for invalid input or shape types without a bounding box. ### Release note Add st_xmax/st_xmin/st_ymax/st_ymin functions. ### Check List (For Author) - Test: No need to test (regression tests come in a later commit) - Behavior changed: Yes - Does this need documentation: Yes (doc PR will be linked)
…ymin ### What problem does this PR solve? Issue Number: close apache#48203 Problem Summary: Add the Nereids scalar function signature classes, following the StX pattern. Each accepts one VARCHAR/String argument and returns DOUBLE. ### Release note None ### Check List (For Author) - Test: No need to test (registration and tests come in later commits) - Behavior changed: No - Does this need documentation: No
### What problem does this PR solve? Issue Number: close apache#48203 Problem Summary: Register the four new scalar functions in BuiltinScalarFunctions and add the corresponding visit methods in ScalarFunctionVisitor. ### Release note None ### Check List (For Author) - Test: No need to test (regression tests come in the next commit) - Behavior changed: No - Does this need documentation: No
…t_ymin ### What problem does this PR solve? Issue Number: close apache#48203 Problem Summary: Add regression test cases covering points (fn_test), polygons, literal linestrings, invalid input (NULL result) and NULL input, following the existing st_x/st_y test style in nereids_scalar_fn_S. ### Release note None ### Check List (For Author) - Test: Regression test (nereids_function_p0, S.groovy) - Behavior changed: No - Does this need documentation: No
### What problem does this PR solve? Issue Number: close apache#48203 Problem Summary: The bounding_box() overrides were defined out-of-line in geo_types.cpp but never declared in the GeoPoint/GeoLine/GeoPolygon/GeoMultiPolygon/ GeoCircle class bodies, which is ill-formed and fails to compile ("out-of-line definition does not match any declaration"). Add the missing override declarations. ### Release note None ### Check List (For Author) - Test: No need to test (compile fix; regression tests already added) - Behavior changed: No - Does this need documentation: No
### What problem does this PR solve? Issue Number: close apache#48203 Problem Summary: Add BE unit tests covering the bounding_box accessor for GeoPoint, GeoLine and GeoPolygon, backing st_xmax/st_xmin/st_ymax/st_ymin. ### Release note None ### Check List (For Author) - Test: Unit test (GeoTypesTest) - Behavior changed: No - Does this need documentation: No
…dicated suite ### What problem does this PR solve? Issue Number: close apache#48203 Problem Summary: Move the bounding box accessor test cases from nereids_scalar_fn_S into a dedicated st_bounding_box suite, so the suite owns a fresh auto-generated .out file and the shared S.out is left untouched. ### Release note None ### Check List (For Author) - Test: Regression test (nereids_scalar_fn_st_bounding_box, passed) - Behavior changed: No - Does this need documentation: No
### What problem does this PR solve? Issue Number: close apache#48203 Problem Summary: clang-tidy (modernize-use-designated-initializers) requires designated initializers for aggregate BoundingBox construction in GeoPoint and GeoCircle bounding_box(). ### Release note None ### Check List (For Author) - Test: No need to test (style fix, no behavior change) - Behavior changed: No - Does this need documentation: No
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
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 How it was fixed
Which behaviors were modified Before: the four functions did not exist; calling them produced a What features were added and why Four new SQL functions compatible with Trino's geospatial functions Refactoring / optimization No existing code was refactored. The only shared change is the new Documentation PR: apache/doris-website#4065 |
What problem does this PR solve?
Issue Number: close #48203
Related PR: #xxx
Problem Summary:
Add four Trino compatible bounding box accessor functions:
st_xmax / st_xmin / st_ymax / st_ymin.
BE:
GeoPoint, GeoLine, GeoPolygon, GeoMultiPolygon and GeoCircle (treated as
its center point).
geometry via GeoShape::from_encoded and returning NULL for invalid input.
FE:
BuiltinScalarFunctions and ScalarFunctionVisitor.
Tests:
auto-generated .out).
Release note
Add st_xmax / st_xmin / st_ymax / st_ymin functions.
Check List (For Author)