Migrating a Hive table to Iceberg

You see how to use a simple ALTER TABLE statement to migrate an external Hive table to an Iceberg table. You see how to specify Iceberg classes in table properties to configure table input and output.

When you migrate an external Hive table to Iceberg, Hive makes the following changes:

  • Converts the storage_handler, serde, inputformat and outputformat properties of the table in HMS to use the Iceberg specific classes.

  • Reads the footers of the existing data files and generates the necessary Iceberg metadata files based on the footers.

  • Commits all the data files to the Iceberg table in a single commit.

  • You must meet the prerequisites to query Iceberg tables from a Virtual Warehouse mentioned earlier.
  • You must have a Hive Virtual Warehouse.
  1. Check that the DATALAKE indicator in your Database Catalog is CDW.
  2. Create a Hive Virtual Warehouse, or select an existing one.
  3. Click Hue.
  4. In Hue, select a database.
  5. Enter a query to migrate an existing external Hive table to an Iceberg table.
    For example:
    ALTER TABLE tbl 
    SET TBLPROPERTIES (‘storage_handler’=’org.apache.iceberg.mr.hive.HiveIcebergStorageHandler’);
  6. Click to run the query.