1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
use std::fmt::Debug;
pub use layouts::{ChunkedLayoutSpec, ColumnLayoutSpec};
use vortex::Array;
use vortex_error::VortexResult;
mod batch;
mod buffered;
mod builder;
mod cache;
mod context;
mod filtering;
mod footer;
mod layouts;
mod stream;
pub use builder::LayoutReaderBuilder;
pub use context::*;
pub use filtering::RowFilter;
pub use stream::LayoutBatchStream;
pub use vortex_schema::projection::Projection;
pub use vortex_schema::Schema;
use crate::stream_writer::ByteRange;
// Recommended read-size according to the AWS performance guide
const INITIAL_READ_SIZE: usize = 8 * 1024 * 1024;
const DEFAULT_BATCH_SIZE: usize = 65536;
const FILE_POSTSCRIPT_SIZE: usize = 20;
#[allow(dead_code)]
#[derive(Debug, Clone)]
pub struct Scan {
indices: Option<Array>,
projection: Projection,
filter: Option<RowFilter>,
batch_size: usize,
}
/// Unique identifier for a message within a layout
pub type LayoutPartId = u16;
pub type MessageId = Vec<LayoutPartId>;
#[derive(Debug)]
pub enum ReadResult {
ReadMore(Vec<(MessageId, ByteRange)>),
Batch(Array),
}
pub trait Layout: Debug + Send {
/// Reads the data from the underlying layout
///
/// The layout can either return a batch data, i.e. an Array or ask for more layout messages to
/// be read. When requesting messages to be read the caller should populate the messages in the cache
/// and then call back into this function.
///
/// The layout is finished reading when it returns None
fn read_next(&mut self) -> VortexResult<Option<ReadResult>>;
// TODO(robert): Support stats pruning via planning. Requires propagating all the metadata
// to top level and then pushing down the result of it
// Try to use metadata of the layout to perform pruning given the passed `Scan` object.
//
// The layout should perform any planning that's cheap and doesn't require reading the data.
// fn plan(&mut self, scan: Scan) -> VortexResult<Option<PlanResult>>;
}