Kontinuation commented on code in PR #525:
URL: https://github.com/apache/sedona-db/pull/525#discussion_r2704409991


##########
rust/sedona-spatial-join/src/stream.rs:
##########
@@ -1202,4 +1381,156 @@ mod tests {
                 "Data mismatch when mapping back from assembled batch row {i} 
to original batch {original_batch_idx} row {original_row_idx}");
         }
     }
+
+    #[test]
+    fn test_produce_joined_indices() {
+        for max_batch_size in 1..20 {
+            verify_produce_probe_indices(&[], 0, max_batch_size);
+            verify_produce_probe_indices(&[0, 0, 0, 0], 1, max_batch_size);
+            verify_produce_probe_indices(&[0, 0, 0, 0], 10, max_batch_size);
+            verify_produce_probe_indices(&[3, 3, 3], 10, max_batch_size);
+            verify_produce_probe_indices(&[0, 0, 3, 3, 3, 6, 7], 10, 
max_batch_size);
+            verify_produce_probe_indices(&[0, 3, 3, 3, 4, 5, 5, 9], 10, 
max_batch_size);
+            verify_produce_probe_indices(&[0, 3, 3, 4, 5, 5, 9, 9], 10, 
max_batch_size);
+        }
+    }
+
+    #[test]
+    fn test_fuzz_produce_probe_indices() {
+        let num_rows_range = 0..100;
+        let max_batch_size_range = 1..100;
+        let match_probability = 0.5;
+        let num_matches_range = 1..100;
+        for _ in 0..1000 {
+            fuzz_produce_probe_indices(
+                num_rows_range.clone(),
+                max_batch_size_range.clone(),
+                match_probability,
+                num_matches_range.clone(),
+            );
+        }
+    }
+
+    fn fuzz_produce_probe_indices(
+        num_rows_range: Range<usize>,
+        max_batch_size_range: Range<usize>,
+        match_probability: f64,
+        num_matches_range: Range<usize>,
+    ) {
+        let mut rng = rand::rng();

Review Comment:
   Fixed this by using fixed seed.



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