server icon indicating copy to clipboard operation
server copied to clipboard

MDEV-34278: Implement the GIS function ST_Collect

Open StefanoPetrilli opened this issue 1 year ago • 1 comments
trafficstars

  • [x] *The Jira issue number for this PR is: MDEV-34278

Description

The GIS function ST_Collect takes as input multiple geometries and returns the aggregation of the distinct geometry arguments.

The resulting value type is chosen using the following policy:

  • If all arguments are Point values, the result is a MultiPoint value.
  • If all arguments are LineString values, the result is a MultiLineString value.
  • If all arguments are Polygon values, the result is a MultiPolygon value.
  • Otherwise, the result is a GeometryCollection value.

If there are multiple geometry arguments and those arguments are in the same SRS, the return value is in that SRS. If those arguments are not in the same SRS, an ER_GIS_DIFFERENT_SRIDS_AGGREGATION error occurs.

This PR does not implement the DISTINCT clause that needs to be handled in a different PR.

To ensure compatibility between the MySQL implementation of this function and the MariaDB implementation, the tests for this function have been cherry-picked from MySQL.

This patch has no side effects.

Release Notes

Adds the function: ST_Collect(Geometry g), ST_Collect(Geometry g) [over clause] : aggregates geometry values and returns the tightest geometry collection value.

How can this PR be tested?

An extensive test suite has been cherry-picked from MySQL.

Basing the PR against the correct MariaDB version

  • [x] This is a new feature or a refactoring, and the PR is based against the latest MariaDB development branch.
  • [ ] This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • [x] I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • [x] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

StefanoPetrilli avatar Jul 11 '24 09:07 StefanoPetrilli

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jul 11 '24 09:07 CLAassistant

@holyfoot I pushed a new version that solves point number 3

StefanoPetrilli avatar Aug 26 '24 15:08 StefanoPetrilli

@holyfoot I pushed a new version that solves point number 3

@StefanoPetrilli the main.spatial_utility_function_collect test fails because the result file wasn't updated, can you please attach those changes to the PR? Thanks.

DaveGosselin-MariaDB avatar Aug 26 '24 17:08 DaveGosselin-MariaDB

@holyfoot I pushed a new version that solves point number 3

@StefanoPetrilli the main.spatial_utility_function_collect test fails because the result file wasn't updated, can you please attach those changes to the PR? Thanks.

@DaveGosselin-MariaDB I forgot to add that file to the changes. Now it should be all right.

StefanoPetrilli avatar Aug 27 '24 09:08 StefanoPetrilli

@holyfoot I pushed a new version that solves point number 3

@StefanoPetrilli the main.spatial_utility_function_collect test fails because the result file wasn't updated, can you please attach those changes to the PR? Thanks.

@DaveGosselin-MariaDB I forgot to add that file to the changes. Now it should be all right.

Thank you, the test is passing now. 😄

DaveGosselin-MariaDB avatar Aug 27 '24 12:08 DaveGosselin-MariaDB