|
25 | 25 | //! [`compare_floats`] sorts `-0.0` before `+0.0`. |
26 | 26 | //! |
27 | 27 | //! Every comparison, hash or grouping boundary should be built from these |
28 | | -//! helpers rather than inspecting float bits itself. Where an Arrow kernel |
29 | | -//! compares, sorts, row-encodes or hashes the values, normalize them first. |
30 | | -//! Where DataFusion compares values itself, use [`compare_floats`], |
31 | | -//! [`float_lt`] or [`float_gt`]. Where it hashes them, hash [`hash_input`]. |
| 28 | +//! helpers rather than inspecting float bits itself: |
| 29 | +//! |
| 30 | +//! - Equality and grouping: normalize first ([`normalize_float`], |
| 31 | +//! [`normalize_floats`], [`normalize_float_scalar`]), then compare bits or |
| 32 | +//! call Arrow's `eq`, `RowConverter` or `make_comparator`. Hash |
| 33 | +//! [`hash_input`]. |
| 34 | +//! - Ordering: use [`compare_floats`], [`float_lt`] or [`float_gt`]. Sorting |
| 35 | +//! does not normalize yet, so `-0.0` still sorts before `+0.0`. |
32 | 36 | //! |
33 | 37 |
|
34 | 38 | use std::cmp::Ordering; |
@@ -114,8 +118,9 @@ pub fn float_gt<T: FloatSemantics>(left: T, right: T) -> bool { |
114 | 118 | compare_floats(left, right).is_gt() |
115 | 119 | } |
116 | 120 |
|
117 | | -/// The value that DataFusion hashes in place of a float. Values that compare |
118 | | -/// as equal hash the same, so this is the value [`normalize_float`] returns. |
| 121 | +/// The value that DataFusion hashes in place of a float. Values that DataFusion |
| 122 | +/// treats as equal hash the same, so this is the value [`normalize_float`] |
| 123 | +/// returns. |
119 | 124 | #[inline] |
120 | 125 | pub fn hash_input<T: FloatSemantics>(v: T) -> T { |
121 | 126 | normalize_float(v) |
|
0 commit comments