1717
1818use datafusion:: physical_expr:: aggregate:: utils:: Hashable ;
1919use datafusion:: { arrow, common, error, logical_expr, scalar} ;
20- use std:: { collections, fmt, hash} ;
20+ use std:: { cmp , collections, fmt, hash, mem } ;
2121
2222#[ derive( fmt:: Debug ) ]
2323pub struct PrimitiveModeAccumulator < T >
@@ -108,11 +108,11 @@ where
108108
109109 self . value_counts . iter ( ) . for_each ( |( value, & count) | {
110110 match count. cmp ( & max_count) {
111- std :: cmp:: Ordering :: Greater => {
111+ cmp:: Ordering :: Greater => {
112112 max_value = Some ( * value) ;
113113 max_count = count;
114114 }
115- std :: cmp:: Ordering :: Equal => {
115+ cmp:: Ordering :: Equal => {
116116 max_value = match max_value {
117117 Some ( ref current_max_value) if value > current_max_value => Some ( * value) ,
118118 Some ( ref current_max_value) => Some ( * current_max_value) ,
@@ -130,7 +130,7 @@ where
130130 }
131131
132132 fn size ( & self ) -> usize {
133- std :: mem:: size_of_val ( & self . value_counts ) + self . value_counts . len ( ) * std :: mem:: size_of :: < ( T :: Native , i64 ) > ( )
133+ mem:: size_of_val ( & self . value_counts ) + self . value_counts . len ( ) * mem:: size_of :: < ( T :: Native , i64 ) > ( )
134134 }
135135}
136136
@@ -221,11 +221,11 @@ where
221221
222222 self . value_counts . iter ( ) . for_each ( |( value, & count) | {
223223 match count. cmp ( & max_count) {
224- std :: cmp:: Ordering :: Greater => {
224+ cmp:: Ordering :: Greater => {
225225 max_value = Some ( value. 0 ) ;
226226 max_count = count;
227227 }
228- std :: cmp:: Ordering :: Equal => {
228+ cmp:: Ordering :: Equal => {
229229 max_value = match max_value {
230230 Some ( current_max_value) if value. 0 > current_max_value => Some ( value. 0 ) ,
231231 Some ( current_max_value) => Some ( current_max_value) ,
@@ -243,8 +243,7 @@ where
243243 }
244244
245245 fn size ( & self ) -> usize {
246- std:: mem:: size_of_val ( & self . value_counts )
247- + self . value_counts . len ( ) * std:: mem:: size_of :: < ( Hashable < T :: Native > , i64 ) > ( )
246+ mem:: size_of_val ( & self . value_counts ) + self . value_counts . len ( ) * mem:: size_of :: < ( Hashable < T :: Native > , i64 ) > ( )
248247 }
249248}
250249
0 commit comments