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

Function cast_array_by_name

datafusion/expr-common/src/columnar_value.rs:306–329  ·  view source on GitHub ↗
(
    array: &ArrayRef,
    cast_type: &DataType,
    cast_options: &CastOptions<'static>,
)

Source from the content-addressed store, hash-verified

304}
305
306fn cast_array_by_name(
307 array: &ArrayRef,
308 cast_type: &DataType,
309 cast_options: &CastOptions<'static>,
310) -> Result<ArrayRef> {
311 // If types are already equal, no cast needed
312 if array.data_type() == cast_type {
313 return Ok(Arc::clone(array));
314 }
315
316 if datafusion_common::nested_struct::requires_nested_struct_cast(
317 array.data_type(),
318 cast_type,
319 ) {
320 datafusion_common::nested_struct::cast_column(array, cast_type, cast_options)
321 } else {
322 ensure_date_array_timestamp_bounds(array, cast_type)?;
323 Ok(kernels::cast::cast_with_options(
324 array,
325 cast_type,
326 cast_options,
327 )?)
328 }
329}
330
331fn ensure_date_array_timestamp_bounds(
332 array: &ArrayRef,

Callers 1

cast_toMethod · 0.85

Calls 5

cast_columnFunction · 0.85
cast_with_optionsFunction · 0.85
data_typeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…