27 releases (16 stable)

new 6.0.0 Oct 17, 2021
5.5.0 Sep 28, 2021
5.3.0 Aug 31, 2021
5.0.0 Jul 17, 2021
0.1.0 Mar 29, 2018

#2 in #arrow

Download history 7809/week @ 2021-07-01 9073/week @ 2021-07-08 11668/week @ 2021-07-15 12088/week @ 2021-07-22 11568/week @ 2021-07-29 11659/week @ 2021-08-05 10092/week @ 2021-08-12 11540/week @ 2021-08-19 10277/week @ 2021-08-26 7581/week @ 2021-09-02 11576/week @ 2021-09-09 11848/week @ 2021-09-16 9312/week @ 2021-09-23 9958/week @ 2021-09-30 10718/week @ 2021-10-07 9317/week @ 2021-10-14

45,548 downloads per month
Used in 48 crates (30 directly)

Apache-2.0

2.5MB
56K SLoC

Apache Arrow Official Native Rust Implementation

Crates.io

This crate contains the official Native Rust implementation of Apache Arrow in memory format. Please see the API documents for additional details.

Rust Version Compatibility

This crate is tested with the latest stable version of Rust. We do not currently test against other, older versions of the Rust compiler.

Versioning / Releases

Unlike many other crates in the Rust ecosystem which spend extended time in "pre 1.0.0" state, releasing versions 0.x, the arrow-rs crate follows the versioning scheme of the overall Apache Arrow project in an effort to signal which language implementations have been integration tested with each other.

Features

The arrow crate provides the following features which may be enabled:

  • csv (default) - support for reading and writing Arrow arrays to/from csv files
  • ipc (default) - support for the [arrow-flight]((https://crates.io/crates/arrow-flight) IPC and wire format
  • prettyprint - support for formatting record batches as textual columns
  • js - support for building arrow for WebAssembly / JavaScript
  • simd - (Requires Nightly Rust) alternate optimized implementations of some compute kernels using explicit SIMD processor intrinsics.
  • chrono-tz - support of parsing timezone using chrono-tz

Safety

TLDR: You should avoid using the alloc and buffer and bitmap modules if at all possible. These modules contain unsafe code and are easy to misuse.

As with all open source code, you should carefully evaluate the suitability of arrow for your project, taking into consideration your needs and risk tolerance prior to use.

Background: There are various parts of the arrow crate which use unsafe and transmute code internally. We are actively working as a community to minimize undefined behavior and remove unsafe usage to align more with Rust's core principles of safety (e.g. the arrow2 project).

As arrow exists today, it is fairly easy to misuse the APIs, leading to undefined behavior, and it is especially easy to misuse code in modules named above. For an example, as described in the arrow2 crate, the following code compiles, does not panic, but results in undefined behavior:

let buffer = Buffer::from_slice_ref(&[0i32, 2i32])
let data = ArrayData::new(DataType::Int64, 10, 0, None, 0, vec![buffer], vec![]);
let array = Float64Array::from(Arc::new(data));

println!("{:?}", array.value(1));

Building for WASM

Arrow can compile to WebAssembly using the wasm32-unknown-unknown and wasm32-wasi targets.

In order to compile Arrow for wasm32-unknown-unknown you will need to disable default features, then include the desired features, but exclude test dependencies (the test_utils feature). For example, use this snippet in your Cargo.toml:

[dependencies]
arrow = { version = "5.0", default-features = false, features = ["csv", "ipc", "simd"] }

Examples

The examples folder shows how to construct some different types of Arrow arrays, including dynamic arrays:

Examples can be run using the cargo run --example command. For example:

cargo run --example builders
cargo run --example dynamic_types
cargo run --example read_csv

Dependencies

~5–7.5MB
~141K SLoC