{"record":{"id":"6b730a3410df474b","repo":"influxdata/influxdb","slug":"no-time-column-in-metadata-statistics","errorCode":null,"errorMessage":"no time column in metadata statistics","messagePattern":"no time column in metadata statistics","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/parquet_file/src/metadata.rs","lineNumber":570,"sourceCode":"///\n/// # Panics\n///\n/// This method panics if the [`IoxParquetMetaData`] structure does not\n/// contain valid metadata bytes, has no readable schema, or has no field\n/// statistics.\n///\n/// A [`RecordBatch`] serialized without the embedded metadata found in the\n/// IOx [`Schema`] type will cause a statistic resolution failure due to\n/// lack of the IOx field type metadata for the time column. Batches\n/// produced from the through the IOx write path always include this\n/// metadata.\n///\n/// [`RecordBatch`]: arrow::record_batch::RecordBatch\npub fn derive_min_max_time(stats: Vec<ColumnSummary>) -> TimestampRange {\n    let time_summary = stats\n        .into_iter()\n        .find(|v| v.name == TIME_COLUMN_NAME)\n        .expect(\"no time column in metadata statistics\");\n\n    assert_eq!(time_summary.influxdb_type, InfluxDbType::Timestamp);\n\n    // Extract the min/max timestamps.\n    match time_summary.stats {\n        Statistics::I64(stats) => {\n            let min = Timestamp::new(stats.min.expect(\"no min time statistic\"));\n            let max = Timestamp::new(stats.max.expect(\"no max time statistic\"));\n            TimestampRange { min, max }\n        }\n        _ => panic!(\"unexpected physical type for timestamp column\"),\n    }\n}\n/// Parquet metadata with IOx-specific wrapper.\n#[derive(Clone, PartialEq, Eq)]\npub struct IoxParquetMetaData {\n    /// [Apache Parquet] metadata as freestanding [Apache Thrift]-encoded, and [Zstandard]-compressed bytes.\n    ///","sourceCodeStart":552,"sourceCodeEnd":588,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/parquet_file/src/metadata.rs#L552-L588","documentation":"derive_min_max_time scans the Vec<ColumnSummary> for a column named TIME_COLUMN_NAME (\"time\") and panics if none is present. The library requires every Parquet file it derives timestamps from to contain the IOx time column in its statistics. This is an invariant: a file without a time column is not a valid IOx Parquet file for this code path.","triggerScenarios":"Calling derive_min_max_time (via to_parquet_file) with summaries from a Parquet file whose schema lacks the 'time' column, e.g. a non-IOx file or one written with the time column renamed/dropped.","commonSituations":"Pointing the tool at foreign Parquet files, schema migrations that renamed the time column, compaction code paths that dropped the time column.","solutions":["Ensure the Parquet file schema contains the 'time' column before calling to_parquet_file","Check the writer used TIME_COLUMN_NAME when building the RecordBatch","If processing foreign files, validate the schema up front and skip/reject them"],"exampleFix":"// caller-side validation\nif !batch.schema().fields().iter().any(|f| f.name() == \"time\") {\n    return Err(anyhow!(\"not an IOx parquet file: missing time column\"));\n}","handlingStrategy":"validation","validationCode":"let has_time = batch.schema().fields().iter().any(|f| f.name() == \"time\");\nif !has_time { return Err(anyhow!(\"missing time column\")); }","typeGuard":"fn has_time_column(schema: &Schema) -> bool { schema.field_with_name(\"time\").is_ok() }","tryCatchPattern":null,"preventionTips":["Always name the timestamp column TIME_COLUMN_NAME (\"time\") when writing","Validate schemas of foreign files before IOx processing","Add schema assertions in compaction write paths"],"tags":["parquet","panic","invariant","time-column"],"backgroundTag":"empty-required-field","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"}