singhpratech opened a new issue, #223:
URL: https://github.com/apache/arrow-swift/issues/223

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   `ArrowWriter` produces file output that deviates from the [IPC file 
format](https://arrow.apache.org/docs/format/Columnar.html#ipc-file-format) in 
three ways. Found on `main` (`15dfba8`), macOS, Swift 6.3, checking the output 
with pyarrow 21.0.0.
   
   **1. `writeFile(_:) -> Data` omits the magic string.** Only 
`toFile(_:info:)` writes `ARROW1` at the start and end, so the `Data` returned 
by `writeFile` is not an Arrow file:
   
   ```
   >>> pyarrow.ipc.open_file(pyarrow.BufferReader(data))
   pyarrow.lib.ArrowInvalid: Not an Arrow file
   ```
   
   Correspondingly, `ArrowReader.readFile(_:)` only accepts a file whose 
trailing magic string has been removed, so it cannot read the bytes of a real 
Arrow file; `fromFile(_:)` strips the trailing magic before calling it. This 
may be related to the unreadable `writeFile` output mentioned in #82.
   
   **2. The schema at the start of the file is not an encapsulated message.** 
The format is `<magic> <padding> <streaming format> <footer> <footer size> 
<magic>`, so the first thing after the padding should be a schema message 
(continuation marker, length, `Message` flatbuffer). The writer emits a bare 
`Schema` flatbuffer instead, and no end-of-stream marker. Readers that use the 
footer (pyarrow, arrow-go) are unaffected, but the body of the file is not a 
valid stream:
   
   ```
   >>> pyarrow.ipc.open_stream(data[8:])   # data written by toFile
   OSError: Invalid flatbuffers message.
   ```
   
   The same call succeeds on a file written by arrow-go.
   
   **3. The footer does not set `version`.** It therefore defaults to `V1`, 
while the messages in the same file are written as `V5`.
   
   ### Expected behaviour
   
   `writeFile` and `toFile` write the same, conforming bytes, and `readFile` 
accepts a complete file.


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