paleolimbot commented on code in PR #722:
URL: https://github.com/apache/sedona-db/pull/722#discussion_r2997314019


##########
rust/sedona-spatial-join/src/operand_evaluator.rs:
##########
@@ -116,10 +142,35 @@ impl EvaluatedGeometryArray {
                 if let Some(rect) = wkb.bounding_rect() {
                     let min = rect.min();
                     let max = rect.max();
-                    // f64_box_to_f32 will ensure the resulting `f32` box is 
no smaller than the `f64` box.
-                    let (min_x, min_y, max_x, max_y) = f64_box_to_f32(min.x, 
min.y, max.x, max.y);
-                    let rect = Rect::new(coord!(x: min_x, y: min_y), coord!(x: 
max_x, y: max_y));
-                    Some(rect)
+                    #[cfg(feature = "gpu")]
+                    {
+                        use wkb::reader::GeometryType;
+                        // For point geometries, we can directly cast f64 to 
f32 without expanding the box.
+                        // This enables libgpuspatial to treat the Rect as 
point for faster processing.
+                        if wkb.geometry_type() == GeometryType::Point {
+                            Some(Rect::new(
+                                coord!(x: min.x as f32, y: min.y as f32),
+                                coord!(x: max.x as f32, y: max.y as f32),
+                            ))

Review Comment:
   I implemented this in https://github.com/apache/sedona-db/pull/737 (the 
ability to override the Rect creation for a SpatialJoinProvider); however, it's 
worth double checking that these rectangles are not used anywhere that this 
assumption might cause problems.



-- 
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]

Reply via email to