CalvinKirs commented on code in PR #26146:
URL: https://github.com/apache/doris/pull/26146#discussion_r1400290028


##########
fe/fe-core/src/main/java/org/apache/doris/job/extensions/mtmv/MTMVJob.java:
##########
@@ -0,0 +1,152 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.job.extensions.mtmv;
+
+import org.apache.doris.catalog.Column;
+import org.apache.doris.catalog.Database;
+import org.apache.doris.catalog.Env;
+import org.apache.doris.catalog.MTMV;
+import org.apache.doris.catalog.ScalarType;
+import org.apache.doris.catalog.TableIf.TableType;
+import org.apache.doris.common.DdlException;
+import org.apache.doris.common.MetaNotFoundException;
+import org.apache.doris.common.io.Text;
+import org.apache.doris.common.util.TimeUtils;
+import org.apache.doris.job.base.AbstractJob;
+import org.apache.doris.job.common.JobType;
+import org.apache.doris.job.common.TaskType;
+import org.apache.doris.persist.gson.GsonUtils;
+import org.apache.doris.qe.ShowResultSetMetaData;
+
+import com.google.common.collect.Lists;
+import com.google.gson.annotations.SerializedName;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.io.DataOutput;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MTMVJob extends AbstractJob<MTMVTask> {
+    private static final Logger LOG = LogManager.getLogger(MTMVJob.class);
+    private static final ShowResultSetMetaData JOB_META_DATA =
+            ShowResultSetMetaData.builder()
+                    .addColumn(new Column("JobId", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("JobName", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("ExecuteType", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("RecurringStrategy", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("JobStatus", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("CreateTime", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("Comment", 
ScalarType.createVarchar(20)))
+                    .build();
+    private static final ShowResultSetMetaData TASK_META_DATA =
+            ShowResultSetMetaData.builder()
+                    .addColumn(new Column("JobId", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("TaskId", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("Status", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("CreateTimeMs", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("StartTimeMs", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("FinishTimeMs", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("Duration", 
ScalarType.createVarchar(20)))
+                    .addColumn(new Column("ExecuteSql", 
ScalarType.createVarchar(20)))
+                    .build();
+
+    @SerializedName(value = "dn")
+    private String dbName;
+    @SerializedName(value = "mi")
+    private long mtmvId;
+
+    public MTMVJob(String dbName, long mtmvId) {
+        this.dbName = dbName;
+        this.mtmvId = mtmvId;
+        super.setCreateTimeMs(System.currentTimeMillis());
+    }
+
+    @Override
+    protected void checkJobParamsInternal() {
+
+    }
+
+    @Override
+    public List<MTMVTask> createTasks(TaskType taskType) {
+        MTMVTask task = new MTMVTask(dbName, mtmvId);
+        task.setTaskType(taskType);
+        ArrayList<MTMVTask> tasks = new ArrayList<>();
+        tasks.add(task);
+        super.initTasks(tasks);

Review Comment:
   This belongs to the task's own creation logic, and there may be other 
operations that need to be processed on the data that has been initialized. At 
the same time, I am not sure if the implementation class will have custom init 
logic (sure,this is usually not necessary).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to