Skip to main content

requires_nested_struct_cast

Function requires_nested_struct_cast 

Source
pub fn requires_nested_struct_cast(
    source_type: &DataType,
    target_type: &DataType,
) -> bool
Expand description

Returns true if casting from source_type to target_type requires DataFusion’s specialized nested/container casting logic rather than Arrow’s standard cast.

This is the case when both types are struct types, or both are the same container type (List, LargeList, equal-width FixedSizeList, ListView, LargeListView, Map, Dictionary) wrapping types that recursively contain structs.

Map entries are technically Struct-backed, but that implementation detail does not require name-based adaptation. A Map uses the specialized path only when its semantic key or value child recursively contains a Struct.

Use this predicate at both planning time (to decide whether to apply nested compatibility validation) and execution time (to decide whether to route through cast_column instead of Arrow’s generic cast).