Skip to content

Commit 21b3dea

Browse files
break: nth_child to return reference instead of clone (#10051)
Signed-off-by: "Joe Isaacs" <[email protected]>
1 parent 4e37c51 commit 21b3dea

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎vortex-array/src/array/erased.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,8 @@ impl ArrayRef {
732732
/// Returns the nth child of the array without allocating a Vec.
733733
///
734734
/// Returns `None` if the index is out of bounds.
735-
pub fn nth_child(&self, idx: usize) -> Option<ArrayRef> {
736-
self.children_iter().nth(idx).cloned()
735+
pub fn nth_child(&self, idx: usize) -> Option<&ArrayRef> {
736+
self.children_iter().nth(idx)
737737
}
738738

739739
/// Returns the names of the children of the array: the slot names of the non-None slots

‎vortex-array/src/scalar_fn/fns/mask/kernel.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ where
9393
}
9494
}
9595

96-
<V as MaskReduce>::mask(array, &mask_child)
96+
<V as MaskReduce>::mask(array, mask_child)
9797
}
9898
}
9999

@@ -121,7 +121,7 @@ where
121121
let mask_child = parent
122122
.nth_child(1)
123123
.ok_or_else(|| vortex_err!("Mask expression must have 2 children"))?;
124-
<V as MaskKernel>::mask(array, &mask_child, ctx)
124+
<V as MaskKernel>::mask(array, mask_child, ctx)
125125
}
126126
}
127127

‎vortex-array/src/scalar_fn/vtable.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,14 +376,14 @@ impl ReduceNode for ArrayReduceNode<'_> {
376376
let array = match &self.array {
377377
Cow::Borrowed(array) => Cow::Borrowed(
378378
array
379-
.children_iter()
380-
.nth(idx)
379+
.nth_child(idx)
381380
.vortex_expect("child idx out of bounds"),
382381
),
383382
Cow::Owned(array) => Cow::Owned(
384383
array
385384
.nth_child(idx)
386-
.vortex_expect("child idx out of bounds"),
385+
.vortex_expect("child idx out of bounds")
386+
.clone(),
387387
),
388388
};
389389
Self { array }

0 commit comments

Comments
 (0)