-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix bug in predicate pushdown and init string namespace in lazy
- Loading branch information
Showing
12 changed files
with
196 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
use super::*; | ||
|
||
pub struct StringNameSpace(pub(crate) Expr); | ||
|
||
impl StringNameSpace { | ||
pub fn extract(self, pat: &str, group_index: usize) -> Expr { | ||
let pat = pat.to_string(); | ||
let function = move |s: Series| { | ||
let ca = s.utf8()?; | ||
match ca.extract(&pat, group_index) { | ||
Ok(ca) => Ok(ca.into_series()), | ||
Err(e) => Err(PolarsError::ComputeError(format!("{:?}", e).into())), | ||
} | ||
}; | ||
self.0 | ||
.map(function, GetOutput::from_type(DataType::Utf8)) | ||
.with_fmt("str.extract") | ||
} | ||
|
||
#[cfg(feature = "temporal")] | ||
pub fn strftime(self, fmt: &str) -> Expr { | ||
let fmt = fmt.to_string(); | ||
let function = move |s: Series| s.strftime(&fmt); | ||
self.0 | ||
.map(function, GetOutput::from_type(DataType::Utf8)) | ||
.with_fmt("strftime") | ||
} | ||
|
||
#[cfg(feature = "concat_str")] | ||
/// Concat the values into a string array. | ||
/// # Arguments | ||
/// | ||
/// * `delimiter` - A string that will act as delimiter between values. | ||
pub fn concat(self, delimiter: &str) -> Expr { | ||
let delimiter = delimiter.to_owned(); | ||
self.0 | ||
.apply( | ||
move |s| Ok(s.str_concat(&delimiter).into_series()), | ||
GetOutput::from_type(DataType::Utf8), | ||
) | ||
.with_fmt("str_concat") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.