You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/05/12 10:35:26 UTC

[GitHub] [incubator-doris] qimumu9406 opened a new pull request, #9526: development Show Load ALL SQL

qimumu9406 opened a new pull request, #9526:
URL: https://github.com/apache/incubator-doris/pull/9526

   # Proposed changes
   
   Issue Number:  #9475
   
   ## Problem Summary:
   show load all
   
   Describe the overview of changes.
   只用root用户才能执行 show load all
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: Yes
   2. Has unit tests been added: Yes
   3. Has document been added or modified: Yes
   4. Does it need to update dependencies: No
   5. Are there any changes that cannot be rolled back: No
   
   ## Further comments
   通过db id和db name 过滤出mysql schema数据库
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [incubator-doris] caiconghui commented on pull request #9526: [Feature] development Show Load ALL SQL

Posted by GitBox <gi...@apache.org>.
caiconghui commented on PR #9526:
URL: https://github.com/apache/incubator-doris/pull/9526#issuecomment-1125139873

   actually, there are many similar overview for the whole cluster, it is not a good design to show all load for all databases at one sql, how about like show proc "/transactions", we can execute show proc "/load_jobs", then we can see the summary of all the database load, and then we can see load detail for any database when we choose one database id, to keep the same style for the doris.


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [incubator-doris] qimumu9406 commented on pull request #9526: [Feature] development Show Load ALL SQL

Posted by GitBox <gi...@apache.org>.
qimumu9406 commented on PR #9526:
URL: https://github.com/apache/incubator-doris/pull/9526#issuecomment-1125165229

   Thanks for your suggestions, I think your suggestions are very helpful to me. Show Load ALL should be to get the ALL Load that the current user has DB permissions.


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [incubator-doris] stalary commented on a diff in pull request #9526: [Feature] development Show Load ALL SQL

Posted by GitBox <gi...@apache.org>.
stalary commented on code in PR #9526:
URL: https://github.com/apache/incubator-doris/pull/9526#discussion_r871499221


##########
docs/zh-CN/sql-manual/sql-reference/Show-Statements/SHOW-LOAD.md:
##########
@@ -51,20 +51,22 @@ SHOW LOAD
 说明:
 
 1) 如果不指定 db_name,使用当前默认db
+
+1) db_name 和 ALL 只能选择一个,当使用 ALL 时(目前支持root用户使用),将查询集群所有db的导入任务
     
-2)  如果使用 LABEL LIKE,则会匹配导入任务的 label 包含 label_matcher 的导入任务
+1)  如果使用 LABEL LIKE,则会匹配导入任务的 label 包含 label_matcher 的导入任务

