private static OptimizingProcessInfo buildOptimizingProcessInfo(
      OptimizingProcessMeta meta, List<OptimizingTaskMeta> optimizingTaskStats) {
    if (meta == null) {
      return null;
    }
    OptimizingProcessInfo result = new OptimizingProcessInfo();

    if (optimizingTaskStats != null) {
      int successTasks = 0;
      int runningTasks = 0;
      for (OptimizingTaskMeta optimizingTaskStat : optimizingTaskStats) {
        TaskRuntime.Status status = optimizingTaskStat.getStatus();
        switch (status) {
          case SUCCESS:
            successTasks++;
            break;
          case SCHEDULED:
          case ACKED:
            runningTasks++;
            break;
        }
      }
      result.setTotalTasks(optimizingTaskStats.size());
      result.setSuccessTasks(successTasks);
      result.setRunningTasks(runningTasks);
    }
    MetricsSummary summary = meta.getSummary();
    if (summary != null) {
      result.setInputFiles(summary.getInputFilesStatistics());
      result.setOutputFiles(summary.getOutputFilesStatistics());
    }

    result.setTableId(meta.getTableId());
    result.setCatalogName(meta.getCatalogName());
    result.setDbName(meta.getDbName());
    result.setTableName(meta.getTableName());

    result.setProcessId(String.valueOf(meta.getProcessId()));
    result.setStartTime(meta.getPlanTime());
    result.setOptimizingType(meta.getOptimizingType().name());
    result.setStatus(ProcessStatus.valueOf(meta.getStatus().name()));
    result.setFailReason(meta.getFailReason());
    result.setDuration(
        meta.getEndTime() > 0
            ? meta.getEndTime() - meta.getPlanTime()
            : System.currentTimeMillis() - meta.getPlanTime());
    result.setFinishTime(meta.getEndTime());
    result.setSummary(meta.getSummary().summaryAsMap(true));
    return result;
  }
Construct ColumnInfo based on schema and primary key field.
amoro-ams/src/main/java/org/apache/amoro/server/dashboard/MixedAndIcebergTableDescriptor.java