influxdata/influxdb · error · Error

Arrow csv printing error

Error message

Arrow csv printing error: {}

What it means

This error is returned when converting query results to CSV fails inside the arrow CSV writer (`arrow::csv::writer`). The underlying ArrowError is wrapped verbatim and shown after 'Arrow csv printing error: '. It indicates the RecordBatches could not be serialized to CSV by arrow.

Solutions

  1. Read the wrapped ArrowError detail for the offending column/type.
  2. Cast unsupported nested columns to strings before CSV export.
  3. Use JSON output format instead, which supports nested types.
  4. Ensure arrow crate versions are consistent between your code and the client.

Example fix

// before
let csv = result.format(format::Format::Csv)?;
// after
let csv = match result.format(format::Format::Csv) {
    Ok(c) => c,
    Err(format::Error::CsvArrow(e)) => {
        eprintln!("csv failed ({e}); using json");
        result.format(format::Format::Json)?
    }
};
Defensive patterns

Strategy: try-catch

Validate before calling

// Rust: reject nested types the arrow CSV writer cannot serialize
fn csv_writable(schema: &SchemaRef) -> bool {
    schema.fields().iter().all(|f| {
        !matches!(f.data_type(), DataType::List(_) | DataType::Struct(_) | DataType::Dictionary(_, _))
    })
}

Type guard

fn is_csv_arrow_err(e: &format::Error) -> Option<&ArrowError> {
    match e { format::Error::CsvArrow(a) => Some(a), _ => None }
}

Try / catch

match result.format(format::Format::Csv) {
    Ok(c) => use_csv(c),
    Err(format::Error::CsvArrow(e)) => eprintln!("csv write failed: {e}"),
    Err(e) => eprintln!("other format error: {e}"),
}

Prevention

When it happens

Trigger: Calling the client's format function with Format::Csv on batches containing column types the arrow CSV writer cannot serialize (e.g. nested list/struct types).

Common situations: Exporting query results with nested or dictionary columns to CSV; arrow version differences in supported CSV writer types.

Related errors


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

Appendix: source

Thrown at core/influxdb_iox_client/src/format.rs:26

    self, csv::WriterBuilder, error::ArrowError, json::ArrayWriter, record_batch::RecordBatch,
};

/// Output formatting for InfluxQL.
pub mod influxql;

/// Error type for results formatting
#[derive(Debug, Error)]
pub enum Error {
    /// Unknown formatting type
    #[error("Unknown format type: {}. Expected one of 'pretty', 'csv' or 'json'", .0)]
    Invalid(String),

    /// Error pretty printing
    #[error("Arrow pretty printing error: {}", .0)]
    PrettyArrow(ArrowError),

    /// Error during CSV conversion
    #[error("Arrow csv printing error: {}", .0)]
    CsvArrow(ArrowError),

    /// Error during JSON conversion
    #[error("Arrow json printing error: {}", .0)]
    JsonArrow(ArrowError),

    /// Error converting CSV output to utf-8
    #[error("Error converting CSV output to UTF-8: {}", .0)]
    CsvUtf8(std::string::FromUtf8Error),

    /// Error converting JSON output to utf-8
    #[error("Error converting JSON output to UTF-8: {}", .0)]
    JsonUtf8(std::string::FromUtf8Error),
}
type Result<T, E = Error> = std::result::Result<T, E>;

#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
/// Requested output format for the query endpoint

View on GitHub (pinned to 06200ef96b)