Skip to main content

Catalogs

Spark uses pluggable table catalogs configured via properties under spark.sql.catalog.

Catalog Types

Iceberg provides two catalog implementations:

Hive Metastore Catalog

Configure a Hive-based catalog:

REST Catalog

Configure a REST catalog:

Hadoop Catalog

Configure a directory-based catalog:

Catalog Configuration

Common configuration properties:

Table Defaults and Overrides

Set default or enforced table properties:

View Defaults and Overrides

Similar configuration for views:

Using Catalogs

Reference tables with catalog names:

Replacing the Session Catalog

Add Iceberg support to Spark’s built-in catalog:
This allows using the same Hive Metastore for both Iceberg and non-Iceberg tables. Non-Iceberg tables are handled by the built-in catalog.

Catalog-Specific Hadoop Configuration

Set per-catalog Hadoop properties:
Catalog-specific properties take precedence over global spark.hadoop.* properties.

Loading Custom Catalogs

Use a custom catalog implementation:

SQL Extensions

Enable Iceberg SQL extensions for advanced features:
Extensions enable:
  • CALL stored procedures
  • ALTER TABLE ... ADD/DROP PARTITION FIELD
  • ALTER TABLE ... WRITE ORDERED BY
  • ALTER TABLE ... SET IDENTIFIER FIELDS
  • Branching and tagging DDL

Runtime Configuration

Configuration Precedence

Settings are applied in the following order (highest to lowest priority):
  1. DataSource Read/Write Options - .option(...) in code
  2. Spark Session Configuration - spark.conf.set(...) or spark-defaults.conf
  3. Table Properties - ALTER TABLE SET TBLPROPERTIES
  4. Default Value

Spark SQL Options

Global Iceberg behaviors via Spark configuration:

Common SQL Options

Read Options

Options for DataFrame reads:

Write Options

Options for DataFrame writes:

Commit Metadata

Add custom metadata to snapshots:

Next Steps

Getting Started

Set up your first Iceberg table

Write Data

Configure write performance and distribution

Procedures

Use stored procedures for maintenance

Structured Streaming

Configure streaming reads and writes