Skip to content

Commit 900ad8a

Browse files
joseph-isaacsclaude
andcommitted
fix: remove Arc double-wrapping in vortex-ffi apply and tests
The `vx_array::new(Arc::new(x.into_array()))` pattern double-wraps arrays since `into_array()` already returns `Arc<dyn DynArray>`. With the new `apply(self: Arc<Self>)` signature, this breaks downcasting because the concrete type behind the trait object becomes `Arc<dyn DynArray>` instead of the actual encoding type. Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Joe Isaacs <joe.isaacs@live.co.uk>
1 parent b3a1f61 commit 900ad8a

2 files changed

Lines changed: 6 additions & 7 deletions

File tree

vortex-ffi/src/array.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ pub unsafe extern "C" fn vx_array_apply(
414414
vortex_ensure!(!expression.is_null());
415415
let array = vx_array::as_ref(array);
416416
let expression = vx_expression::as_ref(expression);
417-
Ok(vx_array::new(Arc::new(array.clone().apply(expression)?)))
417+
Ok(vx_array::new(array.clone().apply(expression)?))
418418
})
419419
}
420420

vortex-ffi/src/expression.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ pub unsafe extern "C" fn vx_expression_list_contains(
295295
#[cfg(test)]
296296
mod tests {
297297
use std::ptr;
298-
use std::sync::Arc;
299298

300299
use vortex::array::IntoArray;
301300
use vortex::array::ToCanonical;
@@ -355,7 +354,7 @@ mod tests {
355354
let column = vx_expression_get_item(c"age".as_ptr(), root);
356355
assert_ne!(column, ptr::null_mut());
357356

358-
let array = vx_array::new(Arc::new(array.into_array()));
357+
let array = vx_array::new(array.into_array());
359358
let mut error = ptr::null_mut();
360359

361360
let applied_array = vx_array_apply(array, column, &raw mut error);
@@ -378,7 +377,7 @@ mod tests {
378377
assert!(!error.is_null());
379378
vx_error_free(error);
380379

381-
let names_array_vx = vx_array::new(Arc::new(names_array.into_array()));
380+
let names_array_vx = vx_array::new(names_array.into_array());
382381
let applied_array = vx_array_apply(names_array_vx, column, &raw mut error);
383382
assert!(applied_array.is_null());
384383
assert!(!error.is_null());
@@ -399,7 +398,7 @@ mod tests {
399398
unsafe {
400399
let root = vx_expression_root();
401400

402-
let array = vx_array::new(Arc::new(array.into_array()));
401+
let array = vx_array::new(array.into_array());
403402

404403
let columns = [c"name".as_ptr(), c"age".as_ptr()];
405404
let column = vx_expression_select(columns.as_ptr(), 2, root);
@@ -441,7 +440,7 @@ mod tests {
441440
let array = StructArray::try_new(names, fields, 4, Validity::NonNullable);
442441

443442
unsafe {
444-
let array = vx_array::new(Arc::new(array.unwrap().into_array()));
443+
let array = vx_array::new(array.unwrap().into_array());
445444

446445
let root = vx_expression_root();
447446
let expression_col1 = vx_expression_get_item(c"col1".as_ptr(), root);
@@ -524,7 +523,7 @@ mod tests {
524523

525524
unsafe {
526525
let root = vx_expression_root();
527-
let array = vx_array::new(Arc::new(array.into_array()));
526+
let array = vx_array::new(array.into_array());
528527
let expression_value = vx_expression::new(Box::new(lit(1)));
529528

530529
let expression = vx_expression_list_contains(root, expression_value);

0 commit comments

Comments
 (0)