influxdata/influxdb · error
should not be absent
Error message
should not be absent
What it means
A panic from `.expect("should not be absent")` in apply_fetch (partition statistics fetch logic). The match arm computing the skip-over-num_rows comparison assumes num_rows carries an exact value, but the pattern matched a Precision that wraps a value that cannot be extracted. It indicates the row-count Precision was in an unexpected state when a Limit/Fetch was applied.
Solutions
- Ensure upstream statistics always produce a num_rows Precision that wraps a value when a fetch is applied
- Update the match guards so Absent num_rows is handled before the skip >= num_rows arm
- File a bug with the plan/statistics if this occurs on stock executors
Example fix
// before
(num_rows, _, skip) if skip >= *num_rows.get_value().expect("should not be absent") => Precision::Exact(0),
// after
(num_rows, _, skip) if num_rows.get_value().map_or(false, |n| skip >= *n) => Precision::Exact(0), Defensive patterns
Strategy: try-catch
Validate before calling
assert!(matches!(stats.num_rows, Precision::Exact(_) | Precision::Inexact(_)), "num_rows must carry a value before applying fetch");
Type guard
fn has_value(p: &Precision<usize>) -> bool { p.get_value().is_some() } Try / catch
// pre-check: if num_rows.get_value().is_none() skip the fetch-optimization path
Prevention
- Only apply fetch optimization when num_rows has a value
- Keep Precision match arms exhaustive
- Unit-test Limit pushdown against Absent statistics
When it happens
Trigger: Applying a fetch/skip to partition statistics where the matched num_rows pattern holds a Precision variant whose get_value() returns None — i.e. an Absent or malformed Precision reaching that arm.
Common situations: Upstream statistics collection returned Absent for num_rows but a different match arm than expected was taken; partial refactors of the Precision enum; custom TableStatistics providers returning unusual Precision combinations.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- min ( ) > max ( )
- should have a single merged statistic
- sorted column is not in the schema
- column id in series key should be valid
- duration not to overflow
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/85890217a97d1933.
Report an issue: GitHub.
Appendix: source
Thrown at core/iox_query/src/statistics/partition_statistics/fetch.rs:26
///
/// Fetch is the total num of rows fetched, after the skip is applied.
///
/// This logic is extracted from [`Statistics::with_fetch`]. Refer to
/// <https://docs.rs/datafusion-common/47.0.0/src/datafusion_common/stats.rs.html#391-397>.
pub(super) fn apply_fetch(
stats: Arc<Statistics>,
fetch: Option<usize>,
skip: usize,
) -> Arc<Statistics> {
let fetch_applied = match (stats.num_rows, fetch, skip) {
(num_rows, None, 0) => num_rows,
(Precision::Absent, None, _) => Precision::Absent,
// absent, but can estimate
(Precision::Absent, Some(fetch), _) => Precision::Inexact(fetch),
// if we are skipping more rows than we have => then 0 output row.
(num_rows, _, skip) if skip >= *num_rows.get_value().expect("should not be absent") => {
Precision::Exact(0)
}
// have exact, return exact
(Precision::Exact(num_rows), fetch, skip) => {
let num_rows_remaining = num_rows.saturating_sub(skip);
let fetched = std::cmp::min(num_rows_remaining, fetch.unwrap_or(num_rows_remaining));
Precision::Exact(fetched)
}
// have inexact, return inexact
(Precision::Inexact(num_rows), fetch, skip) => {
let num_rows_remaining = num_rows.saturating_sub(skip);
let fetched = std::cmp::min(num_rows_remaining, fetch.unwrap_or(num_rows_remaining));
Precision::Inexact(fetched)
}
};
View on GitHub (pinned to 06200ef96b)