Repository navigation
Conversation
…bit offsets The chunk sink's takes_row() asks each column whether the bytes of the current value fit within 2^31 - 1 bytes per utf8 or binary column. A row that doesn't fit ends the chunk, and the next chunk starts with it. A value beyond the limit on its own fails the chunk that it starts, after the rows before it. Before, such a chunk failed with an error and ended the result. The column reads the bytes once for the check and the append. Reading numbers as text doesn't change their storage class, and reading a blob doesn't convert it, so a row that a chunk doesn't take reads alike in the next one. The internal result_set_arrow_max_bytes() lowers the limit for the tests. The test with blobs near 2 GiB runs only with RSQLITE_TEST_LARGE_ARROW=true, which the custom after-install action sets on GitHub Actions. Ported from #863. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
… claude/rb-arrow-byte-limits
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
…umn of NULLs When the limit ends the first chunk while a column without a declared type has held only NULL, that chunk fixes the column as the null type. Text or a blob beyond the limit on its own now fails in such a column too, after the rows before it, instead of becoming NULL with a warning. Later values that fit stay NULL, as after a first chunk of `n` rows. A row that a chunk doesn't take drops the bytes that its columns have read, and the error names the limit, which a test may have lowered. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
…o claude/rb-arrow-byte-limits
Question: should a first chunk that the size limit cuts short fix the type of a column that has only seen NULLs?This pull request ends an Arrow chunk before a utf8 or binary column would exceed its 32-bit offsets, so a long text column can cut the first chunk short without the user asking for it. A column without a declared type that has only held NULLs up to that cut is then fixed as the null type in
Kirill decides. Until then the first option stays as implemented. Generated by Claude Code |
… it isn't valid UTF-8 Text or a blob whose bytes alone exceed the limit now always fails, also in an undecided or utf8 column where text that isn't valid UTF-8 would be NULL. The reset of the bytes that a column has read happens once, in fits(). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
… claude/rb-arrow-byte-limits
No change of behavior for users: Arrow chunks are still internal. An Arrow chunk now ends before a row whose text or blobs would take a utf8 or binary column beyond the 2^31 - 1 bytes that the 32-bit offsets of these arrays can address, and the next chunk starts with that row. Before, such a chunk failed with an error and ended the result (the limitation accepted as Low on #956). A single text or blob value beyond the limit on its own still fails, with an error that names the column, the size and the limit, but only after the rows before it have come out in the chunks before; it fails the chunk it starts and doesn't loop. This holds also in a column without a declared type that has held only NULL when the limit ends the first chunk, which that chunk fixes as the null type. Later values of such a column that fit become NULL with a warning, as after a first chunk of
nrows (the rule from #955).How:
SqliteArrowChunkSink::takes_row()asks each column whether the bytes of the current value fit; a column reads the bytes once for the check and the append. Only what the append adds counts: nothing for NULL, other types or text that a utf8 column makes NULL as invalid UTF-8; numbers count as their text. Reading numbers as text doesn't change their storage class in SQLite, and reading a blob doesn't convert it, so a row that a chunk doesn't take reads alike in the next one;dbColumnInfo()in between doesn't convert values since #951. The row sink's loop leaves the statement on the declined row, so it is neither lost nor read twice; a chunk ended by the limit doesn't read ahead, while a chunk full bynstill does and keeps its error. The old draft'sarrow_row_read_andread_type()aren't needed on the row-sink design and aren't ported. The former overflow check in the append is replaced by the check intakes_row()(nanoarrow still refuses an overflowing append).Tests: the internal
result_set_arrow_max_bytes()lowers the limit for a result, so test-arrow-byte-limits.R uses limits of a few bytes: chunks split at the limit with all rows in order for utf8 and binary and fornof -1, 3 and 1; values exactly at and one byte over the limit; several columns with numbers and invalid UTF-8; read-ahead with a kept step error and a kept bind refusal; a declined row keeping its storage class acrossdbColumnInfo(); a chunk kept by #962 underwarn = 2coming back whole before the declined row;dbBind()after a declined row; an oversized value after NULLs in a column without a declared type, and smaller values in such a column after the cut. The real-size test with blobs near 2 GiB (about 2.5 GB peak resident memory on Linux, with a virtual peak of about 3.1 GB because nanoarrow doubles the capacity of its buffers; platforms whose realloc copies may need more) runs only withRSQLITE_TEST_LARGE_ARROW=true, which the custom after-install action sets on GitHub Actions. Red → green: that test fails on #962's head (c3daa8c) with "Columnb: the values of this Arrow chunk would exceed 2^31 - 1 bytes" and passes here. Full suite with NOT_CRAN=true: FAIL 0, WARN 3 (existing encoding tests), SKIP 64, PASS 12631.Layer F5 of the rebuilt chain, planned in #880; based on #962. Ported from #863.
Coordinating session: https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
https://claude.ai/code/session_01Hr1rd7QnTD4acgzTUihnF4
Generated by Claude Code