Skip to content

fix: Remove deprecation message from upstream polars in some cases with %in%#259

Merged
etiennebacher merged 3 commits intoetiennebacher:mainfrom
ppanko:is_in-deprecation-warning
Oct 21, 2025
Merged

fix: Remove deprecation message from upstream polars in some cases with %in%#259
etiennebacher merged 3 commits intoetiennebacher:mainfrom
ppanko:is_in-deprecation-warning

Conversation

@ppanko
Copy link
Copy Markdown
Contributor

@ppanko ppanko commented Oct 21, 2025

Presumably fixes (#258); not sure if this change has implications elsewhere in the codebase.

@ppanko ppanko changed the title Adding implode in cases where %in% opreator is used Adding implode to rhs vector in cases where %in% opreator is used Oct 21, 2025
@ppanko ppanko closed this Oct 21, 2025
@ppanko ppanko changed the title Adding implode to rhs vector in cases where %in% opreator is used Adding implode to rhs vector in cases where %in% operator is used Oct 21, 2025
@etiennebacher etiennebacher reopened this Oct 21, 2025
@etiennebacher
Copy link
Copy Markdown
Owner

etiennebacher commented Oct 21, 2025

I don't think this would change any behavior. The message is about a deprecated usage that will change in a future version of polars, it was already doing the required change under the hood.

I don't have a good way to test the absence of a message since it appears that this is not really considered as a standard message by R, i.e. those tests wouldn't work as expected before this PR:

expect_message(
  iris_pd |> 
    head() |> 
    filter(Species %in% c("setosa", "virginica"))
)

# Error (but shouldn't):
# ! `filter(head(iris_pd), Species %in% c("setosa", "virginica"))` did not throw the expected message.

expect_silent(
  iris_pd |> 
    head() |> 
    filter(Species %in% c("setosa", "virginica"))
)
# doesn't error while it should

So I just added an extra test to ensure that the $implode() doesn't change anything.

Thanks for opening the issue and the PR!

@etiennebacher etiennebacher changed the title Adding implode to rhs vector in cases where %in% operator is used fix: Remove deprecation message from upstream polars in some cases with %in% Oct 21, 2025
@etiennebacher etiennebacher merged commit 1c94bac into etiennebacher:main Oct 21, 2025
8 of 9 checks passed
@ppanko ppanko deleted the is_in-deprecation-warning branch October 21, 2025 19:47
@ppanko
Copy link
Copy Markdown
Contributor Author

ppanko commented Oct 22, 2025

As far as I can tell, the deprecation message seems to go through the OS-level stderr. A workaround for testing whether %in% triggers the message could be to capture the output from a separate R session. For example:

testthat::test_that("`is_in` deprecation warning is not captured", {
 scriptToRun <-
   'sink <- dplyr::filter(tidypolars::as_polars_df(head(iris)), Species %in% "setosa")'
 result <- system2(
   R.home("bin/Rscript"), c("-e", shQuote(scriptToRun)), stderr = TRUE
 )
 testthat::expect_true(!any(grepl("issues\\/22149", result)))
})

@etiennebacher
Copy link
Copy Markdown
Owner

Thanks for the workaround, but that seems quite hacky and wouldn't work on Windows as far as I can see so I'm not convinced it should be part of the test suite. I had seen the deprecation message before, I just couldn't have it reliably so let it aside until you reported it.

@eitsupi
Copy link
Copy Markdown
Contributor

eitsupi commented Oct 22, 2025

Just wondering, doesn't snapshot testing work?

I think r-polars tests messages generated on the Rust side with snapshot tests.

@etiennebacher
Copy link
Copy Markdown
Owner

True, forgot about that, I guess I was mostly annoyed by the fact this doesn't happen on Windows (and potentially macOS, I can't test on this platform). I'll add a test later

@etiennebacher
Copy link
Copy Markdown
Owner

I just tested and the message also doesn't appear in snapshot tests (before the fix).

@ppanko
Copy link
Copy Markdown
Contributor Author

ppanko commented Oct 22, 2025

polars' handle_result bridge doesn't seem to handle Rust-side warnings, so the message bypasses R and cannot be intercepted by R-side sinks.

Whether or not the message appears is dependent on how the R console/process captures the subprocesses' stderr. On my Windows machine, the message does not appear in RGui or RStudio, but does appear if using Rscript or Emacs+ESS.

@eitsupi
Copy link
Copy Markdown
Contributor

eitsupi commented Oct 23, 2025

Oh, thanks for the detail.
Maybe supporting Rust side warnings is a interesting new feature for savvy.

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.

3 participants