Sealdot opened a new pull request, #564:
URL: https://github.com/apache/arrow-js/pull/564

   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) called 
`this.reset(message.header())` for every Schema message, which replaced the 
schema and dropped the dictionaries mid-stream. As the repro in #563 shows, 
inserting an `Int32` schema 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 through `open()`, or lazily 
through a first `next()` 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 in `next()`.
   
   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 --noEmit` reports no errors in `src/` 
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.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to