Create table as select feature

You can create an Iceberg table based on an existing Hive or Impala table. The create table as select (CTAS) query can optionally include a partitioning spec for the table being created.

Hive examples

CREATE EXTERNAL TABLE ctas STORED BY ICEBERG AS SELECT i, t, j FROM ice_1;

CREATE EXTERNAL TABLE ctas_part PARTITIONED BY(z) STORED BY ICEBERG AS SELECT x, ts, z FROM t;

Impala examples

CREATE TABLE ctas STORED BY ICEBERG AS SELECT i, b FROM ice_11;

CREATE TABLE ctas_part PARTITIONED BY(b) STORED BY ICEBERG AS SELECT i, s, b FROM ice_11;

CREATE TABLE ctas_part_spec PARTITIONED BY SPEC (month(d)) STORED BY ICEBERG AS SELECT x, ts, d FROM source_t;