11# ' @keywords internal
2- lynker_spatial_store <- function (version , domain , kind , ... , conn = duckdb_connection(extensions = " httpfs" )) {
2+ lynker_spatial_store <- function (version , domain , kind , ... , conn = hfutils :: duckdb_connection(extensions = " httpfs" )) {
33 # TODO(justin): this is a mess
44
55 if (startsWith(version , " v" )) {
@@ -42,7 +42,7 @@ store_has_layer.lynker_spatial_store <- function(store, layer, ...) {
4242 p <- paste(store $ src , layer , " vpuid=01" , " part-0.parquet" , sep = " /" )
4343
4444 ok <- try({
45- tbl_http_parquet (p , conn = store $ conn )
45+ hfutils :: tbl_http (p , conn = store $ conn , read_func = " read_parquet " )
4646 TRUE
4747 }, silent = TRUE )
4848
@@ -65,33 +65,5 @@ store_get_layer.lynker_spatial_store <- function(store, layer, ...) {
6565 sep = " /"
6666 )
6767
68- tbl_http_parquet(urls , conn = store $ conn )
69- }
70-
71-
72- # ' Create a new DuckDB connection.
73- # ' @param ... Arguments passed to [DBI::dbConnect()].
74- # ' @param extensions Character vector of extensions to install and load on connect.
75- # ' @returns A DBI connection to a DuckDB instance.
76- # ' @keywords internal
77- duckdb_connection <- function (... , extensions = character (0 )) {
78- conn <- DBI :: dbConnect(duckdb :: duckdb(), ... )
79-
80- if (length(extensions ) > 0 ) {
81- for (ext in extensions ) {
82- DBI :: dbExecute(conn , paste(" INSTALL" , ext ))
83- DBI :: dbExecute(conn , paste(" LOAD" , ext ))
84- }
85- }
86-
87- conn
88- }
89-
90- # ' @keywords internal
91- tbl_http_parquet <- function (urls , ... , conn = duckdb_connection(extensions = " httpfs" )) {
92- query <- paste0(" SELECT * FROM read_parquet([" ,
93- paste0(" '" , urls , " '" , collapse = " ," ),
94- " ])" )
95-
96- dplyr :: tbl(conn , dbplyr :: sql(query ))
68+ hfutils :: tbl_http(urls , conn = store $ conn , read_func = " read_parquet" )
9769}
0 commit comments