Skip to content

Commit f341260

Browse files
Matt KatzMatt Katz
authored andcommitted
remove rebuild from take
1 parent 19a1fb3 commit f341260

1 file changed

Lines changed: 1 addition & 25 deletions

File tree

  • vortex-array/src/arrays/listview/compute

vortex-array/src/arrays/listview/compute/take.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use num_traits::Zero;
55
use vortex_error::VortexResult;
66

7-
use super::REBUILD_DENSITY_THRESHOLD;
87
use crate::ArrayRef;
98
use crate::ExecutionCtx;
109
use crate::IntoArray;
@@ -14,7 +13,6 @@ use crate::arrays::ListViewArray;
1413
use crate::arrays::dict::TakeExecute;
1514
use crate::arrays::dict::TakeReduce;
1615
use crate::arrays::listview::ListViewArrayExt;
17-
use crate::arrays::listview::ListViewRebuildMode;
1816
use crate::builtins::ArrayBuiltins;
1917
use crate::dtype::Nullability;
2018
use crate::match_each_integer_ptype;
@@ -23,14 +21,6 @@ use crate::scalar::Scalar;
2321
/// Metadata-only take for [`ListViewArray`].
2422
impl 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

Comments
 (0)