Create table as select feature

You can create an Iceberg table based on an existing Hive or Impala table. In Cloudera Data Warehouse, create table as select (CTAS) can optionally include a partitioning spec for the table being created.

Hive examples

CREATE EXTERNAL TABLE ctas STORED BY ICEBERG AS SELECT x, y FROM t;

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

Impala examples

CREATE TABLE ctas STORED AS ICEBERG AS SELECT x, y FROM t;

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

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