{"record":{"id":"26a733efb5bfd493","repo":"influxdata/influxdb","slug":"arrow-error","errorCode":null,"errorMessage":"Arrow error: {}","messagePattern":"Arrow error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/influxdb_iox_client/src/format/influxql.rs","lineNumber":16,"sourceCode":"use arrow::array::{Array, ArrayData, StringArray};\nuse arrow::datatypes::DataType;\nuse arrow::error::ArrowError;\nuse arrow::record_batch::RecordBatch;\nuse arrow::util::display::ArrayFormatter;\nuse comfy_table::{Cell, Table};\nuse generated_types::influxdata::iox::querier::v1::InfluxQlMetadata;\nuse std::io::Write;\nuse std::iter;\nuse thiserror::Error;\n\n/// Error type for results formatting\n#[derive(Debug, Error)]\npub enum Error {\n    /// Arrow error.\n    #[error(\"Arrow error: {}\", .0)]\n    Arrow(ArrowError),\n\n    /// [`InfluxQlMetadata`] not found in Arrow schema metadata.\n    #[error(\"Missing InfluxQL metadata\")]\n    MissingMetadata,\n\n    /// Error deserializing [`InfluxQlMetadata`] from Arrow schema metadata.\n    #[error(\"Invalid InfluxQL metadata: {0}\")]\n    InvalidMetadata(#[from] serde_json::Error),\n\n    /// Error writing formatted output.\n    #[error(\"Error writing output: {0}\")]\n    Write(#[from] std::io::Error),\n}\ntype Result<T, E = Error> = std::result::Result<T, E>;\n\n/// Options for controlling how table borders are rendered.\n#[derive(Debug, Default, Clone, Copy)]","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/influxdb_iox_client/src/format/influxql.rs#L1-L34","documentation":"This error variant wraps an Apache Arrow error (arrow::error::ArrowError) encountered while formatting query results into InfluxQL line-protocol-style output. The influxql formatter in the influxdb_iox_client crate surfaces any Arrow-level failure (e.g., during record batch access, column conversion, or pretty printing) as Error::Arrow, preserving the underlying message via its Display impl 'Arrow error: {}'.","triggerScenarios":"Calling the InfluxQL results formatter (format::influxql::Formatter) when the underlying arrow::RecordBatch or schema access fails — e.g., ArrowError from downcasting column arrays to an unsupported type, computing with mismatched batch schemas, or Arrow I/O errors while reading batches.","commonSituations":"Querying a server that returns Arrow data with an unexpected column type not supported by the formatter; using an arrow-rs version whose ArrowError differs (datafusion/arrow version mismatch); malformed or truncated Arrow IPC responses from a misconfigured/older InfluxDB IOx server.","solutions":["Print the inner ArrowError message (source chain) to identify the actual Arrow-level failure","Check the arrow-rs version of the client vs the server's Arrow IPC format and align them with cargo update","Inspect the schema of the returned batches (e.g., print batch.schema()) and ensure column types are ones the InfluxQL formatter supports","If the failure is a downcast of a specific column, convert that column (e.g., cast to Utf8) before formatting or use the json formatter instead"],"exampleFix":"// before\nlet formatted = influxql_formatter.format(&batches).map_err(|e| anyhow!(e))?;\n// after\nlet formatted = influxql_formatter.format(&batches).map_err(|e| {\n    if let Some(src) = e.source() {\n        anyhow::anyhow!(\"influxql format failed: {e}; caused by: {src}\")\n    } else {\n        anyhow::anyhow!(\"influxql format failed: {e}\")\n    }\n})?;","handlingStrategy":"try-catch","validationCode":"// inspect batches before formatting\nfor b in batches {\n    for (i, col) in b.columns().iter().enumerate() {\n        assert_eq!(col.len(), b.num_rows(), \"column {} length mismatch\", i);\n    }\n}","typeGuard":"fn is_arrow_error(e: &influxql_format::Error) -> bool {\n    matches!(e, influxql_format::Error::Arrow(_))\n}","tryCatchPattern":"match formatter.format(&batches) {\n    Ok(out) => println!(\"{out}\"),\n    Err(influxql_format::Error::Arrow(src)) => {\n        eprintln!(\"arrow failure while formatting: {src}\");\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Keep arrow-rs/datafusion versions aligned with the server's IPC format","Validate batch schemas and column lengths before passing to formatters","Prefer the json formatter for arbitrary/unknown column types"],"tags":["arrow","formatting","influxql"],"backgroundTag":"type-mismatch","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"}