Skip to content

Commit 3a94cda

Browse files
committed
implement_group_accumulators_count_distinct
1 parent 2cf899e commit 3a94cda

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

  • datafusion/functions-aggregate/src

datafusion/functions-aggregate/src/count.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,25 @@ impl AggregateUDFImpl for Count {
337337
}
338338

339339
fn groups_accumulator_supported(&self, args: AccumulatorArgs) -> bool {
340-
args.exprs.len() == 1
340+
if args.exprs.len() != 1 {
341+
return false;
342+
}
343+
if args.is_distinct {
344+
// Only support primitive integer types for now
345+
matches!(
346+
args.expr_fields[0].data_type(),
347+
DataType::Int8
348+
| DataType::Int16
349+
| DataType::Int32
350+
| DataType::Int64
351+
| DataType::UInt8
352+
| DataType::UInt16
353+
| DataType::UInt32
354+
| DataType::UInt64
355+
)
356+
} else {
357+
true
358+
}
341359
}
342360

343361
fn create_groups_accumulator(

0 commit comments

Comments
 (0)