diff --git a/vortex-array/src/array/varbinview/compute/mod.rs b/vortex-array/src/array/varbinview/compute/mod.rs index 68bcea8850..44ae9bbb6b 100644 --- a/vortex-array/src/array/varbinview/compute/mod.rs +++ b/vortex-array/src/array/varbinview/compute/mod.rs @@ -1,3 +1,5 @@ +use std::ops::Deref; + use arrow_buffer::ScalarBuffer; use itertools::Itertools; use num_traits::AsPrimitive; @@ -100,17 +102,21 @@ fn take_views>( views: ScalarBuffer, indices: &[I], ) -> ScalarBuffer { - ScalarBuffer::::from_iter(indices.iter().map(|i| views[i.as_()])) + // NOTE(ngates): this deref is not actually trivial, so we run it once. + let views_ref = views.deref(); + ScalarBuffer::::from_iter(indices.iter().map(|i| views_ref[i.as_()])) } fn take_views_unchecked>( views: ScalarBuffer, indices: &[I], ) -> ScalarBuffer { + // NOTE(ngates): this deref is not actually trivial, so we run it once. + let views_ref = views.deref(); ScalarBuffer::::from_iter( indices .iter() - .map(|i| unsafe { *views.get_unchecked(i.as_()) }), + .map(|i| unsafe { *views_ref.get_unchecked(i.as_()) }), ) }