private static List<Record> writeTestData(
      MixedTable table,
      List<Record> baseAdded,
      List<Record> changeAdded,
      List<Record> changeDelete) {
    table.refresh();
    List<Record> initRecords =
        Lists.newArrayList(MixedDataTestHelpers.readTable(table, Expressions.alwaysTrue()));
    List<Record> finalRecords = null;
    long txId;
    if (baseAdded != null && !baseAdded.isEmpty()) {
      txId = table.isKeyedTable() ? table.asKeyedTable().beginTransaction("") : 1L;
      List<DataFile> files = MixedDataTestHelpers.writeBaseStore(table, txId, baseAdded, false);
      UnkeyedTable baseStore = MixedTableUtil.baseStore(table);
      AppendFiles appendFiles = baseStore.newAppend();
      files.forEach(appendFiles::appendFile);
      appendFiles.commit();
      initRecords.addAll(baseAdded);
    }

    if (table.isKeyedTable()) {
      if (changeAdded != null && !changeAdded.isEmpty()) {
        txId = table.asKeyedTable().beginTransaction("");
        List<DataFile> changeInsertFiles =
            MixedDataTestHelpers.writeChangeStore(
                table.asKeyedTable(), txId, ChangeAction.INSERT, changeAdded, false);
        UnkeyedTable changeStore = table.asKeyedTable().changeTable();
        AppendFiles appendFiles = changeStore.newAppend();
        changeInsertFiles.forEach(appendFiles::appendFile);
        appendFiles.commit();
        initRecords.addAll(changeAdded);
        finalRecords =
            Lists.newArrayList(MixedDataTestHelpers.readTable(table, Expressions.alwaysTrue()));
        System.out.println(finalRecords.size());
      }

      if (changeDelete != null && !changeDelete.isEmpty()) {
        txId = table.asKeyedTable().beginTransaction("");
        List<DataFile> changeDeleteFiles =
            MixedDataTestHelpers.writeChangeStore(
                table.asKeyedTable(), txId, ChangeAction.DELETE, changeDelete, false);
        UnkeyedTable changeStore = table.asKeyedTable().changeTable();
        AppendFiles appendFiles = changeStore.newAppend();
        changeDeleteFiles.forEach(appendFiles::appendFile);
        appendFiles.commit();
        Map<Integer, Record> results = Maps.newHashMap();
        initRecords.forEach(r -> results.put(r.get(0, Integer.class), r));
        changeDelete.forEach(r -> results.remove(r.get(0, Integer.class)));
        initRecords = Lists.newArrayList(results.values());
      }
    }
    finalRecords =
        Lists.newArrayList(MixedDataTestHelpers.readTable(table, Expressions.alwaysTrue()));
    System.out.println(finalRecords.size());
    return initRecords;
  }
write test records to the target table and return the expected records
amoro-ams/src/test/java/org/apache/amoro/server/TestInternalMixedCatalogService.java