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

Function take_need

datafusion/functions-aggregate/src/first_last/state.rs:293–309  ·  view source on GitHub ↗
(
    bool_buf_builder: &mut BooleanBufferBuilder,
    emit_to: EmitTo,
)

Source from the content-addressed store, hash-verified

291}
292
293pub(crate) fn take_need(
294 bool_buf_builder: &mut BooleanBufferBuilder,
295 emit_to: EmitTo,
296) -> BooleanBuffer {
297 let bool_buf = bool_buf_builder.finish();
298 match emit_to {
299 EmitTo::All => bool_buf,
300 EmitTo::First(n) => {
301 // split off the first N values in seen_values
302 //
303 let first_n: BooleanBuffer = bool_buf.slice(0, n);
304 // reset the existing buffer
305 bool_buf_builder.append_buffer(&bool_buf.slice(n, bool_buf.len() - n));
306 first_n
307 }
308 }
309}
310
311#[cfg(test)]
312mod tests {

Callers 2

take_stateMethod · 0.85
takeMethod · 0.85

Calls 3

sliceMethod · 0.80
finishMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…