Skip to content

Commit

Permalink
Refine the group value comparison in get_mut()
Browse files Browse the repository at this point in the history
  • Loading branch information
kyotoYaho committed Jul 17, 2023
1 parent f40a842 commit a18ac07
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion datafusion/core/src/physical_plan/aggregates/row_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,17 @@ impl GroupedHashAggregateStream {

match self.row_converter.get_row_width() {
Some(row_width) if row_width <= VALUE_EMBEDDED_WIDTH_THRESHOLD => {
let mut padded_group_value = [0u8; VALUE_EMBEDDED_WIDTH_THRESHOLD];
for (row, &hash) in batch_hashes.iter().enumerate() {
let entry = self.value_embedded_map.get_mut(
hash,
|(_hash, _group_idx, padded_value)| {
// verify that a group that we are inserting with hash is
// actually the same key value as the group in
// existing_idx (aka group_values @ row)
group_rows.row_data(row) == &padded_value[0..row_width]
padded_group_value[0..row_width]
.copy_from_slice(group_rows.row_data(row));
padded_group_value == *padded_value
},
);

Expand Down

0 comments on commit a18ac07

Please sign in to comment.