Home

Awesome

delta-kernel-rs

Delta-kernel-rs is an experimental Delta implementation focused on interoperability with a wide range of query engines. It currently only supports reads.

The Delta Kernel project is a Rust and C library for building Delta connectors that can read (and soon, write) Delta tables without needing to understand the Delta protocol details. This is the Rust/C equivalent of Java Delta Kernel.

Crates

Delta-kernel-rs is split into a few different crates:

Building

By default we build only the kernel and acceptance crates, which will also build derive-macros as a dependency.

To get started, install Rust via rustup, clone the repository, and then run:

cargo test --all-features

This will build the kernel, run all unit tests, fetch the Delta Acceptance Tests data and run the acceptance tests against it.

In general, you will want to depend on delta-kernel-rs by adding it as a dependency to your Cargo.toml, (that is, for rust projects using cargo) for other projects please see the FFI module. The core kernel includes facilities for reading delta tables, but requires the consumer to implement the Engine trait in order to use the table-reading APIs. If there is no need to implement the consumer's own Engine trait, the kernel has a feature flag to enable a default, asynchronous Engine implementation built with Arrow and Tokio.

# fewer dependencies, requires consumer to implement Engine trait.
# allows consumers to implement their own in-memory format
delta_kernel = "0.3"

# or turn on the default engine, based on arrow
delta_kernel = { version = "0.3", features = ["default-engine"] }

Feature flags

There are more feature flags in addition to the default-engine flag shown above. Relevant flags include:

Feature flagDescription
default-engineTurn on the 'default' engine: async, arrow-based Engine implementation
sync-engineTurn on the 'sync' engine: synchronous, arrow-based Engine implementation. Only supports local storage!
arrow-conversionConversion utilities for arrow/kernel schema interoperation
arrow-expressionExpression system implementation for arrow

Versions and Api Stability

We intend to follow Semantic Versioning. However, in the 0.x line, the APIs are still unstable. We therefore may break APIs within minor releases (that is, 0.1 -> 0.2), but we will not break APIs in patch releases (0.1.0 -> 0.1.1).

Documentation

Examples

There are some example programs showing how delta-kernel-rs can be used to interact with delta tables. They live in the kernel/examples directory.

Development

delta-kernel-rs is still under heavy development but follows conventions adopted by most Rust projects.

Concepts

There are a few key concepts that will help in understanding kernel:

  1. The Engine trait encapsulates all the functionality and engine or connector needs to provide to the Delta Kernel in order to read the Delta table.
  2. The DefaultEngine is our default implementation of the the above trait. It lives in engine/default, and provides a reference implementation for all Engine functionality. DefaultEngine uses arrow as its in-memory data format.
  3. A Scan is the entrypoint for reading data from a table.

Design Principles

Some design principles which should be considered:

Tips

{
  "editor.formatOnSave": true,
  "rust-analyzer.cargo.features": ["default-engine", "acceptance"]
}