We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f0554ce commit 1272cafCopy full SHA for 1272caf
datafusion/functions-aggregate/src/first_last/state.rs
@@ -300,13 +300,9 @@ pub(crate) fn take_need(
300
EmitTo::First(n) => {
301
// split off the first N values in seen_values
302
//
303
- // TODO make this more efficient rather than two
304
- // copies and bitwise manipulation
305
- let first_n: BooleanBuffer = bool_buf.iter().take(n).collect();
+ let first_n: BooleanBuffer = bool_buf.slice(0, n);
306
// reset the existing buffer
307
- for b in bool_buf.iter().skip(n) {
308
- bool_buf_builder.append(b);
309
- }
+ bool_buf_builder.append_buffer(&bool_buf.slice(n, bool_buf.len() - n));
310
first_n
311
}
312
0 commit comments