Repository navigation
Conversation
…GetQueryArrow() The default dbFetchArrow() method used to fetch all chunks of a result before returning a stream. It now fetches the first chunk to determine the schema and, if more rows remain, returns a stream that fetches the remaining chunks only when it is consumed. This uses nanoarrow::function_array_stream() and falls back to the previous eager behavior if the installed nanoarrow does not provide it. The default dbGetQueryArrow() method transfers the ownership of the result to the returned stream when the default dbFetchArrow() method is used. The result is cleared when the stream reaches the end, when fetching fails, or when the stream is released. Results that fit into one chunk are still cleared right away, and backends with their own dbFetchArrow() method keep the previous behavior. The development version of nanoarrow is required for the new behavior, so it is temporarily added to Remotes.
The default dbFetchArrow() and dbGetQueryArrow() methods fetch the remaining chunks lazily by default. Setting options(DBI.lazy_arrow = FALSE) restores the previous behavior: all chunks are fetched before the stream is returned, and dbGetQueryArrow() frees the result right away. The option must be TRUE or FALSE; other values are an error. It is read once when the stream is created, so changing it later does not affect existing streams. Backends with their own dbFetchArrow() method are not affected.
Resolve the conflict in DESCRIPTION by keeping both the rmarkdown vignette builder from main and the nanoarrow Remotes entry from #769. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
Resolved: Global option, per-query argument, or per-connection control for lazy Arrow fetching?In #769, Kirill asked whether the control should be per connection or even per query. The PR currently reads only the global option
Kirill decides. If nobody decides, the PR stays as is (global option only) and is not merged. Generated by Claude Code |
Resolved: Should lazy fetching be on by default (
|
Resolved: How to handle the dependency on development nanoarrow (
|
Clean review, round 1 (at 981a130)Reviewed by an agent without context from the work, briefed with the risks of the default change, single-result backends, resource lifetime, downstream impact, and the dev-nanoarrow dependency. Reproduced on RSQLite with 1000 rows (chunk size 256), dev nanoarrow 0.9.0.9000 vs CRAN nanoarrow 0.9.0. High (all on the lazy path only; with CRAN nanoarrow or
Medium
Low
Correct as written: zero-row, single-chunk and option- Tests: Not checked: backends other than RSQLite and duckdb, interrupts during a lazy fetch, finalizers at session exit, an actual reverse-dependency run. How to address High 1–5 is asked in the next comment. Generated by Claude Code |
Resolved: How to address the five High findings of the clean review?All five High findings above (data loss in
Kirill decides, and what is said on #769 is his call. If nobody decides, the PR stays a draft with these findings open and is not merged. Generated by Claude Code |
Question: How do DBI's default methods learn the per-connection
|
…pability check This follows Kirill's decision on PR #783. The default `dbFetchArrow()`, `dbGetQueryArrow()`, and `dbReadTableArrow()` methods fetch eagerly again, exactly as on main, and their documentation matches main. The `DBI.lazy_arrow` option is gone, and no per-query argument replaces it. The lazy machinery stays as internal code, reachable through a `lazy` argument of the internal `fetch_arrow_stream()` and `get_query_arrow()` functions. Lazy fetching needs `nanoarrow::function_array_stream()`. The internal `has_lazy_arrow()` checks that it is exported and that a one-batch stream built with it can be read back, and caches the result per session. Requesting lazy fetching without that capability falls back to eager fetching. DESCRIPTION drops the `Remotes:` field and requires nanoarrow (>= 0.3.0.1) again. The lazy tests call the internal functions and are skipped when the capability is missing. New tests check that the default methods are eager, and that the capability check is FALSE when `function_array_stream()` is not exported. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS
dbFetchArrow() and dbGetQueryArrow() methods
Clean review, round 2 (19c4bb2 only)Scope: the rework commit 19c4bb2; the rest of the PR was context. No High or Medium findings, so the review stops here. Checked and correct
Results
Low (each with its own question below)
Not checked: Generated by Claude Code |
Question: Keep caching the nanoarrow capability check for the whole session?
Kirill decides. If nobody decides, the cache stays as is. Generated by Claude Code |
Question: Suppress warnings from loading nanoarrow during the capability check?The capability check catches errors but not warnings. The first
Kirill decides. If nobody decides, the check stays as is. Generated by Claude Code |
Question: Record ownership before the fetch in
|
Superseded: Accepted limitationsSuperseded by the current copy.
Generated by Claude Code |
Question: Accept the codecov failure, or measure coverage with development nanoarrow?
Kirill decides. If nobody decides, codecov stays red on this draft and nothing changes. Generated by Claude Code |
Accepted limitations
Generated by Claude Code |
This PR carries #769 by
eitsupi(brancheitsupi/DBI:feat/lazy-arrow-fetch, head 0874a09) with its three commits and authorship unchanged, followed by a merge of currentmainand a rework that follows Kirill's decisions on this PR.Origin
dbFetchArrow()anddbGetQueryArrow()methods #769: the original PR and its discussion, the source of the lazy fetch machinery.mainand resolves a conflict inDESCRIPTION.dbFetchArrow()anddbGetQueryArrow()methods #769 as decided on this PR (lazy off by default, no option, per-connection control only, no dev-nanoarrow dependency).What the PR does now
dbFetchArrow(),dbGetQueryArrow(), anddbReadTableArrow()behave exactly as onmain: eager, anddbGetQueryArrow()clears its result on exit. Their documentation is unchanged frommain.dbFetchArrow()anddbGetQueryArrow()methods #769 is kept as internal code:fetch_arrow_stream(res, owned, lazy = FALSE)andget_query_arrow(conn, statement, ..., lazy = FALSE). The remaining chunks are fetched on demand throughnanoarrow::function_array_stream(), and an owned result is cleared at the end of the stream, on error, or on release. No public method reaches it yet.has_lazy_arrow()checks the capability itself, not the version: nanoarrow must exportfunction_array_stream(), and a one-batch probe stream must read back correctly. The result is cached per session. It isFALSEon CRAN nanoarrow 0.9.0 andTRUEon the development version. Without the capability, lazy requests fetch eagerly.DESCRIPTIONequalsmain's: noRemotes,nanoarrow (>= 0.3.0.1)in Suggests.has_lazy_arrow()holds, so they run in thercc devworkflow, which installs development versions of dependencies. New tests pin the eager defaults:dbHasCompleted()afterdbFetchArrow(), overwriting a table from its owndbReadTableArrow()stream, and clearing a result before consuming its stream.Status
dbConnect()setting is open; until then the lazy path is not reachable outside tests.dbFetchArrow()anddbGetQueryArrow()methods #769 as submitted, and its High findings applied to lazy-by-default, which is now gone (resolved). Round 2 covered 19c4bb2 and found only Low issues: Accepted limitations.test-arrow.Rgives 27 pass and 4 skipped on CRAN nanoarrow 0.9.0, and 42 pass on development nanoarrow.🤖 Generated with Claude Code
https://claude.ai/code/session_01Hr1rd4HRcA4823NuBCC8TS