private BeginTableExecuteResult<ConnectorTableExecuteHandle, ConnectorTableHandle> beginOptimize(
      ConnectorSession session, IcebergTableExecuteHandle executeHandle, IcebergTableHandle table) {
    IcebergOptimizeHandle optimizeHandle =
        (IcebergOptimizeHandle) executeHandle.getProcedureHandle();
    Table icebergTable = loadTable(session, table.getSchemaTableName());

    validateNotModifyingOldSnapshot(table, icebergTable);
    validateNotPartitionedByNestedField(icebergTable.schema(), icebergTable.spec());

    int tableFormatVersion =
        ((HasTableOperations) icebergTable).operations().current().formatVersion();
    if (tableFormatVersion > OPTIMIZE_MAX_SUPPORTED_TABLE_VERSION) {
      throw new TrinoException(
          NOT_SUPPORTED,
          format(
              "%s is not supported for Iceberg table format version > %d. Table %s format version is %s.",
              OPTIMIZE.name(),
              OPTIMIZE_MAX_SUPPORTED_TABLE_VERSION,
              table.getSchemaTableName(),
              tableFormatVersion));
    }

    beginTransaction(icebergTable);

    return new BeginTableExecuteResult<>(
        executeHandle, table.forOptimize(true, optimizeHandle.getMaxScannedFileSize()));
  }
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