pub trait ParallelSource:
Source
+ Send
+ Sync {
// Required methods
fn total_rows(&self) -> Option<usize>;
fn create_partition(&self, morsel: &Morsel) -> Box<dyn Source>;
fn num_columns(&self) -> usize;
// Provided methods
fn is_partitionable(&self) -> bool { ... }
fn generate_morsels(
&self,
morsel_size: usize,
source_id: usize,
) -> Vec<Morsel> { ... }
}Expand description
Trait for sources that support parallel partitioning.
Parallel sources can:
- Report their total row count (if known)
- Be partitioned into independent morsels
- Create partition sources for specific morsels
Required Methods§
Sourcefn total_rows(&self) -> Option<usize>
fn total_rows(&self) -> Option<usize>
Returns the total number of rows in this source, if known.
Returns None if the total is unknown (e.g., for streaming sources).
Sourcefn create_partition(&self, morsel: &Morsel) -> Box<dyn Source>
fn create_partition(&self, morsel: &Morsel) -> Box<dyn Source>
Creates a partition source for the given morsel.
The returned source produces data only for the row range specified in the morsel.
Sourcefn num_columns(&self) -> usize
fn num_columns(&self) -> usize
Returns the number of columns in this source.
Provided Methods§
Sourcefn is_partitionable(&self) -> bool
fn is_partitionable(&self) -> bool
Returns whether this source can be partitioned.
Some sources (like streaming or network sources) cannot be partitioned.