@Test
  public void testTraceRewriteByOptimize() {
    UnkeyedTable operationTable = getOperationTable();
    operationTable.newFastAppend().appendFile(getDataFile(1)).appendFile(getDataFile(2)).commit();

    operationTable
        .newRewrite()
        .rewriteFiles(
            Sets.newHashSet(getDataFile(1), getDataFile(2)), Sets.newHashSet(getDataFile(3)))
        .set(SnapshotSummary.SNAPSHOT_PRODUCER, CommitMetaProducer.OPTIMIZE.name())
        .commit();

    List<TableCommitMeta> tableCommitMetas =
        getAmsHandler().getTableCommitMetas().get(operationTable.id().buildTableIdentifier());
    Assert.assertEquals(2, tableCommitMetas.size());
    TableCommitMeta commitMeta = tableCommitMetas.get(1);
    Assert.assertSame(commitMeta.getCommitMetaProducer(), CommitMetaProducer.OPTIMIZE);
    validateCommitMeta(
        commitMeta,
        DataOperations.REPLACE,
        new org.apache.iceberg.DataFile[] {getDataFile(3)},
        new org.apache.iceberg.DataFile[] {getDataFile(1), getDataFile(2)});
  }
Table trace is disabled for version 0.5.0
amoro-format-iceberg/src/test/java/org/apache/amoro/trace/TestTableTracer.java