@Test
  public void testTruncateTablePartitionedIcebergTable() throws TException, InterruptedException {
    // Create a partitioned Iceberg table with some initial data and run a truncate table command on this table.
    // Then check if the data is deleted and the table statistics are reset to 0.
    String databaseName = "default";
    String tableName = "customers";
    PartitionSpec spec =
        PartitionSpec.builderFor(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA).identity("last_name").build();
    List<Record> records = TestHelper.RecordsBuilder.newInstance(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA)
        .add(0L, "Alice", "Brown")
        .add(1L, "Bob", "Brown")
        .add(2L, "Trudy", "Green")
        .add(3L, "John", "Pink")
        .add(4L, "Jane", "Pink")
        .build();
    Table icebergTable = testTables.createTable(shell, tableName, HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
        spec, fileFormat, records);
    testTruncateTable(databaseName, tableName, icebergTable, records,
        HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA, true, false);
  }
Tests truncate table feature on Iceberg tables.
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergTruncateTable.java