pola-rs/polars · error

reverse for FixedSizeList with non-numeric dtypes not yet su

Error message

reverse for FixedSizeList with non-numeric dtypes not yet supported

What it means

todo!() in ArrayChunked::reverse: reversing a FixedSizeList column whose inner dtype is not primitive numeric is not yet implemented (the fast path reinterprets numeric rows). Unsupported functionality; cast or rechunk differently until implemented.

Source

Thrown at crates/polars-core/src/chunked_array/ops/reverse.rs:100

                PlSmallStr::EMPTY,
                (0..self.len() as IdxSize).rev().collect(),
            );
            unsafe { self.take_unchecked(&ca) }
        }
    }
}

impl ChunkReverse for StringChunked {
    fn reverse(&self) -> Self {
        unsafe { self.as_binary().reverse().to_string_unchecked() }
    }
}

#[cfg(feature = "dtype-array")]
impl ChunkReverse for ArrayChunked {
    fn reverse(&self) -> Self {
        if !self.inner_dtype().is_primitive_numeric() {
            todo!("reverse for FixedSizeList with non-numeric dtypes not yet supported")
        }
        let ca = self.rechunk();
        let arr = ca.downcast_as_array();
        let values = arr.values().as_ref();

        let mut builder =
            get_fixed_size_list_builder(ca.inner_dtype(), ca.len(), ca.width(), ca.name().clone())
                .expect("not yet supported");

        // SAFETY, we are within bounds
        unsafe {
            if arr.null_count() == 0 {
                for i in (0..arr.len()).rev() {
                    builder.push_unchecked(values, i)
                }
            } else {
                let validity = arr.validity().unwrap();
                for i in (0..arr.len()).rev() {

View on GitHub (pinned to 9b5d73fd00)

Solutions

  1. Cast the FixedSizeList inner dtype to a numeric type before reversing.
  2. Convert the array to a regular List and reverse element-wise as a workaround.
Defensive patterns

Strategy: fallback

When it happens

Trigger: This panic/expect fires when execution reaches an unguarded state described by: "reverse for FixedSizeList with non-numeric dtypes not yet supported". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.

Common situations: Encountered when input data or configuration does not meet the preconditions of the throwing code path ("reverse for FixedSizeList with non-numeric dtypes not yet supported"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.


AI-assisted analysis of pola-rs/polars@9b5d73fd00 (2026-08-19). Data as JSON: /api/errors/4551dfd2fd4f7c53. Report an issue: GitHub.