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

Function reserve_range_capacity

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

Reserve space for `count` more elements, returning an error when the allocation would overflow `Vec`'s capacity limit or the allocator rejects it, rather than panicking on user-supplied SQL.

(values: &mut Vec<i64>, count: u64)

Source from the content-addressed store, hash-verified

542/// allocation would overflow `Vec`'s capacity limit or the allocator
543/// rejects it, rather than panicking on user-supplied SQL.
544fn reserve_range_capacity(values: &mut Vec<i64>, count: u64) -> Result<()> {
545 let count_usize = usize::try_from(count).map_err(|_| {
546 exec_datafusion_err!(
547 "Range too large to materialize: would produce {count} elements"
548 )
549 })?;
550 values.try_reserve(count_usize).map_err(|e| {
551 exec_datafusion_err!(
552 "Range too large to materialize: failed to allocate {count} elements: {e}"
553 )
554 })
555}
556
557/// Generate integer range values directly into the provided buffer.
558#[inline]

Callers 1

generate_range_valuesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…