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

Function retrieve_range_args

datafusion/functions-nested/src/range.rs:525–539  ·  view source on GitHub ↗

Get the (start, stop, step) args for the range and generate_series function. If any of the arguments is NULL, returns None.

(
    start_array: Option<&Int64Array>,
    stop: Option<i64>,
    step_array: Option<&Int64Array>,
    idx: usize,
)

Source from the content-addressed store, hash-verified

523/// Get the (start, stop, step) args for the range and generate_series function.
524/// If any of the arguments is NULL, returns None.
525fn retrieve_range_args(
526 start_array: Option<&Int64Array>,
527 stop: Option<i64>,
528 step_array: Option<&Int64Array>,
529 idx: usize,
530) -> Option<(i64, i64, i64)> {
531 // Default start value is 0 if not provided
532 let start =
533 start_array.map_or(Some(0), |arr| arr.is_valid(idx).then(|| arr.value(idx)))?;
534 let stop = stop?;
535 // Default step value is 1 if not provided
536 let step =
537 step_array.map_or(Some(1), |arr| arr.is_valid(idx).then(|| arr.value(idx)))?;
538 Some((start, stop, step))
539}
540
541/// Reserve space for `count` more elements, returning an error when the
542/// allocation would overflow `Vec`'s capacity limit or the allocator

Callers 1

gen_range_innerMethod · 0.85

Calls 2

is_validMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…