MakeValid implementation for geometry and geography#4513
Conversation
Pull Request Test Coverage Report for Build 22111839764Warning: This coverage report may be inaccurate.This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Details
💛 - Coveralls |
…t files - Update upgrade schedules to include new test
| INSERT INTO TestSpatialFunc3_MakeValidGeomTemp (ID, GeomColumn, Description) VALUES (2, geometry::STGeomFromText('POINT(30 40)', 4326), 'Valid Point with SRID'); | ||
| ~~ROW COUNT: 1~~ | ||
|
|
||
| INSERT INTO TestSpatialFunc3_MakeValidGeomTemp (ID, GeomColumn, Description) VALUES (3, geometry::STGeomFromText('LINESTRING(0 0, 10 10, 20 20)', 0), 'Valid LineString'); |
There was a problem hiding this comment.
We need to add more tests for invalid linestring and invalid polygon with MakeValid function. Most cases cover only valid instances.
| DROP TABLE TestGeospatialMethods_SPATIALPOINTGEOG_dttemp | ||
|
|
||
| DROP DATABASE TestGeospatialMethods_DB | ||
| DROP DATABASE TestGeospatialMethods_DB |
There was a problem hiding this comment.
Please remove this, unnecessary change.
| CREATE VIEW TestGeospatialMethods_empty_ValFromGeomTemp AS SELECT location.STIsEmpty() FROM TestGeospatialMethods_SPATIALPOINTGEOM_dttemp ORDER BY location.STX; | ||
|
|
||
| CREATE VIEW TestGeospatialMethods_empty_TextFromGeomTemp AS SELECT location.STIsEmpty() AS Dimension FROM TestGeospatialMethods_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; | ||
| CREATE VIEW TestGeospatialMethods_empty_TextFromGeomTemp AS SELECT location.STIsEmpty() AS Dimension FROM TestGeospatialMethods_SPATIALPOINTGEOG_dttemp ORDER BY location.Lat; |
There was a problem hiding this comment.
same as above, we don't need to change any Test-spatial-functions-2 file
| M_DOUBLE_QUOTE: ["] M ["] {pltsql_quoted_identifier == true}?; | ||
| M_SQBRACKET: '[' M ']'; | ||
| MANUAL: M A N U A L; | ||
| MAKEVALID: 'MakeValid'; |
There was a problem hiding this comment.
Why aren't we using M A K E V A L I D?
There was a problem hiding this comment.
Fixed ,Updated to M A K E V A L I D for case-insensitive matching
| @@ -0,0 +1,65 @@ | |||
| CREATE DATABASE TestSpatialFunc3_DB; | |||
There was a problem hiding this comment.
What's the point of creating TestSpatialFunc3_DB db? All the objects are created inside master db
There was a problem hiding this comment.
Fixed I've now created the test tables inside TestSpatialFunc3_DB and added the corresponding tests in the verify file.
| @@ -0,0 +1,334 @@ | |||
| --MakeValid | |||
There was a problem hiding this comment.
Please add comments stating what are testing?
There was a problem hiding this comment.
Done Added comments explaining what each test case is validating.
1ff559d
into
babelfish-for-postgresql:BABEL_5_X_DEV
…stgresql#4513) Implemented the MakeValid GeoSpatial TSQL function that was previously unsupported in Babelfish. Added sys.MakeValid(geom sys.GEOMETRY) function in geometry.sql Added sys.MakeValid(geog sys.GEOGRAPHY) function in geography.sql Delegates to respective helper functions for processing invalid geometries. Functions are marked as IMMUTABLE STRICT PARALLEL SAFE for optimal performance. Task: BABEL-6310 Signed-off-by: Gopal Verma <[email protected]>
…stgresql#4513) Implemented the MakeValid GeoSpatial TSQL function that was previously unsupported in Babelfish. Added sys.MakeValid(geom sys.GEOMETRY) function in geometry.sql Added sys.MakeValid(geog sys.GEOGRAPHY) function in geography.sql Delegates to respective helper functions for processing invalid geometries. Functions are marked as IMMUTABLE STRICT PARALLEL SAFE for optimal performance. Task: BABEL-6310 Signed-off-by: Gopal Verma <[email protected]>
Implemented the MakeValid GeoSpatial TSQL function that was previously unsupported in Babelfish. Added sys.MakeValid(geom sys.GEOMETRY) function in geometry.sql Added sys.MakeValid(geog sys.GEOGRAPHY) function in geography.sql Delegates to respective helper functions for processing invalid geometries. Functions are marked as IMMUTABLE STRICT PARALLEL SAFE for optimal performance. Task: BABEL-6310 Signed-off-by: Gopal Verma <[email protected]>
Implement MakeValid GeoSpatial TSQL Function
Implemented the MakeValid GeoSpatial TSQL function that was previously unsupported in Babelfish.
What's Changed
Function Implementation
sys.MakeValid(geom sys.GEOMETRY)function ingeometry.sqlsys.MakeValid(geog sys.GEOGRAPHY)function ingeography.sqlIMMUTABLE STRICT PARALLEL SAFEfor optimal performanceError Handling
NULLfor NULL input instances (handled bySTRICT)Examples
Point (Already Valid)
Invalid Self-Intersecting Polygon
Geography Instance
Empty Instance
Issues Resolved
Task: BABEL-6331
Test Coverage
Checklist
--signoffSigned-off-by: Gopal Verma [email protected]
Authored-by: Gopal Verma [email protected]
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.