From b3dbb907130e4d8d34fcb0969c2f9602a79c65c0 Mon Sep 17 00:00:00 2001 From: ritchie Date: Sat, 21 Dec 2024 11:48:39 +0100 Subject: [PATCH] fix: Raise on categorical search_sorted --- crates/polars-ops/src/series/ops/search_sorted.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/polars-ops/src/series/ops/search_sorted.rs b/crates/polars-ops/src/series/ops/search_sorted.rs index 11e97ef489e8..17a8d2fb3560 100644 --- a/crates/polars-ops/src/series/ops/search_sorted.rs +++ b/crates/polars-ops/src/series/ops/search_sorted.rs @@ -9,6 +9,11 @@ pub fn search_sorted( descending: bool, ) -> PolarsResult { let original_dtype = s.dtype(); + + if s.dtype().is_categorical() { + polars_bail!(InvalidOperation: "'search_sorted' is not supported on dtype: {}", s.dtype()) + } + let s = s.to_physical_repr(); let phys_dtype = s.dtype();