diff --git a/datafusion/src/physical_plan/distinct_expressions.rs b/datafusion/src/physical_plan/distinct_expressions.rs
index 1c93b5a104d09..a4dd25d0157b3 100644
--- a/datafusion/src/physical_plan/distinct_expressions.rs
+++ b/datafusion/src/physical_plan/distinct_expressions.rs
@@ -196,8 +196,9 @@ mod tests {
use super::*;
use arrow::array::{
- ArrayRef, BooleanArray, Int16Array, Int32Array, Int64Array, Int8Array, ListArray,
- UInt16Array, UInt32Array, UInt64Array, UInt8Array,
+ ArrayRef, BooleanArray, Float32Array, Float64Array, Int16Array, Int32Array,
+ Int64Array, Int8Array, ListArray, UInt16Array, UInt32Array, UInt64Array,
+ UInt8Array,
};
use arrow::array::{Int32Builder, ListBuilder, UInt64Builder};
use arrow::datatypes::DataType;
@@ -355,6 +356,76 @@ mod tests {
}};
}
+ //Used trait to create associated constant for f32 and f64
+ trait SubNormal: 'static {
+ const SUBNORMAL: Self;
+ }
+
+ impl SubNormal for f64 {
+ const SUBNORMAL: Self = 1.0e-308_f64;
+ }
+
+ impl SubNormal for f32 {
+ const SUBNORMAL: Self = 1.0e-38_f32;
+ }
+
+ macro_rules! test_count_distinct_update_batch_floating_point {
+ ($ARRAY_TYPE:ident, $DATA_TYPE:ident, $PRIM_TYPE:ty) => {{
+ use ordered_float::OrderedFloat;
+ let values: Vec