Skip to content

Commit d0b49b1

Browse files
authored
chore: change 4 lines; eliminate countless Arc clones (#4972)
If a consumer needs an owned version they can clone. There are like 50 spots in the code where we only need the slice, not an owned Arc. Signed-off-by: Daniel King <[email protected]>
1 parent fe8594d commit d0b49b1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

vortex-array/src/arrays/struct_/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ pub struct StructArray {
141141
}
142142

143143
impl StructArray {
144-
pub fn fields(&self) -> Arc<[ArrayRef]> {
145-
self.fields.clone()
144+
pub fn fields(&self) -> &Arc<[ArrayRef]> {
145+
&self.fields
146146
}
147147

148148
pub fn field_by_name(&self, name: impl AsRef<str>) -> VortexResult<&ArrayRef> {

vortex-array/src/arrays/struct_/compute/mask.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl MaskKernel for StructVTable {
1414
let validity = array.validity().mask(filter_mask);
1515

1616
StructArray::try_new_with_dtype(
17-
array.fields(),
17+
array.fields().clone(),
1818
array.struct_fields().clone(),
1919
array.len(),
2020
validity,

vortex-array/src/arrays/struct_/compute/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl TakeKernel for StructVTable {
2626
// an out of bounds element
2727
if array.is_empty() {
2828
return StructArray::try_new_with_dtype(
29-
array.fields(),
29+
array.fields().clone(),
3030
array.struct_fields().clone(),
3131
indices.len(),
3232
Validity::AllInvalid,

0 commit comments

Comments
 (0)