File tree Expand file tree Collapse file tree
datafusion/functions-aggregate/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -377,32 +377,30 @@ impl AggregateUDFImpl for Count {
377377 if args. exprs . len ( ) != 1 {
378378 return false ;
379379 }
380- if args. is_distinct {
381- // Only support primitive integer types for now
382- matches ! (
383- args. expr_fields[ 0 ] . data_type( ) ,
384- DataType :: Int8
385- | DataType :: Int16
386- | DataType :: Int32
387- | DataType :: Int64
388- | DataType :: UInt8
389- | DataType :: UInt16
390- | DataType :: UInt32
391- | DataType :: UInt64
392- )
393- } else {
394- true
380+ if !args. is_distinct {
381+ return true ;
395382 }
383+ matches ! (
384+ args. expr_fields[ 0 ] . data_type( ) ,
385+ DataType :: Int8
386+ | DataType :: Int16
387+ | DataType :: Int32
388+ | DataType :: Int64
389+ | DataType :: UInt8
390+ | DataType :: UInt16
391+ | DataType :: UInt32
392+ | DataType :: UInt64
393+ )
396394 }
397395
398396 fn create_groups_accumulator (
399397 & self ,
400398 args : AccumulatorArgs ,
401399 ) -> Result < Box < dyn GroupsAccumulator > > {
402- if args. is_distinct {
403- return create_distinct_groups_accumulator ( args . expr_fields [ 0 ] . data_type ( ) ) ;
400+ if ! args. is_distinct {
401+ return Ok ( Box :: new ( CountGroupsAccumulator :: new ( ) ) ) ;
404402 }
405- Ok ( Box :: new ( CountGroupsAccumulator :: new ( ) ) )
403+ create_distinct_groups_accumulator ( args . expr_fields [ 0 ] . data_type ( ) )
406404 }
407405
408406 fn reverse_expr ( & self ) -> ReversedUDAF {
You can’t perform that action at this time.
0 commit comments