Skip to main content

Module delta_io

Module delta_io 

Source
Expand description

Delta Lake I/O integration module.

This module provides the actual I/O operations for Delta Lake tables via the deltalake crate. All functions are feature-gated behind delta-lake.

§Architecture

The I/O module is separate from the business logic in delta.rs to allow:

  • Testing business logic without the deltalake dependency
  • Clean separation of concerns (buffering/epoch management vs. actual writes)
  • Easy mocking for unit tests

§Exactly-Once Semantics

Delta Lake’s transaction log supports application-level transaction metadata via the txn action. We use this to store (writer_id, epoch) pairs, enabling exactly-once semantics:

  1. On recovery, read txn metadata to find the last committed epoch for this writer
  2. Skip epochs <= last committed (idempotent replay)
  3. Each write includes the epoch in txn metadata

Structs§

CompactionResult
Result of a compaction (OPTIMIZE) operation.
MergeResult
Result of a MERGE (upsert) operation.

Functions§

delete_by_merge
Performs a DELETE-by-merge for rows to be removed from the target table.
get_last_committed_epoch
Retrieves the last committed epoch for a writer from Delta Lake’s txn metadata.
get_latest_version
Returns the latest committed version of a Delta Lake table.
get_table_schema
Extracts the Arrow schema from a Delta Lake table.
merge_batches
Performs a MERGE (upsert) of a source batch into a Delta Lake table.
merge_changelog
Atomic changelog MERGE: inserts, updates, and deletes in one Delta commit.
open_or_create_table
Opens an existing Delta Lake table or creates a new one.
read_batches_at_version
Reads record batches from a specific Delta Lake table version.
resolve_catalog_options
Resolves catalog-aware table URI and merges catalog-specific storage options.
run_compaction
Runs an OPTIMIZE compaction on a Delta Lake table.
run_vacuum
Runs VACUUM on a Delta Lake table, deleting old unreferenced files.
write_batches
Writes batches to a Delta Lake table with exactly-once semantics.