Skip to content

Commit 65a6bc4

Browse files
authored
chore: use extend instead of manual loop in multi group by (apache#19429)
## Which issue does this PR close? N/A ## Rationale for this change using more efficient extend ## What changes are included in this PR? replace manual loop with `extend` ## Are these changes tested? existing tests ## Are there any user-facing changes? Nope
1 parent 4249e4e commit 65a6bc4

File tree

1 file changed

+7
-8
lines changed
  • datafusion/physical-plan/src/aggregates/group_values/multi_group_by

1 file changed

+7
-8
lines changed

datafusion/physical-plan/src/aggregates/group_values/multi_group_by/mod.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -540,14 +540,13 @@ impl<const STREAMING: bool> GroupValuesColumn<STREAMING> {
540540
// into `vectorized_equal_to_row_indices` and `vectorized_equal_to_group_indices`.
541541
let list_offset = group_index_view.value() as usize;
542542
let group_index_list = &self.group_index_lists[list_offset];
543-
for &group_index in group_index_list {
544-
self.vectorized_operation_buffers
545-
.equal_to_row_indices
546-
.push(row);
547-
self.vectorized_operation_buffers
548-
.equal_to_group_indices
549-
.push(group_index);
550-
}
543+
544+
self.vectorized_operation_buffers
545+
.equal_to_group_indices
546+
.extend_from_slice(group_index_list);
547+
self.vectorized_operation_buffers
548+
.equal_to_row_indices
549+
.extend(std::iter::repeat_n(row, group_index_list.len()));
551550
} else {
552551
let group_index = group_index_view.value() as usize;
553552
self.vectorized_operation_buffers

0 commit comments

Comments
 (0)