pola-rs/polars · error
Dynamic MinMax is not yet implemented for
Error message
Dynamic MinMax is not yet implemented for {:?} What it means
The dynamic MinMax kernel dispatches over physical hash types (primitive, binary, utf8, etc.). When the array's dtype is not one of the covered variants (e.g. a list or struct dtype), the macro reaches a `todo!` arm stating dynamic MinMax is not yet implemented for that dtype.
Solutions
- Explode or flatten the nested column and compute min/max over the flat values.
- Compute the aggregate per sub-array instead of using the dynamic kernel.
- Cast the data to a supported dtype (primitive/utf8/binary) before aggregating.
- Upstream: add the missing PH variant arm to the dispatch macro.
Example fix
// before let min = dyn_array_min_ignore_nan(&list_array); // todo! panic // after let flat = list_array.values().as_ref(); // min over the flattened child array let min = dyn_array_min_ignore_nan(flat);
Defensive patterns
Strategy: type-guard
Validate before calling
// Rust: only call dynamic min/max on supported dtypes
fn supports_dyn_minmax(dtype: &DataType) -> bool {
dtype.is_numeric() || dtype.is_string() || dtype.is_boolean()
} Type guard
fn is_dispatchable(arr: &dyn Array) -> bool {
!matches!(arr.dtype(), DataType::List(_) | DataType::Struct(_) | DataType::Object(_))
} Prevention
- Aggregate over the child/values array of nested types instead of the list itself.
- Check dtype support before using the dynamic kernels.
- Prefer typed kernels (min_boolean, min_primitive) when the type is known statically.
When it happens
Trigger: Calling dyn_array_min / dyn_array_min_ignore_nan / dyn_array_max (or the ignore_nan variants) on an array whose dtype is a list, struct, or other non-dispatched physical type.
Common situations: Running a min/max aggregation over nested (list/struct) columns in Polars where the kernel falls through to the dynamic dispatch path.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- horizontal_flatten not supported for data type
- not implemented for
- reverse for FixedSizeList with non-numeric dtypes not yet…
- {0}
- activate dtype
AI-assisted analysis of pola-rs/polars@fe841f959e (2026-09-18).
Data as JSON: /api/errors/668f9435b7283f6f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/polars-compute/src/min_max/dyn_array.rs:71
PH::Primitive(PR::Int128) => call_op!(dt: PArr<i128>, PScalar<i128>, arr, $op$(, $variant)?),
PH::Primitive(PR::UInt8) => call_op!(dt: PArr<u8>, PScalar<u8>, arr, $op$(, $variant)?),
PH::Primitive(PR::UInt16) => call_op!(dt: PArr<u16>, PScalar<u16>, arr, $op$(, $variant)?),
PH::Primitive(PR::UInt32) => call_op!(dt: PArr<u32>, PScalar<u32>, arr, $op$(, $variant)?),
PH::Primitive(PR::UInt64) => call_op!(dt: PArr<u64>, PScalar<u64>, arr, $op$(, $variant)?),
PH::Primitive(PR::UInt128) => call_op!(dt: PArr<u128>, PScalar<u128>, arr, $op$(, $variant)?),
PH::Primitive(PR::Float32) => call_op!(dt: PArr<f32>, PScalar<f32>, arr, $op$(, $variant)?),
PH::Primitive(PR::Float16) => call_op!(dt: PArr<pf16>, PScalar<pf16>, arr, $op$(, $variant)?),
PH::Primitive(PR::Float64) => call_op!(dt: PArr<f64>, PScalar<f64>, arr, $op$(, $variant)?),
PH::BinaryView => call_op!(BinaryViewArray, BinaryViewScalar<[u8]>, arr, $op$(, $variant)?),
PH::Utf8View => call_op!(Utf8ViewArray, BinaryViewScalar<str>, arr, $op$(, $variant)?),
PH::Binary => call_op!(BinaryArray<i32>, BinaryScalar<i32>, arr, $op$(, $variant)?),
PH::LargeBinary => call_op!(BinaryArray<i64>, BinaryScalar<i64>, arr, $op$(, $variant)?),
PH::Utf8 => call_op!(Utf8Array<i32>, BinaryScalar<i32>, arr, $op$(, $variant)?),
PH::LargeUtf8 => call_op!(Utf8Array<i64>, BinaryScalar<i64>, arr, $op$(, $variant)?),
_ => todo!("Dynamic MinMax is not yet implemented for {:?}", arr.dtype()),
}
}};
}
pub fn dyn_array_min_ignore_nan(arr: &dyn Array) -> Option<Box<dyn Scalar>> {
call!(arr, MinMaxKernel::min_ignore_nan_kernel)
}
pub fn dyn_array_max_ignore_nan(arr: &dyn Array) -> Option<Box<dyn Scalar>> {
call!(arr, MinMaxKernel::max_ignore_nan_kernel)
}
pub fn dyn_array_min_propagate_nan(arr: &dyn Array) -> Option<Box<dyn Scalar>> {
call!(arr, MinMaxKernel::min_propagate_nan_kernel)
}
pub fn dyn_array_max_propagate_nan(arr: &dyn Array) -> Option<Box<dyn Scalar>> {
call!(arr, MinMaxKernel::max_propagate_nan_kernel)View on GitHub (pinned to fe841f959e)