pola-rs/polars · error

not yet implemented

Error message

not yet implemented

What it means

Converting a Python polars DataType to the Rust DataType hits an explicit todo!() for the "Object" variant (types.rs:562). pyo3-polars deliberately does not support round-tripping Object dtypes through the plugin ABI; reaching this arm means a PyObject whose dtype name is 'Object' was passed to extract and the crate was compiled with the 'object' feature, so the arm exists but is unimplemented. It aborts the process rather than returning a Python error.

Solutions

  1. Remove Object-typed columns/arguments before calling the plugin function (e.g. df.drop(object_cols) or select only supported dtypes).
  2. Do not enable the 'object' feature when building the pyo3-polars plugin; without it the arm is compiled out and 'Object' falls through to a clean PyTypeError instead of a panic.
  3. If Object dtype support is required, handle it in Python-side wrapper code and never pass the dtype across the plugin boundary.

Example fix

// before
out = plugin_fn(df)  # df has an Object column, plugin built with feature "object"
// after
df = df.drop([c for c in df.columns if df.schema[c] == pl.Object])
out = plugin_fn(df)
Defensive patterns

Strategy: validation

Validate before calling

unsupported = {c for c in df.columns if df.schema[c] == pl.Object}
if unsupported:
    raise TypeError(f"plugin cannot receive Object columns: {unsupported}")

Prevention

When it happens

Trigger: Passing a Python object with dtype Object (e.g. pl.Object) into a pyo3-polars plugin API that extracts PyDataType, when the plugin was compiled with the 'object' cargo feature enabled.

Common situations: Users building custom Polars plugins that accept arbitrary Series/dtype arguments containing Object columns; enabling non-default features like 'object' in a plugin's Cargo.toml without realizing Object dtype extraction is unimplemented.

Related errors


AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18). Data as JSON: /api/errors/24fc2bc3aa6857eb. Report an issue: GitHub.

Appendix: source

Thrown at pyo3-polars/pyo3-polars/src/types.rs:562

                        let mapping = categories.mapping().clone();
                        DataType::Enum(categories, mapping)
                    },
                    "Date" => DataType::Date,
                    "Time" => DataType::Time,
                    "Datetime" => DataType::Datetime(TimeUnit::Microseconds, None),
                    "Duration" => DataType::Duration(TimeUnit::Microseconds),
                    #[cfg(feature = "dtype-decimal")]
                    "Decimal" => {
                        return Err(PyTypeError::new_err("Decimal without specifying precision and scale is not a valid Polars data type".to_string()));
                    },
                    "List" => DataType::List(Box::new(DataType::Null)),
                    #[cfg(feature = "dtype-array")]
                    "Array" => DataType::Array(Box::new(DataType::Null), 0),
                    #[cfg(feature = "dtype-struct")]
                    "Struct" => DataType::Struct(vec![]),
                    "Null" => DataType::Null,
                    #[cfg(feature = "object")]
                    "Object" => todo!(),
                    "Unknown" => DataType::Unknown(Default::default()),
                    dt => {
                        return Err(PyTypeError::new_err(format!(
                            "'{dt}' is not a Polars data type, or the plugin isn't compiled with the right features",
                        )));
                    },
                }
            },
            "Int8" => DataType::Int8,
            "Int16" => DataType::Int16,
            "Int32" => DataType::Int32,
            "Int64" => DataType::Int64,
            "Int128" => DataType::Int128,
            "UInt8" => DataType::UInt8,
            "UInt16" => DataType::UInt16,
            "UInt32" => DataType::UInt32,
            "UInt64" => DataType::UInt64,
            "UInt128" => DataType::UInt128,

View on GitHub (pinned to fe841f959e)