Repository navigation
Conversation
The internal `bind_arrow_stream()` binds the rows of a nanoarrow array stream of struct arrays to a prepared statement, through a new `SqliteArrowParamSource` behind the parameter source of #855, and runs the statement once per row, as `dbBind()` does with a data frame. Named placeholders take the columns by name, anonymous and numbered ones take unnamed columns by position, with the messages of `dbBind()`. Integers, booleans, floats, utf8 and binary (also large), the null type, date32, time32, time64 and timestamp bind as the storage classes that `dbBind()` uses, with nulls from the validity bitmaps. Other types fail before any row runs, and leave the stream and the previous bind as they were. An error of the stream or of a value fails like a later parameter set of `dbBind()`, and an R error that leaves a callback of the stream by a jump unwinds the C++ frames. The default `dbBind()` path is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
The CI's auto-update regenerated `src/SqliteParamSource.dd` and `src/cpp11.dd` with GCC, whose dependency output indents continuation lines by one space, which the filter in `src/Makevars.deps` does not drop, so the files gained hundreds of absolute and vendored paths (#836). This restores them as they were at 098aa5e and keeps the auto-update's formatting of `src/SqliteParamSource.cpp`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
|
Review of this pull request at 098aa5e, by a Claude Code reviewer with clean context that read the description of #866 and of #855, the diff against #865 (049716e), the code it touches ( What was run
What holds
HighNone. Medium
Low
Outside this diff, UBSan reports Generated by Claude Code |
The offset of the struct array applies to its children, so the source binds the values of `offset + i`; the null check of the struct row already counted it. Durations bind as seconds, as `dbBind()` binds a difftime in seconds. `LinkingTo` asks for cpp11 0.5.0, whose nested `unwind_protect()` protects the callbacks of a stream of RSQLite inside those of the parameter source, and a comment states that the stream's `release()` must not raise an R error. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
|
Second review round of this pull request, of 8ccd758, on top of c0c6a4b: a review of this pull request at 8ccd758, by a Claude Code reviewer with clean context that read the description of #866, the first review only to know what the commit addresses, What was run
What holds
HighNone. MediumNone. Low
Generated by Claude Code |
cpp11 protects nested calls of `unwind_protect()` from 0.4.6 on, not from 0.5.0, so `LinkingTo` and the comment of `call_stream()` say so. The test of sliced struct arrays gains a boolean column, whose values and validity start at a bit offset, and a binary column. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
Superseded: Accepted limitationsSuperseded by this newer copy. Two clean review rounds: the first of the whole pull request at 098aa5e, the second of 8ccd758. The first found that a sliced struct array bound the wrong rows, fixed in 8ccd758 together with durations, the cpp11 bound and a comment on
Generated by Claude Code |
…ream Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
…n R < 4.3 Before R 4.3, `as.POSIXct()` on a number needs an `origin`. `.POSIXct()` gives the same value on every R version. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
Question: bind an Arrow duration as
|
Question: bind Arrow date64, decimal and nested columns, rather than refusing them?The parameter source binds the Arrow types that map to a storage class of SQLite ( library(DBI)
library(nanoarrow)
con <- dbConnect(RSQLite::SQLite(), ":memory:")
res <- dbSendQuery(con, "SELECT :x AS x")
date64 <- as_nanoarrow_array(
data.frame(x = as.Date("2026-11-13")),
schema = na_struct(list(x = na_date64()))
)
RSQLite:::bind_arrow_stream(res, date64)
#> Error:
#> ! Can't bind parameter 1 of Arrow type date64.
dbClearResult(res)
dbDisconnect(con)Created on 2026-11-13 with reprex v2.1.1
If nobody decides, these types keep failing before any row runs. Generated by Claude Code |
Question: protect the parameter stream's
|
Question: report a failing
|
Superseded: Accepted limitationsSuperseded by the copy of 2026-11-29. Two clean review rounds: the first of the whole pull request at 098aa5e, the second of 8ccd758. The first found that a sliced struct array bound the wrong rows, fixed in 8ccd758 together with durations, the cpp11 bound and a comment on
Found here, but also on
Generated by Claude Code |
…ream Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
…ream Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
…ream Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd8MVXyvU7qoMeruD1R
The Arrow stream parameter source now checks SQLite's result code of every bind through SqliteParamSource::check_bind(), as the list parameter source does. A value SQLite refuses, such as one over SQLITE_LIMIT_LENGTH, fails with a SqliteBindError that names the parameter and the row, and leaves the result in the same state as for dbBind(). The row counts the parameter sets over all arrays of the stream, in 64 bits, and check_bind() takes the row as int64_t for both sources. A test compares each step with dbBind() for text and blobs over the limit, in the first row, in a later array kept for the next fetch, and in a statement without rows. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd8MVXyvU7qoMeruD1R
Question: what should binding an
|
Accepted limitationsTwo clean review rounds: the first of the whole pull request at 098aa5e, the second of 8ccd758. The first found that a sliced struct array bound the wrong rows, fixed in 8ccd758 together with durations, the cpp11 bound and a comment on The clean review of 2026-11-29, after
Found here, but also on
Generated by Claude Code |
Finding:
|
Pull request 11 of the Arrow rework plan. It stacks on #865 (Arrow streams outlive
dbClearResult()anddbDisconnect()), which stacks on #864, #863, #862, #861, #860, #859, #857, #856, #855, #830 and #850.What changes
A new internal entry point,
bind_arrow_stream(res, stream), binds the rows of a nanoarrow array stream of struct arrays (or of anything nanoarrow converts to one, such as a data frame) to a prepared statement, and runs the statement once per row, asdbBind()does with a data frame. No DBI method calls it yet; the defaultdbBind()path is unchanged.Parameter source. The rows come through a new
SqliteArrowParamSource, next to #855's list source behindSqliteParamSource.SqliteResultImpl::bind()is split so that both sources share the start of a bind (start_bind()) and the count check (check_param_count()), with the same messages as before. The source reads the stream's arrays as the statement runs, oneget_next()whenever the rows of the current array are bound, and skips empty arrays. A null row of the struct array binds NULL to every placeholder. The offset of a sliced struct array applies to its columns, which may have offsets of their own, as Arrow'sStructArray.slice()exports them.Placeholders. Named placeholders take the columns of the same name, anonymous and numbered ones take unnamed columns by position, through #855's
is_unnamed_placeholders()andmatch_placeholders(), which gets the schema's namedchildren. The messages are those ofdbBind(): a column without a name counts as an unnamed parameter, as in DBI's defaultdbBindArrow(), which drops names that are all empty. A stream that isn't of struct arrays fails with "Parameters must be an Arrow stream of struct arrays, with a column per placeholder."Types. These bind to the storage classes that
dbBind()uses for the matching R types:INT64_MAXfails with its value and parameterextended_types#861, so a chunk read withextended_typesbinds back as it was stored. A duration binds asdbBind()binds a difftime in seconds, such as an hms;dbBind()binds a difftime in other units as its bare number, while nanoarrow converts it to a duration, which binds as seconds.Nulls come from the validity bitmaps. Every other type, such as a dictionary (a factor of a data frame), a list, a decimal or date64, fails with "Can't bind parameter 1 of Arrow type …" before any row runs: the source checks the schema in its constructor, before the result drops its previous bind, and takes the stream over only then, so the stream stays with its owner and the previous bind goes on. The result of every
sqlite3_bind_*()call is checked.bind_arrow_stream()reads the schema through nanoarrow before it calls the C++ code, so a failingget_schema()reports nanoarrow's message ("array_stream->get_schema(): …") rather than the source's "Can't read the schema of the Arrow parameters: …", which only a stream whose schema fails the second time would reach.Errors. An error of the stream's
get_next()("Can't read the Arrow parameters: …") or of a value fails like a later parameter set ofdbBind()(#830, #855): it becomes astep_errorwithSQLITE_ERROR, so after a full fetch it is kept for the next one, a statement without rows raises it from the bind after the earlier rows ran, anddbGetRowsAffected()counts those rows. The stream's callbacks may call R, as a stream of RSQLite (#864) does to warn about converted values: they run undercpp11::unwind_protect(), so an R error that leaves one by a jump, such as a warning made an error byoptions(warn = 2), unwinds the C++ frames and leaves the result unbound, like any other failed bind. A stream of RSQLite protects its own callbacks with cpp11 in turn, and cpp11 protects such nested calls from 0.4.6 on, soLinkingTonow asks for cpp11 (>= 0.4.6). #830's busy guard covers the whole bind, so a handler of such a warning can't clear the result meanwhile. The source releases the stream from its destructor, unprotected, also from a new bind,dbClearResult()or a finalizer: as the Arrow C stream interface expects, a stream'srelease()must not raise an R error, which a code comment states.Deliberately left out
dbBindArrow(),dbAppendTableArrow()and the other DBI methods: pull request 17.Tests
tests/testthat/test-arrow-bind.R, through nanoarrow:extended_types, read back withdbGetQuery(), and of its chunk from the Arrow read path into a second table, read back both ways$,@, anonymous and numbered placeholdersdbBind(), and a stream that isn't of struct arraysINSERTafter two rowsdbClearResult()by the busy guard, and one whose warning, made an error, leavesget_next()by a jump; the last test fails withunwind_protect()removedEvery
test_that()block passes on its own afterload_all().devtools::test()withNOT_CRAN=truepasses except the three known errors intest-httpvfs.R(#832, #837). valgrind (--leak-check=full) reports no errors and nothing lost fortest-arrow-bind.R.https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
Generated by Claude Code