zhangfengcdt opened a new pull request, #76:
URL: https://github.com/apache/sedona-db/pull/76
This PR adds ST_Perimeter function to sedona-geo crate.
- **Implementation**: Added `rust/sedona-geo/src/st_perimeter.rs` using
`LengthMeasurableExt::perimeter_ext` trait from
geo-generic-alg with Euclidean metric
- **Registration**: Added st_perimeter to module exports and scalar kernel
registry
- **Testing**: Added comprehensive unit tests covering:
- Basic polygon perimeter calculation
- Multi-polygon support
- Polygons with holes
- LineString geometries (perimeter equals length)
- Point geometries (returns 0)
- Null handling
- **Benchmarks**: Added Rust benchmarks for 10-vertex and 500-vertex
polygons, plus Python benchmarks
Benchmark results:
```
------------------------------------------------ benchmark
'table=polygons_complex': 3 tests
-------------------------------------------------
Name (time in ms) Median Mean
StdDev Min Max
----------------------------------------------------------------------------------------------------------------------------------------------
test_st_perimeter[polygons_complex-SedonaDB] 1.7382 (1.0) 1.7597
(1.0) 0.0912 (1.0) 1.6231 (1.0) 2.2656 (1.0)
test_st_perimeter[polygons_complex-DuckDB] 4.3690 (2.51) 4.7802
(2.72) 0.7686 (8.43) 3.9360 (2.43) 6.7490 (2.98)
test_st_perimeter[polygons_complex-PostGIS] 60.0717 (34.56) 63.7713
(36.24) 11.3609 (124.56) 54.9842 (33.88) 83.1649 (36.71)
----------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------- benchmark
'table=polygons_simple': 3 tests ----------------------------------------------
Name (time in ms) Median Mean
StdDev Min Max
----------------------------------------------------------------------------------------------------------------------------------------
test_st_perimeter[polygons_simple-SedonaDB] 0.2666 (1.0) 0.3579
(1.02) 0.4895 (14.41) 0.2342 (1.0) 4.5126 (7.68)
test_st_perimeter[polygons_simple-DuckDB] 0.3434 (1.29) 0.3499
(1.0) 0.0340 (1.0) 0.3089 (1.32) 0.5879 (1.0)
test_st_perimeter[polygons_simple-PostGIS] 3.1510 (11.82) 3.2089
(9.17) 0.2462 (7.25) 2.9126 (12.43) 4.1143 (7.00)
----------------------------------------------------------------------------------------------------------------------------------------
```
--
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]