Skip to content

Commit 751e0af

Browse files
authored
Move Shared array out of vortex-array into vortex-layout (#10495)
`SharedArray` is only used while reading layouts (the dict reader, the take operator and repartition) and by vortex-cuda, never by vortex-array itself, so it moves into vortex-layout as `vortex_layout::arrays::shared`. vortex-cuda reaches it through `vortex::layout::arrays::shared`. Signed-off-by: Claude <[email protected]>
1 parent c7ae383 commit 751e0af

15 files changed

Lines changed: 66 additions & 63 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎vortex-array/Cargo.toml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ workspace = true
2626
arbitrary = { workspace = true, optional = true }
2727
arcref = { workspace = true }
2828
arrow-buffer = { workspace = true }
29-
async-lock = { workspace = true }
3029
bytes = { workspace = true }
3130
cfg-if = { workspace = true }
3231
cudarc = { workspace = true, optional = true }

‎vortex-array/src/arrays/mod.rs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,6 @@ pub mod scalar_fn;
106106
pub use scalar_fn::ScalarFn;
107107
pub use scalar_fn::ScalarFnArray;
108108

109-
pub mod shared;
110-
pub use shared::Shared;
111-
pub use shared::SharedArray;
112-
113109
pub mod slice;
114110
pub use slice::Slice;
115111
pub use slice::SliceArray;

‎vortex-cuda/src/kernel/arrays/shared.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use async_trait::async_trait;
55
use tracing::instrument;
66
use vortex::array::ArrayRef;
77
use vortex::array::Canonical;
8-
use vortex::array::arrays::Shared;
9-
use vortex::array::arrays::shared::SharedArrayExt;
108
use vortex::error::VortexExpect;
119
use vortex::error::VortexResult;
10+
use vortex::layout::arrays::shared::Shared;
11+
use vortex::layout::arrays::shared::SharedArrayExt;
1212

1313
use crate::executor::CudaArrayExt;
1414
use crate::executor::CudaExecute;

‎vortex-cuda/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ use vortex::array::arrays::Dict;
7979
use vortex::array::arrays::Filter;
8080
use vortex::array::arrays::List;
8181
use vortex::array::arrays::Masked;
82-
use vortex::array::arrays::Shared;
8382
use vortex::array::arrays::Slice;
8483
use vortex::encodings::alp::ALP;
8584
use vortex::encodings::datetime_parts::DateTimeParts;
@@ -93,6 +92,7 @@ use vortex::encodings::sequence::Sequence;
9392
use vortex::encodings::zigzag::ZigZag;
9493
use vortex::encodings::zstd::Zstd;
9594
use vortex::encodings::zstd::ZstdBuffers;
95+
use vortex::layout::arrays::shared::Shared;
9696
#[cfg(test)]
9797
use vortex_cuda_macros::test;
9898
pub use vortex_nvcomp as nvcomp;

‎vortex-layout/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ all-features = true
2020
arcref = { workspace = true }
2121
arrow-array = { workspace = true }
2222
arrow-schema = { workspace = true }
23+
async-lock = { workspace = true }
2324
async-stream = { workspace = true }
2425
async-trait = { workspace = true }
2526
bit-vec = { workspace = true }

‎vortex-layout/src/arrays/mod.rs‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// SPDX-License-Identifier: Apache-2.0
2+
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3+
4+
//! Array encodings that only exist while reading layouts.
5+
6+
pub mod shared;
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@ use std::sync::Arc;
88
use std::sync::OnceLock;
99

1010
use async_lock::Mutex as AsyncMutex;
11+
use vortex_array::Array;
12+
use vortex_array::ArrayParts;
13+
use vortex_array::ArrayRef;
14+
use vortex_array::Canonical;
15+
use vortex_array::IntoArray;
16+
use vortex_array::TypedArrayRef;
17+
use vortex_array::array_slots;
1118
use vortex_error::SharedVortexResult;
1219
use vortex_error::VortexResult;
1320

14-
use crate::ArrayRef;
15-
use crate::Canonical;
16-
use crate::IntoArray;
17-
use crate::array::Array;
18-
use crate::array::ArrayParts;
19-
use crate::array::TypedArrayRef;
20-
use crate::array_slots;
21-
use crate::arrays::Shared;
21+
use crate::arrays::shared::Shared;
22+
use crate::arrays::shared::SharedArray;
2223

2324
#[array_slots(Shared)]
2425
pub struct SharedSlots {
@@ -103,9 +104,9 @@ impl Default for SharedData {
103104
}
104105
}
105106

106-
impl Array<Shared> {
107-
/// Creates a new `SharedArray`.
108-
pub fn new(source: ArrayRef) -> Self {
107+
impl Shared {
108+
/// Creates a new [`SharedArray`] wrapping `source`.
109+
pub fn new(source: ArrayRef) -> SharedArray {
109110
let dtype = source.dtype().clone();
110111
let len = source.len();
111112
unsafe {
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4+
use vortex_array::ArrayEq;
5+
use vortex_array::Canonical;
6+
use vortex_array::EqMode;
7+
use vortex_array::IntoArray;
8+
use vortex_array::VortexSessionExecute;
9+
use vortex_array::arrays::PrimitiveArray;
10+
use vortex_array::validity::Validity;
411
use vortex_buffer::buffer;
512
use vortex_error::VortexResult;
613

7-
use crate::Canonical;
8-
use crate::IntoArray;
9-
use crate::VortexSessionExecute;
10-
use crate::arrays::PrimitiveArray;
11-
use crate::arrays::SharedArray;
14+
use crate::arrays::shared::Shared;
1215
use crate::arrays::shared::SharedArrayExt;
13-
use crate::hash::ArrayEq;
14-
use crate::hash::EqMode;
15-
use crate::validity::Validity;
1616

1717
#[test]
1818
fn shared_array_caches_on_canonicalize() -> VortexResult<()> {
1919
let array = PrimitiveArray::new(buffer![1i32, 2, 3], Validity::NonNullable).into_array();
20-
let shared = SharedArray::new(array);
20+
let shared = Shared::new(array);
2121

22-
let session = crate::array_session();
22+
let session = vortex_array::array_session();
2323
let mut ctx = session.create_execution_ctx();
2424

2525
let first = shared.get_or_compute(|source| source.clone().execute::<Canonical>(&mut ctx))?;

0 commit comments

Comments
 (0)