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

Function cast_list_column

datafusion/common/src/nested_struct.rs:206–234  ·  view source on GitHub ↗
(
    source_col: &ArrayRef,
    target_inner_field: &FieldRef,
    cast_options: &CastOptions,
)

Source from the content-addressed store, hash-verified

204}
205
206fn cast_list_column<O: arrow::array::OffsetSizeTrait>(
207 source_col: &ArrayRef,
208 target_inner_field: &FieldRef,
209 cast_options: &CastOptions,
210) -> Result<ArrayRef> {
211 let source_list = source_col
212 .as_any()
213 .downcast_ref::<GenericListArray<O>>()
214 .ok_or_else(|| {
215 crate::error::DataFusionError::Plan(format!(
216 "Expected list array but got {}",
217 source_col.data_type()
218 ))
219 })?;
220
221 let cast_values = cast_column(
222 source_list.values(),
223 target_inner_field.data_type(),
224 cast_options,
225 )?;
226
227 let result = GenericListArray::<O>::new(
228 Arc::clone(target_inner_field),
229 source_list.offsets().clone(),
230 cast_values,
231 source_list.nulls().cloned(),
232 );
233 Ok(Arc::new(result))
234}
235
236fn cast_list_view_column<O: arrow::array::OffsetSizeTrait>(
237 source_col: &ArrayRef,

Callers

nothing calls this directly

Calls 9

cast_columnFunction · 0.85
newFunction · 0.85
offsetsMethod · 0.80
as_anyMethod · 0.45
valuesMethod · 0.45
data_typeMethod · 0.45
cloneMethod · 0.45
clonedMethod · 0.45
nullsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…