Skip to main content

follow_shredded_path_element

Function follow_shredded_path_element 

Source
pub(crate) fn follow_shredded_path_element(
    shredding_state: &ShreddingState,
    path_element: &VariantPathElement<'_>,
    _cast_options: &CastOptions<'_>,
) -> Result<ShreddedPathStep>
Expand description

Given a shredded variant field – a (value?, typed_value?) pair – try to take one path step deeper. For a VariantPathElement::Field, if there is no typed_value at this level, if typed_value is not a struct, or if the requested field name does not exist, traversal returns a missing-path step (Missing or NotShredded depending on whether value exists).

Safe-cast behavior (cast_options.safe = true):

  • Type mismatch during path traversal (for example field access on non-struct, index access on non-list) returns ShreddedPathStep::Missing or ShreddedPathStep::NotShredded, allowing the caller to continue with null/fallback semantics.
  • List index out-of-bounds produces nulls for the corresponding rows.

Unsafe-cast behavior (cast_options.safe = false):

  • Field access on non-struct returns [ArrowError::CastError].
  • List index path steps follow JSONPath semantics and return missing/null for non-list or out-of-bounds rows.