Skip to content

Navigation Menu

Sign in
Sign up

GH-39688: [R] "Error: Filter expression not supported for Arrow Datasets" using "date" expression rigth hand side of a filter - #51291

Open
thisisnic wants to merge 1 commit into
apache:main from
thisisnic:GH-39688-shadowed-names
Open

GH-39688: [R] "Error: Filter expression not supported for Arrow Datasets" using "date" expression rigth hand side of a filter #51291
thisisnic wants to merge 1 commit into
apache:main from
thisisnic:GH-39688-shadowed-names

Conversation

@thisisnic

@thisisnic thisisnic commented Sep 10, 2026
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Member

Rationale for this change

Error when user tries to use local variable in dplyr pipeline in Arrow

What changes are included in this PR?

Make sure we attach them to the mask

Are these changes tested?

Yup

Are there any user-facing changes?

Yep

Copilot AI lite review requested due to automatic review settings September 10, 2026 17:25

Copy link
Copy Markdown

⚠️ GitHub issue #39688 has been automatically assigned in GitHub to PR creator.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

add_user_variables_to_mask() uses get0() without inherits=TRUE, which can fail to find lexically-scoped variables in parent environments and still diverge from dplyr’s name resolution.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR addresses GH-39688 in Arrow’s R dplyr integration by ensuring that user-defined variables referenced in expressions (e.g., date, day) are correctly resolved even when they share names with Arrow’s function bindings, matching dplyr’s intended masking behavior.

Changes:

  • Extend arrow_eval() to bind user variables into the evaluation mask when they would otherwise be shadowed by function bindings.
  • Add regression tests covering both filter() and mutate() when symbols like date/day collide with function bindings.
File summaries
File Description
r/R/dplyr-eval.R Adds logic to detect and bind shadowed user variables into the evaluation mask.
r/tests/testthat/test-dplyr-filter.R Adds a regression test for filter() symbol collisions with bindings (date, day).
r/tests/testthat/test-dplyr-mutate.R Adds a regression test for mutate() symbol collisions with bindings (day).
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread r/R/dplyr-eval.R
Comment on lines +147 to +151
for (var_name in shadowed) {
user_var <- get0(var_name, quo_env)
# Functions from the user's environment (like lubridate::day) shouldn't
# take precedence over the bindings
if (!is.null(user_var) && !is.function(user_var)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort, defaults to Lite
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@jonkeane jonkeane Awaiting requested review from jonkeane jonkeane is a code owner

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /