Skip to content

ADBC driver doesn't work? #2530

Open
Open
@yutannihilation

Description

@yutannihilation

Describe the bug

As of GDAL 3.11, ADBC driver is available. But, it seems it doesn't work with sf. I investigated if this is a problem on GDAL's side (OSGeo/gdal#10887 (comment)), but GDAL seems fine.

Note that, while I can just use the CRAN version on Window, macOS still uses GDAL 3.8.5, and ubuntugis-unstable PPA is also still 3.10.3. If you are on macOS or Ubuntu, you need to prepare the latest GDAL libary and compile sf from source.

To Reproduce

# check if ADBC driver is available
sf::st_drivers() |> dplyr::filter(name == "ADBC")
#>      name                   long_name write  copy is_raster is_vector   vsi
#> ADBC ADBC Arrow Database Connectivity FALSE FALSE     FALSE      TRUE FALSE

# download a test file
dir.create("gdal-tmp", showWarnings = FALSE)
download.file("https://github.com/OSGeo/gdal/raw/refs/heads/master/autotest/ogr/data/parquet/poly.parquet", "gdal-tmp/poly.parquet", mode = "wb")

# make sure the file is a valid parquet format
nanoparquet::read_parquet_info("gdal-tmp/poly.parquet")
#> # A data frame: 1 × 7
#>   file_name           num_cols num_rows num_row_groups file_size parquet_version
#>   <chr>                  <int>    <dbl>          <int>     <dbl>           <int>
#> 1 gdal-tmp/poly.parq…        8       10              1     10227               2
#> # ℹ 1 more variable: created_by <chr>

# download DuckDB (I'm on Windows, so downloads a Windows binary)
download.file("https://github.com/duckdb/duckdb/releases/download/v1.1.3/libduckdb-windows-amd64.zip", "gdal-tmp/libduckdb.zip", mode = "wb")
unzip("gdal-tmp/libduckdb.zip", exdir = "gdal-tmp/libduckdb")

sf::st_read("ADBC:gdal-tmp/poly.parquet", layer = "poly", options = c(
  'PRELUDE_STATEMENTS="load spatial"',
  "ADBC_DRIVER=gdal-tmp/libduckdb/duckdb.dll" # I'm on Windows
))
#> options:        PRELUDE_STATEMENTS="load spatial" ADBC_DRIVER=gdal-tmp/libduckdb/duckdb.dll
#> Warning in CPL_read_ogr(dsn, layer, query, as.character(options), quiet, : GDAL
#> Error 1: AdbcLoadDriver() failed:
#> Error: Cannot open "ADBC:gdal-tmp/poly.parquet"; Check connection parameters.

Created on 2025-06-22 with reprex v2.1.1

If reporting a change from previous versions

no

Additional context
n/a

sessionInfo():

R version 4.5.0 (2025-04-11 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Matrix products: default
  LAPACK version 3.12.1

locale:
[1] LC_COLLATE=Japanese_Japan.utf8  LC_CTYPE=Japanese_Japan.utf8    LC_MONETARY=Japanese_Japan.utf8 LC_NUMERIC=C                    LC_TIME=Japanese_Japan.utf8    

time zone: Asia/Tokyo
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] vctrs_0.6.5        cli_3.6.5          knitr_1.50         xfun_0.52          rlang_1.1.6        processx_3.8.6     DBI_1.2.3          KernSmooth_2.23-26 generics_0.1.4    
[10] sf_1.0-21          glue_1.8.0         clipr_0.8.0        htmltools_0.5.8.1  e1071_1.7-16       ps_1.9.1           rmarkdown_2.29     grid_4.5.0         evaluate_1.0.3    
[19] classInt_0.4-11    tibble_3.3.0       fastmap_1.2.0      yaml_2.3.10        lifecycle_1.0.4    nanoparquet_0.4.2  compiler_4.5.0     dplyr_1.1.4        fs_1.6.6          
[28] Rcpp_1.0.14        pkgconfig_2.0.3    rstudioapi_0.17.1  digest_0.6.37      R6_2.6.1           class_7.3-23       reprex_2.1.1       tidyselect_1.2.1   utf8_1.2.6        
[37] pillar_1.10.2      callr_3.7.6        magrittr_2.0.3     tools_4.5.0        proxy_0.4-27       withr_3.0.2        units_0.8-7   

sf::sf_extSoftVersion():

          GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H           PROJ 
      "3.13.1"       "3.11.0"        "9.6.0"         "true"         "true"        "9.6.0" 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions