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

Function make_map_array_internal

datafusion/functions-nested/src/map.rs:477–501  ·  view source on GitHub ↗

Helper function to create MapArray from array of values to support arrays for Map scalar function ``` text Format of input KEYS and VALUES column keys values +---------------------+ +---------------------+ | +-----------------+ | | +-----------------+ | | | [k11, k12, k13] | | | | [v11, v12, v13] | | | +-----------------+ | | +-----------------+ | |

(
    keys: &ArrayRef,
    values: &ArrayRef,
)

Source from the content-addressed store, hash-verified

475/// +-----------+ +-----------+
476/// ```text
477fn make_map_array_internal<O: OffsetSizeTrait>(
478 keys: &ArrayRef,
479 values: &ArrayRef,
480) -> Result<ColumnarValue> {
481 // Save original data types and array length before list_to_arrays transforms them
482 let keys_data_type = keys.data_type().clone();
483 let values_data_type = values.data_type().clone();
484 let original_len = keys.len(); // This is the number of rows in the input
485
486 // Save the nulls bitmap from the original keys array (before list_to_arrays)
487 // This tells us which MAP values are NULL (not which keys within maps are null)
488 let nulls_bitmap = keys.nulls().cloned();
489
490 let keys = list_to_arrays::<O>(keys);
491 let values = list_to_arrays_skipping_null_rows::<O>(values, nulls_bitmap.as_ref());
492
493 build_map_array(
494 &keys,
495 &values,
496 &keys_data_type,
497 &values_data_type,
498 original_len,
499 nulls_bitmap,
500 )
501}
502
503/// Helper function specifically for FixedSizeList inputs
504/// Similar to make_map_array_internal but uses fixed_size_list_to_arrays instead of list_to_arrays

Callers

nothing calls this directly

Calls 7

build_map_arrayFunction · 0.85
cloneMethod · 0.45
data_typeMethod · 0.45
lenMethod · 0.45
clonedMethod · 0.45
nullsMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…