lyne7-sc commented on code in PR #21782:
URL: https://github.com/apache/datafusion/pull/21782#discussion_r3141456416
##########
datafusion/functions-aggregate-common/src/aggregate/count_distinct/native.rs:
##########
@@ -85,11 +85,13 @@ where
}
let arr = as_primitive_array::<T>(&values[0])?;
- arr.iter().for_each(|value| {
- if let Some(value) = value {
+ if arr.null_count() > 0 {
Review Comment:
Added null benchmarks for the i64 path (10% and 30% nulls) for both regular
and sliding count(distinct):
```
group main_i64_nulls
66666666666666666666666666666666666666666666666pr_i64_nulls
----- --------------
------------
count_distinct i64 80% distinct 1.90
74.7±2.52µs ? ?/sec 1.00 39.2±2.05µs ? ?/sec
count_distinct i64 80% distinct 10% nulls 1.00
71.4±2.08µs ? ?/sec 1.03 73.5±2.64µs ? ?/sec
count_distinct i64 80% distinct 30% nulls 1.03
62.0±8.24µs ? ?/sec 1.00 60.3±2.06µs ? ?/sec
count_distinct_sliding i64 mid window_1024 1.42
1167.2±29.39µs ? ?/sec 1.00 824.5±27.08µs ? ?/sec
count_distinct_sliding i64 mid window_256 1.47
1238.5±96.19µs ? ?/sec 1.00 841.9±16.41µs ? ?/sec
count_distinct_sliding i64 mid_10pct_nulls window_1024 1.30
1503.1±60.08µs ? ?/sec 1.00 1155.0±56.14µs ? ?/sec
count_distinct_sliding i64 mid_10pct_nulls window_256 1.27
1539.5±34.95µs ? ?/sec 1.00 1213.3±96.65µs ? ?/sec
count_distinct_sliding i64 mid_30pct_nulls window_1024 1.27
1442.2±34.19µs ? ?/sec 1.00 1139.5±91.77µs ? ?/sec
count_distinct_sliding i64 mid_30pct_nulls window_256 1.21
1469.4±31.00µs ? ?/sec 1.00 1212.5±220.52µs ? ?/sec
```
no null-path regression observed compared to `main`.
--
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]