(
input: Arc<dyn ExecutionPlan>,
sink_schema: SchemaRef,
partition: usize,
context: Arc<TaskContext>,
)
| 1378 | reason = "Public API that historically takes owned Arcs" |
| 1379 | )] |
| 1380 | pub 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 | /// |
no test coverage detected
searching dependent graphs…