From ef0bed7ea33bdf98dc0783ba22fc344a54519153 Mon Sep 17 00:00:00 2001 From: Luca Cominardi Date: Fri, 2 Oct 2026 09:18:57 +0200 Subject: [PATCH] Simplify tie-breaker start bound and doc comment --- columnar/src/column/serialize.rs | 2 +- src/schema/schema.rs | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/columnar/src/column/serialize.rs b/columnar/src/column/serialize.rs index 9747efb8e..f50605564 100644 --- a/columnar/src/column/serialize.rs +++ b/columnar/src/column/serialize.rs @@ -31,7 +31,7 @@ pub(crate) fn serialize_generated_tie_breaker_column( output: &mut impl Write, ) -> io::Result<()> { // TODO: Lift this temporary u32 limit once downstream consumers support the full u64 range. - let max_start = u64::from(u32::MAX - num_docs.saturating_sub(1)); + let max_start = (u32::MAX - num_docs) as u64; let start: u64 = rand::rng().random_range(0..=max_start); let end = start + num_docs as u64; let values = start..end; diff --git a/src/schema/schema.rs b/src/schema/schema.rs index 48af9a750..745a1ec30 100644 --- a/src/schema/schema.rs +++ b/src/schema/schema.rs @@ -59,13 +59,11 @@ impl SchemaBuilder { /// Adds a generated tie-breaker fast field. /// - /// The field is exposed as a `u64` fast field. Its generated values are temporarily limited - /// to the `u32` range for downstream compatibility; this limit will eventually be lifted. - /// Values supplied by documents for this field are ignored. + /// The field is exposed as a `u64` fast field. Values are consecutive within a segment, + /// starting at a random offset. Ranges of different segments may overlap, so values are + /// almost always distinct but not guaranteed to be unique. /// - /// Values are consecutive within a segment, starting at a random offset. Ranges of - /// different segments may overlap, so values are almost always distinct but not - /// guaranteed to be unique. + /// Values supplied by documents for this field are ignored. /// /// # Panics ///