Skip to content

compute_parquet() and compute_csv() do not pass options to the internal read_*_duckdb(). #729

@yusuke-sasaki-jprep

Description

@yusuke-sasaki-jprep

When trying to create an encrypted parquet with compute_parquet(), the file is created but an error occurs.

This is probably due to the fact that the options argument is not passed to the last read_parquet_duckdb() inside compute_parquet() (this line).
The same thing can be seen in compute_csv() (this line).

# Create sample data
sample_data <- data.frame(x = 1)

# Set encryption key (32-byte random key)
footer_key <- "your-32-byte-encryption-key-here"

# Register the key
duckplyr::db_exec(paste0("PRAGMA add_parquet_key('main_footer','", footer_key, "');"))

# This results in an error
duckplyr::compute_parquet(
  x = sample_data,
  path = "sample_data.parquet",
  options = list(encryption_config = data.frame(footer_key = 'main_footer'))
)
#> Error in `duckfun()`:
#> ! {"exception_type":"Invalid Input","exception_message":"File 'sample_data.parquet' is encrypted, but 'encryption_config' was not set"}

# but the file was created
file.exists("sample_data.parquet")
#> [1] TRUE

# Check encryption
# Cannot be read using the normal method
duckplyr::read_parquet_duckdb("sample_data.parquet")
#> Error in `duckfun()`:
#> ! {"exception_type":"Invalid Input","exception_message":"File 'sample_data.parquet' is encrypted, but 'encryption_config' was not set"}

# Can be read by passing encryption_config
duckplyr::read_parquet_duckdb(
  "sample_data.parquet",
  options = list(
    encryption_config = data.frame(footer_key = 'main_footer')
  )
)
#> # A duckplyr data frame: 1 variable
#>       x
#>   <dbl>
#> 1     1

Created on 2025-07-04 with reprex v2.1.1

Session info

sessioninfo::session_info()
#> Warning in system2("quarto", "-V", stdout = TRUE, env = paste0("TMPDIR=", :
#> running command '"quarto"
#> TMPDIR=C:/Users/Yusuke.Sasaki/AppData/Local/Temp/RtmpQjgIzF/file575017c75d5e
#> -V' had status 1
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.5.0 (2025-04-11 ucrt)
#>  os       Windows 11 x64 (build 26100)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  Japanese_Japan.utf8
#>  ctype    Japanese_Japan.utf8
#>  tz       Asia/Tokyo
#>  date     2025-07-04
#>  pandoc   3.4 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#>  quarto   NA @ C:\\PROGRA~1\\RStudio\\RESOUR~1\\app\\bin\\quarto\\bin\\quarto.exe
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date (UTC) lib source
#>  cachem        1.1.0   2024-05-16 [1] CRAN (R 4.5.0)
#>  cli           3.6.5   2025-04-23 [1] CRAN (R 4.5.0)
#>  collections   0.3.8   2025-05-08 [1] RSPM
#>  DBI           1.2.3   2024-06-02 [1] CRAN (R 4.5.0)
#>  digest        0.6.37  2024-08-19 [1] CRAN (R 4.5.0)
#>  dplyr         1.1.4   2023-11-17 [1] CRAN (R 4.5.0)
#>  duckdb        1.3.1   2025-06-23 [1] RSPM
#>  duckplyr      1.1.0   2025-05-08 [1] RSPM
#>  evaluate      1.0.4   2025-06-18 [1] RSPM
#>  fastmap       1.2.0   2024-05-15 [1] CRAN (R 4.5.0)
#>  fs            1.6.6   2025-04-12 [1] CRAN (R 4.5.0)
#>  generics      0.1.4   2025-05-09 [1] RSPM
#>  glue          1.8.0   2024-09-30 [1] CRAN (R 4.5.0)
#>  htmltools     0.5.8.1 2024-04-04 [1] CRAN (R 4.5.0)
#>  knitr         1.50    2025-03-16 [1] CRAN (R 4.5.0)
#>  lifecycle     1.0.4   2023-11-07 [1] CRAN (R 4.5.0)
#>  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.5.0)
#>  memoise       2.0.1   2021-11-26 [1] CRAN (R 4.5.0)
#>  pillar        1.10.2  2025-04-05 [1] CRAN (R 4.5.0)
#>  pkgconfig     2.0.3   2019-09-22 [1] CRAN (R 4.5.0)
#>  R6            2.6.1   2025-02-15 [1] CRAN (R 4.5.0)
#>  reprex        2.1.1   2024-07-06 [1] CRAN (R 4.5.0)
#>  rlang         1.1.6   2025-04-11 [1] CRAN (R 4.5.0)
#>  rmarkdown     2.29    2024-11-04 [1] CRAN (R 4.5.0)
#>  rstudioapi    0.17.1  2024-10-22 [1] CRAN (R 4.5.0)
#>  sessioninfo   1.2.3   2025-02-05 [1] RSPM
#>  tibble        3.3.0   2025-06-08 [1] RSPM
#>  tidyselect    1.2.1   2024-03-11 [1] CRAN (R 4.5.0)
#>  vctrs         0.6.5   2023-12-01 [1] CRAN (R 4.5.0)
#>  withr         3.0.2   2024-10-28 [1] CRAN (R 4.5.0)
#>  xfun          0.52    2025-04-02 [1] CRAN (R 4.5.0)
#>  yaml          2.3.10  2024-07-26 [1] CRAN (R 4.5.0)
#> 
#>  [1] C:/Users/Yusuke.Sasaki/AppData/Local/R/win-library/4.5
#>  [2] C:/Program Files/R/R-4.5.0/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────

Metadata

Metadata

Assignees

Labels

bugan unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions