MemorySourceConfig

Struct MemorySourceConfig 

Source
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

Source

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.

Source

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.

Source

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)

Source

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.

Source

pub fn with_limit(self, limit: Option<usize>) -> MemorySourceConfig

Set the limit of the files

Source

pub fn with_show_sizes(self, show_sizes: bool) -> MemorySourceConfig

Set show_sizes to determine whether to display partition sizes

Source

pub fn partitions(&self) -> &[Vec<RecordBatch>]

Ref to partitions

Source

pub fn projection(&self) -> &Option<Vec<usize>>

Ref to projection

Source

pub fn show_sizes(&self) -> bool

Show sizes

Source

pub fn sort_information(&self) -> &[LexOrdering]

Ref to sort information

Source

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.

Source

pub fn original_schema(&self) -> Arc<Schema>

Arc clone of ref to original schema

Trait Implementations§

Source§

impl Clone for MemorySourceConfig

Source§

fn clone(&self) -> MemorySourceConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

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>

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.

Source§

fn open( &self, partition: usize, _context: Arc<TaskContext>, ) -> Result<Pin<Box<dyn RecordBatchStream<Item = Result<RecordBatch, DataFusionError>> + Send>>, DataFusionError>

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn fmt_as( &self, t: DisplayFormatType, f: &mut Formatter<'_>, ) -> Result<(), Error>

Format this source for display in explain plans
Source§

fn output_partitioning(&self) -> Partitioning

Source§

fn eq_properties(&self) -> EquivalenceProperties

Source§

fn scheduling_type(&self) -> SchedulingType

Source§

fn partition_statistics( &self, partition: Option<usize>, ) -> Result<Statistics, DataFusionError>

Returns statistics for a specific partition, or aggregate statistics across all partitions if partition is None.
Source§

fn with_fetch(&self, limit: Option<usize>) -> Option<Arc<dyn DataSource>>

Return a copy of this DataSource with a new fetch limit
Source§

fn fetch(&self) -> Option<usize>

Source§

fn try_swapping_with_projection( &self, projection: &[ProjectionExpr], ) -> Result<Option<Arc<dyn DataSource>>, DataFusionError>

Source§

fn statistics(&self) -> Result<Statistics, DataFusionError>

👎Deprecated since 51.0.0: Use partition_statistics instead
Returns aggregate statistics across all partitions. Read more
Source§

fn metrics(&self) -> ExecutionPlanMetricsSet

Source§

fn try_pushdown_filters( &self, filters: Vec<Arc<dyn PhysicalExpr>>, _config: &ConfigOptions, ) -> Result<FilterPushdownPropagation<Arc<dyn DataSource>>, DataFusionError>

Try to push down filters into this DataSource. See ExecutionPlan::handle_child_pushdown_result for more details.
Source§

impl Debug for MemorySourceConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,