quickwit-oss/tantivy · error
interval not precomputed for date histogram source
Error message
interval not precomputed for date histogram source
What it means
Date-interval precomputation for a composite date_histogram source failed to produce an applicable interval: PrecomputedDateInterval::NotApplicable reached the bucketing code. Calendar intervals that need month-aware bucketing must be precomputed; hitting the NotApplicable branch is an internal invariant violation.
Source
Thrown at src/aggregation/bucket/composite/collector.rs:618
accessor.column_type
)
}
};
let bucket_index = match accessor.date_histogram_interval {
PrecomputedDateInterval::FixedNanoseconds(fixed_interval_ns) => {
(value_ns / fixed_interval_ns) * fixed_interval_ns
}
PrecomputedDateInterval::Calendar(CalendarInterval::Year) => {
calendar_interval::try_year_bucket(value_ns)?
}
PrecomputedDateInterval::Calendar(CalendarInterval::Month) => {
calendar_interval::try_month_bucket(value_ns)?
}
PrecomputedDateInterval::Calendar(CalendarInterval::Week) => {
calendar_interval::week_bucket(value_ns)
}
PrecomputedDateInterval::NotApplicable => {
panic!("interval not precomputed for date histogram source")
}
};
let bucket_value = i64::to_u64(bucket_index);
if is_on_after_key {
let should_skip = match current_level_source.order() {
Order::Asc => current_level_accessors.after_key.gt(bucket_value),
Order::Desc => current_level_accessors.after_key.lt(bucket_value),
};
if should_skip {
continue;
}
}
self.sub_level_values.push(InternalValueRepr::new_histogram(
bucket_value,
current_level_source.order(),
));
let still_on_after_key =
current_level_accessors.after_key.equals(bucket_value);View on GitHub (pinned to b5d8deb80c)
Solutions
- Ensure the aggregation request's date_histogram interval is validated and precomputed (via the normal CompositeAggregation request builder) before collection.
- If building requests manually/deserialized, run the standard interval precomputation logic instead of bypassing it.
- Report as a bug with the exact date_histogram interval used; NotApplicable should never reach visit for a required interval.
Example fix
// before
let interval = PrecomputedDateInterval::NotApplicable;
// after
let interval = PrecomputedDateInterval::Calendar(CalendarInterval::Month); // precomputed from request
// or guard:
if matches!(interval, PrecomputedDateInterval::NotApplicable) {
return Err(TantivyError::InvalidArgument("date_histogram interval missing".into()));
} Defensive patterns
Strategy: validation
Validate before calling
if matches!(precomputed, PrecomputedDateInterval::NotApplicable)
&& request_requires_interval {
return Err(InvalidArgument("date_histogram interval not precomputed"));
} Type guard
fn interval_ready(p: &PrecomputedDateInterval) -> bool {
!matches!(p, PrecomputedDateInterval::NotApplicable)
} Prevention
- Always build date_histogram requests through the standard precomputation path
- Validate calendar intervals (month/quarter/year) are precomputed before collection
- Report NotApplicable-on-required-path as a library bug
When it happens
Trigger: Visiting a date_histogram source where the precomputed interval is PrecomputedDateInterval::NotApplicable but the code requires a bucket index (e.g. calendar interval like Month/Quarter/Year that was never precomputed), typically due to a bug in interval preparation from the aggregation request.
Common situations: Using calendar_interval values (month/quarter/year) that failed the precompute step; custom or deserialized aggregation requests that skipped interval precomputation; internal refactor leaving a NotApplicable value on a path that requires an interval.
Related errors
- unsupported
- unexpected type {:?}. This should not happen
- unsupported
- null must be handled separately
- dictionary missing for str accessor
AI-assisted analysis of quickwit-oss/tantivy@b5d8deb80c (2026-09-05).
Data as JSON: /api/errors/4b28d82b58b074ea.
Report an issue: GitHub.