Kontinuation commented on code in PR #53:
URL: https://github.com/apache/sedona-db/pull/53#discussion_r2338436235
##########
rust/sedona-spatial-join/src/index.rs:
##########
@@ -331,6 +358,14 @@ pub(crate) struct SpatialIndex {
/// Cleared on `SpatialIndex` drop
#[expect(dead_code)]
reservation: MemoryReservation,
+
+ /// Cached vector of geometries for KNN queries to avoid repeated
WKB-to-geometry conversions
+ /// This is computed once during index building for performance
optimization
+ cached_geometries: Vec<Geometry<f64>>,
+
+ /// Cached position mapping for geometries to avoid recomputing during KNN
queries
+ /// Maps geometry index to (batch_idx, row_idx) pairs
+ cached_geometry_positions: Vec<(i32, i32)>,
Review Comment:
There's no need to add a new field. We can use `data_id_to_batch_pos` for
mapping the index retrieved from rtree to (batch_idx, row_idx).
--
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]