Skip to content

Commit 2a08105

Browse files
committed
Fix review comments
1 parent 2ff882c commit 2a08105

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

rust/sedona-spatial-join/src/evaluated_batch/evaluated_batch_stream/evaluate.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,52 @@ pub(crate) fn create_evaluated_probe_stream(
160160
false,
161161
))
162162
}
163+
164+
#[cfg(test)]
165+
mod tests {
166+
use std::sync::Arc;
167+
168+
use arrow_schema::{DataType, Field, Fields, Schema, SchemaRef};
169+
170+
use super::schema_contains_view_types;
171+
172+
fn schema(fields: Vec<Field>) -> SchemaRef {
173+
Arc::new(Schema::new(fields))
174+
}
175+
176+
#[test]
177+
fn test_schema_contains_view_types_false() {
178+
let schema = schema(vec![
179+
Field::new("a", DataType::Int32, true),
180+
Field::new("b", DataType::Utf8, true),
181+
]);
182+
183+
assert!(!schema_contains_view_types(&schema));
184+
}
185+
186+
#[test]
187+
fn test_schema_contains_view_types_true_top_level() {
188+
let schema = schema(vec![
189+
Field::new("a", DataType::Utf8View, true),
190+
Field::new("b", DataType::BinaryView, true),
191+
]);
192+
193+
assert!(schema_contains_view_types(&schema));
194+
}
195+
196+
#[test]
197+
fn test_schema_contains_view_types_true_nested() {
198+
let nested = Field::new(
199+
"s",
200+
DataType::Struct(Fields::from(vec![Field::new(
201+
"v",
202+
DataType::Utf8View,
203+
true,
204+
)])),
205+
true,
206+
);
207+
208+
let schema = schema(vec![nested]);
209+
assert!(schema_contains_view_types(&schema));
210+
}
211+
}

rust/sedona-spatial-join/src/utils/arrow_utils.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ use arrow_array::ArrayRef;
2323
use arrow_array::StructArray;
2424
use arrow_schema::{ArrowError, DataType};
2525
use datafusion_common::Result;
26+
use sedona_common::sedona_internal_err;
2627

2728
/// Reconstruct `batch` to organize the payload buffers of each `StringViewArray` and
2829
/// `BinaryViewArray` in sequential order by calling `gc()` on them.
@@ -117,7 +118,10 @@ pub(crate) fn compact_array(array: ArrayRef) -> Result<(ArrayRef, bool)> {
117118

118119
let DataType::List(field) = list_array.data_type() else {
119120
// Defensive: this downcast should only succeed for DataType::List.
120-
return Ok((array, false));
121+
return sedona_internal_err!(
122+
"ListArray has non-List data type: {:?}",
123+
list_array.data_type()
124+
);
121125
};
122126

123127
let rebuilt = ListArray::new(

0 commit comments

Comments
 (0)