Repository navigation
Conversation
A chunk whose text or blobs took a `utf8` or `binary` column beyond the 2^31 - 1 bytes that their 32-bit offsets address failed with "Can't append to Arrow array", and the error completed the result. Now the chunk ends before such a row, which stays the current row of the statement and starts the next chunk, so that `result_fetch_arrow_chunk()` returns fewer than `n` rows there and never fails for the size of a chunk alone. A value beyond the limit on its own fails the chunk that it starts, naming the column and the limit, which only the lowered limits of the tests can reach. The check counts what the append adds: the bytes of text and blobs, the text of a number, and nothing for `NULL` or for values that are `NULL` as not valid UTF-8. Each value is read once for the check and the append. A row held back keeps its storage classes for the next chunk until the next step, and reports its conversions with the chunk that returns it. `result_set_arrow_max_bytes()` lowers the limit of one result for the tests in the new `test-arrow-chunks.R`. A test with blobs near 2 GiB needs about 2.5 GB of memory and runs only with `RSQLITE_TEST_LARGE_ARROW=true`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
The test peaks at about 2.5 GB of memory and stays off unless `RSQLITE_TEST_LARGE_ARROW` is true. The `custom/after-install` hook sets it where it is unset, which reaches the jobs of `R-CMD-check.yaml` that call the hook on the hosted runners. The R-hub containers call no custom action, so the sanitizers and valgrind skip the test, as do CRAN and users. A value set before the hook wins. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
…imits A `binary` value is read before its conversion is logged on both sides: the base reads it at the append, this branch in `read_bytes()` before the append, which the append keeps. The comment of `fetch_arrow_chunk()` keeps the kept chunk and the byte limit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
A fetch that is full reads the next row ahead, and the next Arrow chunk read that row's storage classes only when it took the row. Reading the row as a data frame in between, with `dbColumnInfo()` or `dbFetch(n = 0)`, converts a blob in a character column to text, so that the chunk took the blob for text and didn't report it as converted. Now the Arrow columns read the storage classes of a row read ahead at once, after an Arrow chunk and after a data frame fetch between Arrow chunks, and keep them for the next chunk, as for a row that a chunk held back. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
The CI's auto-update regenerated `src/SqliteArrowColumn.dd`, `src/SqliteResultImpl.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 and lost package-relative entries (#836). This restores them as they were at 06df15e and keeps the auto-update's formatting of the `src/*.cpp` files. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
|
Review of this pull request at 06df15e, by a Claude Code reviewer with clean context that read the description, the diff against #862 ( What was run
What holds
High
MediumNone. Low
Generated by Claude Code |
`result_set_arrow_max_bytes()` cast its limit to an integer, so 1.5 silently became 1. It now stops unless the limit is a whole number of bytes in range. Also the comment of the CI step that enables the large Arrow test now names both workflows that call the hook, `R-CMD-check.yaml` and the daily `rcc dev` jobs of `R-CMD-check-dev.yaml`. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
Superseded: Accepted limitationsSuperseded by the new copy. The clean review of 06df15e found nothing above Low in the commits of this pull request: chunks end exactly at the limit, also with empty values and
Generated by Claude Code |
The CI's auto-update regenerated `src/result.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 975e379 and keeps the auto-update's formatting of `src/result.cpp`. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
Question: should fewer CI jobs run the Arrow test with blobs near 2 GiB?The new CI hook sets
Kirill decides. If nobody decides, every hosted job that calls the hook runs the test. Generated by Claude Code |
Superseded: Accepted limitationsSuperseded by the copy of 2026-11-29. The clean review of 06df15e found nothing above Low in the commits of this pull request: chunks end exactly at the limit, also with empty values and
Found here, but on the base too:
Generated by Claude Code |
…imits Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
…imits Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
…imits Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd8MVXyvU7qoMeruD1R
An Arrow chunk full by its rows reads ahead, and the step past its last row binds the next parameter set. When SQLite refuses a value of that set, the error is kept for the next chunk, which raises it once and completes the result; the rows of both chunks before it count, and a new dbBind() goes on. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd8MVXyvU7qoMeruD1R
Question: should a blob in the row held for the next Arrow chunk survive a
|
Accepted limitationsThe clean review of 06df15e found nothing above Low in the commits of this pull request: chunks end exactly at the limit, also with empty values and The clean review of 2026-11-29, after
Found here, but on the base too:
Generated by Claude Code |
A result fetched as Arrow arrays refuses data frame fetches, so the tests that interleaved them now fix the data frame types with `dbColumnInfo()`, and the test of a row held back checks only that `dbBind()` starts anew. `dbColumnInfo()` and `dbFetch()` of no rows still read the current row as a data frame, which is why the storage classes are still read ahead for the next Arrow chunk. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
Eighth step of the Arrow rework (plan: #829 (comment)): an Arrow chunk now ends before a row whose text or blobs would take a
utf8orbinarycolumn beyond the 2^31 - 1 bytes that the 32-bit offsets of these types address, and the next chunk starts with that row. Before, such a chunk failed with "Can't append to Arrow array", and the error completed the result (#860). The entry pointresult_fetch_arrow_chunk()stays internal, so nothing changes for users.What changes:
result_fetch_arrow_chunk(res, n)returns fewer thannrows, also forn = -1, when the next row doesn't fit, and never fails for the size of a chunk alone. A chunk takes at least one row: a value beyond the limit on its own fails the chunk that it would start, after the chunk before it has come out, with "Columns: a value of 11 bytes exceeds the 10 bytes that an Arrow utf8 or binary array can hold." As any error of a fetch since fix: Never restart a statement after an error indbFetch()ordbBind()#830, it completes the result. With the real limit, no value gets there: SQLite holds at most 2^31 - 1 bytes per value (SQLITE_MAX_LENGTHinMakevars), so the error only guards the lowered limits of the tests.utf8orbinarycolumn, and nothing forNULLand for text and blobs that areNULLin autf8column as not valid UTF-8. A column still undecided in the first chunk counts its value for the type that the value would give it. Each column has its own limit; the first one that a row would overflow ends the chunk.fetch_loop()askstakes_row()before each row:ArrowChunkchecks the bytes there,SqliteDataFrametakes every row. A row that the chunk doesn't take stays the current row of the statement, as the row read ahead past a full chunk does (fix: A fetch returns its rows when the step past its last row fails #850), and no step happens. SodbHasCompleted()isFALSEanddbGetRowCount()counts the rows handed out. A step error after the held-back row comes with the fetch that steps past it: it fails that fetch, or is kept for the next one if that fetch is full and only reads ahead.SqliteArrowColumn::read_type()reads its storage class before anything converts it,read_bytes()reads the bytes of autf8orbinaryvalue and checks its UTF-8, andappend_row()uses both. A held-back row keeps its storage classes for the next chunk until the next step clears them, since reading the row as a data frame meanwhile, withdbColumnInfo()ordbFetch(n = 0), converts a blob in a character column to text. Its bytes are read again by the next chunk, as such a read can move them.dbFetch()after a held-back row returns it first, reading its storage classes itself. The check has rendered a number in autf8orbinarycolumn as text, after which SQLite documentssqlite3_column_type()as undefined; the bundled SQLite keeps the class of a number next to its text, whichdbColumnInfo()followed bydbFetch()already relies on, and a test pins it. The check doesn't convert text or blobs: a blob in autf8column keeps its bytes (feat: Build Arrow arrays from text and blob columns #860).dbBind()starts a new execution with its own first row, and keeps the limit of the result.result_set_arrow_max_bytes()lowers the limit of one result, so that the tests need little memory. It refuses a limit that isn't a whole number between 0 and 2^31 - 1.The row read ahead past a full fetch (#850) now keeps its storage classes as well, in a commit of its own (fix: Keep the storage classes of an Arrow row read ahead). On #862, the next Arrow chunk read them only when it took the row, so a
dbColumnInfo()ordbFetch(n = 0)in between, which reads the row as a data frame and converts a blob in a character column to text, made the chunk take the blob for text and leave it out of the warning. Nowread_ahead()has the Arrow columns read the storage classes of the row at once, after an Arrow chunk and after a data-frame fetch between Arrow chunks, and the next chunk keeps them until the next step, as for a held-back row. Before the first Arrow chunk of an execution there are no Arrow columns yet: a data-frame fetch and adbColumnInfo()before it still leave that chunk to read the converted classes, as on #862.The design comes from #795: 569fe5d (end the chunk before the row), 943b178 (read each value once), c0891bf (keep the storage classes of a held-back row), 3f988e8 (the limit of one result instead of a global hook) and 1449720 (the hook for the large test in GitHub Actions). Where it differs:
dbFetch()while a row was held back, because its check read blobs in autf8column as text, which changes their storage class; here the check reads them as bytes, anddbFetch()returns the row.NULLin the chunk; here it counts nothing.Deliberately left out:
large_utf8andlarge_binary, whose 64-bit offsets need no limit (43fdcaa), come with the requested types in pull request 14.dbGetRowCount()anddbGetRowsAffected()stay right beyondINT_MAX#858, frommain.Tested:
tests/testthat/test-arrow-chunks.R, with the limit lowered to 6 to 150 bytes: chunks end exactly before the row that would overflow, with the first row of a chunk at the limit, a value of no bytes in a full column, andnending a chunk before or after the limit, for text and for blobs, with no row lost or repeated; several text and blob columns with numbers andNULL, where each column ends a chunk, a number counts the bytes of its text and text that isn't valid UTF-8 counts nothing; the read-ahead boundary, with a step error after the rows: a chunk ended by the limit before it, the next one full and keeping the error, or asking for more rows and failing, and the row stepped past a full chunk reading its own storage classes; conversions of a held-back row reported with the chunk that returns it, with their row numbers after adbFetch(), and a blob held back across adbColumnInfo()that converts it to text still reported as a blob; a value beyond the limit on its own, failing after the rows before it and in the first row of a result, with the result completed;dbFetch()after a held-back row anddbBind()starting anew.dbHasCompleted()anddbGetRowCount()are checked after each chunk. A last test fetches blobs of 1e9, 1.2e9 and 1 bytes with the real limit, in chunks of 1 and 2 rows; it needs about 2.5 GB of memory (2.49 GB peak measured, 5 s) and runs only withRSQLITE_TEST_LARGE_ARROW=true, afterskip_on_cran()..github/workflows/custom/after-install/action.ymlsetsRSQLITE_TEST_LARGE_ARROW=truewhere it is unset, as 1449720 did, so every hosted job that calls the hook runs the 2.5 GB test: inR-CMD-check.yaml,rcc-smokewith its coverage run, each entry of thercc-fullmatrix of operating systems and R versions, its coverage entries included, and each entry ofrcc-suggests; and inR-CMD-check-dev.yaml, the dailyrcc devbase job and each job per dev dependency. R-hub's containers call no custom action and skip it, as do CRAN and users. Reviewers may weigh that cost against the coverage; dropping the hook keeps the test off everywhere unless the variable is set.tests/testthat/helper-arrow.R:write_sized_table(),local_limited_result(),fetch_arrow_chunks()andchunk_lengths().dbColumnInfo(), is still reported as a converted blob by the next chunk. It fails without the fix.test_that()block of the five Arrow test files (test-arrow-chunks.R,test-arrow-coercion.R,test-arrow-columns.R,test-arrow-text.Randtest-arrow-dates.R) passes on its own in a fresh session right afterpkgload::load_all(): 57 blocks pass, and three skip there, the large test and the two out-of-memory blocks whosecallrsessions need an installed build.<for<=at the limit, numbers counting nothing, invalid UTF-8 counting its bytes, failing a value beyond the limit also after other rows, reading the storage classes anew for a held-back row, not clearing them at a step, and no check at all.test-read-ahead.Randtest-extendedTypes.Rpass, the large test and the out-of-memory blocks included.-O1), after the merge and the read-ahead fix,test-arrow-chunks.Rwith the large test,test-arrow-coercion.R,test-arrow-columns.R,test-arrow-text.R,test-arrow-dates.R,test-read-ahead.R,test-dbSendQuery.R,test-dbClearResult.R,test-error.R,test-dbBind.Randtest-extendedTypes.Rpass without a report, and so does a script of 300 random tables of text, numbers, blobs andNULLwith random limits and chunk sizes anddbColumnInfo()between chunks, 2820 chunks in all, which checks that no chunk holds more than the limit in a column and that no row is lost.devtools::test()withNOT_CRAN=true: no failures beyond the three errors intest-httpvfs.Rthat also happen onmain(test: Run the HTTP VFS tests for real, and make their errors fail the check #832, testthat hides a test's error when the test records another result after it #837).Cost of the check, measured before the merge and the read-ahead fix, which only moves the reading of one row's storage classes per full fetch to the read-ahead: one million rows from a file database in one chunk,
-O2, median of 11 runs, seven rounds alternating between #862 and this branch. One text column of about 20 bytes: 0.114 to 0.126 s on both. Three text columns: 0.264 to 0.276 s on #862, 0.275 to 0.285 s here, about 4 %. One blob column: 0.113 to 0.122 and 0.114 to 0.123 s. An integer, a text, a real and a blob column: 0.288 to 0.311 and 0.309 to 0.319 s, about 4 %. The three text columns in chunks of 100 rows: 0.417 to 0.468 and 0.435 to 0.475 s, about 3 %. #795 measured about 6 %. The check moves the reads of the append rather than adding any, and a variant that reads the storage classes and the bytes in one pass over the columns measured the same.After the clean review, f61447c restores the
src/*.ddfiles that CI's auto-update filled with absolute paths (#836, fixed by #853), and 975e379 answers two of its Lows: the CI hook's comment namesrcc dev, and the setter refuses a fractional limit.Sits on #862 at ea9f836 (merged into this branch, with #862's review fixes), which is on #861, #860, #859, #857, #856, #855, #830 and #850, and merges #845. The merge resolves two conflicts: a
binaryvalue is read before its conversion is logged on both sides, here inread_bytes(), and the comment offetch_arrow_chunk()keeps both the kept chunk and the byte limit.Size
About 190 hand-written lines of C++: 80 in
SqliteArrowColumn.cppand.h, 90 inSqliteResultImpl.cppand.hwith the read-ahead fix, and 20 inSqliteResult,SqliteDataFrame.handresult.cpp; 335 lines of tests, 280 intest-arrow-chunks.Rand 55 inhelper-arrow.R; and 12 lines of the CI hook. That is about 540 in all, within the plan's 600. No.ddfile changes, since no file includes a new header.https://claude.ai/code/session_01Hr1rd3gjmufoKCWVDBPCgE
https://claude.ai/code/session_01Hr1rd432Aef98ibnZSSsYn
Generated by Claude Code