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

Function execute_input_stream

datafusion/physical-plan/src/execution_plan.rs:1380–1411  ·  view source on GitHub ↗
(
    input: Arc<dyn ExecutionPlan>,
    sink_schema: SchemaRef,
    partition: usize,
    context: Arc<TaskContext>,
)

Source from the content-addressed store, hash-verified

1378 reason = "Public API that historically takes owned Arcs"
1379)]
1380pub fn execute_input_stream(
1381 input: Arc<dyn ExecutionPlan>,
1382 sink_schema: SchemaRef,
1383 partition: usize,
1384 context: Arc<TaskContext>,
1385) -> Result<SendableRecordBatchStream> {
1386 let input_stream = input.execute(partition, context)?;
1387
1388 debug_assert_eq!(sink_schema.fields().len(), input.schema().fields().len());
1389
1390 // Find input columns that may violate the not null constraint.
1391 let risky_columns: Vec<_> = sink_schema
1392 .fields()
1393 .iter()
1394 .zip(input.schema().fields().iter())
1395 .enumerate()
1396 .filter_map(|(idx, (sink_field, input_field))| {
1397 (!sink_field.is_nullable() && input_field.is_nullable()).then_some(idx)
1398 })
1399 .collect();
1400
1401 if risky_columns.is_empty() {
1402 Ok(input_stream)
1403 } else {
1404 // Check not null constraint on the input stream
1405 Ok(Box::pin(RecordBatchStreamAdapter::new(
1406 sink_schema,
1407 input_stream
1408 .map(move |batch| check_not_null_constraints(batch?, &risky_columns)),
1409 )))
1410 }
1411}
1412
1413/// Checks a `RecordBatch` for `not null` constraints on specified columns.
1414///

Callers 1

executeMethod · 0.85

Calls 10

newFunction · 0.85
collectMethod · 0.80
executeMethod · 0.45
iterMethod · 0.45
fieldsMethod · 0.45
schemaMethod · 0.45
is_nullableMethod · 0.45
is_emptyMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…