HyukjinKwon commented on code in PR #48630:
URL: https://github.com/apache/arrow/pull/48630#discussion_r2650036610


##########
r/tests/testthat/test-dplyr-join.R:
##########
@@ -188,8 +188,41 @@ test_that("Error handling for unsupported expressions in 
join_by", {
   )
 })
 
-# TODO: test duplicate col names
-# TODO: casting: int and float columns?
+test_that("joins with duplicate column names", {
+  # When column names are duplicated (not in by), suffixes are added
+  left_dup <- tibble::tibble(
+    x = 1:5,
+    y = 1:5,
+    z = letters[1:5]
+  )
+  right_dup <- tibble::tibble(
+    x = 1:5,
+    y = 6:10,
+    z = LETTERS[1:5]
+  )
+
+  compare_dplyr_binding(
+    .input |>
+      left_join(right_dup, by = "x") |>
+      collect(),
+    left_dup
+  )
+
+  compare_dplyr_binding(
+    .input |>
+      inner_join(right_dup, by = "x") |>
+      collect(),
+    left_dup
+  )
+
+  # Test with custom suffixes
+  compare_dplyr_binding(
+    .input |>
+      left_join(right_dup, by = "x", suffix = c("_left", "_right")) |>
+      collect(),
+    left_dup
+  )
+})

Review Comment:
   Sure! let me take a look!



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