coderfender commented on code in PR #21561:
URL: https://github.com/apache/datafusion/pull/21561#discussion_r3080858573


##########
datafusion/functions-aggregate/src/count.rs:
##########
@@ -336,18 +337,70 @@ impl AggregateUDFImpl for Count {
     }
 
     fn groups_accumulator_supported(&self, args: AccumulatorArgs) -> bool {
-        // groups accumulator only supports `COUNT(c1)`, not
-        // `COUNT(c1, c2)`, etc
-        if args.is_distinct {
+        if args.exprs.len() != 1 {
             return false;
         }
-        args.exprs.len() == 1
+        if args.is_distinct {
+            // Only support primitive integer types for now
+            matches!(
+                args.expr_fields[0].data_type(),
+                DataType::Int8
+                    | DataType::Int16
+                    | DataType::Int32
+                    | DataType::Int64
+                    | DataType::UInt8
+                    | DataType::UInt16
+                    | DataType::UInt32
+                    | DataType::UInt64
+            )
+        } else {
+            true
+        }
     }
 
     fn create_groups_accumulator(
         &self,
-        _args: AccumulatorArgs,
+        args: AccumulatorArgs,
     ) -> Result<Box<dyn GroupsAccumulator>> {
+        if args.is_distinct {
+            let data_type = args.expr_fields[0].data_type();
+            return match data_type {
+                DataType::Int8 => Ok(Box::new(

Review Comment:
   If you meant using bitmaps for smaller data types , yes I absolutely plan to 
do that 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to