public DataFile writeFile(StructLike partition, List<Record> records) throws IOException {
    Preconditions.checkNotNull(table, "table not set");
    File file = tmp.newFile();
    Assert.assertTrue(file.delete());
    return appendToLocalFile(table, file, fileFormat, partition, records, conf);
  }
Helper for appending {@link DataFile} to a table or appending {@link Record}s to a table.
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/data/GenericAppenderHelper.java