Skip to content

Commit 219bc4f

Browse files
author
B Vadlamani
committed
expl_tuple_vec_on_demand_sort
1 parent d2c5830 commit 219bc4f

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

  • datafusion/functions-aggregate/src

datafusion/functions-aggregate/src/count.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)