jonkeane commented on a change in pull request #12113:
URL: https://github.com/apache/arrow/pull/12113#discussion_r823941962



##########
File path: r/tests/testthat/test-dplyr-join.R
##########
@@ -248,6 +247,26 @@ test_that("arrow dplyr query correctly filters then 
joins", {
   )
 })
 
+test_that("suffix", {
+  left_suf <- Table$create(
+    key = c(1, 2),
+    left_unique = c(2.1, 3.1),
+    shared = c(10.1, 10.3)
+  )
+
+  right_suf <- Table$create(
+    key = c(1, 2, 3, 10, 20),
+    right_unique = c(1.1, 1.2, 3.1, 4.1, 4.3),
+    shared = c(20.1, 30, 40, 50, 60)
+  )
+
+  join_op <- inner_join(left_suf, right_suf, by = "key", suffix = c("_left", 
"_right"))
+  output <- collect(join_op)
+  res_col_names <- names(output)
+  expected_col_names <- c("key", "left_unique", "shared_left", "right_unique", 
"shared_right")
+  expect_equal(expected_col_names, res_col_names)
+})

Review comment:
       We should also try a version where we summarize first and then join 
(because of how the flow in implicit schema works):
   
   Something like:
   
   ```
   left_suf <- Table$create(
       key = c(1, 2, 1, 2),
       left_unique = c(2.1, 3.1, 4.1, 6.1),
       shared = c(10.1, 10.3, 10.2, 10.4)
     )
   
     right_suf <- Table$create(
       key = c(1, 2, 3, 10, 20),
       right_unique = c(1.1, 1.2, 3.1, 4.1, 4.3),
       shared = c(20.1, 30, 40, 50, 60)
     )
   
   
    joined <- left_suf %>%
       group_by(key) %>%
       summarize(left_unique = mean(left_unique), shared = mean(shared)) %>%
       inner_join(right_suf, by = "key", suffix = c("_left", "_right"))
     
     output <- collect(joined)
     res_col_names <- names(output)
     expected_col_names <- c("key", "left_unique", "shared_left", 
"right_unique", "shared_right")
     expect_equal(expected_col_names, res_col_names)
   ```




-- 
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