Fix Utf8View/BinaryView variadicBufferCounts Int64 deserialization (#615)

RecordBatch.variadicBufferCounts is defined as [long] (Int64) in the
Apache Arrow Message.fbs spec, but was deserialized as
FlatBuffers.Array{Int32}. When reading tables with multiple
Utf8View/BinaryView columns (e.g. from Polars), reading 32-bit elements
split each 64-bit buffer count into two 32-bit words, shifting buffer
offsets for subsequent columns and causing out-of-bounds reads or
segmentation faults in Arrow.View getindex:

  signal 11 (2): Segmentation fault: 11
  getindex at ./essentials.jl:975 [inlined]
  getindex at Arrow/src/arraytypes/views.jl:61 [inlined]

Also handle 4-byte-aligned Int64 vectors in FlatBuffers.Array{T} when
the vector payload following the 4-byte UOffsetT length prefix is not
8-byte aligned.

---------

Co-authored-by: Brian D. Klahn <bdk@Brians-MBP.home.local>
3 files changed
tree: 0b3e048a314b2965e00023254635570a52cee107
  1. .github/
  2. dev/
  3. docs/
  4. src/
  5. test/
  6. .asf.yaml
  7. .gitignore
  8. .JuliaFormatter.toml
  9. codecov.yaml
  10. LICENSE
  11. NOTICE
  12. Project.toml
  13. README.md
README.md

Arrow

docs CI codecov

deps version pkgeval

This is a pure Julia implementation of the Apache Arrow data standard. This package provides Julia AbstractVector objects for referencing data that conforms to the Arrow standard. This allows users to seamlessly interface Arrow formatted data with a great deal of existing Julia code.

Please see this document for a description of the Arrow memory layout.

Installation

The package can be installed by typing in the following in a Julia REPL:

julia> using Pkg; Pkg.add("Arrow")

Local Development

When developing on Arrow.jl it is recommended that you run the following to ensure that any changes to ArrowTypes.jl are immediately available to Arrow.jl without requiring a release:

julia --project -e 'using Pkg; Pkg.develop(path="src/ArrowTypes")'

Format Support

This implementation supports the 1.0 version of the specification, including support for:

  • All primitive data types
  • All nested data types
  • Dictionary encodings and messages
  • Extension types
  • Streaming, file, record batch, and replacement and isdelta dictionary messages

It currently doesn't include support for:

  • Tensors or sparse tensors
  • Flight RPC
  • C data interface

Third-party data formats:

See the full documentation for details on reading and writing arrow data.