adriangb commented on code in PR #18832:
URL: https://github.com/apache/datafusion/pull/18832#discussion_r2608207615
##########
datafusion/physical-expr/src/expressions/in_list.rs:
##########
@@ -198,99 +213,302 @@ impl ArrayStaticFilter {
}
}
-struct Int32StaticFilter {
- null_count: usize,
- values: HashSet<i32>,
+/// Wrapper for f32 that implements Hash and Eq using IEEE 754 total ordering.
+/// This treats NaN values as equal to each other (using total_cmp).
+#[derive(Clone, Copy)]
+struct OrderedFloat32(f32);
+
+impl Hash for OrderedFloat32 {
+ fn hash<H: Hasher>(&self, state: &mut H) {
+ self.0.to_ne_bytes().hash(state);
+ }
}
-impl Int32StaticFilter {
- fn try_new(in_array: &ArrayRef) -> Result<Self> {
- let in_array = in_array
- .as_primitive_opt::<Int32Type>()
- .ok_or_else(|| exec_datafusion_err!("Failed to downcast array"))?;
+impl PartialEq for OrderedFloat32 {
+ fn eq(&self, other: &Self) -> bool {
+ self.0.total_cmp(&other.0).is_eq()
Review Comment:
I added tests for all of those and cross references against postgres/duckdb.
But I will try `to_bits()`.
--
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]