{"record":{"id":"f1cf08db0dc460ea","repo":"influxdata/influxdb","slug":"no-time-column-found","errorCode":null,"errorMessage":"No time column found","messagePattern":"No time column found","errorType":"error_code","errorClass":"TimeColumnError","httpStatus":null,"severity":"warning","filePath":"core/partition/src/traits.rs","lineNumber":20,"sourceCode":"mod record_batch;\n\nuse bitvec::{prelude::Lsb0, view::BitView};\nuse data_types::TableBatchWithoutId;\n\nuse generated_types::influxdata::pbdata::v1::{\n    self as proto,\n    column::{SemanticType, Values},\n};\nuse schema::InfluxColumnType;\nuse table_batch::ValueCollection;\nuse thiserror::Error;\n\n/// An error accessing the time column of a batch.\n#[expect(missing_copy_implementations)]\n#[derive(Debug, Error, PartialEq, Eq, Clone)]\npub enum TimeColumnError {\n    /// The batch did not have a time column.\n    #[error(\"No time column found\")]\n    NotFound,\n}\n\n/// The behavior a column in a batch needs to have to be partitioned\npub trait PartitioningColumn: std::fmt::Debug {\n    /// The type of a thing that can be used to identify whether a tag has changed or not; may or\n    /// may not be the actual tag\n    type TagIdentityKey: ?Sized + PartialEq;\n\n    /// Whether the value at the given row index is valid or NULL\n    fn is_valid(&self, idx: usize) -> bool;\n\n    /// Get the identity of the tag at the given row index.\n    ///\n    /// The return value is only valid if `is_valid(idx)` for the same `idx`\n    /// returns true.\n    fn get_tag_identity_key(&self, idx: usize) -> Option<&Self::TagIdentityKey>;\n","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/partition/src/traits.rs#L2-L38","documentation":"TimeColumnError::NotFound with display 'No time column found' is the error the partition library returns when a batch does not contain a column named TIME_COLUMN_NAME ('time'). Unlike the unreachable/expect panics in this module, this is a designed, catchable error for the legitimate case of a batch lacking a time column.","triggerScenarios":"Calling MutableBatch::time_column or RecordBatch::time_column when self.column(TIME_COLUMN_NAME) / column_by_name(TIME_COLUMN_NAME) returns None — i.e. the batch was never given a 'time' column, or it was named differently.","commonSituations":"Writing batches that omit the time column, renaming the time column in an upstream writer, aggregations that drop the time column, or fixture batches missing the field.","solutions":["Ensure every batch written to a partition includes a 'time' column of i64 nanoseconds","Check for typos or alternate names in the column name used at write time","Match on TimeColumnError::NotFound in the caller and handle batches without time gracefully","Inspect the batch's column list before calling time_column()"],"exampleFix":"// before\nlet tc = batch.time_column().expect(\"time exists\");\n// after\nlet tc = match batch.time_column() {\n    Ok(tc) => tc,\n    Err(TimeColumnError::NotFound) => return Ok(()), // batch has no time column\n    Err(e) => return Err(e.into()),\n};","handlingStrategy":"validation","validationCode":"// rust\nfn has_time_column(batch: &RecordBatch) -> bool {\n    batch.schema().column_with_name(TIME_COLUMN_NAME).is_some()\n}","typeGuard":null,"tryCatchPattern":"match batch.time_column() {\n    Ok(col) => col,\n    Err(TimeColumnError::NotFound) => return Ok(()), // no time column: skip\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Always include a 'time' column when writing batches destined for partitioning","Check the schema for TIME_COLUMN_NAME before calling time_column()","Match on TimeColumnError::NotFound explicitly rather than treating all errors alike"],"tags":["rust","time-column","missing-column","error-enum"],"backgroundTag":"resource-not-found","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"}