etseidl commented on code in PR #9619:
URL: https://github.com/apache/arrow-rs/pull/9619#discussion_r3318397926
##########
parquet/src/column/writer/mod.rs:
##########
@@ -2795,6 +2861,139 @@ mod tests {
}
}
+ #[test]
+ fn test_ieee754_total_order_float() {
+ // Test IEEE 754 total order for f32
+ // Order should be: -NaN < -Inf < -1.0 < -0.0 < +0.0 < 1.0 < +Inf <
+NaN
+ let neg_nan = f32::from_bits(0xffc00000);
+ let neg_inf = f32::NEG_INFINITY;
+ let neg_one = -1.0_f32;
+ let neg_zero = -0.0_f32;
+ let pos_zero = 0.0_f32;
+ let pos_one = 1.0_f32;
+ let pos_inf = f32::INFINITY;
+ let pos_nan = f32::from_bits(0x7fc00000);
+
+ let values = vec![
+ pos_nan, neg_zero, pos_inf, neg_one, neg_nan, pos_one, neg_inf,
pos_zero,
+ ];
+
+ let stats = statistics_roundtrip::<FloatType>(&values);
+ if let Statistics::Float(stats) = stats {
+ // With IEEE 754 total order, min should be -NaN, max should be
+NaN
+ // But since we filter out NaN values, min should be -Inf, max
should be +Inf
+ assert_eq!(stats.min_opt().unwrap(), &neg_inf);
+ assert_eq!(stats.max_opt().unwrap(), &pos_inf);
+ assert_eq!(stats.nan_count_opt(), Some(2)); // neg_nan and pos_nan
+ } else {
+ panic!("Expected float statistics");
+ }
+ }
+
+ #[test]
+ fn test_ieee754_total_order_float_only_nan() {
+ // Test IEEE 754 total order for f32
+ // Order should be: -NaN < -Inf < -1.0 < -0.0 < +0.0 < 1.0 < +Inf <
+NaN
Review Comment:
Sorry, copy/paste leftovers. will fix
--
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]