From fbc8944322ec843d26812f7e1280b38bb44de867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 6 Aug 2023 19:26:16 +0200 Subject: [PATCH] Remove tbl_vars() implementation --- NAMESPACE | 1 - R/tbl_vars.R | 27 --------------------------- dplyr-methods/tbl_vars.txt | 3 --- patch/tbl_vars.patch | 29 ----------------------------- tools/00-funs.R | 4 +++- 5 files changed, 3 insertions(+), 61 deletions(-) delete mode 100644 R/tbl_vars.R delete mode 100644 dplyr-methods/tbl_vars.txt delete mode 100644 patch/tbl_vars.patch diff --git a/NAMESPACE b/NAMESPACE index 8268c0ed..bfdaace5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -81,7 +81,6 @@ S3method(slice_head,duckplyr_df) S3method(slice_tail,duckplyr_df) S3method(summarise,duckplyr_df) S3method(symdiff,duckplyr_df) -S3method(tbl_vars,duckplyr_df) S3method(transmute,duckplyr_df) S3method(ungroup,duckplyr_df) S3method(union,duckplyr_df) diff --git a/R/tbl_vars.R b/R/tbl_vars.R deleted file mode 100644 index b98d1825..00000000 --- a/R/tbl_vars.R +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by 02-duckplyr_df-methods.R -#' @export -tbl_vars.duckplyr_df <- function(x) { - # Our implementation - # Avoid rel_try(), it's not an error if the input is not an ALTREP df - tryCatch( - { - rel <- duckdb:::rel_from_altrep_df(x) - return(rel_names(rel)) - }, - error = identity - ) - - # dplyr implementation - names(x) -} - -duckplyr_tbl_vars <- function(x, ...) { - try_fetch( - x <- as_duckplyr_df(x), - error = function(e) { - testthat::skip(conditionMessage(e)) - } - ) - out <- tbl_vars(x, ...) - out -} diff --git a/dplyr-methods/tbl_vars.txt b/dplyr-methods/tbl_vars.txt deleted file mode 100644 index 43b05cc1..00000000 --- a/dplyr-methods/tbl_vars.txt +++ /dev/null @@ -1,3 +0,0 @@ -tbl_vars.data.frame <- function(x) { - names(x) -} diff --git a/patch/tbl_vars.patch b/patch/tbl_vars.patch deleted file mode 100644 index 0d5ccfd6..00000000 --- a/patch/tbl_vars.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git b/R/tbl_vars.R a/R/tbl_vars.R -index 8c28d2d..b98d182 100644 ---- b/R/tbl_vars.R -+++ a/R/tbl_vars.R -@@ -2,18 +2,15 @@ - #' @export - tbl_vars.duckplyr_df <- function(x) { - # Our implementation -- rel_try( -- "No relational implementation for tbl_vars()" = TRUE, -+ # Avoid rel_try(), it's not an error if the input is not an ALTREP df -+ tryCatch( - { -- return(out) -- } -+ rel <- duckdb:::rel_from_altrep_df(x) -+ return(rel_names(rel)) -+ }, -+ error = identity - ) - -- # dplyr forward -- tbl_vars <- dplyr:::tbl_vars.data.frame -- out <- tbl_vars(x) -- return(out) -- - # dplyr implementation - names(x) - } diff --git a/tools/00-funs.R b/tools/00-funs.R index ff03099f..76c941e1 100644 --- a/tools/00-funs.R +++ b/tools/00-funs.R @@ -27,7 +27,9 @@ df_methods <- # methods we don't need to implement but can test mutate(skip_impl = name %in% c( "collapse", "tally", - "slice_min", "slice_max", "slice_sample" + "slice_min", "slice_max", "slice_sample", + "tbl_vars", + NULL )) %>% mutate(is_tbl_return = !(name %in% c( # Special case: forward to `NextMethod()`, don't change output