paleolimbot commented on code in PR #13641:
URL: https://github.com/apache/arrow/pull/13641#discussion_r928885064


##########
r/R/dplyr.R:
##########
@@ -184,6 +184,29 @@ dim.arrow_dplyr_query <- function(x) {
   c(rows, cols)
 }
 
+#' @export
+unique.arrow_dplyr_query <- function(x, incomparables = FALSE, fromLast = 
FALSE, ...) {
+
+  if (incomparables == TRUE) {
+    arrow_not_supported("`unique()` with `incomparables = TRUE`")
+  }
+
+  if (fromLast == TRUE) {
+    arrow_not_supported("`unique()` with `fromLast = TRUE`")
+  }
+
+  x <- dplyr::distinct(x)
+  dplyr::collect(x)

Review Comment:
   Perhaps `unique()` should return the same type as the input (except maybe 
for Dataset, where returning an arrow_dplyr_query is safer)? I don't think 
anybody would expect to `collect()` if doing `unique(some_table)`, but when a 
pipeline starts with a dataset I think it's reasonable to force an explicit 
collect at the end?



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