Skip to content

Commit

Permalink
refactor: Rename ContainsMany to ContainsAny (#20785)
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher authored Jan 20, 2025
1 parent 565743f commit 088f880
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions crates/polars-plan/src/dsl/function_expr/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub enum StringFunction {
#[cfg(feature = "string_pad")]
ZFill,
#[cfg(feature = "find_many")]
ContainsMany {
ContainsAny {
ascii_case_insensitive: bool,
},
#[cfg(feature = "find_many")]
Expand Down Expand Up @@ -205,7 +205,7 @@ impl StringFunction {
.collect(),
)),
#[cfg(feature = "find_many")]
ContainsMany { .. } => mapper.with_dtype(DataType::Boolean),
ContainsAny { .. } => mapper.with_dtype(DataType::Boolean),
#[cfg(feature = "find_many")]
ReplaceMany { .. } => mapper.with_same_dtype(),
#[cfg(feature = "find_many")]
Expand Down Expand Up @@ -299,7 +299,7 @@ impl Display for StringFunction {
#[cfg(feature = "string_pad")]
ZFill => "zfill",
#[cfg(feature = "find_many")]
ContainsMany { .. } => "contains_many",
ContainsAny { .. } => "contains_any",
#[cfg(feature = "find_many")]
ReplaceMany { .. } => "replace_many",
#[cfg(feature = "find_many")]
Expand Down Expand Up @@ -407,10 +407,10 @@ impl From<StringFunction> for SpecialEq<Arc<dyn ColumnsUdf>> {
#[cfg(feature = "extract_jsonpath")]
JsonPathMatch => map_as_slice!(strings::json_path_match),
#[cfg(feature = "find_many")]
ContainsMany {
ContainsAny {
ascii_case_insensitive,
} => {
map_as_slice!(contains_many, ascii_case_insensitive)
map_as_slice!(contains_any, ascii_case_insensitive)
},
#[cfg(feature = "find_many")]
ReplaceMany {
Expand Down Expand Up @@ -439,7 +439,7 @@ impl From<StringFunction> for SpecialEq<Arc<dyn ColumnsUdf>> {
}

#[cfg(feature = "find_many")]
fn contains_many(s: &[Column], ascii_case_insensitive: bool) -> PolarsResult<Column> {
fn contains_any(s: &[Column], ascii_case_insensitive: bool) -> PolarsResult<Column> {
let ca = s[0].str()?;
let patterns = s[1].str()?;
polars_ops::chunked_array::strings::contains_any(ca, patterns, ascii_case_insensitive)
Expand Down
2 changes: 1 addition & 1 deletion crates/polars-plan/src/dsl/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl StringNameSpace {
#[cfg(feature = "find_many")]
pub fn contains_any(self, patterns: Expr, ascii_case_insensitive: bool) -> Expr {
self.0.map_many_private(
FunctionExpr::StringExpr(StringFunction::ContainsMany {
FunctionExpr::StringExpr(StringFunction::ContainsAny {
ascii_case_insensitive,
}),
&[patterns],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn can_pushdown_slice_past_projections(
//
// TODO: Simply checking that a column node is present does not handle e.g.:
// `select(c = Literal([1, 2, 3]).is_in(col(a)))`, for functions like `is_in`,
// `str.contains`, `str.contains_many` etc. - observe a column node is present
// `str.contains`, `str.contains_any` etc. - observe a column node is present
// but the output height is not dependent on it.
let mut has_column = false;
let mut literals_all_scalar = true;
Expand Down
6 changes: 3 additions & 3 deletions crates/polars-python/src/lazyframe/visitor/expr_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ pub enum PyStringFunction {
Titlecase,
Uppercase,
ZFill,
ContainsMany,
ContainsAny,
ReplaceMany,
EscapeRegex,
Normalize,
Expand Down Expand Up @@ -933,9 +933,9 @@ pub(crate) fn into_py(py: Python<'_>, expr: &AExpr) -> PyResult<PyObject> {
StringFunction::Uppercase => (PyStringFunction::Uppercase,).into_py_any(py),
StringFunction::ZFill => (PyStringFunction::ZFill,).into_py_any(py),
#[cfg(feature = "find_many")]
StringFunction::ContainsMany {
StringFunction::ContainsAny {
ascii_case_insensitive,
} => (PyStringFunction::ContainsMany, ascii_case_insensitive).into_py_any(py),
} => (PyStringFunction::ContainsAny, ascii_case_insensitive).into_py_any(py),
#[cfg(feature = "find_many")]
StringFunction::ReplaceMany {
ascii_case_insensitive,
Expand Down

0 comments on commit 088f880

Please sign in to comment.