nealrichardson commented on code in PR #19706:
URL: https://github.com/apache/arrow/pull/19706#discussion_r1072489324


##########
r/tests/testthat/test-dplyr-query.R:
##########
@@ -759,3 +759,27 @@ test_that("Can use nested field refs", {
       filter(nested > 7)
   )
 })
+
+test_that("Use struct_field for $ on non-field-ref", {
+  compare_dplyr_binding(
+    .input %>%
+      mutate(
+        df_col = tibble(i = int, d = dbl)
+      ) %>%
+      transmute(
+        int2 = df_col$i,
+        dbl2 = df_col$d
+      ) %>%
+      collect(),
+    example_data
+  )
+})
+
+test_that("nested field ref error handling", {
+  expect_error(
+    example_data %>%
+      arrow_table() %>%
+      mutate(x = int$nested) %>%
+      compute()
+  )

Review Comment:
   It's the usual "No match for `field_ref->ToString()` in 
`schema->ToString()`". I wanted to check (which I did visually) that it was 
sensible, which it is, and then the test basically asserts that it doesn't try 
to compute something wrong and doesn't segfault. Since the error comes from C++ 
I thought it best not to assert something specific about it. 



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to