influxdata/influxdb · error · Error

datafusion error

Error message

datafusion error: {0}

What it means

The DataFusion variant of influxdb3_server::Error, wrapping a datafusion::error::DataFusionError via #[from]. It means query planning or execution in the DataFusion engine failed — SQL parse/plan errors, missing tables/columns, type mismatches, or execution failures.

Solutions

  1. Read the wrapped DataFusionError text — it names the parse/plan/execution failure precisely
  2. Run the query with corrected syntax against SHOW TABLES / schema info to confirm table and column names
  3. Cast literals/columns to matching types (e.g. use a proper timestamp literal) and remove unsupported functions

Example fix

// before
SELECT * FROM cpu WHERE time > '2024-01-01'  -- string vs timestamp type mismatch
// after
SELECT * FROM cpu
WHERE time > TIMESTAMP '2024-01-01T00:00:00Z';
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify objects exist before querying
let tables = client.show_tables(db)?;
anyhow::ensure!(tables.contains(&"cpu".to_string()), "table 'cpu' missing");

Try / catch

match err {
    ServerError::DataFusion(df_err)
        if matches!(df_err, DataFusionError::Plan(_) | DataFusionError::SQL(_, _)) =>
    {
        // static SQL problem: fix the query text; retrying won't help
    }
    ServerError::DataFusion(df_err) => {
        // execution failure: log, optionally retry with backoff
    }
    _ => return Err(err),
}

Prevention

When it happens

Trigger: Submitting SQL with a syntax error; querying a table (measurement) or column that does not exist; type-incompatible comparisons (e.g. comparing a string column to an int); resource/execution errors during a streaming query plan.

Common situations: Hand-written or generated SQL with typos; schema drift after measurement/tag changes; porting queries from InfluxQL/other SQL dialects with unsupported functions; querying a time column with the wrong literal type.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/4b8656d85a3d0b9c. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_server/src/lib.rs:72

pub const PRODUCT_NAME: &str = "InfluxDB 3 Core";
pub const INFLUXDB3_BUILD: &str = "Core";

/// Version string combining the product name, [`influxdb3_process::INFLUXDB3_VERSION`], and [`influxdb3_process::INFLUXDB3_GIT_HASH`].
pub static VERSION_STRING: LazyLock<String> = LazyLock::new(|| build_version_string(PRODUCT_NAME));

#[derive(Debug, Error)]
pub enum Error {
    #[error("hyper error: {0}")]
    Hyper(#[from] hyper::Error),

    #[error("http error: {0}")]
    Http(#[from] Box<http::Error>),

    #[error("database not found {db_name}")]
    DatabaseNotFound { db_name: String },

    #[error("datafusion error: {0}")]
    DataFusion(#[from] datafusion::error::DataFusionError),

    #[error("influxdb3_write error: {0}")]
    InfluxDB3Write(#[from] influxdb3_write::Error),

    #[error("from hex error: {0}")]
    FromHex(#[from] hex::FromHexError),

    #[error("io error: {0}")]
    Io(#[from] std::io::Error),

    #[error("tls config error: {0}")]
    TlsConfig(String),

    #[error("rustls error: {0}")]
    Rustls(#[from] rustls::Error),
}

View on GitHub (pinned to 06200ef96b)