44use num_traits:: Zero ;
55use vortex_error:: VortexResult ;
66
7- use super :: REBUILD_DENSITY_THRESHOLD ;
87use crate :: ArrayRef ;
98use crate :: ExecutionCtx ;
109use crate :: IntoArray ;
@@ -14,7 +13,6 @@ use crate::arrays::ListViewArray;
1413use crate :: arrays:: dict:: TakeExecute ;
1514use crate :: arrays:: dict:: TakeReduce ;
1615use crate :: arrays:: listview:: ListViewArrayExt ;
17- use crate :: arrays:: listview:: ListViewRebuildMode ;
1816use crate :: builtins:: ArrayBuiltins ;
1917use crate :: dtype:: Nullability ;
2018use crate :: match_each_integer_ptype;
@@ -23,14 +21,6 @@ use crate::scalar::Scalar;
2321/// Metadata-only take for [`ListViewArray`].
2422impl TakeReduce for ListView {
2523 fn take ( array : ArrayView < ' _ , ListView > , indices : & ArrayRef ) -> VortexResult < Option < ArrayRef > > {
26- // Approximate element density by the fraction of list rows retained. Assumes roughly
27- // uniform list sizes; good enough to decide whether dragging along the full `elements`
28- // buffer is worth avoiding a rebuild.
29- let kept_row_fraction = indices. len ( ) as f32 / array. sizes ( ) . len ( ) as f32 ;
30- if kept_row_fraction < REBUILD_DENSITY_THRESHOLD {
31- return Ok ( None ) ;
32- }
33-
3424 Ok ( Some ( apply_take ( array, indices) ?. into_array ( ) ) )
3525 }
3626}
@@ -45,21 +35,7 @@ impl TakeExecute for ListView {
4535 indices : & ArrayRef ,
4636 _ctx : & mut ExecutionCtx ,
4737 ) -> VortexResult < Option < ArrayRef > > {
48- let kept_row_fraction = indices. len ( ) as f32 / array. sizes ( ) . len ( ) as f32 ;
49- let taken = apply_take ( array, indices) ?;
50-
51- if kept_row_fraction < REBUILD_DENSITY_THRESHOLD {
52- // TODO(connor)[ListView]: Ideally, we would only rebuild after all `take`s and `filter`
53- // compute functions have run, at the "top" of the operator tree. However, we cannot do
54- // this right now, so we will just rebuild every time (similar to `ListArray`).
55- Ok ( Some (
56- taken
57- . rebuild ( ListViewRebuildMode :: MakeZeroCopyToList ) ?
58- . into_array ( ) ,
59- ) )
60- } else {
61- Ok ( Some ( taken. into_array ( ) ) )
62- }
38+ Ok ( Some ( apply_take ( array, indices) ?. into_array ( ) ) )
6339 }
6440}
6541
0 commit comments