{"record":{"id":"ef0483812ace09d8","repo":"influxdata/influxdb","slug":"invalid-statistics","errorCode":null,"errorMessage":"invalid statistics","messagePattern":"invalid statistics","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/parquet_file/src/metadata.rs","lineNumber":472,"sourceCode":"            ?partition_id,\n            ?decoded,\n            \"DecodedIoxParquetMetaData decoded from its IoxParquetMetaData\"\n        );\n        let row_count = decoded.row_count();\n        if decoded.md.row_groups().is_empty() {\n            debug!(\n                ?partition_id,\n                \"Decoded IoxParquetMetaData has no row groups to provide useful statistics\"\n            );\n        }\n\n        // Derive the min/max timestamp from the Parquet column statistics.\n        let schema = decoded\n            .read_schema()\n            .expect(\"failed to read encoded schema\");\n        let stats = decoded\n            .read_statistics(&schema)\n            .expect(\"invalid statistics\");\n        let columns: Vec<_> = stats.iter().map(|v| column_id_map(&v.name)).collect();\n\n        // Extract the min/max timestamps.\n        let TimestampRange {\n            min: min_time,\n            max: max_time,\n        } = derive_min_max_time(stats);\n\n        ParquetFileParams {\n            namespace_id: self.namespace_id,\n            table_id: self.table_id,\n            partition_id,\n            partition_hash_id,\n            object_store_id: self.object_store_id,\n            min_time,\n            max_time,\n            file_size_bytes: file_size_bytes as i64,\n            compaction_level: self.compaction_level,","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/parquet_file/src/metadata.rs#L454-L490","documentation":"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.","triggerScenarios":"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.","commonSituations":"Files written with statistics disabled (parquet writer set_statistics(false)), externally truncated files, schema/type changes between writer and reader.","solutions":["Re-encode the file ensuring Parquet column statistics are enabled in the writer options","Verify the file contains at least one row group with valid statistics","Check parquet crate version consistency between writer and reader","Regenerate the Parquet file from the original RecordBatch"],"exampleFix":"// ensure statistics are written\nlet props = WriterProperties::builder().set_statistics_enabled(EnabledStatistics::Page).build();\n// before\nlet props = WriterProperties::builder().build(); // may omit required stats","handlingStrategy":"try-catch","validationCode":"let stats_written = props.statistics_enabled() != EnabledStatistics::None; // at write time\nif !stats_written { return Err(anyhow!(\"statistics must be enabled\")); }","typeGuard":null,"tryCatchPattern":"let stats = decoded.read_statistics(&schema).map_err(|e| Error::BadStatistics { source: e })?;","preventionTips":["Always enable column statistics in WriterProperties","Never post-process/truncate Parquet footers","Regenerate from source batch on failure instead of re-reading"],"tags":["parquet","statistics","panic","metadata"],"backgroundTag":"schema-validation-failed","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}