influxdata/influxdb · error · anyhow::Error

unsupported Arrow type for Python conversion

Error message

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

What it means

extract_arrow_value_to_py maps a fixed set of Arrow types (Int64, UInt64, Float64, Boolean, Utf8, LargeUtf8, Timestamp(Nanosecond), Dictionary(Int32, Utf8)) to Python values. Any other Arrow data type hits the catch-all arm and bails with this error. It occurs during query()/wal_flush_to_py() row conversion whenever a column has an unconverted type.

Solutions

  1. Cast unsupported columns to a supported type in the query (e.g. arrow_cast(col, 'Timestamp(Nanosecond)') or float64 for Float32).
  2. Exclude unsupported columns from the SELECT projection.
  3. Write data with supported types (Int64/UInt64/Float64/Boolean/Utf8/ns-Timestamp/string dictionaries) from the start.

Example fix

// before
SELECT ts, raw_binary FROM metrics
// after
SELECT ts, arrow_cast(raw_binary, 'Utf8') AS raw_binary FROM metrics
Defensive patterns

Strategy: validation

Validate before calling

# check column types before querying through the Python conversion path
SUPPORTED = {'Int64','UInt64','Float64','Boolean','Utf8','LargeUtf8','Timestamp(Nanosecond, None)','Dictionary(Int32, Utf8)'}
# cast or drop unsupported columns in SQL:
# SELECT arrow_cast(col, 'Utf8') AS col FROM t

Try / catch

try:
    rows = client.query(sql)
except Exception as e:
    if 'unsupported Arrow type' in str(e):
        sql = rewrite_with_arrow_casts(sql)
        rows = client.query(sql)

Prevention

When it happens

Trigger: Querying or flushing a table containing a column whose Arrow type is outside the supported set (e.g. Float32, Date64, Binary, Decimal128, Timestamp with non-nanosecond unit).

Common situations: Writing non-nanosecond timestamps or binary/decimal data via other clients, then reading through the Python conversion path; schema evolved to include a newer column type.

Related errors


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

Appendix: 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 06200ef96b)