We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 152e91d commit f5d62bcCopy full SHA for f5d62bc
datafusion/functions-aggregate/src/first_last.rs
@@ -432,13 +432,9 @@ where
432
EmitTo::First(n) => {
433
// split off the first N values in seen_values
434
//
435
- // TODO make this more efficient rather than two
436
- // copies and bitwise manipulation
437
- let first_n: BooleanBuffer = bool_buf.iter().take(n).collect();
+ let first_n: BooleanBuffer = bool_buf.slice(0, n);
438
// reset the existing buffer
439
- for b in bool_buf.iter().skip(n) {
440
- bool_buf_builder.append(b);
441
- }
+ bool_buf_builder.append_buffer(&bool_buf.slice(n, bool_buf.len() - n));
442
first_n
443
}
444
0 commit comments