Open files
with database capabilities.
The Apache Iceberg and Delta Lake formats add to the storage files what is expected from a database: schema, ACID transactions, updates and deletes of records, and table versions.
- Open tables with Iceberg and Delta Lake
- ACID transactions
- Versions and time travel
- Scenario: deleting records and retaining versions
Open tables with Iceberg and Delta Lake
The data is kept in Parquet files, and each table format has an open specification, read by different engines.
In Iceberg, columns can be added, dropped, renamed, reordered or have their type widened, without rewriting the data files. In Delta Lake, schema validation prevents writing incompatible records, and new columns can be incorporated on write.
The UPDATE, DELETE and MERGE commands change records directly in the tables, which enables incremental loads and the application of changes captured by CDC.
Storage
Apache Ozone
Stores the data and metadata files of the tables, accessed through the S3 API.
Table format
Apache Iceberg and Delta Lake
Organize the files as tables and record each change as a new version of the table.
Catalog
Hive Metastore
Records the schema and the location of the tables, so that the engines find them by name.
ACID transactions
A change is published as a transaction, preserving the consistency of the table.
Iceberg and Delta Lake keep metadata that determines which files make up each state of the table. Committing a transaction publishes a new state. Readers query a consistent state instead of following partially written files.
| Property | What it means for an operation on the table |
|---|---|
| Atomicity | The transaction is committed in full or is not published. |
| Consistency | The changes respect the rules and validations applied by the format and by the engine. |
| Isolation | Concurrent reads and writes follow the concurrency control of the format. Conflicts may require a retry. |
| Durability | A committed change remains recorded in the persisted data and metadata. |
In TDP, these features are used by the engines compatible with each format. The available operations depend on the connector and the version. Each transaction applies to one table.
As an example, an incremental load of orders in Spark can use MERGE to incorporate changes into the table. The readers, such as the Trino queries, follow the committed versions, and any write conflicts are handled according to the engine used.
Apache Iceberg and Delta Lake. Change history: Versions and time travel.
Versions and time travel
Each write generates a new version of the table. The previous ones remain available while they are retained.
In Iceberg, each version is a snapshot. In Delta Lake, each commit recorded in the transaction log generates a version.
The old versions allow querying the past and undoing changes, and retention defines how long they exist.
Versions
Time travel
Queries the table as it was at a version or at a point in time (VERSION AS OF, TIMESTAMP AS OF), to audit, compare or reproduce a result. The table can also be rolled back to a previous version.
Versions
Retention
Defines how long the old versions and their files are preserved. It is also the limit of how far back time travel reaches.
Versions
Expiration
Removes the versions that are past retention and the files used only by them, freeing up storage space. In TDP, expiration is already scheduled.
Scenario: deleting records and retaining versions
Situation: a DELETE removes records from the current version of a table.
The files with the old data remain in storage while any retained version references them.
What TDP does: the scheduled expiration jobs remove the files that no retained version uses anymore: in Iceberg, through expire_snapshots. In Delta Lake, through VACUUM.
Effect: the files used only by the expired versions leave the storage, and those versions are no longer available for time travel.
When the deletion is marked separately, without rewriting the file, the record remains in the data file until the file is rewritten and the versions that still reference it expire.
See also
Storage
Storage and catalog
Ozone or another S3 endpoint for the files. Hive Metastore and Trino catalogs to locate the tables.
Operation
Scheduled maintenance
Version expiration, removal of unused files and compaction, per format, and what is configurable.