Skip to content

Releases

arrow 2.2.0

Choose a tag to compare

@Mosaad-M Mosaad-M released this 26 Oct 15:37
29bad95

Requires Mojo >= 1.2.0. Use the previous release for Mojo 1.0/1.1.

v1.2.2: fix integer overflow crash in decode_array/decode_list_utf8_array

Choose a tag to compare

@Mosaad-M Mosaad-M released this 29 Sep 15:45

Security fix

Found via a real security review, confirmed with a direct exploit:
5 buffer-bounds checks (3 in decode_array, 2 in decode_list_utf8_array)
computed end = start + length from an attacker-controlled BufferDesc
with only a sign check, no upper bound. Mojo's Int silently wraps on
overflow, so a crafted offset/length pair near Int64::MAX bypasses the
end > len(body) check and crashes the process on the resulting
out-of-bounds slice.

Affects every consumer of this package -- decode_arrow_file is a
general-purpose parser for an externally-supplied file format, so a
crafted or corrupted .feather file is a real, standard threat model.

Fix: a new _checked_slice_bounds helper applies the overflow-safe
subtraction pattern (length > body_len - start) already used elsewhere
in this file, now applied consistently at all 5 vulnerable call sites.

Verified: reverted one call site to confirm the new regression tests
crash the whole suite exactly like the real exploit (not just fail an
assertion), proving both the tests and the vulnerability are real.

65/65 tests pass (2 new). No performance change. Purely additive, zero
breaking changes.

v1.2.1: fix two more byte-by-byte IPC copy loops

Choose a tag to compare

@Mosaad-M Mosaad-M released this 29 Sep 13:26

Performance fix

Found via real sample-based profiling of a downstream consumer (hl7-arrow),
not guessed: encode_ipc_message's body-copy loop and decode_ipc_message's
metadata+body copy loops (the latter called from encode_arrow_file's
per-batch loop purely to re-derive a length) together accounted for 53.8%
of all real work in that pipeline once message bodies got large.

Same class of bug fixed before in this repo (v1.1.2, v1.1.3) -- these two
spots were missed until a real consumer's payload sizes made them dominant.

Real, isolated benchmark improvement:

  • encode_ipc_message: ~4.8x faster
  • decode_ipc_message: ~5.0x faster
  • encode_record_batch (100k rows): ~5.0x faster
  • decode_record_batch (100k rows): ~7.6x faster
  • encode_arrow_file (100k rows): ~5.3x faster

Verified against real pyarrow.feather.read_table() on a 50,000-row,
~9.9MB payload.

63/63 tests pass, zero breaking changes.

v1.2.0: List<Utf8> support

Choose a tag to compare

@Mosaad-M Mosaad-M released this 29 Sep 07:09

New capability

Real Arrow List<Utf8> column support (a repeated-string column), scoped
narrowly to a Utf8 child only, not a general nested-list-of-any-type.
Fully additive: zero breaking changes to any existing type, function
signature, or consumer.

  • ArrowType.list_utf8(), ArrowArray.list_utf8(...)
  • encode_list_utf8_array / decode_list_utf8_array
  • encode_record_batch/decode_record_batch/decode_arrow_file now
    correctly handle a List column (2 FieldNodes, 5 buffers) alongside
    ordinary scalar columns in the same RecordBatch

Verified end-to-end against real pyarrow.feather.read_table(), not
just this package's own decoder: correct list<item: string> schema,
correct values for multi-element, empty-list, and null-list rows.

One real interop bug found and fixed via that pyarrow verification: the
Field table's children vector was initially written at slot 4 (real
Arrow's dictionary slot), not slot 5 (children) -- pyarrow's Footer
verifier rejected the file until corrected.

63/63 tests pass (3 new for List).

See the commit for the full technical writeup.

v1.1.3

Choose a tag to compare

@Mosaad-M Mosaad-M released this 28 Sep 01:41

Performance fix: encode_arrow_file's final message-concatenation loop had the same byte-by-byte List.append() anti-pattern already fixed elsewhere in this file for v1.1.2 -- missed that time because it used a precomputed length variable instead of an inline len() call, so the earlier grep-based sweep didn't catch it.

Found via real profiling (macOS sample, tracing call stacks into the allocator), not re-reading source speculatively. Fixed with the same List.extend() technique. New benchmark added (bench_encode_arrow_file_100k_rows) since the existing benchmark never exercised this code path.

Measured before/after (100k rows, 3 columns): 11.70ms -> 8.24ms (1.42x faster).

Behavior-preserving: all 67 tests pass unchanged, real pyarrow.feather.read_table() re-verified working.

v1.1.2

Choose a tag to compare

@Mosaad-M Mosaad-M released this 24 Sep 20:47

Performance fix: encode_array/decode_array/encode_record_batch (plus ArrowArray's own init/copyinit) copied column data one byte at a time via List.append() in a loop. Replaced with List.extend() calls on already-formed source lists/slices.

Measured on a new 100k-row x 3-column benchmark (added since none existed at this scale before):

  • encode_record_batch: 10.99ms -> 4.08ms (2.7x faster)
  • decode_record_batch: 11.08ms -> 3.90ms (2.84x faster)

Behavior-preserving: all 67 existing tests pass unchanged, real pyarrow.feather.read_table() re-verified working after the change.

v1.1.1

Choose a tag to compare

@Mosaad-M Mosaad-M released this 24 Sep 20:30

Real pyarrow/Arrow-ecosystem interop, verified end-to-end (not just self-roundtrip):

  • Fix encode_arrow_file/decode_arrow_file trailing-magic bytes (spec requires a 6-byte unpadded trailer, not 8)
  • Bump flatbuffers dependency to >=1.1.1, which fixes an inverted soffset sign convention that broke Footer verification in real Arrow C++
  • Fix RecordBatch Block.bodyLength/metaDataLength in the Footer (were computed from the wrong reference point, always came out ~0)
  • Add main() to csv_arrow.mojo and fix the pixi task to forward CLI args, so the README quickstart actually runs
  • Remove the spurious AVX-512 CI check (this repo uses no SIMD)

A real python3 -c "import pyarrow.feather as f; print(f.read_table(...))" call now succeeds against files this repo writes.

v1.0.0

Choose a tag to compare

@Mosaad-M Mosaad-M released this 10 Apr 20:39
88a2b81

Pure-Mojo Apache Arrow IPC stream encoder/decoder — initial release.

Features

  • Arrow IPC file format (Feather v2) encode/decode
  • Schema, RecordBatch, ArrowArray
  • Typed arrays: Int16, Int32, Int64, Float32, Float64, Utf8
  • CSV reader with type inference and csv_to_feather/feather_to_csv
  • 66 tests, all passing
  • Depends on flatbuffers >=1.0.1

Platforms

  • linux-64
  • osx-arm64