pola-rs/polars · error

Writing to parquet not yet implemented

Error message

Writing {:?} to parquet not yet implemented

What it means

todo!() in the parquet page writer's array-to-columns conversion: an Arrow array dtype reached the writer that has no parquet encoding implemented. The wildcard match arm reports the offending dtype instead of silently dropping data.

Solutions

  1. Cast unsupported columns before writing, e.g. arr.cast(List) or to a supported type
  2. Drop or restructure columns containing unsupported dtypes
  3. Upgrade polars; unimplemented writer branches are added over time
  4. File an issue with the dtype printed in the message if it should be supported

Example fix

// before
df.write_parquet(path)?; // df has FixedSizeList column
// after
let df = df.with_column(col("arr").cast(DataType::List(Box::new(inner))))?;
df.write_parquet(path)?;
Defensive patterns

Strategy: validation

Validate before calling

// Rust: reject unsupported dtypes before sink
for (name, dtype) in df.get_column_names_str().zip(df.dtypes()) {
    if matches!(dtype, DataType::Array(_, _)) {
        return Err(format!("cast or drop column {name}: {:?} unsupported by parquet writer", dtype));
    }
}

Try / catch

std::panic::catch_unwind(|| df.write_parquet(path));

Prevention

When it happens

Trigger: Calling write_parquet / SinkTrait parquet sink on a frame containing an array dtype (e.g. Array/FixedSizeList, or other unhandled P::* variants) not supported by the writer.

Common situations: Writing fixed-size list/Array columns built with arr.* namespace to parquet; dataframes ingested from backends producing exotic dtypes; hitting an unported type after a polars upgrade.

Related errors


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

Appendix: source

Thrown at crates/polars-parquet/src/arrow/write/pages.rs:526

                    &mut array_stack,
                );
            },
            P::Null
            | P::Boolean
            | P::Primitive(_)
            | P::Binary
            | P::FixedSizeBinary
            | P::LargeBinary
            | P::Utf8
            | P::LargeUtf8
            | P::Dictionary(_)
            | P::BinaryView
            | P::Utf8View
            | P::Struct => {
                leaves.push(array.with_validity(validity.into()));
            },

            other => todo!("Writing {:?} to parquet not yet implemented", other),
        }
    }
}

/// Convert `ParquetType` to `Vec<ParquetPrimitiveType>` leaves in DFS order.
pub fn to_parquet_leaves(type_: ParquetType) -> Vec<ParquetPrimitiveType> {
    let mut leaves = vec![];
    to_parquet_leaves_recursive(type_, &mut leaves);
    leaves
}

fn to_parquet_leaves_recursive(type_: ParquetType, leaves: &mut Vec<ParquetPrimitiveType>) {
    match type_ {
        ParquetType::PrimitiveType(primitive) => leaves.push(primitive),
        ParquetType::GroupType { fields, .. } => {
            fields
                .into_iter()
                .for_each(|type_| to_parquet_leaves_recursive(type_, leaves));

View on GitHub (pinned to fe841f959e)