vortex_layout/layouts/flat/
mod.rs1mod eval_expr;
2mod reader;
3pub mod writer;
4
5use std::collections::BTreeSet;
6use std::sync::Arc;
7
8use vortex_array::ArrayContext;
9use vortex_dtype::FieldMask;
10use vortex_error::VortexResult;
11
12use crate::layouts::flat::reader::FlatReader;
13use crate::reader::{LayoutReader, LayoutReaderExt};
14use crate::segments::SegmentSource;
15use crate::vtable::LayoutVTable;
16use crate::{FLAT_LAYOUT_ID, Layout, LayoutId};
17
18#[derive(Debug)]
19pub struct FlatLayout;
20
21impl LayoutVTable for FlatLayout {
22 fn id(&self) -> LayoutId {
23 FLAT_LAYOUT_ID
24 }
25
26 fn reader(
27 &self,
28 layout: Layout,
29 segment_source: &Arc<dyn SegmentSource>,
30 ctx: &ArrayContext,
31 ) -> VortexResult<Arc<dyn LayoutReader>> {
32 Ok(FlatReader::try_new(layout, segment_source.clone(), ctx.clone())?.into_arc())
33 }
34
35 fn register_splits(
36 &self,
37 layout: &Layout,
38 field_mask: &[FieldMask],
39 row_offset: u64,
40 splits: &mut BTreeSet<u64>,
41 ) -> VortexResult<()> {
42 for path in field_mask {
43 if path.matches_root() {
44 splits.insert(row_offset + layout.row_count());
45 break;
46 }
47 }
48 Ok(())
49 }
50}