Skip to main content
Iceberg supports reading and writing Iceberg tables through Apache Hive by using a StorageHandler.

Feature Support

Hive supports the following features with Hive version 4.0.0 and above:

Table Operations

  • Creating an Iceberg table
  • Creating an Iceberg identity-partitioned table
  • Creating an Iceberg table with any partition spec, including various transforms
  • Creating a table from an existing table (CTAS)
  • Dropping a table
  • Altering a table while keeping Iceberg and Hive schemas in sync
  • Altering the partition schema (updating columns)
  • Altering the partition schema by specifying partition transforms
  • Truncating a table/partition, dropping a partition
  • Migrating tables in Avro, Parquet, or ORC (Non-ACID) format to Iceberg

Query Operations

  • Reading an Iceberg table
  • Reading the schema of a table
  • Querying Iceberg metadata tables
  • Time travel applications

Write Operations

  • Inserting into a table/partition (INSERT INTO)
  • Inserting data overwriting existing data (INSERT OVERWRITE)
  • Copy-on-write support for DELETE, UPDATE and MERGE queries
  • CRUD support for Iceberg V1 tables

Advanced Features

  • Expiring snapshots
  • Creating tables like existing tables (CTLT)
  • Supporting Parquet compression types
  • Altering table metadata location
  • Supporting table rollback
  • Honoring sort orders on existing tables when writing
  • Creating, writing to and dropping Iceberg branches/tags
  • Setting current snapshot using snapshot ID
  • Table renaming
  • Converting tables to Iceberg format
  • Fast forwarding and cherry-picking commits to branches
  • Creating a branch from a tag
  • Deleting orphan files
  • Full table compaction
  • Showing partition information (SHOW PARTITIONS)
DML operations work only with Tez execution engine.

Version Support

Hive 4.1.x

Hive 4.1.x comes with Iceberg 1.9.1 included.

Hive 4.0.x

Hive 4.0.x comes with Iceberg 1.4.3 included.
Starting from Iceberg 1.8.0, Iceberg doesn’t release a Hive runtime connector. For Hive 2.x and 3.x integration, use the Hive runtime connector from Iceberg 1.6.1, or use Hive 4.0.0 or later.

Enabling Iceberg Support

If the Iceberg storage handler is not in Hive’s classpath, Hive cannot load or update the metadata for an Iceberg table. To avoid broken tables in Hive, Iceberg will not add the storage handler unless Hive support is enabled.

Hadoop Configuration

To enable Hive support globally for an application, set iceberg.engine.hive.enabled=true in its Hadoop configuration:
For example, setting this in the hive-site.xml loaded by Spark will enable the storage handler for all tables created by Spark.

Table Property Configuration

Alternatively, set the property engine.hive.enabled=true when creating the Iceberg table:
The table level configuration overrides the global Hadoop configuration.

Catalog Management

Global Hive Catalog

From the Hive engine’s perspective, there is only one global data catalog defined in the Hadoop configuration. In contrast, Iceberg supports multiple catalog types such as Hive, Hadoop, AWS Glue, or custom implementations. A table in the Hive metastore can represent three different ways of loading an Iceberg table, depending on the table’s iceberg.catalog property:
  1. HiveCatalog - No iceberg.catalog is set
  2. Custom catalog - iceberg.catalog is set to a catalog name
  3. Location-based table - iceberg.catalog is set to location_based_table

Custom Iceberg Catalogs

To globally register different catalogs, set the following Hadoop configurations:

Examples

Register a HiveCatalog called another_hive:
Register a HadoopCatalog called hadoop:
Register an AWS GlueCatalog called glue:

Type Compatibility

Hive and Iceberg support different sets of types. Iceberg can perform type conversion automatically for some combinations. Enable auto-conversion through Hadoop configuration:

Hive to Iceberg Type Mapping

DDL Commands

CREATE TABLE

Non-partitioned Tables

You can specify the default file format (Avro, Parquet, ORC) at table creation:

Partitioned Tables

Create Iceberg partitioned tables using familiar syntax:
The resulting table does not create partitions in HMS, but instead converts partition data into Iceberg identity partitions.
Create Iceberg partitions using partition specification syntax (Hive 4.0.0+):
Supported transformations:
  • years(ts): partition by year
  • months(ts): partition by month
  • days(ts) or date(ts): equivalent to dateint partitioning
  • hours(ts) or date_hour(ts): equivalent to dateint and hour partitioning
  • bucket(N, col): partition by hashed value mod N buckets
  • truncate(L, col): partition by value truncated to L

CREATE TABLE AS SELECT

The Iceberg table and corresponding Hive table are created at the beginning of query execution. Data is inserted when the query finishes.

CREATE TABLE LIKE TABLE

CREATE EXTERNAL TABLE

Overlay a Hive table on top of an existing Iceberg table:
For path-based Hadoop tables:

DML Commands

SELECT

Select statements work the same on Iceberg tables with Iceberg benefits:
  • No file system listings - especially important on blob stores like S3
  • No partition listing from the Metastore
  • Advanced partition filtering - partition keys can be calculated
  • Handle higher number of partitions than normal Hive tables
Features:
  1. Predicate pushdown to Iceberg TableScan and readers
  2. Column projection to reduce columns read
  3. Tez query execution engine support (Hive 4.x)
Read from branches:

INSERT INTO

Insert into branches:
Partition-level insert (Hive 4):

INSERT OVERWRITE

Partition-level overwrite:

DELETE FROM

UPDATE

MERGE INTO

Metadata Tables

Query Iceberg metadata tables using the full table name:
Available metadata tables:
  • all_data_files
  • all_delete_files
  • all_entries
  • all_files
  • all_manifests
  • data_files
  • delete_files
  • entries
  • files
  • history
  • manifests
  • metadata_log_entries
  • partitions
  • refs
  • snapshots

Time Travel

Query historical table snapshots:

Maintenance Operations

Expire Snapshots

Delete Orphan Files

Table Rollback

Rollback to the last snapshot before a specific timestamp:
Rollback to a specific snapshot ID:

Compaction

Next Steps

Configuration

Configure Iceberg table properties

Maintenance

Maintain Iceberg tables