{"record":{"id":"8e345c0f90c9bd0b","repo":"pola-rs/polars","slug":"not-implemented-8e345c","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-arrow/src/scalar/equal.rs","lineNumber":56,"sourceCode":"    match lhs.dtype().to_physical_type() {\n        Null => dyn_eq!(NullScalar, lhs, rhs),\n        Boolean => dyn_eq!(BooleanScalar, lhs, rhs),\n        Primitive(primitive) => with_match_primitive_type_full!(primitive, |$T| {\n            dyn_eq!(PrimitiveScalar<$T>, lhs, rhs)\n        }),\n        LargeUtf8 => dyn_eq!(Utf8Scalar<i64>, lhs, rhs),\n        LargeBinary => dyn_eq!(BinaryScalar<i64>, lhs, rhs),\n        LargeList => dyn_eq!(ListScalar<i64>, lhs, rhs),\n        Dictionary(key_type) => match_integer_type!(key_type, |$T| {\n            dyn_eq!(DictionaryScalar<$T>, lhs, rhs)\n        }),\n        Struct => dyn_eq!(StructScalar, lhs, rhs),\n        FixedSizeBinary => dyn_eq!(FixedSizeBinaryScalar, lhs, rhs),\n        FixedSizeList => dyn_eq!(FixedSizeListScalar, lhs, rhs),\n        Union => dyn_eq!(UnionScalar, lhs, rhs),\n        Map => dyn_eq!(MapScalar, lhs, rhs),\n        Utf8View => dyn_eq!(BinaryViewScalar<str>, lhs, rhs),\n        _ => unimplemented!(),\n    }\n}\n","sourceCodeStart":38,"sourceCodeEnd":59,"githubUrl":"https://github.com/pola-rs/polars/blob/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/crates/polars-arrow/src/scalar/equal.rs#L38-L59","documentation":"equal(lhs, rhs) implements == for dyn Scalar: it first compares dtypes (mismatched dtypes return false without panicking) and then dispatches on physical type. Arms exist for Null, Boolean, all primitives, LargeUtf8/LargeBinary/LargeList, dictionaries, structs, FixedSizeBinary/List, union, map and Utf8View — but the 32-bit Utf8 and Binary physical types and BinaryView are missing, so they fall into _ => unimplemented!() (crates/polars-arrow/src/scalar/equal.rs:56) and panic instead of returning a bool.","triggerScenarios":"Comparing Box<dyn Scalar>/Arc<dyn Scalar> values whose dtype is Utf8 (i32 offsets), Binary (i32) or BinaryView — e.g. scalar == scalar in expression evaluation, filter predicates, or tests after extracting .get(0)/scalar() from legacy string/binary arrays.","commonSituations":"Older IPC/Parquet string data still in Utf8/Binary (i32) form; scalars pulled from arrays before a cast to Utf8View; hand-written equality helpers over dyn Scalar in join or predicate code.","solutions":["Cast the column to LargeUtf8/Utf8View (or BinaryView) before extracting scalars — those arms are implemented","Downcast and compare the concrete scalar types yourself (Utf8Scalar<i32> implements PartialEq natively)","Guard on to_physical_type() before comparing dyn scalars","Add the missing arms upstream, mirroring the LargeUtf8 arm with Utf8Scalar<i32>, BinaryScalar<i32> and BinaryViewScalar<[u8]>"],"exampleFix":"// before\nlet eq = lhs_scalar == rhs_scalar; // panics for Utf8 scalars\n\n// after\nlet eq = match lhs_scalar.dtype().to_physical_type() {\n    PhysicalType::Utf8 => {\n        let l = lhs_scalar.as_any().downcast_ref::<Utf8Scalar<i32>>().unwrap();\n        let r = rhs_scalar.as_any().downcast_ref::<Utf8Scalar<i32>>().unwrap();\n        l == r\n    },\n    _ => lhs_scalar == rhs_scalar,\n};","handlingStrategy":"type-guard","validationCode":"if !scalar_eq_supported(lhs.dtype()) {\n    polars_bail!(InvalidOperation: \"scalar equality not implemented for {:?}; cast to Utf8View/LargeUtf8 first\", lhs.dtype());\n}","typeGuard":"fn scalar_eq_supported(dtype: &ArrowDataType) -> bool {\n    use polars_arrow::datatypes::PhysicalType::*;\n    !matches!(dtype.to_physical_type(), Utf8 | Binary | BinaryView)\n}","tryCatchPattern":"let res = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| lhs_scalar == rhs_scalar));\nlet eq = match res {\n    Ok(v) => v,\n    Err(_) => polars_bail!(ComputeError: \"scalar comparison panicked: cast Utf8/Binary to Utf8View first\"),\n};","preventionTips":["Cast string/binary columns to Utf8View/BinaryView before extracting scalars for comparisons","Compare concrete scalar types (Utf8Scalar<i32>) instead of dyn Scalar where possible","Keep a whitelist of equality-supported physical types next to scalar helpers"],"tags":["rust","polars-arrow","scalar","equality","utf8","panic"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}