fix: Serialize `bitWidth` field of `FlatBuffers` Time type for `time64` (#190) ## What's Changed The vendored `ArrowWriterHelper` did not serialize the `bitWidth` field of the FlatBuffers `Time` type when writing a `time64` schema. Since the field's FlatBuffers default is 32, a `time64` column was encoded as `Time(unit, 32)`, and servers validating the schema rejected the column with: ``` [UNSUPPORTED_ARROWTYPE] Unsupported arrow type Time(NANOSECOND, 32) ``` This adds `bitWidth: 64` to the `.time64` case in `toFBType`. `time32` is unaffected because 32 is the correct default there. ## Testing Added `TimeBitWidthTests`, which serializes a schema via `ArrowWriter.toMessage(_:)` and parses the resulting FlatBuffers message to assert that `time64` (microseconds/nanoseconds) encodes `bitWidth` 64 and `time32` (seconds/milliseconds) encodes 32. The existing round-trip test (`testTimeInMemoryToFromStream`) cannot catch this regression because the Swift reader dispatches on `unit` only and ignores `bitWidth`.
Apache Arrow is a universal columnar format and multi-language toolbox for fast data interchange and in-memory analytics. It contains a set of technologies that enable data systems to efficiently store, process, and move data.
Add Arrow as a dependency in your Package.swift:
dependencies: [ .package(url: "https://github.com/apache/arrow-swift.git", from: "21.0.0") ]
Then add Arrow to your target's dependencies:
.target( name: "YourTarget", dependencies: ["Arrow"] )
https://github.com/apache/arrow-swift.gitFor API documentation and usage examples, see the documentation on Swift Package Index.
Even if you do not plan to contribute to Apache Arrow itself or Apache Arrow integrations in other projects, we'd be happy to have you involved:
We prefer to receive contributions in the form of GitHub pull requests. Please send pull requests against the github.com/apache/arrow-swift repository.
If you are looking for some ideas on what to contribute, check out the GitHub Issues for the Apache Arrow Swift project. Comment on the issue, GitHub Discussions and/or contact dev@arrow.apache.org with your questions and ideas.
If you‘d like to report a bug but don’t have time to fix it, you can still post it on GitHub issues.