influxdata/influxdb · error

invalid statistics

Error message

invalid statistics

What it means

Panicked during to_parquet_file when read_statistics() returned an Err while parsing per-column statistics from the Parquet row groups. Statistics are derived from the encoded footer; an Err here means the statistics in the file are absent, malformed, or inconsistent with the schema. The library treats this as unrecoverable for deriving the min/max timestamp.

Solutions

  1. Re-encode the file ensuring Parquet column statistics are enabled in the writer options
  2. Verify the file contains at least one row group with valid statistics
  3. Check parquet crate version consistency between writer and reader
  4. Regenerate the Parquet file from the original RecordBatch

Example fix

// ensure statistics are written
let props = WriterProperties::builder().set_statistics_enabled(EnabledStatistics::Page).build();
// before
let props = WriterProperties::builder().build(); // may omit required stats
Defensive patterns

Strategy: try-catch

Validate before calling

let stats_written = props.statistics_enabled() != EnabledStatistics::None; // at write time
if !stats_written { return Err(anyhow!("statistics must be enabled")); }

Try / catch

let stats = decoded.read_statistics(&schema).map_err(|e| Error::BadStatistics { source: e })?;

Prevention

When it happens

Trigger: Calling to_parquet_file on a file whose row groups lack column statistics (stats disabled at write time), statistics corrupted in the encoded footer, or statistics whose types do not match the schema.

Common situations: Files written with statistics disabled (parquet writer set_statistics(false)), externally truncated files, schema/type changes between writer and reader.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/ef0483812ace09d8. Report an issue: GitHub.

Appendix: source

Thrown at core/parquet_file/src/metadata.rs:472

            ?partition_id,
            ?decoded,
            "DecodedIoxParquetMetaData decoded from its IoxParquetMetaData"
        );
        let row_count = decoded.row_count();
        if decoded.md.row_groups().is_empty() {
            debug!(
                ?partition_id,
                "Decoded IoxParquetMetaData has no row groups to provide useful statistics"
            );
        }

        // Derive the min/max timestamp from the Parquet column statistics.
        let schema = decoded
            .read_schema()
            .expect("failed to read encoded schema");
        let stats = decoded
            .read_statistics(&schema)
            .expect("invalid statistics");
        let columns: Vec<_> = stats.iter().map(|v| column_id_map(&v.name)).collect();

        // Extract the min/max timestamps.
        let TimestampRange {
            min: min_time,
            max: max_time,
        } = derive_min_max_time(stats);

        ParquetFileParams {
            namespace_id: self.namespace_id,
            table_id: self.table_id,
            partition_id,
            partition_hash_id,
            object_store_id: self.object_store_id,
            min_time,
            max_time,
            file_size_bytes: file_size_bytes as i64,
            compaction_level: self.compaction_level,

View on GitHub (pinned to 06200ef96b)