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

Syntax error shown instead of unsupported function error #1000

Closed
slhck opened this issue Sep 8, 2022 · 4 comments · Fixed by #1001
Closed

Syntax error shown instead of unsupported function error #1000

slhck opened this issue Sep 8, 2022 · 4 comments · Fixed by #1001

Comments

@slhck
Copy link

slhck commented Sep 8, 2022

I wanted to test a function using quantile. I see it has been introduced here: 19909fa

Unfortunately it isn't available for SQLite, but instead of getting a message that would let me know that, there is a very obscure syntax error shown:

library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(dbplyr)
#> 
#> Attaching package: 'dbplyr'
#> The following objects are masked from 'package:dplyr':
#> 
#>     ident, sql

memdb_frame(x = runif(100)) %>%
  mutate(x = quantile(x, 0.95))
#> Warning: Missing values are always removed in SQL aggregation functions.
#> Use `na.rm = TRUE` to silence this warning
#> This warning is displayed once every 8 hours.
#> Error: near "(": syntax error

Created on 2022-09-08 by the reprex package (v2.0.1)

I was wondering if it is possible to allow for better user-facing error messages in cases where particular functions are not supported for a database dialect?

@slhck slhck changed the title Syntax error shown instead of unsupported function Syntax error shown instead of unsupported function error Sep 8, 2022
@mgirlich
Copy link
Collaborator

mgirlich commented Sep 9, 2022

Thanks. For unsupported verbs we usually have a better error message. I added one for quantile() on SQLite as well.

@slhck
Copy link
Author

slhck commented Sep 9, 2022

Thanks for the quick fix! 🎉

@emmansh
Copy link

emmansh commented Jan 1, 2023

I just ran into this problem as well. I have dbplyr version 2.2.1. Am I supposed to see the error still?

library(ggplot2)
library(dbplyr)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:dbplyr':
#> 
#>     ident, sql
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

memdb_frame(mpg) |> 
  group_by(manufacturer) |> 
  summarise(cty_pct80 = quantile(cty, 0.8, na.rm = TRUE))
#> Error: near "(": syntax error

sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value
#>  version  R version 4.2.2 (2022-10-31 ucrt)
#>  os       Windows 8.1 x64 (build 9600)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  English_United States.1252
#>  ctype    English_United States.1252
#>  tz       Asia/Jerusalem
#>  date     2023-01-01
#>  pandoc   2.19.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version date (UTC) lib source
#>  assertthat    0.2.1   2019-03-21 [1] CRAN (R 4.2.2)
#>  bit           4.0.4   2020-08-04 [1] CRAN (R 4.2.2)
#>  bit64         4.0.5   2020-08-30 [1] CRAN (R 4.2.2)
#>  blob          1.2.3   2022-04-10 [1] CRAN (R 4.2.1)
#>  cachem        1.0.6   2021-08-19 [1] CRAN (R 4.2.2)
#>  cli           3.4.1   2022-09-23 [1] CRAN (R 4.2.1)
#>  colorspace    2.0-3   2022-02-21 [1] CRAN (R 4.2.1)
#>  DBI           1.1.3   2022-06-18 [1] CRAN (R 4.2.1)
#>  dbplyr      * 2.2.1   2022-06-27 [1] CRAN (R 4.2.1)
#>  digest        0.6.30  2022-10-18 [1] CRAN (R 4.2.1)
#>  dplyr       * 1.0.10  2022-09-01 [1] CRAN (R 4.2.1)
#>  evaluate      0.18    2022-11-07 [1] CRAN (R 4.2.2)
#>  fansi         1.0.3   2022-03-24 [1] CRAN (R 4.2.1)
#>  fastmap       1.1.0   2021-01-25 [1] CRAN (R 4.2.2)
#>  fs            1.5.2   2021-12-08 [1] CRAN (R 4.2.2)
#>  generics      0.1.3   2022-07-05 [1] CRAN (R 4.2.1)
#>  ggplot2     * 3.4.0   2022-11-04 [1] CRAN (R 4.2.2)
#>  glue          1.6.2   2022-02-24 [1] CRAN (R 4.2.1)
#>  gtable        0.3.1   2022-09-01 [1] CRAN (R 4.2.1)
#>  highr         0.9     2021-04-16 [1] CRAN (R 4.2.2)
#>  htmltools     0.5.3   2022-07-18 [1] CRAN (R 4.2.1)
#>  knitr         1.40    2022-08-24 [1] CRAN (R 4.2.1)
#>  lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.2.1)
#>  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.2.1)
#>  memoise       2.0.1   2021-11-26 [1] CRAN (R 4.2.2)
#>  munsell       0.5.0   2018-06-12 [1] CRAN (R 4.2.2)
#>  pillar        1.8.1   2022-08-19 [1] CRAN (R 4.2.1)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.2.2)
#>  purrr         0.3.5   2022-10-06 [1] CRAN (R 4.2.1)
#>  R6            2.5.1   2021-08-19 [1] CRAN (R 4.2.2)
#>  Rcpp          1.0.9   2022-07-08 [1] CRAN (R 4.2.1)
#>  reprex        2.0.2   2022-08-17 [1] CRAN (R 4.2.1)
#>  rlang         1.0.6   2022-09-24 [1] CRAN (R 4.2.1)
#>  rmarkdown     2.18    2022-11-09 [1] CRAN (R 4.2.2)
#>  RSQLite       2.2.18  2022-10-04 [1] CRAN (R 4.2.1)
#>  rstudioapi    0.14    2022-08-22 [1] CRAN (R 4.2.1)
#>  scales        1.2.1   2022-08-20 [1] CRAN (R 4.2.1)
#>  sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.2.2)
#>  stringi       1.7.8   2022-07-11 [1] CRAN (R 4.2.1)
#>  stringr       1.4.1   2022-08-20 [1] CRAN (R 4.2.1)
#>  tibble        3.1.8   2022-07-22 [1] CRAN (R 4.2.1)
#>  tidyselect    1.2.0   2022-10-10 [1] CRAN (R 4.2.1)
#>  utf8          1.2.2   2021-07-24 [1] CRAN (R 4.2.2)
#>  vctrs         0.5.0   2022-10-22 [1] CRAN (R 4.2.1)
#>  withr         2.5.0   2022-03-03 [1] CRAN (R 4.2.1)
#>  xfun          0.34    2022-10-18 [1] CRAN (R 4.2.2)
#>  yaml          2.3.6   2022-10-18 [1] CRAN (R 4.2.1)
#> 
#>  [1] C:/Program Files/R/my_packages
#>  [2] C:/Program Files/R/R-4.2.2/library
#> 
#> ------------------------------------------------------------------------------

Created on 2023-01-01 with reprex v2.0.2

@mgirlich
Copy link
Collaborator

mgirlich commented Jan 2, 2023

The new error message is currently only seen in the dev version. We plan to release this to CRAN this month 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants