pub trait DataSink:
Any
+ DisplayAs
+ Debug
+ Send
+ Sync {
// Required methods
fn schema(&self) -> &SchemaRef;
fn write_all<'life0, 'life1, 'async_trait>(
&'life0 self,
data: SendableRecordBatchStream,
context: &'life1 Arc<TaskContext>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn metrics(&self) -> Option<MetricsSet> { ... }
fn try_to_proto(
&self,
_exec: &DataSinkExec,
_ctx: &ExecutionPlanEncodeCtx<'_>,
) -> Result<Option<PhysicalPlanNode>> { ... }
}Expand description
DataSink implements writing streams of RecordBatches to
user defined destinations.
The Display impl is used to format the sink for explain plan
output.
Required Methods§
Sourcefn write_all<'life0, 'life1, 'async_trait>(
&'life0 self,
data: SendableRecordBatchStream,
context: &'life1 Arc<TaskContext>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write_all<'life0, 'life1, 'async_trait>(
&'life0 self,
data: SendableRecordBatchStream,
context: &'life1 Arc<TaskContext>,
) -> Pin<Box<dyn Future<Output = Result<u64>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Writes the data to the sink, returns the number of values written
This method will be called exactly once during each DML statement. Thus prior to return, the sink should do any commit or rollback required.
Provided Methods§
Sourcefn metrics(&self) -> Option<MetricsSet>
fn metrics(&self) -> Option<MetricsSet>
Return a snapshot of the MetricsSet for this DataSink.
See ExecutionPlan::metrics() for more details
Sourcefn try_to_proto(
&self,
_exec: &DataSinkExec,
_ctx: &ExecutionPlanEncodeCtx<'_>,
) -> Result<Option<PhysicalPlanNode>>
Available on crate feature proto only.
fn try_to_proto( &self, _exec: &DataSinkExec, _ctx: &ExecutionPlanEncodeCtx<'_>, ) -> Result<Option<PhysicalPlanNode>>
proto only.Serialize this sink into a full protobuf plan node, if it knows how.
Implementations can use ctx to encode the input plan, sink-specific
expressions, and DataSinkExec::encode_sort_order.
Returning Ok(None) lets the caller try its extension codec instead.
Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".