{"record":{"id":"668f9435b7283f6f","repo":"pola-rs/polars","slug":"dynamic-minmax-is-not-yet-implemented-for","errorCode":null,"errorMessage":"Dynamic MinMax is not yet implemented for {:?}","messagePattern":"Dynamic MinMax is not yet implemented for (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-compute/src/min_max/dyn_array.rs","lineNumber":71,"sourceCode":"            PH::Primitive(PR::Int128) => call_op!(dt: PArr<i128>, PScalar<i128>, arr, $op$(, $variant)?),\n            PH::Primitive(PR::UInt8) => call_op!(dt: PArr<u8>, PScalar<u8>, arr, $op$(, $variant)?),\n            PH::Primitive(PR::UInt16) => call_op!(dt: PArr<u16>, PScalar<u16>, arr, $op$(, $variant)?),\n            PH::Primitive(PR::UInt32) => call_op!(dt: PArr<u32>, PScalar<u32>, arr, $op$(, $variant)?),\n            PH::Primitive(PR::UInt64) => call_op!(dt: PArr<u64>, PScalar<u64>, arr, $op$(, $variant)?),\n            PH::Primitive(PR::UInt128) => call_op!(dt: PArr<u128>, PScalar<u128>, arr, $op$(, $variant)?),\n            PH::Primitive(PR::Float32) => call_op!(dt: PArr<f32>, PScalar<f32>, arr, $op$(, $variant)?),\n            PH::Primitive(PR::Float16) => call_op!(dt: PArr<pf16>, PScalar<pf16>, arr, $op$(, $variant)?),\n            PH::Primitive(PR::Float64) => call_op!(dt: PArr<f64>, PScalar<f64>, arr, $op$(, $variant)?),\n\n            PH::BinaryView => call_op!(BinaryViewArray, BinaryViewScalar<[u8]>, arr, $op$(, $variant)?),\n            PH::Utf8View => call_op!(Utf8ViewArray, BinaryViewScalar<str>, arr, $op$(, $variant)?),\n\n            PH::Binary => call_op!(BinaryArray<i32>, BinaryScalar<i32>, arr, $op$(, $variant)?),\n            PH::LargeBinary => call_op!(BinaryArray<i64>, BinaryScalar<i64>, arr, $op$(, $variant)?),\n            PH::Utf8 => call_op!(Utf8Array<i32>, BinaryScalar<i32>, arr, $op$(, $variant)?),\n            PH::LargeUtf8 => call_op!(Utf8Array<i64>, BinaryScalar<i64>, arr, $op$(, $variant)?),\n\n            _ => todo!(\"Dynamic MinMax is not yet implemented for {:?}\", arr.dtype()),\n        }\n    }};\n}\n\npub fn dyn_array_min_ignore_nan(arr: &dyn Array) -> Option<Box<dyn Scalar>> {\n    call!(arr, MinMaxKernel::min_ignore_nan_kernel)\n}\n\npub fn dyn_array_max_ignore_nan(arr: &dyn Array) -> Option<Box<dyn Scalar>> {\n    call!(arr, MinMaxKernel::max_ignore_nan_kernel)\n}\n\npub fn dyn_array_min_propagate_nan(arr: &dyn Array) -> Option<Box<dyn Scalar>> {\n    call!(arr, MinMaxKernel::min_propagate_nan_kernel)\n}\n\npub fn dyn_array_max_propagate_nan(arr: &dyn Array) -> Option<Box<dyn Scalar>> {\n    call!(arr, MinMaxKernel::max_propagate_nan_kernel)","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-compute/src/min_max/dyn_array.rs#L53-L89","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running a min/max aggregation over nested (list/struct) columns in Polars where the kernel falls through to the dynamic dispatch path.","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."],"exampleFix":"// before\nlet min = dyn_array_min_ignore_nan(&list_array); // todo! panic\n// after\nlet flat = list_array.values().as_ref(); // min over the flattened child array\nlet min = dyn_array_min_ignore_nan(flat);","handlingStrategy":"type-guard","validationCode":"// Rust: only call dynamic min/max on supported dtypes\nfn supports_dyn_minmax(dtype: &DataType) -> bool {\n    dtype.is_numeric() || dtype.is_string() || dtype.is_boolean()\n}","typeGuard":"fn is_dispatchable(arr: &dyn Array) -> bool {\n    !matches!(arr.dtype(), DataType::List(_) | DataType::Struct(_) | DataType::Object(_))\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["rust","polars","not-implemented","min-max"],"backgroundTag":"unsupported-operation","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}