vortex_scan/source.rs
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4//! Source inputs and byte access for scans.
5
6use std::sync::Arc;
7
8use vortex_array::dtype::DType;
9pub use vortex_io::segments::SegmentFuture;
10pub use vortex_io::segments::SegmentId;
11pub use vortex_io::segments::SegmentSource;
12
13use crate::execution::SegmentLocation;
14use crate::execution::cache::ScanCache;
15use crate::plan::LazyPlanRef;
16
17/// The plan and byte source used to prepare a scan.
18///
19/// The lazy root defers lowering until preparation runs on a compute task. Segment identifiers
20/// are local to this input. Reuse a cache only while the plan, dtype, locations, and source
21/// describe the same data.
22#[derive(Clone)]
23pub struct ScanInput {
24 /// The dtype of the root plan.
25 pub dtype: DType,
26 /// The root plan, initialized without reading payloads.
27 pub root: LazyPlanRef,
28 /// Byte locations indexed by source-local segment identifiers.
29 pub locations: Arc<[SegmentLocation]>,
30 /// Fetches bytes by source-local segment identifier.
31 pub segments: Arc<dyn SegmentSource>,
32 /// State shared by repeated scans of this input.
33 pub cache: Option<ScanCache>,
34}