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

feat(r): Add ability to deterministically run a finalizer on an array stream #196

Merged
merged 4 commits into from
May 17, 2023

Conversation

paleolimbot
Copy link
Member

Before, the finalizer would only run on garbage collection. For ADBC, we want that to be deterministic so that we can close a statement/connection predictably.

@codecov-commenter
Copy link

codecov-commenter commented May 17, 2023

Codecov Report

Merging #196 (a9dd6c7) into main (f559d59) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #196      +/-   ##
==========================================
+ Coverage   88.30%   88.35%   +0.04%     
==========================================
  Files          60       60              
  Lines        8981     9016      +35     
==========================================
+ Hits         7931     7966      +35     
  Misses       1050     1050              
Impacted Files Coverage Δ
r/src/array_stream.h 88.23% <ø> (ø)
r/src/util.h 100.00% <ø> (ø)
r/R/array-stream.R 95.65% <100.00%> (+0.41%) ⬆️
r/src/array_stream.c 88.34% <100.00%> (+2.46%) ⬆️
r/src/nanoarrow_cpp.cc 95.83% <100.00%> (+0.27%) ⬆️
r/src/pointers.c 94.16% <100.00%> (+0.36%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@paleolimbot paleolimbot merged commit dea6733 into apache:main May 17, 2023
11 checks passed
@paleolimbot paleolimbot deleted the r-stream-finalizer branch May 18, 2023 11:27
paleolimbot added a commit to apache/arrow-adbc that referenced this pull request May 24, 2023
…enience functions (#706)

After #693 and apache/arrow-nanoarrow#196 we
have enough lifecycle management to implement some convenience methods.
This makes it about 1000% easier to play around with queries. An example
with the SQLite driver:

``` r
library(adbcdrivermanager)

temp <- tempfile()
db <- adbc_database_init(adbcsqlite::adbcsqlite(), uri = temp)

write_adbc(data.frame(x = 1:10), db, "some_table")

read_adbc(db, "SELECT * from some_table") |> 
  tibble::as_tibble()
#> # A tibble: 10 × 1
#>        x
#>    <dbl>
#>  1     1
#>  2     2
#>  3     3
#>  4     4
#>  5     5
#>  6     6
#>  7     7
#>  8     8
#>  9     9
#> 10    10

execute_adbc(
  db, 
  "UPDATE some_table SET x = ? WHERE x >= ?",
  bind = data.frame(123, 8)
)

read_adbc(db, "SELECT * from some_table") |> 
  tibble::as_tibble()
#> # A tibble: 10 × 1
#>        x
#>    <dbl>
#>  1     1
#>  2     2
#>  3     3
#>  4     4
#>  5     5
#>  6     6
#>  7     7
#>  8   123
#>  9   123
#> 10   123
```

<sup>Created on 2023-05-24 with [reprex
v2.0.2](https://reprex.tidyverse.org)</sup>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants