From fe03f7a48599bcdef4309f668e072f933ee96cd2 Mon Sep 17 00:00:00 2001 From: Alexander Beedie Date: Mon, 30 Sep 2024 17:05:31 +0400 Subject: [PATCH] rebase --- crates/polars-plan/src/dsl/name.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/crates/polars-plan/src/dsl/name.rs b/crates/polars-plan/src/dsl/name.rs index fa1dc8894ecb..279b6caff1e2 100644 --- a/crates/polars-plan/src/dsl/name.rs +++ b/crates/polars-plan/src/dsl/name.rs @@ -1,8 +1,8 @@ -#[cfg(feature = "regex")] -use regex::Regex; use polars_utils::format_pl_smallstr; #[cfg(feature = "dtype-struct")] use polars_utils::pl_str::PlSmallStr; +#[cfg(feature = "regex")] +use regex::Regex; use super::*; @@ -57,10 +57,14 @@ impl ExprNameNameSpace { let value = value.to_string(); let pattern = pattern.to_string(); if literal { - self.map(move |name| Ok(name.replace(&pattern, &value))) + self.map(move |name| Ok(PlSmallStr::from_string(name.replace(&pattern, &value)))) } else { let rx = Regex::new(&pattern); - self.map(move |name| Ok(rx.clone()?.replace_all(name, &value).to_string())) + self.map(move |name| { + Ok(PlSmallStr::from_string( + rx.clone()?.replace_all(name, &value).to_string(), + )) + }) } }