File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change 1717
1818//! [`SingleDistinctToGroupBy`] replaces `AGG(DISTINCT ..)` with `AGG(..) GROUP BY ..`
1919
20- use std:: hash:: BuildHasher ;
2120use std:: sync:: Arc ;
2221
2322use 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 }
You can’t perform that action at this time.
0 commit comments