Apache Iceberg Rust

repository·main·Indexed 23 days ago

https://github.com/apache/iceberg-rust

A high-performance Rust implementation of the Apache Iceberg table format for data warehouses, query engines, and ETL pipelines. It includes a modular architecture with crates for core functionality, storage backends via iceberg-storage-opendal, and catalog implementations for AWS Glue, Hive Metastore, REST, and S3 Tables. The project also provides integrations for Apache DataFusion, Moka caching, and serves as the core for Pyiceberg Python bindings.

Tokens
43K
Snippets
71
Records
246
Agent score
79%

What's inside apache-iceberg-rust

  1. Overview of Apache Iceberg™ Rust components

    main

    Apache Iceberg Rust is a Rust implementation of the Apache Iceberg specification. The project is modular and composed of several specialized crates for core functionality, catalog integration, storage, and query engine integration:

    Core & Loading

    • iceberg: The main implementation crate.
    • iceberg-catalog-loader: Logic for loading catalogs.

    Catalog Implementations

    • iceberg-catalog-glue: AWS Glue integration.
    • iceberg-catalog-hms: Hive Metastore integration.
    • iceberg-catalog-rest: REST Catalog integration.
    • iceberg-catalog-s3tables: S3 Tables integration.
    • iceberg-catalog-sql: SQL-based catalog integration.

    Integrations & Storage

    • iceberg-datafusion: Integration with the Apache DataFusion query engine.
    • iceberg-cache-moka: Integration with the Moka caching library.
    • iceberg-storage-opendal: Storage backend support via OpenDAL.
  2. What is Apache Iceberg?

    main

    Apache Iceberg is an open table format for huge analytic datasets. It provides a metadata layer that sits on top of file formats like Parquet and ORC. This layer enables SQL-like table capabilities in processing engines (such as Spark, Trino, PrestoDB, Flink, Hive, and Impala) and provides features like:

    • Transactional consistency
    • Schema evolution
    • Time travel

    Iceberg is designed to work with data stored directly on object storage systems like Amazon S3.

  3. How StorageFactory enables lazy initialization

    main

    The StorageFactory trait is used to create Storage instances from configuration. This pattern allows for lazy initialization of storage backends and enables custom storage injection into the system. A factory is used to build a new Storage instance given a StorageConfig.

    #[typetag::serde(tag = "type")]
    pub trait StorageFactory: Debug + Send + Sync {
        /// Build a new Storage instance from the given configuration.
        fn build(&self, config: &StorageConfig) -> Result<Arc<dyn Storage>>;
    }
  4. Identify core Iceberg protocol traits

    main

    The following core protocol traits are hosted in the iceberg crate. These define the fundamental behavior of the Iceberg specification and are intended to be implemented by various companion crates (e.g., FileIO implementations in crates/fileio/* or Runtime implementations in crates/runtime/*):

    • FileIO: Handles file system operations.
    • Runtime: Manages the execution environment (e.g., iceberg-runtime-tokio).
    • Catalog: Manages table namespaces and references.
    • Table: Represents an Iceberg table.
    • Transaction: Manages atomic updates to the table.
    • TableScan: Describes a plan for scanning table data.
  5. Understand the Iceberg Rust storage crate structure

    main

    The storage logic is organized across several crates:

    • iceberg (Core):
      • io/storage.rs: Defines Storage and StorageFactory traits.
      • io/file_io.rs: Defines FileIO, InputFile, and OutputFile.
      • io/config/: Contains StorageConfig and backend-specific constants (S3, GCS, OSS, Azdls).
      • io/memory.rs: Provides MemoryStorage (in-memory HashMap for testing).
      • io/local_fs.rs: Provides LocalFsStorage (standard filesystem operations).
    • iceberg-storage-opendal (Extension):
      • Provides OpenDalStorage and OpenDalStorageFactory for cloud providers like S3, GCS, Azure, and OSS via the OpenDAL framework.
    • catalog implementations (e.g., rest, glue, hms, s3tables, sql):
      • These use with_storage_factory injection to support various storage backends.