@Test
  public void testInsertOverwriteOnEmptyV1Table() throws IOException {
    TableIdentifier target = TableIdentifier.of("default", "target");
    Table table = testTables.createTable(shell, target.name(), HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
        fileFormat, HiveIcebergStorageHandlerTestUtils.CUSTOMER_RECORDS);

    // Insert some data.
    List<Record> newRecords = TestHelper.RecordsBuilder.newInstance(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA)
        .add(0L, "ABC", "DBAK")
        .add(1L, "XYZ", "RDBS")
        .build();
    shell.executeStatement(testTables.getInsertQuery(newRecords, target, false));

    // Change the partition and then insert some more data.
    shell.executeStatement("ALTER TABLE target SET PARTITION SPEC(TRUNCATE(2, last_name))");
    newRecords = TestHelper.RecordsBuilder.newInstance(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA)
        .add(2L, "Mike", "Taylor")
        .add(3L, "Christy", "Hubert")
        .build();

    shell.executeStatement(testTables.getInsertQuery(newRecords, target, false));

    // Truncate the table
    shell.executeStatement("TRUNCATE TABLE target");

    newRecords = TestHelper.RecordsBuilder.newInstance(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA)
        .add(0L, "Mike", "Taylor")
        .add(3L, "ABC", "DBAK")
        .add(4L, "APL", "DBAM")
        .build();

    // Do an insert-overwrite and this should be successful because the table is empty.
    shell.executeStatement(testTables.getInsertQuery(newRecords, target, true));

    HiveIcebergTestUtils.validateData(table, newRecords, 0);
  }
Testing map-reduce inserts.
@throws IOException If there is an underlying IOException
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergInserts.java