Copilot commented on code in PR #690:
URL: https://github.com/apache/sedona-db/pull/690#discussion_r2889108154
##########
rust/sedona-pointcloud/src/las/opener.rs:
##########
@@ -303,6 +324,11 @@ mod tests {
.collect()
.await
.unwrap();
- assert_eq!(result1, result2);
+
+ // Compare content independent of batch boundaries and partition
ordering.
+ // Sort by the x column (index 0) to get a deterministic row order.
+ let batch1 = concat_and_sort(&result1, 0);
+ let batch2 = concat_and_sort(&result2, 0);
+ assert_eq!(batch1, batch2);
Review Comment:
Sorting only by the `x` column doesn’t guarantee deterministic row order
when there are duplicate `x` values (very likely with clustered/quantized LAS
coordinates). This can leave the test flaky even after sorting. Consider
sorting by multiple columns (e.g., lexicographic sort on x,y,z and/or other
fields) to ensure a total ordering before `assert_eq!`.
##########
rust/sedona-pointcloud/src/las/opener.rs:
##########
@@ -280,11 +280,32 @@ mod tests {
#[tokio::test]
async fn round_robin_partitioning() {
+ use datafusion_common::arrow::compute::{
+ concat_batches, sort_to_indices, take_record_batch,
+ };
+
+ /// Concatenate batches and sort by the column at `sort_col` index for
+ /// order-independent comparison.
+ fn concat_and_sort(
+ batches: &[arrow_array::RecordBatch],
+ sort_col: usize,
+ ) -> arrow_array::RecordBatch {
Review Comment:
`concat_and_sort` indexes `batches[0]` and will panic with an out-of-bounds
access if the query returns zero batches (e.g., empty file / filtered-out
scan). Adding an explicit non-empty assertion (with a helpful message) or
handling the empty case would make the test failure clearer and avoid an
unexpected panic.
```suggestion
) -> arrow_array::RecordBatch {
assert!(
!batches.is_empty(),
"concat_and_sort expected at least one RecordBatch, but the
query returned no batches"
);
```
--
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]