singhpratech opened a new pull request, #224:
URL: https://github.com/apache/arrow-swift/pull/224

   ## What's Changed
   
   `ArrowWriter` file output deviated from the IPC file format in three ways 
(details in #223):
   
   - `writeFile(_:)` returned data without the `ARROW1` magic string; only 
`toFile(_:info:)` wrote it. The magic string is now written by the shared 
private `writeFile`, so both produce the same bytes.
   - The schema at the start of the file was a bare `Schema` flatbuffer rather 
than an encapsulated schema message, and there was no end-of-stream marker, so 
the body of the file was not a valid stream. The schema is now written as a 
message, padded to 8 bytes, and the end-of-stream marker is written before the 
footer.
   - The footer did not set `version`, so it defaulted to `V1` while the 
messages are `V5`. It is now set.
   
   `ArrowReader.readFile(_:)` now accepts a complete file. It still accepts a 
file without its trailing magic string, which is what it took before, so 
existing callers that pair it with older `writeFile` output or strip the marker 
themselves keep working. `fromFile(_:)` passes the whole file through.
   
   Note that `writeFile(_:)` output changes: it is now 14 bytes of magic string 
and padding longer and has a different leading schema block.
   
   ## Testing
   
   - `testFileWriter_fileFormat` checks the magic strings, that `toFile` and 
`writeFile` write identical bytes, and that the result reads back through 
`readFile` (with and without the trailing magic string) and, from offset 8, 
through `readStreaming`.
   - `testFileReader_completeFileData` passes the bytes of an arrow-go written 
file straight to `readFile`.
   - `swift test` passes locally on macOS with Swift 6.3 and the 
`-warnings-as-errors` flags enabled.
   - Checked by hand with pyarrow 21.0.0: `ipc.open_file` reads the output of 
both `writeFile` and `toFile`, including a file with no record batches, and 
`ipc.open_stream` reads the file body from offset 8. arrow-go also opens the 
file.
   
   Closes #223.


-- 
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