pub struct MemorySourceConfig {
partitions: Vec<Vec<RecordBatch>>,
schema: SchemaRef,
projected_schema: SchemaRef,
projection: Option<Vec<usize>>,
sort_information: Vec<LexOrdering>,
show_sizes: bool,
fetch: Option<usize>,
}Expand description
Data source configuration for reading in-memory batches of data
Fields§
§partitions: Vec<Vec<RecordBatch>>The partitions to query.
Each partition is a Vec<RecordBatch>.
schema: SchemaRefSchema representing the data before projection
projected_schema: SchemaRefSchema representing the data after the optional projection is applied
projection: Option<Vec<usize>>Optional projection
sort_information: Vec<LexOrdering>Sort information: one or more equivalent orderings
show_sizes: boolif partition sizes should be displayed
fetch: Option<usize>The maximum number of records to read from this plan. If None,
all records after filtering are returned.
Implementations§
Source§impl MemorySourceConfig
impl MemorySourceConfig
Sourcepub fn try_new(
partitions: &[Vec<RecordBatch>],
schema: SchemaRef,
projection: Option<Vec<usize>>,
) -> Result<Self>
pub fn try_new( partitions: &[Vec<RecordBatch>], schema: SchemaRef, projection: Option<Vec<usize>>, ) -> Result<Self>
Create a new MemorySourceConfig for reading in-memory record batches
The provided schema should not have the projection applied.
Sourcepub fn try_new_exec(
partitions: &[Vec<RecordBatch>],
schema: SchemaRef,
projection: Option<Vec<usize>>,
) -> Result<Arc<DataSourceExec>>
pub fn try_new_exec( partitions: &[Vec<RecordBatch>], schema: SchemaRef, projection: Option<Vec<usize>>, ) -> Result<Arc<DataSourceExec>>
Create a new DataSourceExec plan for reading in-memory record batches
The provided schema should not have the projection applied.
Sourcepub fn try_new_as_values(
schema: SchemaRef,
data: Vec<Vec<Arc<dyn PhysicalExpr>>>,
) -> Result<Arc<DataSourceExec>>
pub fn try_new_as_values( schema: SchemaRef, data: Vec<Vec<Arc<dyn PhysicalExpr>>>, ) -> Result<Arc<DataSourceExec>>
Create a new execution plan from a list of constant values (ValuesExec)
Sourcepub fn try_new_from_batches(
schema: SchemaRef,
batches: Vec<RecordBatch>,
) -> Result<Arc<DataSourceExec>>
pub fn try_new_from_batches( schema: SchemaRef, batches: Vec<RecordBatch>, ) -> Result<Arc<DataSourceExec>>
Create a new plan using the provided schema and batches.
Errors if any of the batches don’t match the provided schema, or if no batches are provided.
Sourcepub fn with_limit(self, limit: Option<usize>) -> Self
pub fn with_limit(self, limit: Option<usize>) -> Self
Set the limit of the files
Sourcepub fn with_show_sizes(self, show_sizes: bool) -> Self
pub fn with_show_sizes(self, show_sizes: bool) -> Self
Set show_sizes to determine whether to display partition sizes
Sourcepub fn partitions(&self) -> &[Vec<RecordBatch>]
pub fn partitions(&self) -> &[Vec<RecordBatch>]
Ref to partitions
Sourcepub fn projection(&self) -> &Option<Vec<usize>>
pub fn projection(&self) -> &Option<Vec<usize>>
Ref to projection
Sourcepub fn show_sizes(&self) -> bool
pub fn show_sizes(&self) -> bool
Show sizes
Sourcepub fn sort_information(&self) -> &[LexOrdering]
pub fn sort_information(&self) -> &[LexOrdering]
Ref to sort information
Sourcepub fn try_with_sort_information(
self,
sort_information: Vec<LexOrdering>,
) -> Result<Self>
pub fn try_with_sort_information( self, sort_information: Vec<LexOrdering>, ) -> Result<Self>
A memory table can be ordered by multiple expressions simultaneously.
[EquivalenceProperties] keeps track of expressions that describe the
global ordering of the schema. These columns are not necessarily same; e.g.
┌-------┐
| a | b |
|---|---|
| 1 | 9 |
| 2 | 8 |
| 3 | 7 |
| 5 | 5 |
└---┴---┘where both a ASC and b DESC can describe the table ordering. With
[EquivalenceProperties], we can keep track of these equivalences
and treat a ASC and b DESC as the same ordering requirement.
Note that if there is an internal projection, that projection will be
also applied to the given sort_information.
Sourcepub fn original_schema(&self) -> SchemaRef
pub fn original_schema(&self) -> SchemaRef
Arc clone of ref to original schema
Sourcefn repartition_preserving_order(
&self,
target_partitions: usize,
output_ordering: LexOrdering,
) -> Result<Option<Vec<Vec<RecordBatch>>>>
fn repartition_preserving_order( &self, target_partitions: usize, output_ordering: LexOrdering, ) -> Result<Option<Vec<Vec<RecordBatch>>>>
Repartition while preserving order.
Returns Ok(None) if cannot fulfill the requested repartitioning, such
as having too few batches to fulfill the target_partitions or if unable
to preserve output ordering.
Sourcefn repartition_evenly_by_size(
&self,
target_partitions: usize,
) -> Result<Option<Vec<Vec<RecordBatch>>>>
fn repartition_evenly_by_size( &self, target_partitions: usize, ) -> Result<Option<Vec<Vec<RecordBatch>>>>
Repartition into evenly sized chunks (as much as possible without batch splitting), disregarding any ordering.
Current implementation uses a first-fit-decreasing bin packing, modified to enable
us to still return the desired count of target_partitions.
Returns Ok(None) if cannot fulfill the requested repartitioning, such
as having too few batches to fulfill the target_partitions.
Trait Implementations§
Source§impl Clone for MemorySourceConfig
impl Clone for MemorySourceConfig
Source§fn clone(&self) -> MemorySourceConfig
fn clone(&self) -> MemorySourceConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl DataSource for MemorySourceConfig
impl DataSource for MemorySourceConfig
Source§fn repartitioned(
&self,
target_partitions: usize,
_repartition_file_min_size: usize,
output_ordering: Option<LexOrdering>,
) -> Result<Option<Arc<dyn DataSource>>>
fn repartitioned( &self, target_partitions: usize, _repartition_file_min_size: usize, output_ordering: Option<LexOrdering>, ) -> Result<Option<Arc<dyn DataSource>>>
If possible, redistribute batches across partitions according to their size.
Returns Ok(None) if unable to repartition. Preserve output ordering if exists.
Refer to DataSource::repartitioned for further details.
fn open( &self, partition: usize, _context: Arc<TaskContext>, ) -> Result<SendableRecordBatchStream>
fn as_any(&self) -> &dyn Any
Source§fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter<'_>) -> Result
fn fmt_as(&self, t: DisplayFormatType, f: &mut Formatter<'_>) -> Result
fn output_partitioning(&self) -> Partitioning
fn eq_properties(&self) -> EquivalenceProperties
fn scheduling_type(&self) -> SchedulingType
Source§fn partition_statistics(&self, partition: Option<usize>) -> Result<Statistics>
fn partition_statistics(&self, partition: Option<usize>) -> Result<Statistics>
partition is None.Source§fn with_fetch(&self, limit: Option<usize>) -> Option<Arc<dyn DataSource>>
fn with_fetch(&self, limit: Option<usize>) -> Option<Arc<dyn DataSource>>
fn fetch(&self) -> Option<usize>
fn try_swapping_with_projection( &self, projection: &[ProjectionExpr], ) -> Result<Option<Arc<dyn DataSource>>>
Source§fn statistics(&self) -> Result<Statistics>
fn statistics(&self) -> Result<Statistics>
fn metrics(&self) -> ExecutionPlanMetricsSet
Source§fn try_pushdown_filters(
&self,
filters: Vec<Arc<dyn PhysicalExpr>>,
_config: &ConfigOptions,
) -> Result<FilterPushdownPropagation<Arc<dyn DataSource>>>
fn try_pushdown_filters( &self, filters: Vec<Arc<dyn PhysicalExpr>>, _config: &ConfigOptions, ) -> Result<FilterPushdownPropagation<Arc<dyn DataSource>>>
ExecutionPlan::handle_child_pushdown_result for more details.Auto Trait Implementations§
impl Freeze for MemorySourceConfig
impl !RefUnwindSafe for MemorySourceConfig
impl Send for MemorySourceConfig
impl Sync for MemorySourceConfig
impl Unpin for MemorySourceConfig
impl !UnwindSafe for MemorySourceConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more