From 667132fa7ab4a30e0c1870d791f23902ebfc6152 Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Tue, 28 Jul 2026 15:57:03 +0200 Subject: [PATCH] rename to WithLanes --- src/aggregation/bucket/term_agg/mod.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/aggregation/bucket/term_agg/mod.rs b/src/aggregation/bucket/term_agg/mod.rs index 8776cd905..196a5e194 100644 --- a/src/aggregation/bucket/term_agg/mod.rs +++ b/src/aggregation/bucket/term_agg/mod.rs @@ -466,7 +466,7 @@ pub(crate) fn build_segment_term_collector( return Ok(Box::new(collector)); } - let term_buckets = LowCardVecTermBuckets::<()>::new(num_terms, &mut bucket_id_provider); + let term_buckets = VecTermBucketsWithLanes::<()>::new(num_terms, &mut bucket_id_provider); add_memory_consumption(&term_buckets, req_data)?; return Ok(boxed_high_card_collector( term_buckets, @@ -818,12 +818,12 @@ const NUM_LOW_CARD_COUNT_LANES: usize = 8; /// A very-low-cardinality term bucket with split count storage and one shared sub-aggregation id. /// Only the counters are replicated: `bucket_id` remains unique per logical term. #[derive(Clone, Copy, Debug)] -struct LowCardTermBucket { +struct TermBucketWithLanes { count_lanes: [u32; NUM_LOW_CARD_COUNT_LANES], bucket_id: B, } -impl LowCardTermBucket { +impl TermBucketWithLanes { #[inline(always)] fn new(bucket_id_provider: &mut BucketIdProvider) -> Self { Self { @@ -844,18 +844,18 @@ impl LowCardTermBucket { /// A dense term map for very low cardinality. Each logical bucket cycles writes over independent /// count lanes, which are consolidated when the map is converted into its result representation. #[derive(Clone, Debug)] -struct LowCardVecTermBuckets { - buckets: Vec>, +struct VecTermBucketsWithLanes { + buckets: Vec>, next_count_lane: usize, } -impl TermAggregationMap for LowCardVecTermBuckets { +impl TermAggregationMap for VecTermBucketsWithLanes { type Slot = B; const SORTED_BY_ORD: bool = true; fn get_memory_consumption(&self) -> usize { - self.buckets.capacity() * std::mem::size_of::>() + self.buckets.capacity() * std::mem::size_of::>() } #[inline(always)] @@ -886,7 +886,7 @@ impl TermAggregationMap for LowCardVecTermBuckets { } fn new(num_terms: u64, bucket_id_provider: &mut BucketIdProvider) -> Self { - let buckets = std::iter::repeat_with(|| LowCardTermBucket::new(bucket_id_provider)) + let buckets = std::iter::repeat_with(|| TermBucketWithLanes::new(bucket_id_provider)) .take(num_terms as usize) .collect(); Self { @@ -1540,7 +1540,7 @@ mod tests { use common::DateTime; use time::{Date, Month}; - use super::{LowCardVecTermBuckets, PagedTermMap, TermAggregationMap, PAGE_SIZE}; + use super::{PagedTermMap, TermAggregationMap, VecTermBucketsWithLanes, PAGE_SIZE}; use crate::aggregation::agg_req::Aggregations; use crate::aggregation::intermediate_agg_result::IntermediateAggregationResults; use crate::aggregation::segment_agg_result::BucketIdProvider; @@ -1557,7 +1557,7 @@ mod tests { #[test] fn low_card_term_map_consolidates_count_lanes_and_shares_bucket_ids() { let mut bucket_id_provider = BucketIdProvider::default(); - let mut map = LowCardVecTermBuckets::::new(3, &mut bucket_id_provider); + let mut map = VecTermBucketsWithLanes::::new(3, &mut bucket_id_provider); let mut expected_counts = [0u32; 3]; // Exercise every lane with a deliberately skewed distribution.