You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "jiayuasu (via GitHub)" <gi...@apache.org> on 2026/09/30 05:13:03 UTC
[I] Native ST_Distance/ST_DWithin treat POINT EMPTY inside nonempty GeometryCollection as distance zero [sedona-db]
jiayuasu opened a new issue, #1374:
URL: https://github.com/apache/sedona-db/issues/1374
## Summary
The native `sedona-geo` distance kernels treat `POINT EMPTY` inside a **nonempty** `GEOMETRYCOLLECTION` as if it were at distance zero. For `POINT (0 0)` and `GEOMETRYCOLLECTION (POINT EMPTY, POINT (10 0))`, `ST_Distance` returns `0` and `ST_DWithin(..., 1)` returns `true`; the distance to the collection's nonempty point is `10`, so those results should be `10` and `false`.
## Reproduce
Add this test to the existing `tests` module in `rust/sedona-geo/src/st_distance.rs`, then run `cargo test -p sedona-geo --lib nonempty_collection_with_empty_point -- --nocapture` from `rust/`:
```rust
#[test]
fn nonempty_collection_with_empty_point() {
let point = create_scalar(Some("POINT (0 0)"), &WKB_GEOMETRY);
let mixed = create_scalar(
Some("GEOMETRYCOLLECTION (POINT EMPTY, POINT (10 0))"),
&WKB_GEOMETRY,
);
let distance = ScalarUdfTester::new(
SedonaScalarUDF::from_impl("st_distance", st_distance_impl()).into(),
vec![WKB_GEOMETRY, WKB_GEOMETRY],
)
.invoke_scalar_scalar(point.clone(), mixed.clone())
.unwrap();
let dwithin = ScalarUdfTester::new(
SedonaScalarUDF::from_impl("st_dwithin", crate::st_dwithin::st_dwithin_impl()).into(),
vec![WKB_GEOMETRY, WKB_GEOMETRY, SedonaType::Arrow(DataType::Float64)],
)
.invoke_scalar_scalar_scalar(point, mixed, ScalarValue::Float64(Some(1.0)))
.unwrap();
assert_eq!(
(distance, dwithin),
(ScalarValue::Float64(Some(10.0)), ScalarValue::Boolean(Some(false)))
);
}
```
At #1369's current head, this fails with `left: (Float64(0), Boolean(true))` and `right: (Float64(10), Boolean(false))`. I also checked the equivalent geometry pair with GEOS, which gives distance `10` and `dwithin(..., 1) == false`.
This case predates #1369, which addresses **wholly empty operands** (#1356). #473 also discusses empty members in collections, but does not track this incorrect distance result.
--
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: issues-unsubscribe@sedona.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Native ST_Distance/ST_DWithin treat POINT EMPTY inside nonempty GeometryCollection as distance zero [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot closed issue #1374: Native ST_Distance/ST_DWithin treat POINT EMPTY inside nonempty GeometryCollection as distance zero
URL: https://github.com/apache/sedona-db/issues/1374
--
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: issues-unsubscribe@sedona.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org