Review Comment:
   There seems to be something wrong with the number?



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/ShowLoadStmt.java:
##########
@@ -61,6 +62,17 @@ public class ShowLoadStmt extends ShowStmt {
     public ShowLoadStmt(String db, Expr labelExpr, List<OrderByElement> orderByElements, LimitElement limitElement) {
         this.dbName = db;
         this.whereClause = labelExpr;
+        this.isAll=false;
+        this.orderByElements = orderByElements;
+        this.limitElement = limitElement;
+
+        this.labelValue = null;
+        this.stateValue = null;
+        this.isAccurateMatch = false;
+    }
+    public ShowLoadStmt(boolean isAll, Expr labelExpr, List<OrderByElement> orderByElements, LimitElement limitElement) {

Review Comment:
   Add a newline



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/ShowLoadStmt.java:
##########
@@ -61,6 +62,17 @@ public class ShowLoadStmt extends ShowStmt {
     public ShowLoadStmt(String db, Expr labelExpr, List<OrderByElement> orderByElements, LimitElement limitElement) {
         this.dbName = db;
         this.whereClause = labelExpr;
+        this.isAll=false;

Review Comment:
   There are blank before and after the equals sign.



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/ShowLoadStmt.java:
##########
@@ -256,13 +273,16 @@ private void analyzeSubPredicate(Expr subExpr) throws AnalysisException {
     @Override
     public String toSql() {
         StringBuilder sb = new StringBuilder();
-        sb.append("SHOW LOAD ");
-        if (!Strings.isNullOrEmpty(dbName)) {
-            sb.append("FROM `").append(dbName).append("`");
+        if(isAll){

Review Comment:
   format.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java:
##########
@@ -993,21 +995,40 @@ private void handleShowLoad() throws AnalysisException {
         ShowLoadStmt showStmt = (ShowLoadStmt) stmt;
 
         Catalog catalog = Catalog.getCurrentCatalog();
-        Database db = catalog.getDbOrAnalysisException(showStmt.getDbName());
-        long dbId = db.getId();
+        List<Database> dbList=Lists.newArrayList();
+
+        if(showStmt.getIsAll()){
+            if(ctx.getCurrentUserIdentity().getQualifiedUser().equals("root")){

Review Comment:
   suggest
   ```java
   ctx.getCurrentUserIdentity().isRootUser()
   ```



##########
fe/fe-core/src/test/java/org/apache/doris/analysis/ShowLoadStmtTest.java:
##########
@@ -78,6 +80,13 @@ public void testNormal() throws UserException, AnalysisException {
         Assert.assertEquals("SHOW LOAD FROM `testCluster:testDb`", stmt.toString());
     }
 
+    @Test
+    public void testAllDb() throws UserException, AnalysisException {

Review Comment:
   You can replace the old tests with extends TestWithFeService



##########
docs/zh-CN/sql-manual/sql-reference/Show-Statements/SHOW-LOAD.md:
##########
@@ -78,40 +80,46 @@ SHOW LOAD
     SHOW LOAD;
     ```
 
-2. 展示指定 db 的导入任务,label 中包含字符串 "2014_01_02",展示最老的10个
+1. 展示所有db的所有导入任务(root 用户执行)
+    
+   ```sql
+    SHOW LOAD ALL;
+    ```
+
+1. 展示指定 db 的导入任务,label 中包含字符串 "2014_01_02",展示最老的10个

Review Comment:
   There seems to be something wrong with the number?



##########
fe/fe-core/src/test/java/org/apache/doris/analysis/ShowLoadStmtTest.java:
##########
@@ -122,6 +131,31 @@ public void testWhere() throws UserException, AnalysisException {
         stmt.analyze(analyzer);
         Assert.assertEquals("SHOW LOAD FROM `testCluster:testDb` WHERE `state` = \'PENDING\' LIMIT 10", stmt.toString());
     }
+    @Test
+    public void testAllDbWhere() throws UserException, AnalysisException {
+        ShowLoadStmt stmt = new ShowLoadStmt(true, null, null, null);
+        stmt.analyze(analyzer);
+        Assert.assertEquals("SHOW LOAD ALL ", stmt.toString());
+
+        SlotRef slotRef = new SlotRef(null, "label");

Review Comment:
   use parseAndAnalyzeStmt.



##########
fe/fe-core/src/test/java/org/apache/doris/analysis/ShowLoadStmtTest.java:
##########
@@ -156,5 +190,39 @@ public void testInvalidWhereClause() throws AnalysisException {
                 () -> stmt2.analyze(analyzer));
 
 
+    }
+    @Test
+    public void testAllDbInvalidWhereClause() throws AnalysisException {
+        //test:  WHERE label="abc" AND label LIKE "def";  --> AnalysisException
+        SlotRef slotRef1 = new SlotRef(null, "label");

Review Comment:
   use parseAndAnalyzeStmt.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java:
##########
@@ -993,21 +995,40 @@ private void handleShowLoad() throws AnalysisException {
         ShowLoadStmt showStmt = (ShowLoadStmt) stmt;
 
         Catalog catalog = Catalog.getCurrentCatalog();
-        Database db = catalog.getDbOrAnalysisException(showStmt.getDbName());
-        long dbId = db.getId();
+        List<Database> dbList=Lists.newArrayList();

Review Comment:
   format.
   http://doris.incubator.apache.org/zh-CN/developer-guide/java-format-code.html



-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [doris] stalary closed pull request #9526: [Feature] development Show Load ALL SQL

Posted by GitBox <gi...@apache.org>.
stalary closed pull request #9526: [Feature] development Show Load ALL SQL 
URL: https://github.com/apache/doris/pull/9526


-- 
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-unsubscribe@doris.apache.org

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


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


[GitHub] [incubator-doris] stalary commented on pull request #9526: [Feature] development Show Load ALL SQL

Posted by GitBox <gi...@apache.org>.
stalary commented on PR #9526:
URL: https://github.com/apache/incubator-doris/pull/9526#issuecomment-1125155906

   Show All Load and show All Routineload have different semantics. We really should redesign this feature.


-- 
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-unsubscribe@doris.apache.org

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


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