Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g
Question: Where are the Arrow arrays built?RSQLite (r-dbi/RSQLite#859 and the stack in r-dbi/RSQLite#880) builds the Arrow arrays in C++, inside its result class. It appends each value straight into vendored nanoarrow arrays through a shared
If nobody decides, the work proceeds with the first option. I'll ask the coordinator to settle the seam with the ALTREP session before touching Generated by Claude Code |
Question: How long does an Arrow stream live?RSQLite (r-dbi/RSQLite#864, #865) returns a lazy stream that holds its own share of the result, so it outlives
If nobody decides, the work proceeds with the first option, and this follows the lazy-fetch work in DBI where it changes the generics' contract. Generated by Claude Code |
Question: Which Arrow types do
|
Question: How should the native Arrow PRs be stacked?The next PR builds Arrow arrays from result columns as a second row sink. It needs both the row-sink seam in #638 and the vendored nanoarrow in #635. These two PRs are independent of each other, and both are based on
If nobody decides, the native Arrow implementation waits for the first option. The fix PRs listed in the body are independent of it. Generated by Claude Code |
HandoverThis session is being archived. Here is the state as of 2026-11-29 19:30 UTC. Merged: #634, #647, #656, #658, #660, #662 and #665. #659 was closed: the recommendation is to cast Open and ready for review:
On #635 and #638 the aggregate The native Arrow implementation (builders, stream, binding and COPY-based writing) has not started. It waits for #635 and #638 to merge and for the four open questions above: stacking, where the arrays are built, stream lifetime and type mapping. A fresh session can pick it up from this PR's body. Two sibling sessions build on #638's interface and have agreed to it:
Issues filed without a fix yet: #639–#646, #649–#653. Most should be fixed by construction with native Arrow. #652 is a nanoarrow problem and #653 a DBItest problem; neither is reported upstream. Generated by Claude Code |
This PR records the state and the open questions of the work on native Arrow support in RPostgres. It carries no code. The implementation lands in separate PRs, linked below as they open.
Kirill's request (relayed): "Review the Arrow work in RSQLite PRs, implement in a similar fashion in this package. When implementing, file all problems discovered as issues and fix them in separate PRs."
What RSQLite does
RSQLite has not shipped native Arrow on
mainyet. The old all-in-one draft is r-dbi/RSQLite#795. The new stack, coordinated in r-dbi/RSQLite#880, builds Arrow arrays in C++ inside the result class, using vendored nanoarrow C (#857). It hands them to R as a lazy stream that holds its own share of the result (#856, #864, #865), and binds Arrow streams through a parameter source (#855, #866). Much of that stack deals with SQLite's dynamic typing (#862, #867). RPostgres does not need that part, because libpq fixes each column's type by OID. The step that exposes the DBI methods is still open in RSQLite.Plan for RPostgres
One concern per PR, smallest first:
reexportskip inhelper-DBItest.R.PqResultImpl::fetch_rows(), agreed with the ALTREP session (refactor: Fetch rows through a pluggable row sink #638).dbSendQueryArrow(),dbFetchArrow(),dbFetchArrowChunk()anddbGetQueryArrow(), with the stream lifetime decided below.dbBind()with Arrow streams, through a parameter source.dbAppendTableArrow(),dbCreateTableArrow()anddbWriteTableArrow()viaCOPY, with no fetch-path change.main.Currently, RPostgres relies on DBI's default Arrow methods, which go through data frames. Problems found in that behavior become issues with their own fix PRs.
Open questions
int8,numericand text map to?Constraints
Related PRs and issues
PRs for the plan, all after clean review:
mainmerged in after fix: Remove dead WindowsWSAStartup()workaround #647, smoke test green.PqResultImpl::fetch_rows(), shared with the ALTREP work in docs: Design ALTREP-backed result columns #632 and the binary transport work in docs: Design binary result transport #667, ready;mainmerged in, smoke test green.Problems in the current behavior, found by probing DBI's default Arrow methods against PostgreSQL 16 ("native" means native support is expected to fix it by construction):
dbGetQueryArrow()fails for json, jsonb, array, inet, xml and point columns #639dbGetQueryArrow()fails for json, jsonb, array, inet, xml, point (high, native)dbWriteTableArrow()createsdouble precisionfor int64 columns and loses precision #640dbWriteTableArrow()stores int64 asdouble precision(high, native)dbBindArrow()loses precision for int64 parameters #641dbBindArrow()loses int64 precision (medium, native)dbBindArrow()rejects every stream with named columns #642dbBindArrow()rejects named columns (medium): fix: Explain how to bind a named stream indbBindArrow()#658 keeps the error with a clearer message, mergeddbGetQueryArrow()returnstimecolumns astime32[ms]and drops microseconds #643timeread astime32[ms](medium, native)int8columns depends on thebigintargument, andbigint = "integer"turns large values intoNAsilently #644int8Arrow type followsbigint;bigint = "integer"gives silentNA(medium, partly native)timestampfromtimestamptz#645timestampvs.timestamptz(medium, native)dbWriteTableArrow()creates lossy or wrong column types for several Arrow types #646 lossy or wrong types indbWriteTableArrow()(medium, native)dbWriteTable()writes list columns that are not lists of raw as garbagebytea#648 list columns written as garbagebytea(high): fix: Reject list columns that are not lists of raw indbWriteTable()#657, readydbAppendTableArrow()anddbWriteTableArrow()are not atomic across batches #650 multi-batch Arrow append/write is not atomic (medium, native)dbGetQueryArrow()is several times slower thandbGetQuery()and does not stream #651 Arrow fetch in 256-row chunks, all collected (medium, native)moneycolumns are read as 0 #654moneyread as 0 (medium): closed by Kirill, cast to numeric in queries instead; fix: Readmoneycolumns as numbers instead of 0 #659 closedinfinity, are read as garbage, with a probable out-of-bounds read #655 infinite, BC and far-future dates and timestamps garbled, with an out-of-bounds read (high): fix: Parseinfinity, BC dates, and years beyond 9999 in dates and timestamps #660, mergeddbGetQueryArrow()anddbSendQueryArrow()reject every Arrow stream passed asparams#661 Arrow streams asparams =always rejected (high): fix: Bind a nanoarrow stream inparamswithdbBindArrow()#662, mergedBuild problems found on the way:
WSAStartup()workaround inRPostgres-init.cnever runs #636 WindowsWSAStartup()workaround never ran: fix: Remove dead WindowsWSAStartup()workaround #647, mergedsrc/CMakeLists.txt#637 build housekeeping: build: Use vendored Boost with Rtools and droplogging.cppfromCMakeLists.txt#656, mergedSession: https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g
https://claude.ai/code/session_01Hr1rd5LPjEzyaTRpXAuS6g
Generated by Claude Code