Repository navigation
pxf: DatasetReader returns a complete row from a stream that stays open (#171) - #173
Merged
Merged
Conversation
trendvidia
force-pushed
the
dataset-scan-linear-168
branch
from
November 7, 2026 04:23
2c84b66 to
3f3e817
Compare
trendvidia
force-pushed
the
dataset-live-stream-171
branch
from
November 7, 2026 04:24
58937d7 to
5166281
Compare
trendvidia
force-pushed
the
dataset-scan-linear-168
branch
from
November 7, 2026 06:49
3f3e817 to
38a9ca2
Compare
trendvidia
force-pushed
the
dataset-live-stream-171
branch
from
November 7, 2026 06:50
5166281 to
5bcadcc
Compare
…en (#171) On a stream that stays open, a row that had arrived could wait for more input or for the end. Two things held it, both now as protowire-go does (TestDatasetReader_CompleteRowIsNotHeldBack): - Pull used std::istream::read, which waits for all 4096 bytes. It now takes what the stream has buffered (readsome), and blocks, through peek, only when nothing is, for one byte or the end. - The scan took a token as complete only once four bytes followed it. It now takes a token as complete once the bytes the lexer looks at past it are buffered. A one-byte token needs none. A closed string, bytes literal or block comment needs none, except `""`, which a third quote would open into `"""`. Any other token needs the byte after it, and the byte after that when the first is `.`, `p`, `/` or the first byte of `µ`. An error token, or one that starts past ASCII, still waits for four. DatasetReaderLive.CompleteRowIsNotHeldBack feeds Go's 16 rows one byte per read through a streambuf that records any read past the bytes written. Before this change all 16 waited. With it, none does, and the 590-case Go sweep still matches. IsLinearOneByteAtATime holds the scan linear in one-byte reads, which Pull now does.
trendvidia
force-pushed
the
dataset-live-stream-171
branch
from
November 7, 2026 07:31
5bcadcc to
4095d75
Compare
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.
Fixes #171. Stacked on #172 (#168). #167 has merged. It also carries #170's commit (95ab86f, the #169 timestamp fix, identical to #170's), because one of the live rows,
(2026-10-23T00:00:00Z), needs it. Merge order: #172, #170, then this. Rebasing after #170 merges drops the duplicate commit.What was wrong
On a pipe, a socket or a file still being appended to,
Nextcould hold a row that had already arrived. It waited for 4 KiB more input, or for the stream to end. Two causes:Pullusedstd::istream::read, which waits for all 4096 bytes.)was the last byte read waited.What changes
Pulltakes what the stream has buffered (readsome). It blocks only when nothing is buffered, throughpeek, for one byte or the end. On anistringstreamthe reads are still 4096 bytes, so the sweep's byte counts are unchanged.A token counts as complete as soon as the bytes the lexer looks at past it have arrived:
"", which a third quote would turn into""";.,p,/or the first byte ofµ;That follows what the lexer reads, path by path. Go's lexer records the same thing as
sawEnd.The issue left the read method as a choice for the PR. I chose
readsomepluspeekoverrdbuf()->sgetn, so the stream's state flags stay right for the caller.Evidence
DatasetReaderLive.CompleteRowIsNotHeldBackfeeds protowire-go's 16 rows (TestDatasetReader_CompleteRowIsNotHeldBack) one byte per read. It uses astreambufthat records any read past the bytes written, which stands in for a pipe that stays open, without threads or timeouts. Before this change all 16 rows waited. With it, none does.DatasetReaderScan.IsLinearOneByteAtATimekeeps the scan linear in one-byte reads, whichPullcan now return: 4 shapes at 256 KiB. It also passes on the old reader, which never did one-byte reads, so it guards the new path rather than proving this fix.ctest: 735/735 locally (macOS). clang-format 18 is clean. clang-tidy 23 reports nothing new on the changed files.