{"record":{"id":"27f7aaed9c83947a","repo":"influxdata/influxdb","slug":"datafusion-error-0-persister","errorCode":null,"errorMessage":"datafusion error: {0}","messagePattern":"datafusion error: (.+?)","errorType":"error_code","errorClass":"PersisterError","httpStatus":null,"severity":"error","filePath":"influxdb3_write/src/persister.rs","lineNumber":50,"sourceCode":"use futures_util::stream::TryStreamExt;\nuse futures_util::stream::{FuturesOrdered, StreamExt};\nuse influxdb3_cache::parquet_cache::ParquetFileDataToCache;\nuse influxdb3_wal::SnapshotSequenceNumber;\nuse iox_time::TimeProvider;\nuse object_store::path::Path as ObjPath;\nuse object_store::{ObjectMeta, ObjectStore};\nuse object_store_utils::{AdaptiveGetExt, AdaptivePutExt};\nuse observability_deps::tracing::{debug, error, info, trace, warn};\nuse parking_lot::RwLock;\nuse parquet::arrow::ArrowWriter;\nuse parquet::basic::Compression;\nuse parquet::file::metadata::ParquetMetaData;\nuse parquet::file::properties::WriterProperties;\nuse tokio::sync::Semaphore;\n\n#[derive(Debug, thiserror::Error)]\npub enum PersisterError {\n    #[error(\"datafusion error: {0}\")]\n    DataFusion(#[from] DataFusionError),\n\n    #[error(\"serde_json error: {0}\")]\n    SerdeJson(#[from] serde_json::Error),\n\n    #[error(\"object_store error: {0}\")]\n    ObjectStore(#[from] object_store::Error),\n\n    #[error(\"parquet error: {0}\")]\n    ParquetError(#[from] parquet::errors::ParquetError),\n\n    #[error(\"tried to serialize a parquet file with no rows\")]\n    NoRows,\n\n    #[error(\"parse int error: {0}\")]\n    ParseInt(#[from] std::num::ParseIntError),\n\n    #[error(\"unexpected persister error: {0:?}\")]","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_write/src/persister.rs#L32-L68","documentation":"PersisterError::DataFusion wraps a DataFusionError produced while executing DataFusion queries or converting RecordBatches inside the Persister. It is surfaced with `#[from]`, so any DataFusion operation performed by the persister (query planning, execution, schema/batch handling) that fails is automatically converted into this variant.","triggerScenarios":"Calling Persister methods (e.g. persist of query results, write of RecordBatches) that internally run or consume DataFusion APIs; a DataFusion plan, schema mismatch, or execution failure propagates via `?` into DataFusion(PersisterError).","commonSituations":"Querying data whose schema changed between snapshots; DataFusion SQL errors from bad queries issued internally; incompatible record batch schemas passed to write; DataFusion version upgrades introducing behavioral changes.","solutions":["Read the inner DataFusionError message (printed after 'datafusion error:') to identify the root cause.","Fix the query or RecordBatch schema that DataFusion rejected.","Ensure influxdb3 and datafusion crate versions are aligned (no mixed versions in the build).","Add tests around the failing persister call to reproduce with a minimal batch."],"exampleFix":"// before: mismatched schema batch passed to persister\nlet batch = RecordBatch::try_new(bad_schema, cols)?;\npersister.write(db, table, batch).await?;\n// after: use the schema derived from the table definition\nlet batch = RecordBatch::try_new(table_schema.clone(), cols)?;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_datafusion_error(e: &PersisterError) -> bool {\n    matches!(e, PersisterError::DataFusion(_))\n}","tryCatchPattern":"match persister.write(db, table, batch).await {\n    Err(PersisterError::DataFusion(e)) => eprintln!(\"datafusion failed: {e}\"),\n    Err(e) => return Err(e.into()),\n    Ok(v) => v,\n}","preventionTips":["Validate RecordBatch schemas against the table definition before persisting.","Pin compatible datafusion/arrow versions in Cargo.toml.","Test persistence paths with minimal RecordBatches in CI."],"tags":["datafusion","query-execution","rust","wrapper-error"],"backgroundTag":"database-query-failed","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"}