thisisnic commented on code in PR #49795:
URL: https://github.com/apache/arrow/pull/49795#discussion_r3118229333


##########
r/tests/testthat/test-dplyr-filter.R:
##########
@@ -287,11 +287,21 @@ test_that("filter environment scope", {
 })
 
 test_that("Filtering on a column that doesn't exist errors correctly", {
+  # expect_warning(., NA) because the usual behavior when it hits a filter
+  # that it can't evaluate is to raise a warning, collect() to R, and retry
+  # the filter. But we want this to error the first time because it's
+  # a user error, not solvable by retrying in R
+  expect_warning(
+    expect_error(
+      tbl |> record_batch() |> filter(not_a_col == 42) |> collect(),
+      class = "validation_error"
+    ),
+    NA
+  )
+})

Review Comment:
   When you say side-stepping, how do you mean?  I didn't want to lose the 
language-specific stuff, but it was erroring when both were in the same test, 
and so I split it out into two separate tests.  
   
   There's some weird stuff going on which I dug into with Claude (which 
couldn't figure it out properly), around the language not getting reset 
properly when it's within the same test block, even with the use of 
`with_language()`.  It probably warrants a ticket opening on `withr` if I can 
make a decent reprex, but it feels like there's a weird intersection between 
runner environment and code, so I might just have to point at this PR as I 
don't have that much time to spend on it.
   
   This most recent commit was to see if we get a difference between separate 
expectations in the same test, versus separate tests, which looks like it 
passes, so the difference is some underlying mechanism around the test setup 
rather than our code not outputting locale-specific errors properly - does that 
make sense, or is there some other nuance I'm missing here?
   
   (Side-note: am I being paranoid, or does "is there some other nuance I'm 
missing here?" sound really passive-aggressive? 😬  I trust you know I don't 
mean it like that! 😆  )



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to