Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor!: rewrite str$contains() #982

Merged
merged 6 commits into from
Mar 30, 2024
Merged

refactor!: rewrite str$contains() #982

merged 6 commits into from
Mar 30, 2024

Conversation

eitsupi
Copy link
Collaborator

@eitsupi eitsupi commented Mar 29, 2024

No description provided.

@eitsupi eitsupi marked this pull request as ready for review March 29, 2024 13:25
Copy link
Collaborator

@etiennebacher etiennebacher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, some minor comments

R/expr__string.R Outdated Show resolved Hide resolved
R/expr__string.R Outdated Show resolved Hide resolved
R/expr__string.R Outdated
Comment on lines 451 to 455
#' # The inline `(?i)` syntax example
#' pl$DataFrame(s = c("AAA", "aAa", "aaa"))$with_columns(
#' default_match = pl$col("s")$str$contains("AA"),
#' insensitive_match = pl$col("s")$str$contains("(?i)AA")
#' )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to showcase this

R/expr__string.R Outdated Show resolved Hide resolved
Some(true) => self.0.clone().str().contains_literal(pat.0.clone()),
_ => self.0.clone().str().contains(pat.0.clone(), strict),
})
pub fn str_contains(&self, pat: &RPolarsExpr, literal: Robj, strict: Robj) -> RResult<Self> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't pat be Robj here? I think that would remove the need for .0.clone() below

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.
The conversion to Expr on the Rust side was shown to be sufficient and conversion on the R side was found to be unnecessary.

eitsupi and others added 3 commits March 30, 2024 12:19
Co-authored-by: Etienne Bacher <52219252+etiennebacher@users.noreply.github.com>
@eitsupi eitsupi merged commit 1f7c927 into main Mar 30, 2024
35 checks passed
@eitsupi eitsupi deleted the str_contains branch March 30, 2024 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants