tree: 1937af0fa1d13838c72b0de69f443d5bd737b401 [path history] [tgz]
  1. src/
  2. testdata/
  3. tests/
  4. Cargo.toml
  5. DEPENDENCIES.rust.tsv
  6. README.md
crates/iceberg/README.md

Apache Iceberg Official Native Rust Implementation

crates.io docs.rs

This crate contains the official Native Rust implementation of Apache Iceberg.

See the API documentation for examples and the full API.

Usage

use futures::TryStreamExt;
use iceberg::io::{FileIO, FileIOBuilder};
use iceberg::{Catalog, Result, TableIdent};
use iceberg_catalog_memory::MemoryCatalog;

#[tokio::main]
async fn main() -> Result<()> {
    // Build your file IO.
    let file_io = FileIOBuilder::new("memory").build()?;
    // Connect to a catalog.
    let catalog = MemoryCatalog::new(file_io, None);
    // Load table from catalog.
    let table = catalog
        .load_table(&TableIdent::from_strs(["hello", "world"])?)
        .await?;
    // Build table scan.
    let stream = table
        .scan()
        .select(["name", "id"])
        .build()?
        .to_arrow()
        .await?;

    // Consume this stream like arrow record batch stream.
    let _data: Vec<_> = stream.try_collect().await?;
    Ok(())
}

IO Support

Iceberg Rust provides various storage backends through feature flags. Here are the currently supported storage backends:

Storage BackendFeature FlagStatusDescription
Memorystorage-memoryโœ… StableIn-memory storage for testing and development
Local Filesystemstorage-fsโœ… StableLocal filesystem storage
Amazon S3storage-s3โœ… StableAmazon S3 storage
Google Cloud Storagestorage-gcsโœ… StableGoogle Cloud Storage
Alibaba Cloud OSSstorage-oss๐Ÿงช ExperimentalAlibaba Cloud Object Storage Service
Azure Datalakestorage-azdls๐Ÿงช ExperimentalAzure Datalake Storage v2

You can enable all stable storage backends at once using the storage-all feature flag.

Note that storage-oss and storage-azdls are currently experimental and not included in storage-all.

Example usage in Cargo.toml:

[dependencies]
iceberg = { version = "x.y.z", features = ["storage-s3", "storage-fs"] }