Creating an Iceberg partitioned table

The ease of use of the Iceberg partitioning is clear from an example of how to partition a table using the backward compatible, identity-partition syntax. Alternatively, you can partition an Iceberg table by column values from Hive or Impala.

You can specify partitioning that is backward compatible with Iceberg V1 using the PARTITION BY clause. This type of table is called an identity-partitioned table. For more information about partitioning, see the Apache Iceberg documentation.

  1. In Hue, select a database.
  2. Create an identity-partitioned table.
    Hive:
    CREATE EXTERNAL TABLE ice_ext1 (i int, s string, ts timestamp, d date) PARTITIONED BY (state string)
    STORED BY ICEBERG 
    STORED AS ORC;
    Impala:
    CREATE TABLE ice_ext2 (i int, s string, ts timestamp, d date) PARTITIONED BY (state string)
    STORED BY ICEBERG;
  3. Click to run the query.
  4. Create a table and specify an identity transform, such as bucket, truncate, or date, using the Iceberg V2 PARTITION BY SPEC clause.
    Hive:
    CREATE TABLE ice_t_transforms_1 (i int, s string, ts timestamp, d date)
    PARTITIONED BY SPEC (TRUNCATE(10, i), BUCKET(11, s), YEAR(ts))
    STORED by ICEBERG; 
    Impala:
    CREATE TABLE ice_t_transforms (i int, s string, ts timestamp, d date)PARTITIONED BY SPEC (TRUNCATE(10, i), BUCKET(11, s), YEAR(ts))STORED AS ICEBERG;
  5. Click to run the query.