@Test
  public void testCTASTblPropsAndLocationClause() throws Exception {
    shell.executeStatement("CREATE TABLE source (id bigint, name string) PARTITIONED BY (dept string) STORED AS ORC");
    shell.executeStatement(testTables.getInsertQuery(
        HiveIcebergStorageHandlerTestUtils.CUSTOMER_RECORDS, TableIdentifier.of("default", "source"), false));

    String location = temp.newFolder().toURI().toString();
    shell.executeStatement(String.format(
        "CREATE TABLE target PARTITIONED BY (dept, name) " +
        "STORED BY ICEBERG STORED AS %s LOCATION '%s' TBLPROPERTIES ('customKey'='customValue') " +
        "AS SELECT * FROM source", fileFormat.toString(), location));

    // check table can be read back correctly
    List<Object[]> objects = shell.executeStatement("SELECT id, name, dept FROM target ORDER BY id");
    HiveIcebergTestUtils.validateData(HiveIcebergStorageHandlerTestUtils.CUSTOMER_RECORDS,
        HiveIcebergTestUtils.valueForRow(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA, objects), 0);

    // check table is created at the correct location
    org.apache.hadoop.hive.metastore.api.Table tbl = shell.metastore().getTable("default", "target");
    Assert.assertEquals(location, tbl.getSd().getLocation() + "/" /* HMS trims the trailing dash */);

    // check if valid table properties are preserved, while serde props don't get preserved
    Assert.assertEquals("customValue", tbl.getParameters().get("customKey"));
    Assert.assertNull(tbl.getParameters().get(serdeConstants.LIST_COLUMNS));
    Assert.assertNull(tbl.getParameters().get(serdeConstants.LIST_PARTITION_COLUMNS));
  }
Creates Iceberg tables using CTAS, and runs select queries against these new tables to verify table content.
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergCTAS.java