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 2021/07/27 11:08:47 UTC

[GitHub] [incubator-doris] morningman commented on a change in pull request #6314: [Bug] Fix show load like match

morningman commented on a change in pull request #6314:
URL: https://github.com/apache/incubator-doris/pull/6314#discussion_r677346055



##########
File path: fe/fe-core/src/main/java/org/apache/doris/qe/ShowExecutor.java
##########
@@ -977,18 +977,25 @@ private void handleShowLoad() throws AnalysisException {
             ErrorReport.reportAnalysisException(ErrorCode.ERR_BAD_DB_ERROR, showStmt.getDbName());
         }
         long dbId = db.getId();
+        boolean isAccurateMatch = showStmt.isAccurateMatch();
+        String label = showStmt.getLabelValue();
+        if (!isAccurateMatch && label != null) {
+            if (!label.contains("%")) {

Review comment:
       This should be done in analyze() of ShowLoadStmt.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/loadv2/LoadManager.java
##########
@@ -317,7 +320,13 @@ public void cancelLoadJob(CancelLoadStmt stmt, boolean isAccurateMatch) throws D
                 }
             } else {
                 for (Map.Entry<String, List<LoadJob>> entry : labelToLoadJobs.entrySet()) {
-                    if (entry.getKey().contains(stmt.getLabel())) {
+                    String label = stmt.getLabel();
+                    // Compatible with historical issues
+                    if (!label.contains("%")) {

Review comment:
       This should be done in analyze() of CancelLoadStmt.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/qe/DdlExecutor.java
##########
@@ -142,9 +142,15 @@ public static void execute(Catalog catalog, DdlStmt ddlStmt) throws Exception {
             }
         } else if (ddlStmt instanceof CancelLoadStmt) {
             boolean isAccurateMatch = ((CancelLoadStmt) ddlStmt).isAccurateMatch();
+            String label = ((CancelLoadStmt) ddlStmt).getLabel();
+            if (!isAccurateMatch && label != null) {

Review comment:
       This should be done in analyze() of CancelLoadStmt.

##########
File path: fe/fe-core/src/main/java/org/apache/doris/load/Load.java
##########
@@ -1610,7 +1612,8 @@ public boolean isLabelExist(String dbName, String labelValue, boolean isAccurate
                 }
             } else {
                 for (Map.Entry<String, List<LoadJob>> entry : labelToLoadJobs.entrySet()) {
-                    if (entry.getKey().contains(labelValue)) {
+                    PatternMatcher matcher = PatternMatcher.createMysqlPattern(labelValue, CaseSensibility.LABEL.getCaseSensibility());

Review comment:
       `PatternMatcher.createMysqlPattern` can be put outside the `for` loop.
   Same suggestion to other `PatternMatcher.createMysqlPattern`.




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