pub struct MemorySourceConfig {
partitions: Vec<Vec<RecordBatch>>,
schema: Arc<Schema>,
projected_schema: Arc<Schema>,
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>>§schema: Arc<Schema>§projected_schema: Arc<Schema>§projection: Option<Vec<usize>>§sort_information: Vec<LexOrdering>§show_sizes: bool§fetch: Option<usize>Implementations§
Source§impl MemorySourceConfig
impl MemorySourceConfig
Sourcepub fn try_new(
partitions: &[Vec<RecordBatch>],
schema: Arc<Schema>,
projection: Option<Vec<usize>>,
) -> Result<MemorySourceConfig, DataFusionError>
pub fn try_new( partitions: &[Vec<RecordBatch>], schema: Arc<Schema>, projection: Option<Vec<usize>>, ) -> Result<MemorySourceConfig, DataFusionError>
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: Arc<Schema>,
projection: Option<Vec<usize>>,
) -> Result<Arc<DataSourceExec>, DataFusionError>
pub fn try_new_exec( partitions: &[Vec<RecordBatch>], schema: Arc<Schema>, projection: Option<Vec<usize>>, ) -> Result<Arc<DataSourceExec>, DataFusionError>
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: Arc<Schema>,
data: Vec<Vec<Arc<dyn PhysicalExpr>>>,
) -> Result<Arc<DataSourceExec>, DataFusionError>
pub fn try_new_as_values( schema: Arc<Schema>, data: Vec<Vec<Arc<dyn PhysicalExpr>>>, ) -> Result<Arc<DataSourceExec>, DataFusionError>
Create a new execution plan from a list of constant values (ValuesExec)
Sourcepub fn try_new_from_batches(
schema: Arc<Schema>,
batches: Vec<RecordBatch>,
) -> Result<Arc<DataSourceExec>, DataFusionError>
pub fn try_new_from_batches( schema: Arc<Schema>, batches: Vec<RecordBatch>, ) -> Result<Arc<DataSourceExec>, DataFusionError>
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>) -> MemorySourceConfig
pub fn with_limit(self, limit: Option<usize>) -> MemorySourceConfig
Set the limit of the files
Sourcepub fn with_show_sizes(self, show_sizes: bool) -> MemorySourceConfig
pub fn with_show_sizes(self, show_sizes: bool) -> MemorySourceConfig
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<MemorySourceConfig, DataFusionError>
pub fn try_with_sort_information( self, sort_information: Vec<LexOrdering>, ) -> Result<MemorySourceConfig, DataFusionError>
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) -> Arc<Schema>
pub fn original_schema(&self) -> Arc<Schema>
Arc clone of ref to original schema
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>>, DataFusionError>
fn repartitioned( &self, target_partitions: usize, _repartition_file_min_size: usize, output_ordering: Option<LexOrdering>, ) -> Result<Option<Arc<dyn DataSource>>, DataFusionError>
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<Pin<Box<dyn RecordBatchStream<Item = Result<RecordBatch, DataFusionError>> + Send>>, DataFusionError>
fn as_any(&self) -> &(dyn Any + 'static)
Source§fn fmt_as(
&self,
t: DisplayFormatType,
f: &mut Formatter<'_>,
) -> Result<(), Error>
fn fmt_as( &self, t: DisplayFormatType, f: &mut Formatter<'_>, ) -> Result<(), Error>
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, DataFusionError>
fn partition_statistics( &self, partition: Option<usize>, ) -> Result<Statistics, DataFusionError>
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>>, DataFusionError>
Source§fn statistics(&self) -> Result<Statistics, DataFusionError>
fn statistics(&self) -> Result<Statistics, DataFusionError>
fn metrics(&self) -> ExecutionPlanMetricsSet
Source§fn try_pushdown_filters(
&self,
filters: Vec<Arc<dyn PhysicalExpr>>,
_config: &ConfigOptions,
) -> Result<FilterPushdownPropagation<Arc<dyn DataSource>>, DataFusionError>
fn try_pushdown_filters( &self, filters: Vec<Arc<dyn PhysicalExpr>>, _config: &ConfigOptions, ) -> Result<FilterPushdownPropagation<Arc<dyn DataSource>>, DataFusionError>
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