EmmyMiao87 commented on a change in pull request #6394:
URL: https://github.com/apache/incubator-doris/pull/6394#discussion_r685898611



##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadManager.java
##########
@@ -232,34 +232,92 @@ public RoutineLoadJob checkPrivAndGetJob(String dbName, 
String jobName)
         return routineLoadJob;
     }
 
+    // get all jobs which state is not in final state from specified database
+    public List<RoutineLoadJob> checkPrivAndGetAllJobs(String dbName)
+            throws MetaNotFoundException, DdlException, AnalysisException {
+
+        List<RoutineLoadJob> result = Lists.newArrayList();
+        Database database = Catalog.getCurrentCatalog().getDb(dbName);
+        if (database == null) {
+            throw new MetaNotFoundException("failed to find database: " + 
dbName);
+        }
+        long dbId = database.getId();
+        Map<String, List<RoutineLoadJob>> jobMap = 
dbToNameToRoutineLoadJob.get(dbId);
+        if (jobMap == null) {
+            throw new MetaNotFoundException("failed to find routine load jobs 
with databas id: " + dbId);

Review comment:
       maybe return empty is better?

##########
File path: 
fe/fe-core/src/main/java/org/apache/doris/load/routineload/RoutineLoadManager.java
##########
@@ -232,34 +232,92 @@ public RoutineLoadJob checkPrivAndGetJob(String dbName, 
String jobName)
         return routineLoadJob;
     }
 
+    // get all jobs which state is not in final state from specified database
+    public List<RoutineLoadJob> checkPrivAndGetAllJobs(String dbName)
+            throws MetaNotFoundException, DdlException, AnalysisException {
+
+        List<RoutineLoadJob> result = Lists.newArrayList();
+        Database database = Catalog.getCurrentCatalog().getDb(dbName);
+        if (database == null) {
+            throw new MetaNotFoundException("failed to find database: " + 
dbName);

Review comment:
       ERROR_CODE ERR_BAD_DB_ERROR

##########
File path: 
fe/fe-core/src/test/java/org/apache/doris/load/routineload/RoutineLoadManagerTest.java
##########
@@ -45,14 +45,14 @@
 import org.apache.doris.system.SystemInfoService;
 import org.apache.doris.thrift.TResourceInfo;
 
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.junit.Assert;
 import org.junit.Test;
 
+import com.google.common.collect.Lists;

Review comment:
       Can you slightly change the import order of your ide




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to