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`.
2 files changed
tree: 8bd673fdfe1d9e270b9d07f098222c0ba131928e
  1. .github/
  2. CDataWGo/
  3. ci/
  4. data-generator/
  5. dev/
  6. Sources/
  7. Tests/
  8. .asf.yaml
  9. .dockerallow
  10. .editorconfig
  11. .env
  12. .gitignore
  13. .pre-commit-config.yaml
  14. .spi.yml
  15. .swiftlint.yml
  16. CODE_OF_CONDUCT.md
  17. compose.yaml
  18. CONTRIBUTING.md
  19. gen-flatbuffers.sh
  20. gen-protobuffers.sh
  21. LICENSE.txt
  22. NOTICE.txt
  23. Package.resolved
  24. Package.swift
  25. README.md
README.md

Apache Arrow Swift

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.

Installation

Swift Package Manager

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"]
)

Xcode

  1. Go to File > Add Package Dependencies...
  2. Enter the repository URL: https://github.com/apache/arrow-swift.git
  3. Select your desired version rules and click Add Package

Getting Started

For API documentation and usage examples, see the documentation on Swift Package Index.

Getting involved

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.

License

Apache 2.0