You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by ag...@apache.org on 2025/06/05 13:24:28 UTC
(datafusion) branch main updated: fix: NaN semantics in GROUP BY (#16256)
This is an automated email from the ASF dual-hosted git repository.
agrove pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new ab8cd8c149 fix: NaN semantics in GROUP BY (#16256)
ab8cd8c149 is described below
commit ab8cd8c149ccaac5d8b31f0f9792fb0d2d3c9e50
Author: Chen Chongchen <ch...@qq.com>
AuthorDate: Thu Jun 5 21:24:24 2025 +0800
fix: NaN semantics in GROUP BY (#16256)
---
.../src/aggregates/group_values/multi_group_by/primitive.rs | 3 ++-
datafusion/sqllogictest/test_files/aggregate.slt | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs b/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs
index 22d5987380..afec25fd3d 100644
--- a/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs
+++ b/datafusion/physical-plan/src/aggregates/group_values/multi_group_by/primitive.rs
@@ -17,6 +17,7 @@
use crate::aggregates::group_values::multi_group_by::{nulls_equal_to, GroupColumn};
use crate::aggregates::group_values::null_builder::MaybeNullBufferBuilder;
+use arrow::array::ArrowNativeTypeOp;
use arrow::array::{cast::AsArray, Array, ArrayRef, ArrowPrimitiveType, PrimitiveArray};
use arrow::buffer::ScalarBuffer;
use arrow::datatypes::DataType;
@@ -121,7 +122,7 @@ impl<T: ArrowPrimitiveType, const NULLABLE: bool> GroupColumn
// Otherwise, we need to check their values
}
- *equal_to_result = self.group_values[lhs_row] == array.value(rhs_row);
+ *equal_to_result = self.group_values[lhs_row].is_eq(array.value(rhs_row));
}
}
diff --git a/datafusion/sqllogictest/test_files/aggregate.slt b/datafusion/sqllogictest/test_files/aggregate.slt
index 38a1c59ea0..86e429f903 100644
--- a/datafusion/sqllogictest/test_files/aggregate.slt
+++ b/datafusion/sqllogictest/test_files/aggregate.slt
@@ -7018,3 +7018,12 @@ VALUES
);
----
{a: 1, b: 2, c: 3} {a: 1, b: 2, c: 4}
+
+query TI
+SELECT column1, COUNT(DISTINCT column2) FROM (
+VALUES
+ ('x', arrow_cast('NAN','Float64')),
+ ('x', arrow_cast('NAN','Float64'))
+) GROUP BY 1 ORDER BY 1;
+----
+x 1
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org