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

Method execute

datafusion/physical-plan/src/union.rs:279–315  ·  view source on GitHub ↗
(
        &self,
        mut partition: usize,
        context: Arc<TaskContext>,
    )

Source from the content-addressed store, hash-verified

277 }
278
279 fn execute(
280 &self,
281 mut partition: usize,
282 context: Arc<TaskContext>,
283 ) -> Result<SendableRecordBatchStream> {
284 trace!(
285 "Start UnionExec::execute for partition {} of context session_id {} and task_id {:?}",
286 partition,
287 context.session_id(),
288 context.task_id()
289 );
290 let baseline_metrics = BaselineMetrics::new(&self.metrics, partition);
291 // record the tiny amount of work done in this function so
292 // elapsed_compute is reported as non zero
293 let elapsed_compute = baseline_metrics.elapsed_compute().clone();
294 let _timer = elapsed_compute.timer(); // record on drop
295
296 // find partition to execute
297 for input in self.inputs.iter() {
298 // Calculate whether partition belongs to the current partition
299 if partition < input.output_partitioning().partition_count() {
300 let stream = input.execute(partition, context)?;
301 debug!("Found a Union partition to execute");
302 return Ok(Box::pin(ObservedStream::new(
303 stream,
304 baseline_metrics,
305 None,
306 )));
307 } else {
308 partition -= input.output_partitioning().partition_count();
309 }
310 }
311
312 warn!("Error in Union: Partition {partition} not found");
313
314 exec_err!("Partition {partition} not found in Union")
315 }
316
317 fn metrics(&self) -> Option<MetricsSet> {
318 Some(self.metrics.clone_inner())

Callers

nothing calls this directly

Calls 10

newFunction · 0.85
timerMethod · 0.80
partition_countMethod · 0.80
cloneMethod · 0.45
elapsed_computeMethod · 0.45
iterMethod · 0.45
output_partitioningMethod · 0.45
pushMethod · 0.45
lenMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected