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

[R] Inscrutable error while running Rscript data-raw/codegen.R #40858

Closed
amoeba opened this issue Mar 28, 2024 · 3 comments · Fixed by #40859
Closed

[R] Inscrutable error while running Rscript data-raw/codegen.R #40858

amoeba opened this issue Mar 28, 2024 · 3 comments · Fixed by #40859
Assignees
Milestone

Comments

@amoeba
Copy link
Member

amoeba commented Mar 28, 2024

Describe the bug, including details regarding any error messages, version, and platform.

While installing the package from source, I get a strange error,

> R CMD INSTALL --preclean --no-multiarch .
* installing to library/Users/bryce/Library/Caches/org.R-project.R/R/renv/library/r-380ad223/R-4.3/aarch64-apple-darwin20* installing *source* packagearrow...
** using staged installation
*** Generating code with data-raw/codegen.R
*** > 542 functions decorated with [[arrow|acero|dataset|substrait|parquet|s3|gcs|json::export]]
Error in `pmap_chr()`:In index: 1.
Caused by error:
! argument "..3" is missing, with no default
Backtrace:1. ├─... %>% glue_collapse(sep = "\n")
  2. ├─glue::glue_collapse(., sep = "\n")
  3. ├─purrr::pmap_chr(...)
  4. │ └─purrr:::pmap_("character", .l, .f, ..., .progress = .progress)
  5. │   ├─purrr:::with_indexed_errors(...)
  6. │   │ └─base::withCallingHandlers(...)
  7. │   ├─purrr:::call_with_cleanup(...)
  8. │   └─.f(...)
  9. │     └─glue::glue(...)
 10. │       └─glue::glue_data(...)
 11. │         └─base::lapply(...)
 12. │           └─glue (local) FUN(X[[i]], ...)
 13. │             ├─eval(call("force", as.symbol(paste0("..", x)))) %||% .null
 14. │             ├─base::eval(call("force", as.symbol(paste0("..", x))))
 15. │             │ └─base::eval(call("force", as.symbol(paste0("..", x))))
 16. │             └─base::force(..3)
 17. └─base::.handleSimpleError(...)
 18.   └─purrr (local) h(simpleError(msg, call))
 19.     └─cli::cli_abort(...)
 20.       └─rlang::abort(...)
Execution halted

Installation continues and succeeds but the error was new to me. When I run data-raw/codegen.R directly, I get the same error. Can anyone reproduce this?

The error comes from some of the glue::glue calls in codegen.R and can be triggered by including a dangling comma in the call like in this basic example:

> x <- "x"; glue::glue("{x}",) # <- trailing comma
Error in eval(call("force", as.symbol(paste0("..", x)))) : 
  argument "..2" is missing, with no default

An example of where we call like this is,

arrow/r/data-raw/codegen.R

Lines 144 to 149 in 6cecbab

glue::glue("
// {basename(file)}
{ifdef_wrap(cpp11_wrapped, name, sexp_signature, decoration)}
",
sep = "\n",
)

I'm really not sure what could have changed here. I'll put up a PR to remove the dangling commas but I want to figure out how this worked before and why it's not working on my system any longer.

Session Info
─ Session info ──────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.3.3 (2024-02-29)
 os       macOS Sonoma 14.4
 system   aarch64, darwin20
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       America/Juneau
 date     2024-03-27
 pandoc   3.1.12.3 @ /opt/homebrew/bin/pandoc

─ Packages ──────────────────────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 cachem        1.0.8   2023-05-01 [1] CRAN (R 4.3.0)
 callr         3.7.3   2022-11-02 [1] CRAN (R 4.3.0)
 cli           3.6.1   2023-03-23 [1] CRAN (R 4.3.0)
 crayon        1.5.2   2022-09-29 [1] CRAN (R 4.3.0)
 devtools      2.4.5   2022-10-11 [1] CRAN (R 4.3.0)
 digest        0.6.33  2023-07-07 [1] CRAN (R 4.3.0)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.3.0)
 fastmap       1.1.1   2023-02-24 [1] CRAN (R 4.3.0)
 fs            1.6.3   2023-07-20 [1] CRAN (R 4.3.0)
 glue          1.6.2   2022-02-24 [1] CRAN (R 4.3.0)
 htmltools     0.5.6   2023-08-10 [1] CRAN (R 4.3.0)
 htmlwidgets   1.6.2   2023-03-17 [1] CRAN (R 4.3.0)
 httpuv        1.6.11  2023-05-11 [1] CRAN (R 4.3.0)
 later         1.3.1   2023-05-02 [1] CRAN (R 4.3.0)
 lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.3.0)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.3.0)
 memoise       2.0.1   2021-11-26 [1] CRAN (R 4.3.0)
 mime          0.12    2021-09-28 [1] CRAN (R 4.3.0)
 miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0)
 pkgbuild      1.4.2   2023-06-26 [1] CRAN (R 4.3.0)
 pkgload       1.3.3   2023-09-22 [1] CRAN (R 4.3.1)
 prettyunits   1.2.0   2023-09-24 [1] CRAN (R 4.3.1)
 processx      3.8.2   2023-06-30 [1] CRAN (R 4.3.0)
 profvis       0.3.8   2023-05-02 [1] CRAN (R 4.3.0)
 promises      1.2.0.1 2021-02-11 [1] CRAN (R 4.3.0)
 ps            1.7.5   2023-04-18 [1] CRAN (R 4.3.0)
 purrr         1.0.2   2023-08-10 [1] CRAN (R 4.3.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.3.0)
 Rcpp          1.0.11  2023-07-06 [1] CRAN (R 4.3.0)
 remotes       2.4.2   2021-11-30 [1] CRAN (R 4.3.0)
 rlang         1.1.3   2024-01-10 [1] CRAN (R 4.3.1)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
 shiny         1.7.4.1 2023-07-06 [1] CRAN (R 4.3.0)
 stringi       1.7.12  2023-01-11 [1] CRAN (R 4.3.0)
 stringr       1.5.0   2022-12-02 [1] CRAN (R 4.3.0)
 urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.3.0)
 usethis       2.2.2   2023-07-06 [1] CRAN (R 4.3.0)
 vctrs         0.6.3   2023-06-14 [1] CRAN (R 4.3.0)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 4.3.0)

 [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library

─────────────────────────────────────────────────────────────────────────────────────

Component(s)

R

@amoeba
Copy link
Member Author

amoeba commented Mar 28, 2024

This looks to be related to tidyverse/glue#320. I think merging PR associated with this issue is fine no matter what happens there.

@amoeba
Copy link
Member Author

amoeba commented Mar 28, 2024

I narrowed it down to a seemingly undocumented change in R 4.3.3. glue may choose to fix this on their end in a future release but I think we have everything we need to merge this.

@amoeba amoeba added this to the 16.0.0 milestone Mar 28, 2024
@amoeba
Copy link
Member Author

amoeba commented Mar 28, 2024

Issue resolved by pull request 40859
#40859

@amoeba amoeba closed this as completed Mar 28, 2024
amoeba added a commit that referenced this issue Mar 28, 2024
### Rationale for this change

This is a draft PR fixing #40858, though I'm not sure how or why this broke (or worked correctly).

Fixes #40858

### Are these changes tested?

These have been tested locally.
* GitHub Issue: #40858

Authored-by: Bryce Mecum <petridish@gmail.com>
Signed-off-by: Bryce Mecum <petridish@gmail.com>
tolleybot pushed a commit to tmct/arrow that referenced this issue May 2, 2024
### Rationale for this change

This is a draft PR fixing apache#40858, though I'm not sure how or why this broke (or worked correctly).

Fixes apache#40858

### Are these changes tested?

These have been tested locally.
* GitHub Issue: apache#40858

Authored-by: Bryce Mecum <petridish@gmail.com>
Signed-off-by: Bryce Mecum <petridish@gmail.com>
vibhatha pushed a commit to vibhatha/arrow that referenced this issue May 25, 2024
### Rationale for this change

This is a draft PR fixing apache#40858, though I'm not sure how or why this broke (or worked correctly).

Fixes apache#40858

### Are these changes tested?

These have been tested locally.
* GitHub Issue: apache#40858

Authored-by: Bryce Mecum <petridish@gmail.com>
Signed-off-by: Bryce Mecum <petridish@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant