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


##########
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:
   Thanks for mentioning this. When one side contains only points, their 
coordinates in FP64 are downcast to FP32, which may result in false negatives. 
However, on the other side containing rectangles, I called `next_after` to 
produce a conservative bounding box. This compensates for potential 
false-negative issues.
   



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