pola-rs/polars · error
Expected Statistics to be {}, found {} instead
Error message
Expected Statistics to be {}, found {} instead What it means
Documented panic of the Statistics interpret method: the stored Statistics variant does not match the requested concrete type (e.g. interpreting Int64 statistics as Boolean). Use the try_into variant (returns Option) to handle mismatches gracefully.
Source
Thrown at crates/polars-parquet/src/parquet/statistics/mod.rs:181
}
#[doc = concat!("Try to take [`Statistics`] as [`", stringify!($struct), "`]")]
#[inline]
pub fn $into_ident(self) -> Option<$struct> {
match self {
Self::$variant(s) => Some(s),
_ => None,
}
}
#[doc = concat!("Interpret [`Statistics`] to be [`", stringify!($struct), "`]")]
///
/// Panics if it is not the correct variant.
#[track_caller]
#[inline]
pub fn $expect_ident(&self) -> &$struct {
let Self::$variant(s) = self else {
panic!("Expected Statistics to be {}, found {} instead", stringify!($struct), self.variant_str());
};
s
}
#[doc = concat!("Interpret [`Statistics`] to be [`", stringify!($struct), "`]")]
///
/// Panics if it is not the correct variant.
#[track_caller]
#[inline]
pub fn $owned_expect_ident(self) -> $struct {
let Self::$variant(s) = self else {
panic!("Expected Statistics to be {}, found {} instead", stringify!($struct), self.variant_str());
};
s
}
)+View on GitHub (pinned to 9b5d73fd00)
Solutions
- The statistics type does not match the column type; verify the parquet file was written correctly.
- Ignore/fix mismatched statistics by rewriting the file or disabling statistics usage.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: This panic/expect fires when execution reaches an unguarded state described by: "Expected Statistics to be {}, found {} instead". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.
Common situations: Encountered when input data or configuration does not meet the preconditions of the throwing code path ("Expected Statistics to be {}, found {} instead"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.
AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19).
Data as JSON: /api/errors/6d0deac905426426.
Report an issue: GitHub.