@Test
  public void testTruncateEmptyTable() throws IOException, TException, InterruptedException {
    // Create an empty Iceberg table and execute a truncate table command on it.
    String databaseName = "default";
    String tableName = "customers";
    TableIdentifier identifier = TableIdentifier.of(databaseName, tableName);
    Table icebergTable = testTables.createTable(shell, tableName, HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
        fileFormat, null);
    // Set the 'external.table.purge' table property on the table
    String alterTableCommand =
        "ALTER TABLE " + identifier + " SET TBLPROPERTIES('external.table.purge'='true')";
    shell.executeStatement(alterTableCommand);

    shell.executeStatement("ANALYZE TABLE " + identifier + " COMPUTE STATISTICS");

    shell.executeStatement("TRUNCATE " + identifier);

    icebergTable = testTables.loadTable(TableIdentifier.of(databaseName, tableName));
    Map<String, String> summary = icebergTable.currentSnapshot().summary();
    for (String key : STATS_MAPPING.values()) {
      Assert.assertEquals("0", summary.get(key));
    }
    List<Object[]> rows = shell.executeStatement("SELECT * FROM " + identifier);
    Assert.assertEquals(0, rows.size());
    validateBasicStats(icebergTable, databaseName, tableName);
  }
Tests truncate table feature on Iceberg tables.
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergTruncateTable.java