Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap call as list before applying map() #1085

Merged
merged 4 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Imports:
magrittr,
methods,
pillar (>= 1.5.0),
purrr (>= 0.3.5),
purrr (>= 1.0.0),
R6 (>= 2.2.2),
rlang (>= 1.0.6),
tibble (>= 1.4.2),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# dbplyr (development version)

* Compatibility with purrr 1.0.0 (@mgirlich, #1085).

## New features

* `stringr::str_like()` (new in 1.5.0) is translated to the closest `LIKE`
Expand Down
2 changes: 1 addition & 1 deletion R/optimise-utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ expr_uses_var <- function(x, vars) {
return(is_symbol(x, vars))
}

any(purrr::map_lgl(x[-1], expr_uses_var, vars))
any(purrr::map_lgl(as.list(x[-1]), expr_uses_var, vars))
}
4 changes: 3 additions & 1 deletion tests/testthat/_snaps/escape.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
Code
lf %>% filter(a == input$x) %>% show_query()
Condition
Error:
Error in `purrr::map_chr()`:
i In index: 1.
Caused by error:
! Cannot translate shiny inputs to SQL.
i Do you want to force evaluation in R with (e.g.) `!!input$x` or `local(input$x)`?

Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/_snaps/verb-expand.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@
Code
tidyr::expand(memdb_frame(x = 1, y = 1), nesting(x, x = x + 1))
Condition
Error in `tidyr::expand()`:
Error in `purrr::map()`:
i In index: 1.
Caused by error in `tidyr::expand()`:
! Names must be unique.
x These names are duplicated:
* "x" at locations 1 and 2.
Expand Down
6 changes: 5 additions & 1 deletion tests/testthat/_snaps/verb-pivot-longer.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@
(expect_error(tidyr::pivot_longer(df, x, values_transform = 1)))
Output
<error/rlang_error>
Error in `dbplyr_pivot_longer_spec()`:
Error in `purrr::map()`:
i In index: 1.
Caused by error in `map2()`:
i In index: 1.
Caused by error in `dbplyr_pivot_longer_spec()`:
! Can't convert to a function.
Code
(expect_error(tidyr::pivot_longer(df, x, values_transform = list(~.x))))
Expand Down
8 changes: 6 additions & 2 deletions tests/testthat/_snaps/verb-pivot-wider.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@

---

Can't convert to a function.
i In index: 2.
Caused by error in `dbplyr_pivot_wider_spec()`:
! Can't convert to a function.

# values_fn cannot be NULL

Expand All @@ -76,7 +78,9 @@
(expect_error(tidyr::pivot_wider(df, id_cols = id, unused_fn = 1)))
Output
<error/rlang_error>
Error in `dbplyr_pivot_wider_spec()`:
Error in `map2()`:
i In index: 1.
Caused by error in `dbplyr_pivot_wider_spec()`:
! Can't convert to a function.

# can fill in missing cells
Expand Down