MCPcopy Create free account
hub / github.com/apache/datafusion / execute

Method execute

datafusion/datasource/src/sink.rs:228–257  ·  view source on GitHub ↗

Execute the plan and return a stream of `RecordBatch`es for the specified partition.

(
        &self,
        partition: usize,
        context: Arc<TaskContext>,
    )

Source from the content-addressed store, hash-verified

226 /// Execute the plan and return a stream of `RecordBatch`es for
227 /// the specified partition.
228 fn execute(
229 &self,
230 partition: usize,
231 context: Arc<TaskContext>,
232 ) -> Result<SendableRecordBatchStream> {
233 assert_eq_or_internal_err!(
234 partition,
235 0,
236 "DataSinkExec can only be called on partition 0!"
237 );
238 let data = execute_input_stream(
239 Arc::clone(&self.input),
240 Arc::clone(self.sink.schema()),
241 0,
242 Arc::clone(&context),
243 )?;
244
245 let count_schema = Arc::clone(&self.count_schema);
246 let sink = Arc::clone(&self.sink);
247
248 let stream = futures::stream::once(async move {
249 sink.write_all(data, &context).await.map(make_count_batch)
250 })
251 .boxed();
252
253 Ok(Box::pin(RecordBatchStreamAdapter::new(
254 count_schema,
255 stream,
256 )))
257 }
258
259 /// Returns the metrics of the underlying [DataSink]
260 fn metrics(&self) -> Option<MetricsSet> {

Callers 4

exec_with_limitFunction · 0.45
plan_to_jsonFunction · 0.45
plan_to_csvFunction · 0.45
plan_to_parquetFunction · 0.45

Calls 5

execute_input_streamFunction · 0.85
newFunction · 0.85
schemaMethod · 0.45
mapMethod · 0.45
write_allMethod · 0.45

Tested by

no test coverage detected