Skip to content

Commit 87e59ea

Browse files
committed
Fix docs
1 parent f1027d7 commit 87e59ea

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎datafusion/common/src/float_semantics.rs‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,14 @@
2525
//! [`compare_floats`] sorts `-0.0` before `+0.0`.
2626
//!
2727
//! 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`.
3236
//!
3337
3438
use std::cmp::Ordering;
@@ -114,8 +118,9 @@ pub fn float_gt<T: FloatSemantics>(left: T, right: T) -> bool {
114118
compare_floats(left, right).is_gt()
115119
}
116120

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.
119124
#[inline]
120125
pub fn hash_input<T: FloatSemantics>(v: T) -> T {
121126
normalize_float(v)

0 commit comments

Comments
 (0)