Skip to content

mutate(x = across(c(a, b)) should error #761

Description

@mgirlich

In dplyr a nested tibble is created which is not possible in dbplyr, so this should error

library(dplyr, warn.conflicts = FALSE)
suppressMessages(devtools::load_all("~/GitHub/dbplyr/"))


tibble(a = 1, b = 2) %>% 
  mutate(a = 2, x = across())
#> # A tibble: 1 × 3
#>       a     b   x$a    $b
#>   <dbl> <dbl> <dbl> <dbl>
#> 1     2     2     2     2

lazy_frame(a = 1, b = 2) %>% 
  mutate(a = 2, x = across())
#> <SQL>
#> SELECT `a`, `b`
#> FROM (
#>   SELECT 2.0 AS `a`, `b`
#>   FROM `df`
#> ) `q01`

Created on 2022-01-19 by the reprex package (v2.0.1)

TEST

test_that("mutate() error if gets multiple columns in across()", {
  df <- lazy_frame(a = 1, b = 2)
  expect_snapshot({
    (expect_error(mutate(df, a = 2, x = across())))
  })
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementfunc trans 🌍Translation of individual functions to SQL

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions