adonis0147 commented on code in PR #13147:
URL: https://github.com/apache/doris/pull/13147#discussion_r1002953537


##########
fe/fe-core/src/main/java/org/apache/doris/persist/EditLog.java:
##########
@@ -884,6 +890,36 @@ public static void loadJournal(Env env, JournalEntity 
journal) {
                     env.getLoadManager().replayCleanLabel(log);
                     break;
                 }
+                case OperationType.OP_CREATE_MTMV_JOB: {
+                    final MtmvJob job = (MtmvJob) journal.getData();
+                    env.getMtmvJobManager().replayCreateJob(job);
+                    break;
+                }
+                case OperationType.OP_ALTER_MTMV_JOB: {
+                    ChangeMvmtJob changeJob = (ChangeMvmtJob) 
journal.getData();
+                    env.getMtmvJobManager().replayUpdateJob(changeJob);
+                    break;
+                }
+                case OperationType.OP_DROP_MTMV_JOB: {
+                    DropMtmvJob dropJob = (DropMtmvJob) journal.getData();
+                    
env.getMtmvJobManager().replayDropJobs(dropJob.getJobIds());
+                    break;
+                }
+                case OperationType.OP_CREATE_MTMV_TASK: {
+                    final MtmvTask task = (MtmvTask) journal.getData();

Review Comment:
   Why are some objects marked as `final` objects and others are not?



##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MtmvTaskExecutor.java:
##########
@@ -0,0 +1,179 @@
+// 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.mtmv;
+
+import org.apache.doris.analysis.UserIdentity;
+import org.apache.doris.common.Config;
+import org.apache.doris.mtmv.MtmvUtils.TaskState;
+import org.apache.doris.mtmv.metadata.MtmvJob;
+import org.apache.doris.mtmv.metadata.MtmvTask;
+import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.QueryState;
+import org.apache.doris.thrift.TUniqueId;
+
+import com.google.common.collect.Maps;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
+import java.util.concurrent.Future;
+
+public class MtmvTaskExecutor implements Comparable<MtmvTaskExecutor> {
+    private static final Logger LOG = 
LogManager.getLogger(MtmvTaskExecutor.class);
+
+    private long jobId;
+
+    private Map<String, String> properties;
+
+    private Future<?> future;
+
+    private MtmvJob job;
+
+    private ConnectContext ctx;
+
+    private MtmvTaskProcessor processor;
+
+    private MtmvTask task;
+
+    public long getJobId() {
+        return jobId;
+    }
+
+    public void setJobId(long jobId) {
+        this.jobId = jobId;
+    }
+
+    public MtmvJob getJob() {
+        return job;
+    }
+
+    public void setJob(MtmvJob job) {
+        this.job = job;
+    }
+
+    public Map<String, String> getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Map<String, String> properties) {
+        this.properties = properties;
+    }
+
+    public Future<?> getFuture() {
+        return future;
+    }
+
+    public void setFuture(Future<?> future) {
+        this.future = future;
+    }
+
+    public MtmvTaskProcessor getProcessor() {
+        return processor;
+    }
+
+    public void setProcessor(MtmvTaskProcessor processor) {
+        this.processor = processor;
+    }
+
+    public boolean executeTask() throws Exception {
+        MtmvTaskContext taskContext = new MtmvTaskContext();
+        taskContext.setDefinition(task.getDefinition());

Review Comment:
   ```suggestion
           taskContext.setQuery(task.getQuery());
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/mtmv/MtmvTaskContext.java:
##########
@@ -0,0 +1,61 @@
+// 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.mtmv;
+
+import org.apache.doris.qe.ConnectContext;
+
+import java.util.Map;
+
+public class MtmvTaskContext {
+    ConnectContext ctx;
+    String definition;

Review Comment:
   ```suggestion
       String query;
   ```



-- 
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