Derives the output field for a cast expression from the source field. For `TryCast`, `force_nullable` is `true` since a failed cast returns NULL.
(
source_field: &FieldRef,
target_type: &DataType,
force_nullable: bool,
)
| 72 | /// Derives the output field for a cast expression from the source field. |
| 73 | /// For `TryCast`, `force_nullable` is `true` since a failed cast returns NULL. |
| 74 | fn cast_output_field( |
| 75 | source_field: &FieldRef, |
| 76 | target_type: &DataType, |
| 77 | force_nullable: bool, |
| 78 | ) -> Arc<Field> { |
| 79 | let mut f = source_field |
| 80 | .as_ref() |
| 81 | .clone() |
| 82 | .with_data_type(target_type.clone()) |
| 83 | .with_metadata(source_field.metadata().clone()); |
| 84 | if force_nullable { |
| 85 | f = f.with_nullable(true); |
| 86 | } |
| 87 | Arc::new(f) |
| 88 | } |
| 89 | |
| 90 | impl ExprSchemable for Expr { |
| 91 | /// Returns the [arrow::datatypes::DataType] of the expression |
no test coverage detected
searching dependent graphs…