public void appendToTable(List<Record> rowSet) throws IOException {
    // The rows collected by partitions
    Map<PartitionKey, List<Record>> rows = Maps.newHashMap();
    PartitionKey partitionKey = new PartitionKey(table.spec(), table.schema());
    for (Record record : rowSet) {
      partitionKey.partition(record);
      List<Record> partitionRows = rows.get(partitionKey);
      if (partitionRows == null) {
        partitionRows = Lists.newArrayList();
        rows.put(partitionKey.copy(), partitionRows);
      }

      partitionRows.add(record);
    }

    for (PartitionKey partition : rows.keySet()) {
      appendToTable(partition, rows.get(partition));
    }
  }
Appends the rows to the table. If the table is partitioned then it will create the correct partitions.
@param rowSet The rows to add
@throws IOException If there is an exception during writing out the files
iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestHelper.java