Repository navigation
Conversation
Throw when a stream delivers a Schema message after its schema is already set, instead of silently replacing the schema and dropping the dictionaries. The lazy first-read path still consumes the stream's initial Schema message. AI assistance: Cognition Devin CLI agent (SWE-2 High).
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.
Closes #563.
An Arrow IPC stream carries one Schema message, at its start. The stream reader accepted a second Schema message anywhere in the stream:
RecordBatchStreamReaderImpl.next()(and its async counterpart) calledthis.reset(message.header())for every Schema message, which replaced the schema and dropped the dictionaries mid-stream. As the repro in #563 shows, inserting anInt32schema between the DictionaryBatch and the RecordBatch of a dictionary stream makes the column read as its raw indices[0, 1, 0]with no error.The reader now throws
Expected a DictionaryBatch or RecordBatch message in the IPC stream, but was a second Schema message.when a Schema message arrives after a schema is already in place — whether read throughopen(), or lazily through a firstnext()on an unopened reader (that lazy path, used by iteration and the stream adapters, still consumes the stream's first Schema message). The file readers are unaffected: they index record batch blocks through the footer and never see Schema messages innext().The regression tests split real writer output into messages and reassemble streams with a second Schema after the dictionary batch, after the first record batch, or right after the first Schema — all now raise the error in the sync reader, and the async reader rejects in
next(). A valid dictionary stream still reads['a', 'b', 'a'], and lazy iteration of an unopened reader still works.All 2,979 IPC tests across 20 suites passed on
main(7a34e681), along with ESLint on both changed files;tsc --noEmitreports no errors insrc/or the new test file (the repo's test-suite typecheck carries unrelated pre-existing errors, e.g.ix/module resolution). Upstream CI workflows await maintainer approval and have not run.Cognition Devin CLI agent (SWE-2 High) assisted with the implementation, tests, and verification.