You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/04/07 16:53:25 UTC

[GitHub] [arrow] ianmcook commented on a change in pull request #9927: ARROW-11754: [R] Support dplyr::compute()

ianmcook commented on a change in pull request #9927:
URL: https://github.com/apache/arrow/pull/9927#discussion_r608829420



##########
File path: r/R/dplyr.R
##########
@@ -619,9 +619,23 @@ collect.arrow_dplyr_query <- function(x, as_data_frame = TRUE, ...) {
     restore_dplyr_features(tab, x)
   }
 }
-collect.ArrowTabular <- as.data.frame.ArrowTabular
+collect.ArrowTabular <- function(x, as_data_frame = TRUE, ...) {
+  if (as_data_frame) as.data.frame(x, ...) else x
+}
 collect.Dataset <- function(x, ...) dplyr::collect(arrow_dplyr_query(x), ...)
 
+compute.arrow_dplyr_query <- function(x, ...) dplyr::collect(x, as_data_frame = FALSE)
+compute.ArrowTabular <- function(x, ...) x
+compute.Dataset <- function(x, ...) {
+  dplyr::collect(arrow_dplyr_query(x), as_data_frame = FALSE, ...)
+}
+# for compatibility with dplyr 1.0.5 and earlier (https://github.com/tidyverse/dplyr/pull/5783):
+if ("name" %in% names(formals(dplyr::compute))) {

Review comment:
       This is to avoid the dreaded "S3 generic/method consistency" warnings from `R CMD check`, which by my recollection can be triggered if the method args do not include _all_ of the generic's formal args (dots or not).




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

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