vortex_layout/layouts/chunked/
mod.rsmod evaluator;
mod reader;
pub mod stats_table;
pub mod writer;
use std::collections::BTreeSet;
use std::sync::Arc;
use vortex_array::ContextRef;
use vortex_error::VortexResult;
use crate::data::LayoutData;
use crate::encoding::{LayoutEncoding, LayoutId};
use crate::layouts::chunked::reader::ChunkedReader;
use crate::reader::{LayoutReader, LayoutScanExt};
use crate::segments::AsyncSegmentReader;
use crate::CHUNKED_LAYOUT_ID;
#[derive(Default, Debug)]
pub struct ChunkedLayout;
impl LayoutEncoding for ChunkedLayout {
fn id(&self) -> LayoutId {
CHUNKED_LAYOUT_ID
}
fn reader(
&self,
layout: LayoutData,
ctx: ContextRef,
segments: Arc<dyn AsyncSegmentReader>,
) -> VortexResult<Arc<dyn LayoutReader>> {
Ok(ChunkedReader::try_new(layout, ctx, segments)?.into_arc())
}
fn register_splits(
&self,
layout: &LayoutData,
row_offset: u64,
splits: &mut BTreeSet<u64>,
) -> VortexResult<()> {
let nchunks = layout.nchildren() - (if layout.metadata().is_some() { 1 } else { 0 });
let mut offset = row_offset;
for i in 0..nchunks {
let child = layout.child(i, layout.dtype().clone())?;
child.register_splits(offset, splits)?;
offset += child.row_count();
splits.insert(offset);
}
Ok(())
}
}