You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@sedona.apache.org by "paleolimbot (via GitHub)" <gi...@apache.org> on 2026/09/03 04:36:37 UTC
[PR] chore(rust): upgrade geo to 0.33.1 [sedona-db]
paleolimbot opened a new pull request, #1228:
URL: https://github.com/apache/sedona-db/pull/1228
Uses the dependency-free ranked-query callbacks from georust/geo-index#161, pinned to its current commit, to remove geo-index's geo 0.31 feature. Upgrades geo to 0.33.1, migrates concave-hull options, updates Triangle accessors, and preserves KNN behavior with conservative spherical pruning.\n\nCloses #455\nCloses #491\nReplaces #566
--
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
Re: [PR] chore(rust): upgrade geo to 0.33.1 [sedona-db]
Posted by "zhangfengcdt (via GitHub)" <gi...@apache.org>.
zhangfengcdt commented on code in PR #1228:
URL: https://github.com/apache/sedona-db/pull/1228#discussion_r4017716934
##########
rust/sedona-spatial-join/src/index/default_spatial_index.rs:
##########
@@ -339,30 +336,32 @@ impl SpatialIndex for DefaultSpatialIndex {
}
};
- // Select the appropriate distance metric
- let distance_metric: &dyn DistanceMetric<f32> = {
- let Some(knn_components) = self.inner.knn_components.as_ref() else {
- return sedona_internal_err!(
- "knn_components is not initialized when running KNN join"
- );
- };
- if use_spheroid {
- &knn_components.haversine_metric
- } else {
- &knn_components.euclidean_metric
- }
- };
-
// Create geometry accessor for on-demand WKB decoding and caching
let geometry_accessor = self.create_knn_accessor()?;
- // Use neighbors_geometry to find k nearest neighbors
- let initial_results = self.inner.rtree.neighbors_geometry(
- &probe_geom,
- Some(k as usize),
- None, // no max_distance filter
- distance_metric,
- &geometry_accessor,
+ // Use dependency-free callbacks from geo-index. A zero lower bound is required for
+ // spherical distances because planar longitude/latitude boxes do not provide a valid
+ // Haversine lower bound. Planar queries use the exact geometry-to-rectangle distance.
+ let initial_results = self.inner.rtree.neighbors_with_callbacks(
Review Comment:
Understood returning 0 is safe and yes the old estimate is not a strictly valid spherical lower bound.
But, we might consider using great-circle distance - it is never less than the latitude difference, so R * |lat_probe - clamp(lat_probe, min_lat, max_lat)| in radians is a valid non-zero bound for point probes. It will help for most of the pruning.
see this for reference:
https://github.com/google/s2geometry/blob/079611b654ad89afd9c3c3a1796d64bdd6a6b340/src/s2/s2latlng_rect.cc#L571
--
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
Re: [PR] chore(rust): upgrade geo to 0.33.1 [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #1228:
URL: https://github.com/apache/sedona-db/pull/1228#discussion_r3927215541
##########
rust/sedona-geo-generic-alg/benches/intersection.rs:
##########
@@ -413,7 +413,7 @@ fn point_triangle_intersection(c: &mut Criterion) {
}
assert_eq!(intersects, 533);
- assert_eq!(non_intersects, 5450151);
+ assert_eq!(non_intersects, 5484911);
Review Comment:
This I believe is due to an update to the earcut algorithm, not to behaviour here.
--
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
Re: [PR] chore(rust): upgrade geo to 0.33.1 [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot merged PR #1228:
URL: https://github.com/apache/sedona-db/pull/1228
--
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
Re: [PR] chore(rust): upgrade geo to 0.33.1 [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #1228:
URL: https://github.com/apache/sedona-db/pull/1228#discussion_r4017399618
##########
rust/sedona-geo/src/st_concavehull.rs:
##########
@@ -327,11 +340,11 @@ mod tests {
),
(
"MULTIPOINT ((0 0), (10 0), (0 10), (10 10), (5 5))",
- "POLYGON ((10 0, 10 10, 0 10, 0 0, 5 5, 10 0))",
+ "POLYGON ((10 0, 10 10, 0 10, 0 0, 10 0))",
),
(
"MULTILINESTRING ((10 10, 20 20, 10 40), (40 40, 30 30, 40 20, 30 10))",
- "POLYGON ((20 20, 10 40, 30 30, 40 40, 40 20, 30 10, 10 10, 20 20))",
+ "POLYGON ((30 10, 40 20, 40 40, 10 40, 10 10, 30 10))",
Review Comment:
This is a change to output geometry for this kernel; however, this kernel is not used by default because it's parameterized differently and we can't get PostGIS behaviour alignment.
##########
rust/sedona-spatial-join/src/index/default_spatial_index.rs:
##########
@@ -339,30 +336,32 @@ impl SpatialIndex for DefaultSpatialIndex {
}
};
- // Select the appropriate distance metric
- let distance_metric: &dyn DistanceMetric<f32> = {
- let Some(knn_components) = self.inner.knn_components.as_ref() else {
- return sedona_internal_err!(
- "knn_components is not initialized when running KNN join"
- );
- };
- if use_spheroid {
- &knn_components.haversine_metric
- } else {
- &knn_components.euclidean_metric
- }
- };
-
// Create geometry accessor for on-demand WKB decoding and caching
let geometry_accessor = self.create_knn_accessor()?;
- // Use neighbors_geometry to find k nearest neighbors
- let initial_results = self.inner.rtree.neighbors_geometry(
- &probe_geom,
- Some(k as usize),
- None, // no max_distance filter
- distance_metric,
- &geometry_accessor,
+ // Use dependency-free callbacks from geo-index. A zero lower bound is required for
+ // spherical distances because planar longitude/latitude boxes do not provide a valid
+ // Haversine lower bound. Planar queries use the exact geometry-to-rectangle distance.
+ let initial_results = self.inner.rtree.neighbors_with_callbacks(
+ NeighborsOptions {
+ k: Some(k as usize),
+ max_distance: None,
+ include_tie_breakers: false,
+ },
+ |[min_x, min_y, max_x, max_y]| {
+ if use_spheroid {
+ 0.0
+ } else {
+ let bbox = Geometry::Rect(Rect::new(
+ coord! { x: min_x as f64, y: min_y as f64 },
+ coord! { x: max_x as f64, y: max_y as f64 },
+ ));
+ Euclidean.distance(&probe_geom, &bbox)
+ }
+ },
+ |item_index, _bbox| {
+ geometry_accessor.distance(&probe_geom, item_index as usize, use_spheroid)
+ },
Review Comment:
This is the main update (did not require any test changes)
--
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
Re: [PR] chore(rust): upgrade geo to 0.33.1 [sedona-db]
Posted by "paleolimbot (via GitHub)" <gi...@apache.org>.
paleolimbot commented on code in PR #1228:
URL: https://github.com/apache/sedona-db/pull/1228#discussion_r4018324108
##########
rust/sedona-spatial-join/src/index/default_spatial_index.rs:
##########
@@ -339,30 +336,32 @@ impl SpatialIndex for DefaultSpatialIndex {
}
};
- // Select the appropriate distance metric
- let distance_metric: &dyn DistanceMetric<f32> = {
- let Some(knn_components) = self.inner.knn_components.as_ref() else {
- return sedona_internal_err!(
- "knn_components is not initialized when running KNN join"
- );
- };
- if use_spheroid {
- &knn_components.haversine_metric
- } else {
- &knn_components.euclidean_metric
- }
- };
-
// Create geometry accessor for on-demand WKB decoding and caching
let geometry_accessor = self.create_knn_accessor()?;
- // Use neighbors_geometry to find k nearest neighbors
- let initial_results = self.inner.rtree.neighbors_geometry(
- &probe_geom,
- Some(k as usize),
- None, // no max_distance filter
- distance_metric,
- &geometry_accessor,
+ // Use dependency-free callbacks from geo-index. A zero lower bound is required for
+ // spherical distances because planar longitude/latitude boxes do not provide a valid
+ // Haversine lower bound. Planar queries use the exact geometry-to-rectangle distance.
+ let initial_results = self.inner.rtree.neighbors_with_callbacks(
Review Comment:
I added https://github.com/apache/sedona-db/issues/1308 for this one...perhaps you could update that since I have no experience with that particular bit of code 😬
--
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