influxdata/influxdb · error

unsupported Arrow type for Python conversion: {:?}. Supporte

Error message

unsupported Arrow type for Python conversion: {:?}. Supported types: Int64, UInt64, Float64, Boolean, Utf8, LargeUtf8, Timestamp(Nanosecond), Dictionary(Int32, Utf8).

What it means

py_conversion.rs converts a single Arrow value from Rust query results into a Python object for plugin code. The supported set is exactly: Int64, UInt64, Float64, Boolean, Utf8, LargeUtf8, Timestamp(Nanosecond), and Dictionary(Int32, Utf8). Any other Arrow DataType hits the catch-all arm and bails with this message, printing the offending DataType via Debug so you can see precisely which column/type failed.

Source

Thrown at influxdb3_py_api/src/py_conversion.rs:119

            let arr = array.as_string::<i64>();
            arr.value(index).into_pyobject(py)?.into_any().unbind()
        }
        DataType::Timestamp(arrow_schema::TimeUnit::Nanosecond, _) => {
            let arr = array.as_primitive::<arrow_array::types::TimestampNanosecondType>();
            arr.value(index).into_pyobject(py)?.into_any().unbind()
        }
        DataType::Dictionary(_, value_type) if value_type.as_ref() == &DataType::Utf8 => {
            // Dictionary-encoded strings (common for tags)
            let dict_arr = array
                .as_any()
                .downcast_ref::<DictionaryArray<Int32Type>>()
                .context("failed to downcast dictionary array")?;
            let values = dict_arr.values().as_string::<i32>();
            let key = dict_arr.keys().value(index) as usize;
            values.value(key).into_pyobject(py)?.into_any().unbind()
        }
        _ => {
            anyhow::bail!(
                "unsupported Arrow type for Python conversion: {:?}. \
                Supported types: Int64, UInt64, Float64, Boolean, Utf8, LargeUtf8, Timestamp\
                (Nanosecond), Dictionary(Int32, Utf8).",
                data_type
            );
        }
    };

    Ok(value)
}

pub(crate) fn args_to_py_object<'py>(
    py: Python<'py>,
    args: &Option<HashMap<String, String>>,
) -> PyResult<Option<Bound<'py, PyDict>>> {
    args.as_ref()
        .map(|args| map_to_py_object(py, args))
        .transpose()

View on GitHub (pinned to d28e26e048)

Solutions

  1. Read the {:?} in the message to identify the exact column type, then cast that column in SQL to a supported type (e.g. `CAST(col AS STRING)` / `::string`)
  2. Project only the columns the plugin needs instead of SELECT *
  3. For timestamps, normalize to nanosecond precision in the query (e.g. cast to Timestamp(Nanosecond) or string) rather than micro/millisecond units
  4. For nested/binary data, serialize to JSON strings in SQL before it reaches the plugin

Example fix

-- before
SELECT now() AS ts, payload FROM events
-- Timestamp(Second/Microsecond...) can land in the unsupported arm

-- after
SELECT CAST(now() AS TIMESTAMP(9)) AS ts, CAST(payload AS STRING) AS payload FROM events
Defensive patterns

Strategy: validation

Validate before calling

-- keep the plugin-facing projection inside the supported type set
SELECT
  CAST(ts AS TIMESTAMP(9))  AS ts,          -- Timestamp(Nanosecond)
  CAST(id AS BIGINT)         AS id,          -- Int64
  CAST(payload AS STRING)    AS payload      -- Utf8
FROM events;

Try / catch

match run_plugin_query(&sql).await {
    Err(e) if e.to_string().contains("unsupported Arrow type") => {
        // ask the user to cast the reported column; the message names the exact DataType
        Err(reject_with_hint(e, "cast the reported column to Int64/UInt64/Float64/Boolean/Utf8/LargeUtf8/Timestamp(Nanosecond)/Dictionary(Int32, Utf8)"))
    }
    other => other,
}

Prevention

When it happens

Trigger: A plugin query whose output includes columns such as Timestamp(Microsecond/Millisecond/Second), Date32/Date64, Int8/16/32, Float32, Binary, or nested List/Struct types — e.g. date/time SQL functions returning non-nanosecond units, or dictionary-encoded strings keyed by something other than Int32.

Common situations: Using date_bin()/now()-style functions whose result unit differs from Timestamp(Nanosecond); CASTs to DATE or TIME; downstream DataFusion version changes widening the set of emitted Arrow types; selecting raw columns of exotic types from parquet.

Related errors


AI-assisted analysis of influxdata/influxdb@d28e26e048 (2026-08-16). Data as JSON: /api/errors/5b9a3abf366dc60a. Report an issue: GitHub.