feat: Add support for List data types (#39)

### Rationale within the changes

This PR refactors and extends support for nested types in the Arrow
integration. The current implementation of `ArrowNestedType` is tailored
primarily for data structs, as seen in `StructBufferBuilder`. However,
it lacks broader support and certain expected functionalities, such as
`loadStructArrayBuilder`.

To address this, the following improvements have been made:

- Renamed `ArrowNestedType` to `ArrowTypeStruct` to align with naming
conventions used elsewhere in the codebase.
- Introduced initial support for `ArrowTypeList`, including nested
lists.

For simplicity, instead of introducing a dedicated subtype for lists,
this PR uses an interface of `[Any?]?`. If this approach proves
insufficient, there are more explicit alternatives that can be explored.

**NOTE:** Work on `ArrowCExporter` and `ArrowCImporter` has been
intentionally deferred. These components require a deeper understanding
of memory ownership and child parsing, and I believe it's better to be
addressed in a future PR, unless it's strict necessary.

### What's Changed

1. Renamed `ArrowNestedType -> ArrowTypeStruct`.
2. Added support for `ArrowTypeList`, including nested lists.
3. Implemented `ListArray` with basic `.asString` formatting.
4. Added `ListArrayBuilder`.
5. Extended `ArrowArrayBuilder` to support the `.list` type.
6. Implemented `loadStructArrayBuilder` and `loadListArrayBuilder`.
7. Introduced `ListBufferBuilder`.
8. Added `ArrowReader.loadListData`.
9. Added `makeListHolder`.

### Are these changes tested?

Tests are included in `ArrayTests.swift`. It's also working on internal
applications, including integration with `ArrowFlight`.

Closes #16.

---------

Co-authored-by: Marco <mgraziano@dadostech.com>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
11 files changed
tree: 60002107bfc48147ff2c718f28c39de6398d08da
  1. .github/
  2. Arrow/
  3. ArrowFlight/
  4. CDataWGo/
  5. ci/
  6. data-generator/
  7. dev/
  8. .asf.yaml
  9. .dockerallow
  10. .editorconfig
  11. .env
  12. .gitignore
  13. .pre-commit-config.yaml
  14. .swiftlint.yml
  15. CODE_OF_CONDUCT.md
  16. compose.yaml
  17. CONTRIBUTING.md
  18. gen-flatbuffers.sh
  19. gen-protobuffers.sh
  20. LICENSE.txt
  21. NOTICE.txt
  22. Package.resolved
  23. Package.swift
  24. 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.

Install

TODO: We should update this after we register this package to Swift Package Index.

Getting Started

TODO: We should refer auto generated documentation on Swift Package Index after we register this package to 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