Use Apache Iceberg v3 features
This feature is in Beta.
This page describes how to use Apache Iceberg v3 features with Unity Catalog. Iceberg v3 enhances query performance and introduces new features for managed Delta Lake tables with UniForm, managed Iceberg tables, and foreign Iceberg tables.
The key features of Iceberg v3 are:
- Deletion vectors: Enable efficient, row-level deletes without rewriting entire data files.
- VARIANT data type: Supports storing and processing semi-structured data.
- Row lineage: Tracks incremental changes to table data.
Row lineage is required for all Iceberg v3 tables. There's no command to enable or disable row lineage.
Requirements
To use Iceberg v3 features, you must meet the following requirements:
- A workspace with Unity Catalog enabled
- Databricks Runtime 17.3 or above to read and write to managed tables with Iceberg v3
Create a new table with Iceberg v3
Create new tables with Iceberg v3 enabled for both managed Delta tables with UniForm and managed Iceberg tables.
- Managed Delta table with UniForm
- Managed Iceberg table
To create a new managed Delta table with UniForm and Iceberg v3 enabled, use the following SQL command:
CREATE OR REPLACE TABLE main.schema.table (c1 INT) TBLPROPERTIES(
'delta.universalFormat.enabledFormats' = 'iceberg',
'delta.enableIcebergCompatV3' = 'true'
);
For more information about UniForm, see Read Delta tables with Iceberg clients.
To create a new managed Iceberg table with the v3 format, use the following SQL command:
CREATE OR REPLACE TABLE main.schema.table (c1 INT)
USING iceberg
TBLPROPERTIES ('format-version' = 3);
For more information about managed Iceberg tables, see What is Apache Iceberg in Databricks?.
Upgrade an existing table to Iceberg v3
You can upgrade an existing table to Iceberg v3 by:
- Enabling any v3 feature on a table.
- Setting the Iceberg format version on a table to 3 (shown below).
Managed Iceberg tables that are upgraded to v3 can't be downgraded. Managed Delta tables with UniForm can be safely downgraded.
- Managed Delta table with UniForm
- Managed Iceberg table
To upgrade a managed Delta table with UniForm to v3, use the following command:
ALTER TABLE catalog.schema.table SET TBLPROPERTIES(
'delta.enableIcebergCompatV3' = 'true',
'delta.enableIcebergCompatV2' = 'false'
);
To upgrade a managed Iceberg table to v3, use the following command:
ALTER TABLE catalog.schema.table SET TBLPROPERTIES (
'format-version' = 3
);
Enable deletion vectors
Deletion vectors optimize row-level data modification operations and are enabled by default on all new Iceberg v3 tables. See What are deletion vectors?.
Enabling deletion vectors on an existing Iceberg table upgrades the Iceberg format version to 3.
- Managed Delta table with UniForm
- Managed Iceberg table
To create a new managed Delta table with UniForm, Iceberg v3, and deletion vectors enabled, set the following table properties:
CREATE TABLE catalog.schema.table (c1 INT) TBLPROPERTIES(
'delta.enableDeletionVectors' = 'true',
'delta.enableIcebergCompatV3' = 'true',
'delta.universalFormat.enabledFormats' = 'iceberg'
);
To create a new managed Iceberg table with deletion vectors enabled, set the iceberg.enableDeletionVectors table property:
CREATE TABLE catalog.schema.table (c1 INT)
USING ICEBERG TBLPROPERTIES (
'iceberg.enableDeletionVectors' = 'true'
);
Use the VARIANT data type
The VARIANT data type allows you to store and query semi-structured data.
Using VARIANT in an existing Iceberg table upgrades the Iceberg format version to 3.
- Managed Delta table with UniForm
- Managed Iceberg table
To create a new managed Delta table with UniForm and a VARIANT column:
CREATE TABLE catalog.schema.deltaTable (col VARIANT) TBLPROPERTIES(
'delta.enableIcebergCompatV3' = 'true',
'delta.universalFormat.enabledFormats' = 'iceberg'
);
To create a new managed Iceberg table with a VARIANT column:
CREATE TABLE catalog.schema.icebergTable (col VARIANT) USING iceberg;
To add a VARIANT column to an existing table, use the ALTER TABLE command:
ALTER TABLE catalog.schema.table ADD COLUMN variant_col VARIANT;
Restore a table to a previous version
If you need to revert a table to a state before it was upgraded to Iceberg v3, you can use the RESTORE command.
RESTORE TABLE catalog.schema.table TO VERSION AS OF 1;
Limitations
Databricks supports version 3 of the Iceberg specification, with the following exceptions:
- Defaults, including write defaults and initial defaults, aren't supported.
- The following data types aren't supported:
- Geospatial types
- Unknown type
- Nanosecond precision timestamp.
- Multi-argument transforms aren't supported.