This repository was archived by the owner on Nov 21, 2026. It is now read-only.
Repository navigation
bindings: to_list() ends a batch at 4 MiB of JSON, so wide rows no longer need the whole batch in the heap - #320
Merged
Merged
Conversation
…nger need the whole batch in the heap (Fixes #319) TypedRows.nextRows wrote up to 1,000 rows as one JSON text whatever their size, so 400 rows of 1 MiB raised OutOfMemoryError in a 1 GiB heap where iter_dicts() and the pre-#286 to_list() read them. A batch now ends once its text reaches 4 MiB of characters and the call returns a third element, drained, because a short batch no longer means a drained result set. Python stops on drained. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01222vQiEr2wJRo4UhFYo9Fv
This was referenced Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #319.
TypedRows.nextRowsnow ends a batch once its JSON text reaches 4 MiB of characters (MAX_BATCH_CHARS) and returns a third element,drained. A short batch no longer means a drained result set, so_to_list_typedstops ondrainedinstead of onlen(rows) < _TYPED_BATCH_ROWS, and the bridge closes the result set only when it is drained.iter_dicts()reads one row per call and is unchanged.Checked before the push, on cores 8-9 with the repository's own tests run against a wheel built from this branch's sources plus a bridge jar compiled from them (corretto 25):
test_typed_rows.py,test_resultset.py,test_percall_calls.py,test_core.py,test_resultset_read_errors.py, andtest_results_after_close.pypass (140 and 125 tests).to_list(); main raises OutOfMemoryError. The existing batch-boundary tests (1, 999, 1000, 1001, 2000, 2500 rows, and the call counts of a short and an exact-batch result) still pass, so narrow rows still cross 1,000 at a time.pre-commiton the changed files andmkdocs build --strictpass.Swept:
to_list()is the only caller ofTypedRows.nextRowswith a batch; the docs that describe the batch (bridge.md,performance.md,results.md) say what changed, andto_json_list()anditer_json_batches()now say that theirbatch_sizebounds rows and not bytes.to_json_list()itself is not changed.🤖 Generated with Claude Code
https://claude.ai/code/session_01222vQiEr2wJRo4UhFYo9Fv