Skip to content

Commit

Permalink
remove SharedVec -> Arc<[Array]>
Browse files Browse the repository at this point in the history
  • Loading branch information
a10y committed Sep 24, 2024
1 parent 42e90aa commit 8b218cd
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 134 deletions.
2 changes: 1 addition & 1 deletion encodings/datetime-parts/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl DateTimePartsArray {
seconds_dtype: seconds.dtype().clone(),
subseconds_dtype: subsecond.dtype().clone(),
},
vec![days, seconds, subsecond].into(),
[days, seconds, subsecond].into(),
StatsSet::new(),
)
}
Expand Down
2 changes: 1 addition & 1 deletion encodings/dict/src/dict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl DictArray {
codes_dtype: codes.dtype().clone(),
values_len: values.len(),
},
vec![values, codes].into(),
[values, codes].into(),
StatsSet::new(),
)
}
Expand Down
2 changes: 1 addition & 1 deletion encodings/fastlanes/src/for/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl FoRArray {
reference.dtype().clone(),
child.len(),
FoRMetadata { reference, shift },
vec![child].into(),
[child].into(),
StatsSet::new(),
)
}
Expand Down
6 changes: 4 additions & 2 deletions encodings/fsst/src/array.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::sync::Arc;

use fsst::{Decompressor, Symbol};
use serde::{Deserialize, Serialize};
use vortex::array::VarBinArray;
Expand Down Expand Up @@ -73,7 +75,7 @@ impl FSSTArray {
let len = codes.len();
let strings_dtype = codes.dtype().clone();
let uncompressed_lengths_dtype = uncompressed_lengths.dtype().clone();
let children = vec![symbols, symbol_lengths, codes, uncompressed_lengths];
let children = Arc::new([symbols, symbol_lengths, codes, uncompressed_lengths]);

Self::try_from_parts(
dtype,
Expand All @@ -83,7 +85,7 @@ impl FSSTArray {
codes_dtype: strings_dtype,
uncompressed_lengths_dtype,
},
children.into(),
children,
StatsSet::new(),
)
}
Expand Down
2 changes: 1 addition & 1 deletion encodings/zigzag/src/zigzag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl ZigZagArray {
.with_nullability(encoded_dtype.nullability());

let len = encoded.len();
let children = vec![encoded];
let children = [encoded];

Self::try_from_parts(dtype, len, ZigZagMetadata, children.into(), StatsSet::new())
}
Expand Down
114 changes: 0 additions & 114 deletions vortex-array/src/arc_slice.rs

This file was deleted.

2 changes: 1 addition & 1 deletion vortex-array/src/array/constant/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl ConstantArray {
scalar: scalar.clone(),
length,
},
vec![].into(),
[].into(),
stats,
)
.unwrap_or_else(|err| {
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/extension/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl ExtensionArray {
ExtensionMetadata {
storage_dtype: storage.dtype().clone(),
},
vec![storage].into(),
[storage].into(),
Default::default(),
)
.vortex_expect("Invalid ExtensionArray")
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/null/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl NullArray {
DType::Null,
len,
NullMetadata { len },
vec![].into(),
[].into(),
StatsSet::nulls(len, &DType::Null),
)
.vortex_expect("NullArray::new should never fail!")
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/array/sparse/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl SparseArray {
len,
fill_value,
},
vec![indices, values].into(),
[indices, values].into(),
StatsSet::new(),
)
}
Expand Down
5 changes: 2 additions & 3 deletions vortex-array/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use vortex_dtype::DType;
use vortex_error::{vortex_bail, vortex_panic, VortexResult};
use vortex_scalar::Scalar;

use crate::arc_slice::SharedVec;
use crate::encoding::EncodingRef;
use crate::stats::{Stat, Statistics, StatsSet};
use crate::{Array, ArrayDType, ArrayMetadata, ToArray};
Expand All @@ -17,7 +16,7 @@ pub struct ArrayData {
len: usize,
metadata: Arc<dyn ArrayMetadata>,
buffer: Option<Buffer>,
children: SharedVec<Array>,
children: Arc<[Array]>,
stats_map: Arc<RwLock<StatsSet>>,
}

Expand All @@ -28,7 +27,7 @@ impl ArrayData {
len: usize,
metadata: Arc<dyn ArrayMetadata>,
buffer: Option<Buffer>,
children: SharedVec<Array>,
children: Arc<[Array]>,
statistics: StatsSet,
) -> VortexResult<Self> {
let data = Self {
Expand Down
2 changes: 1 addition & 1 deletion vortex-array/src/implementation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ macro_rules! impl_encoding {
dtype: vortex_dtype::DType,
len: usize,
metadata: [<$Name Metadata>],
children: $crate::arc_slice::SharedVec<$crate::Array>,
children: std::sync::Arc<[$crate::Array]>,
stats: $crate::stats::StatsSet,
) -> VortexResult<Self> {
Ok(Self { typed: $crate::TypedArray::try_from_parts(dtype, len, metadata, None, children, stats)? })
Expand Down
1 change: 0 additions & 1 deletion vortex-array/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ use crate::variants::ArrayVariants;
use crate::visitor::{AcceptArrayVisitor, ArrayVisitor};

pub mod accessor;
pub mod arc_slice;
pub mod array;
pub mod arrow;
mod canonical;
Expand Down
3 changes: 1 addition & 2 deletions vortex-array/src/typed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use vortex_buffer::Buffer;
use vortex_dtype::DType;
use vortex_error::{vortex_bail, vortex_panic, VortexError, VortexResult};

use crate::arc_slice::SharedVec;
use crate::stats::StatsSet;
use crate::{Array, ArrayData, ArrayDef, IntoArray, ToArray, TryDeserializeArrayMetadata};

Expand All @@ -20,7 +19,7 @@ impl<D: ArrayDef> TypedArray<D> {
len: usize,
metadata: D::Metadata,
buffer: Option<Buffer>,
children: SharedVec<Array>,
children: Arc<[Array]>,
stats: StatsSet,
) -> VortexResult<Self> {
let array = Array::Data(ArrayData::try_new(
Expand Down
5 changes: 2 additions & 3 deletions vortex-array/src/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use vortex_dtype::{DType, Nullability};
use vortex_error::{vortex_bail, vortex_err, VortexError, VortexExpect as _, VortexResult};
use vortex_scalar::{PValue, Scalar, ScalarValue};

use crate::arc_slice::SharedVec;
use crate::encoding::EncodingRef;
use crate::opaque::OpaqueEncoding;
use crate::stats::{Stat, Statistics, StatsSet};
Expand All @@ -23,7 +22,7 @@ pub struct ArrayView {
len: usize,
flatbuffer: Buffer,
flatbuffer_loc: usize,
buffers: SharedVec<Buffer>,
buffers: Arc<[Buffer]>,
ctx: Arc<Context>,
// TODO(ngates): a store a Projection. A projected ArrayView contains the full fb::Array
// metadata, but only the buffers from the selected columns. Therefore we need to know
Expand Down Expand Up @@ -74,7 +73,7 @@ impl ArrayView {
len,
flatbuffer,
flatbuffer_loc,
buffers: SharedVec::from(buffers),
buffers: buffers.into(),
ctx,
};

Expand Down

0 comments on commit 8b218cd

Please sign in to comment.