Skip to content

Commit 03520a0

Browse files
committed
add top level comment
1 parent 86a4c47 commit 03520a0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/aggregation/bucket/term_agg/term_histogram.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ pub(super) fn maybe_build_collector(
217217
//
218218
// We don't cap the term cardinality here: the flat grid is bounded by the total cell count
219219
// (`num_terms * num_time_buckets <= MAX_FUSED_GRID_BUCKETS`) checked below, which subsumes it.
220+
//
221+
// We only allow this at the top-level, since we don't know how many buckets are created. We
222+
// are less likely to get enough docs for the preallocation to be worth and there's a risk of
223+
// using too much memory. We could check the maximum theoretical buckets up-front and pass
224+
// them down.
220225
let fuseable = is_top_level
221226
&& terms_req_data.allowed_term_ids.is_none()
222227
&& terms_req_data.accessor.get_cardinality().is_full()

0 commit comments

Comments
 (0)