{"record":{"id":"fce84db081ee4dfe","repo":"influxdata/influxdb","slug":"error-reading-time-column","errorCode":null,"errorMessage":"error reading time column","messagePattern":"error reading time column","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"core/partition/src/lib.rs","lineNumber":83,"sourceCode":"    }\n\n    range_encode(partition_keys(batch, template.parts()))\n}\n\n/// Returns an iterator of partition keys for the given table batch.\n///\n/// This function performs deduplication on returned keys; the returned iterator\n/// yields [`Some`] containing the partition key string when a new key is\n/// generated, and [`None`] when the generated key would equal the last key.\npub fn partition_keys<'a, T>(\n    batch: &'a T,\n    template_parts: impl Iterator<Item = TemplatePart<'a>>,\n) -> impl Iterator<Item = Option<Result<String, PartitionKeyError>>> + 'a\nwhere\n    T: Batch,\n{\n    // Extract the timestamp data.\n    let time = batch.time_column().expect(\"error reading time column\");\n\n    // Convert TemplatePart into an ordered array of Template\n    let mut template = template_parts\n        .map(|v| Template::from((v, batch, time)))\n        .collect::<Vec<_>>();\n\n    // Track the length of the last yielded partition key, and pre-allocate the\n    // next partition key string to match it.\n    //\n    // In the happy path, keys of consistent sizes are generated and the\n    // allocations reach a minimum. If the keys are inconsistent, at best a\n    // subset of allocations are eliminated, and at worst, a few bytes of memory\n    // is temporarily allocated until the resulting string is shrunk down.\n    let mut last_len = 5;\n\n    // The first row in a batch must always be evaluated to produce a key.\n    //\n    // Row 0 is guaranteed to exist, otherwise attempting to read the time","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/partition/src/lib.rs#L65-L101","documentation":"partition_keys calls batch.time_column().expect(\"error reading time column\"), panicking when the batch has no time column. Partition key generation always needs timestamp data to render time-based template parts, so a batch lacking the time column is an invariant violation rather than a recoverable error.","triggerScenarios":"Calling partition_keys/partition_batch on a Batch whose time_column() returns None — i.e. a record batch without a 'time' column or with an unreadable/invalid time column.","commonSituations":"Feeding a hand-built Arrow RecordBatch into partitioning without a time column; a write path that dropped or renamed the time column upstream; corrupted parquet data missing the time column.","solutions":["Ensure the batch includes a valid 'time' column before partitioning","Validate batch schema (time column present and of timestamp type) before calling partition_keys","If building batches manually, always append the time column returned by the write API"],"exampleFix":"// before\nlet keys: Vec<_> = partition_keys(&batch, template.parts()).collect();\n// after\nassert!(batch.time_column().is_some(), \"batch must contain a time column before partitioning\");\nlet keys: Vec<_> = partition_keys(&batch, template.parts()).collect();","handlingStrategy":"validation","validationCode":"if batch.time_column().is_none() {\n    return Err(anyhow!(\"batch is missing the required 'time' column; cannot compute partition keys\"));\n}","typeGuard":"fn has_time_column(b: &dyn Batch) -> bool { b.time_column().is_some() }","tryCatchPattern":null,"preventionTips":["Always include the time column when constructing record batches for the write path","Validate batch schemas on ingest before buffering","Never drop or rename the 'time' column in upstream transforms"],"tags":["rust","panic","missing-column","time-series"],"backgroundTag":"missing-required-argument","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"}