{"record":{"id":"89b3e45f9aa5e41b","repo":"influxdata/influxdb","slug":"time-column","errorCode":null,"errorMessage":"time column","messagePattern":"time column","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/partition/src/filter.rs","lineNumber":23,"sourceCode":"use crate::Batch;\nuse mutable_batch::MutableBatch;\nuse std::ops::Range;\n\n/// Given a [`MutableBatch`] a time predicate and a set of row ranges, returns the row\n/// indexes that pass the predicate\n///\n/// # Panic\n///\n/// Panics if `batch` does not contain a time column of the correct type\npub(crate) fn filter_time<'a, F>(\n    batch: &'a MutableBatch,\n    ranges: &'a [Range<usize>],\n    mut predicate: F,\n) -> Vec<Range<usize>>\nwhere\n    F: FnMut(i64) -> bool,\n{\n    let col_data = batch.time_column().expect(\"time column\");\n\n    // Time column is not nullable so can skip checking mask\n    let mut ret = vec![];\n    for range in ranges {\n        let offset = range.start;\n        ret.extend(\n            filter_slice(&col_data[range.clone()], &mut predicate)\n                .map(|r| (r.start + offset)..(r.end + offset)),\n        )\n    }\n    ret\n}\n\nfn filter_slice<'a, T, F>(\n    col_data: &'a [T],\n    predicate: &'a mut F,\n) -> impl Iterator<Item = Range<usize>> + 'a\nwhere","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/partition/src/filter.rs#L5-L41","documentation":"filter_time unwraps batch.time_column() with the message 'time column'. IOx batches are invariantly required to carry a non-nullable time column, so its absence is a programming error and the library panics rather than returning an error.","triggerScenarios":"Calling filter_time (via filter_ranges/filter_batch) on a RecordBatch that has no time column, e.g. a batch built manually without it or with the time column dropped.","commonSituations":"Test helpers constructing batches from only tag/field columns; upstream pipeline bug dropping the time column before filtering.","solutions":["Ensure the batch always contains the time column before filtering","Check the code path that produced the batch for a dropped/renamed time column","In tests, use the batch builders that include the time column"],"exampleFix":"// before\nlet out = filter_ranges(&batch, &[0..10], |t| t > 0);\n// after\nassert!(batch.time_column().is_some(), \"batch missing time column\");\nlet out = filter_ranges(&batch, &[0..10], |t| t > 0);","handlingStrategy":"type-guard","validationCode":"if batch.time_column().is_none() { return Err(\"batch missing time column\"); }","typeGuard":"fn has_time_column(batch: &RecordBatch) -> bool { batch.time_column().is_some() }","tryCatchPattern":null,"preventionTips":["Treat the time column as an invariant of every batch entering the filter pipeline","Add debug assertions in batch constructors"],"tags":["panic","invariant","time-column"],"backgroundTag":"internal-invariant-violation","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"}