Bring Reader into conformance with other resumable decoders#6
Merged
Conversation
On input not ending in the row-terminating empty line, Reader used to emit the incomplete trailing row at EOF — the non-resumable behavior, diverging from the Java/Rust/Scala readers which buffer it. Align with them: preserve line and row buffers across StopIteration so iteration resumes cleanly when more data arrives (tailing), including a cell split across the EOF boundary. Non-resumable load/loads keep emitting the incomplete tail.
Same semantics as the previous commit, but keeping the original check order and loop shape so the change reads as a delta: acc promoted to a persistent row buffer, a line buffer for the partial line at EOF, and the EOF tail emission removed.
The previous prepend (line_buffer + line) re-copied the accumulated prefix on every resume, so a large cell arriving in small reads while tailing cost O(n^2). Keep the pieces in a list and join once when the terminating newline arrives. Lines that arrive complete skip the list entirely (two cheap checks, no append/clear).
Revert the third row added to the basic sample and its expected data; drop the stale commented-out assertion instead of restoring it — the EOF contract has its own tests. Reduce reader comments to the one non-obvious invariant.
Reusing the object would silently wipe any outside view of the parts, e.g. if peeking is ever introduced.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.