@@ -3003,7 +3003,6 @@ struct ST_Dump {
30033003 }
30043004};
30053005
3006-
30073006// ======================================================================================================================
30083007// ST_Expand
30093008// ======================================================================================================================
@@ -3016,28 +3015,29 @@ struct ST_Expand {
30163015 static void Execute (DataChunk &args, ExpressionState &state, Vector &result) {
30173016 auto &lstate = LocalState::ResetAndGet (state);
30183017
3019- BinaryExecutor::Execute<string_t , double , string_t >(args.data [0 ], args.data [1 ], result, args.size (), [&](const string_t &blob, double distance) {
3020- sgl::geometry geom;
3021- lstate.Deserialize (blob, geom);
3022- auto bbox = sgl::extent_xy::smallest ();
3023-
3024- if (sgl::ops::get_total_extent_xy (geom, bbox) == 0 ) {
3025- const sgl::geometry empty (sgl::geometry_type::GEOMETRY_COLLECTION, false , false );
3026- return lstate.Serialize (result, empty);
3027- } else {
3028- sgl::geometry expanded (sgl::geometry_type::POLYGON, false , false );
3029- const auto min_x = bbox.min .x - distance;
3030- const auto min_y = bbox.min .y - distance;
3031- const auto max_x = bbox.max .x + distance;
3032- const auto max_y = bbox.max .y + distance;
3033- const double buffer[10 ] = {min_x, min_y, min_x, max_y, max_x, max_y, max_x, min_y, min_x, min_y};
3018+ BinaryExecutor::Execute<string_t , double , string_t >(
3019+ args.data [0 ], args.data [1 ], result, args.size (), [&](const string_t &blob, double distance) {
3020+ sgl::geometry geom;
3021+ lstate.Deserialize (blob, geom);
3022+ auto bbox = sgl::extent_xy::smallest ();
30343023
3035- sgl::geometry ring (sgl::geometry_type::LINESTRING, false , false );
3036- ring.set_vertex_array (buffer, 5 );
3037- expanded.append_part (&ring);
3038- return lstate.Serialize (result, expanded);
3039- }
3040- });
3024+ if (sgl::ops::get_total_extent_xy (geom, bbox) == 0 ) {
3025+ const sgl::geometry empty (sgl::geometry_type::GEOMETRY_COLLECTION, false , false );
3026+ return lstate.Serialize (result, empty);
3027+ } else {
3028+ sgl::geometry expanded (sgl::geometry_type::POLYGON, false , false );
3029+ const auto min_x = bbox.min .x - distance;
3030+ const auto min_y = bbox.min .y - distance;
3031+ const auto max_x = bbox.max .x + distance;
3032+ const auto max_y = bbox.max .y + distance;
3033+ const double buffer[10 ] = {min_x, min_y, min_x, max_y, max_x, max_y, max_x, min_y, min_x, min_y};
3034+
3035+ sgl::geometry ring (sgl::geometry_type::LINESTRING, false , false );
3036+ ring.set_vertex_array (buffer, 5 );
3037+ expanded.append_part (&ring);
3038+ return lstate.Serialize (result, expanded);
3039+ }
3040+ });
30413041 }
30423042
30433043 // ------------------------------------------------------------------------------------------------------------------
@@ -3079,7 +3079,6 @@ struct ST_Expand {
30793079 }
30803080};
30813081
3082-
30833082// ======================================================================================================================
30843083// ST_Extent
30853084// ======================================================================================================================
0 commit comments