apache / apache/arrow-adbc

r: Support `bool` and `dictionary<string>` in `AdbcStatementBind()`

Open
#1,008 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
627
Forks
217
Avg merge
17h
Merged PRs (30d)
57

Description

Some examples:

```r
library(adbcdrivermanager)

con <- adbc_connection_init(
adbc_database_init(adbcsqlite::adbcsqlite(), uri = ":memory:")
)

write_adbc(data.frame(a = as.factor(letters)), con, "fct")
#> Error in adbc_statement_execute_query(stmt) :
#> Column 0 has unsupported type dictionary
write_adbc(data.frame(a = c(TRUE, FALSE, NA)), con, "bol")
#> Error in adbc_statement_execute_query(stmt) :
#> Column 0 has unsupported type bool
write_adbc(data.frame(a = as.difftime(1, units = "hours")), con, "dtm")
#> Error in adbc_statement_execute_query(stmt) :
#> Column 0 has unsupported type duration
```

While the errors are correct in the sense that SQLite does not offer proper support for any of these types, DBI/RSQLite is more lenient:

```r
con <- DBI::dbConnect(RSQLite::SQLite(), ":memory:")

DBI::dbWriteTable(con, "types", data.frame(
fct = as.factor(letters[1:3]),
bol = c(TRUE, FALSE, NA),
dtm = as.difftime(1:3, units = "hours")
))

str(DBI::dbReadTable(con, "types"))
#> 'data.frame': 3 obs. of 3 variables:
#> $ fct: chr "a" "b" "c"
#> $ bol: int 1 0 NA
#> $ dtm: int 1 2 3
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.