{"record":{"id":"b48774b55e5f81b3","repo":"influxdata/influxdb","slug":"no-row-group-found-cannot-recover-statistics","errorCode":null,"errorMessage":"No row group found, cannot recover statistics","messagePattern":"No row group found, cannot recover statistics","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/parquet_file/src/metadata.rs","lineNumber":781,"sourceCode":"            file_metadata.key_value_metadata(),\n        )\n        .context(ArrowFromParquetFailureSnafu {})?;\n\n        // The parquet reader will propagate any metadata keys present in the parquet\n        // metadata onto the arrow schema. This will include the encoded IOxMetadata\n        //\n        // We strip this out to avoid false negatives when comparing schemas for equality,\n        // as this metadata will vary from file to file\n        let arrow_schema_ref = Arc::new(arrow_schema.with_metadata(Default::default()));\n\n        arrow_schema_ref\n            .try_into()\n            .context(IoxFromArrowFailureSnafu {})\n    }\n\n    /// Read IOx statistics (including timestamp range) from parquet metadata.\n    pub fn read_statistics(&self, schema: &Schema) -> Result<Vec<ColumnSummary>> {\n        ensure!(!self.md.row_groups().is_empty(), NoRowGroupSnafu);\n\n        let mut column_summaries = Vec::with_capacity(schema.len());\n\n        for (row_group_idx, row_group) in self.md.row_groups().iter().enumerate() {\n            let row_group_column_summaries =\n                read_statistics_from_parquet_row_group(row_group, row_group_idx, schema)?;\n\n            combine_column_summaries(&mut column_summaries, row_group_column_summaries);\n        }\n\n        Ok(column_summaries)\n    }\n\n    /// Estimate the memory consumption of this object and its contents\n    pub fn size(&self) -> usize {\n        // This is likely a wild under count as it doesn't include\n        // memory pointed to in the `ParquetMetaData` structues.\n        // Feature tracked in arrow-rs: https://github.com/apache/arrow-rs/issues/1729","sourceCodeStart":763,"sourceCodeEnd":799,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/parquet_file/src/metadata.rs#L763-L799","documentation":"read_statistics returns a NoRowGroupSnafu error (\"No row group found, cannot recover statistics\") when the Parquet metadata contains zero row groups. Statistics are aggregated per row group, so an empty file cannot yield column summaries. Unlike the expect() panics, this is a proper Result error.","triggerScenarios":"Calling read_statistics (via assert_metadata or to_parquet_file) on a Parquet file whose footer reports no row groups — an empty or truncated file.","commonSituations":"Writing zero-row batches to Parquet, interrupted flushes leaving empty footers, files created by compaction over empty inputs.","solutions":["Check row count before writing: skip encoding empty RecordBatches","Handle the Result from read_statistics and skip/reject empty files","Re-flush from the source data rather than re-reading the empty file"],"exampleFix":"// caller-side guard\nif batch.num_rows() == 0 {\n    return Ok(None); // don't produce an empty parquet file\n}","handlingStrategy":"validation","validationCode":"if batch.num_rows() == 0 { return Ok(None); } // skip empty writes","typeGuard":null,"tryCatchPattern":"match parquet_file.read_statistics(&schema) {\n    Err(e) if matches!(e, ...NoRowGroup..) => return Ok(None),\n    r => r?,\n}","preventionTips":["Skip writing Parquet files for empty batches","Check footer num_row_groups() before reading statistics","Make flushes atomic so partial/empty files never become visible"],"tags":["parquet","row-group","empty-file"],"backgroundTag":"empty-result-set","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"}