{"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":69,"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":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-compute/src/min_max/dyn_array.rs#L51-L87","documentation":"dyn_array_min_ignore_nan / dyn_array_max_ignore_nan (and the propagate_nan variants) dyn-dispatch min/max over Arrow physical types. Boolean, every primitive, BinaryView/Utf8View and i32/i64 Binary/Utf8 are wired; any other physical type - Null, List, LargeList, FixedSizeList, Struct, Map, Union, Dictionary - falls through to todo!(\"Dynamic MinMax is not yet implemented\").","triggerScenarios":"Calling these polars-compute entry points (directly from Rust, or via higher-level Series aggregation code routed through them) on an array whose physical type is outside the dispatch - e.g. a ListArray, StructArray, NullArray, or Arrow dictionary array.","commonSituations":"Generic Rust code computing min/max over Box<dyn Array> without first narrowing the dtype; integration code feeding Arrow interop data (dictionary-encoded strings, nested types) into polars-compute min/max kernels.","solutions":["Narrow the dtype before calling: only invoke the dyn min/max entry points for Boolean/Primitive/string/binary physical types","For nested dtypes, restructure the computation (explode lists, take struct fields) instead of dyn min/max","Implement the missing MinMaxKernel arms or extend the dyn dispatch upstream"],"exampleFix":"// before\nlet m = dyn_array_min_ignore_nan(arr); // panics for List/Struct/Dictionary arrays\n// after\nuse arrow::datatypes::PhysicalType::*;\nfn supported(dtype: &ArrowDataType) -> bool {\n    matches!(dtype.to_physical_type(), Boolean | Primitive(_) | BinaryView | Utf8View | Binary | LargeBinary | Utf8 | LargeUtf8)\n}\nlet m = if supported(arr.dtype()) { dyn_array_min_ignore_nan(arr) } else { None /* compute differently */ };","handlingStrategy":"type-guard","validationCode":"use arrow::datatypes::PhysicalType::*;\nfn min_max_supported(dtype: &ArrowDataType) -> bool {\n    matches!(dtype.to_physical_type(),\n        Boolean | Primitive(_) | BinaryView | Utf8View | Binary | LargeBinary | Utf8 | LargeUtf8)\n}\nif min_max_supported(arr.dtype()) {\n    let m = dyn_array_min_ignore_nan(arr);\n} else {\n    // restructure: explode / take fields / reject with a clear error\n}","typeGuard":"// Rust: narrow before dispatch\nfn is_scalar_min_max_dtype(dtype: &ArrowDataType) -> bool {\n    min_max_supported(dtype)\n}","tryCatchPattern":null,"preventionTips":["Do not call dyn min/max on Box<dyn Array> without a physical-type whitelist","Explode lists or project struct fields before aggregating nested data","Keep an explicit supported-dtype table next to generic aggregation code"],"tags":["polars","min-max","aggregation","unsupported-dtype","panic","todo-macro"],"backgroundTag":"min-max-unsupported-dtype","analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}