Skip to content

Commit 2ba102f

Browse files
chore: use arg display_name as hash key instead of a hashed value
1 parent 55e3d16 commit 2ba102f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

datafusion/optimizer/src/single_distinct_to_groupby.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
//! [`SingleDistinctToGroupBy`] replaces `AGG(DISTINCT ..)` with `AGG(..) GROUP BY ..`
1919
20-
use std::hash::BuildHasher;
2120
use std::sync::Arc;
2221

2322
use crate::optimizer::ApplyOrder;
@@ -204,7 +203,7 @@ impl OptimizerRule for SingleDistinctToGroupBy {
204203

205204
// replace the distinct arg with alias
206205
let mut index = 1;
207-
let mut distinct_aggr_exprs = HashSet::new();
206+
let mut group_fields_set = HashSet::new();
208207
let mut inner_aggr_exprs = vec![];
209208
let outer_aggr_exprs = aggr_expr
210209
.into_iter()
@@ -221,8 +220,7 @@ impl OptimizerRule for SingleDistinctToGroupBy {
221220
}
222221
let arg = args.swap_remove(0);
223222

224-
let expr_id = distinct_aggr_exprs.hasher().hash_one(&arg);
225-
if distinct_aggr_exprs.insert(expr_id) {
223+
if group_fields_set.insert(arg.display_name()?) {
226224
inner_group_exprs
227225
.push(arg.alias(SINGLE_DISTINCT_ALIAS));
228226
}

0 commit comments

Comments
 (0)