Using Hive, you can create an Iceberg table followed by using the CTAS command to
alter or copy the existing Hive table and its properties into the Iceberg table.
In this case, you create an external table and alter an existing Hive table to
Iceberg table using the Hive engine.
Run the following command in your Hive shell to
create an Iceberg table.
create external table if not exists hive_ice_1 (CountryID int, CountryName
string, Capital string, Population string) STORED BY ICEBERG STORED AS
PARQUET;
Navigate accordingly in the Atlas UI to view the changes.
The following images provide information about Iceberg table creation
process.
Run the following commands in your Hive shell to copy the contents
of one table (hive_ice_3) to another newly created table (hive_ice_4).
create external table if not exists hive_ice_3 (CountryID int,
CountryName string, Capital string, Population string) STORED BY ICEBERG
STORED AS PARQUET;
create external table if not exists hive_ice_4 STORED BY ICEBERG STORED
AS PARQUET as select * from hive_ice_3;
The following images provide information about copying contents from one table
to another.
You can alter an existing Hive table to Iceberg table.
create external table if not exists hive_ice_5 (CountryID int,
CountryName string, Capital string, Population string)STORED AS
PARQUET;
ALTER TABLE hive_ice_5 SET TBLPROPERTIES
('storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler');
The following images provide information about alter tables operations.