Skip to content

Commit c42454e

Browse files
committed
poc3.
1 parent 6ba1c00 commit c42454e

File tree

1 file changed

+9
-7
lines changed
  • datafusion/functions-aggregate-common/src/aggregate/groups_accumulator

1 file changed

+9
-7
lines changed

datafusion/functions-aggregate-common/src/aggregate/groups_accumulator/prim_op.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,18 @@ where
118118
values,
119119
opt_filter,
120120
total_num_groups,
121-
|block_ids, block_offsets, row_offsets, row_idxs| {
121+
|block_ids, block_offsets, row_offsets, val_row_idxs| {
122122
let iter = block_ids.iter().zip(row_offsets.windows(2));
123123
for (&block_id, row_bound) in iter {
124124
let block = &mut self.values[block_id as usize];
125-
(row_bound[0]..row_bound[1]).for_each(|idx| {
126-
let block_offset = block_offsets[idx];
127-
let value = &mut block[block_offset as usize];
128-
let value_row_idx = row_idxs[idx];
129-
(self.prim_fn)(value, data[value_row_idx]);
130-
});
125+
let beg = row_bound[0];
126+
let end = row_bound[1];
127+
let blk_offsets_iter = block_offsets[beg..end].iter();
128+
let val_row_idxs_iter = val_row_idxs[beg..end].iter();
129+
for (&blk_offset, &val_row_idx) in blk_offsets_iter.zip(val_row_idxs_iter) {
130+
let value = &mut block[blk_offset as usize];
131+
(self.prim_fn)(value, data[val_row_idx]);
132+
}
131133
}
132134
},
133135
);

0 commit comments

Comments
 (0)