private Optional<ConnectorTableLayout> getWriteLayout(
      Schema tableSchema, PartitionSpec partitionSpec, boolean forceRepartitioning) {
    if (partitionSpec.isUnpartitioned()) {
      return Optional.empty();
    }

    validateNotPartitionedByNestedField(tableSchema, partitionSpec);
    Map<Integer, IcebergColumnHandle> columnById =
        getColumns(tableSchema, typeManager).stream()
            .collect(toImmutableMap(IcebergColumnHandle::getId, identity()));

    List<IcebergColumnHandle> partitioningColumns =
        partitionSpec.fields().stream()
            .sorted(Comparator.comparing(PartitionField::sourceId))
            .map(
                field ->
                    requireNonNull(
                        columnById.get(field.sourceId()),
                        () -> "Cannot find source column for partitioning field " + field))
            .distinct()
            .collect(toImmutableList());
    List<String> partitioningColumnNames =
        partitioningColumns.stream().map(IcebergColumnHandle::getName).collect(toImmutableList());

    if (!forceRepartitioning
        && partitionSpec.fields().stream().allMatch(field -> field.transform().isIdentity())) {
      // Do not set partitioningHandle, to let engine determine whether to repartition data or not,
      // on stat-based basis.
      return Optional.of(new ConnectorTableLayout(partitioningColumnNames));
    }
    IcebergPartitioningHandle partitioningHandle =
        new IcebergPartitioningHandle(toPartitionFields(partitionSpec), partitioningColumns);
    return Optional.of(new ConnectorTableLayout(partitioningHandle, partitioningColumnNames));
  }
Iceberg original metadata has some problems for mixed-format table, such as iceberg version,
table type. So copy from IcebergMetadata and made some change
amoro-format-mixed/amoro-mixed-trino/src/main/java/org/apache/amoro/trino/unkeyed/IcebergMetadata.java