This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new a4c5c03acfd [fix](mtmv) Add debug log decide for performance when 
query rewrite by materialized view (#39914) (#39952)
a4c5c03acfd is described below

commit a4c5c03acfda7e3272739fae41afdf559e64d12b
Author: seawinde <149132972+seawi...@users.noreply.github.com>
AuthorDate: Tue Aug 27 14:27:44 2024 +0800

    [fix](mtmv) Add debug log decide for performance when query rewrite by 
materialized view (#39914) (#39952)
    
    ## Proposed changes
    In method `AbstractMaterializedViewRule#isMaterializationValid` Should
    add `LOG.isDebugEnabled()` before print debug log. Because
    `Plan#treeString` in debug log is performance consume.
    
    ## Proposed changes
    
    pr: https://github.com/apache/doris/pull/39914
    commitId: 45ddb8ce
---
 .../mv/AbstractMaterializedViewRule.java           | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewRule.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewRule.java
index 2f2e4e5ddc0..541c935d54c 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewRule.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/AbstractMaterializedViewRule.java
@@ -831,10 +831,12 @@ public abstract class AbstractMaterializedViewRule 
implements ExplorationRuleFac
                         "View struct info is invalid", () -> 
String.format("view plan is %s",
                                 
context.getStructInfo().getOriginalPlan().treeString()));
                 // tmp to location question
-                LOG.debug(String.format("View struct info is invalid, mv 
identifier is %s, query plan is %s,"
-                                + "view plan is %s",
-                        context.generateMaterializationIdentifier(), 
queryPlan.treeString(),
-                        context.getStructInfo().getTopPlan().treeString()));
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug(String.format("View struct info is invalid, mv 
identifier is %s, query plan is %s,"
+                                    + "view plan is %s",
+                            context.generateMaterializationIdentifier(), 
queryPlan.treeString(),
+                            
context.getStructInfo().getTopPlan().treeString()));
+                }
                 
cascadesContext.getMemo().recordMaterializationCheckResult(this.getClass(), 
materializationId,
                         false);
                 return false;
@@ -846,20 +848,24 @@ public abstract class AbstractMaterializedViewRule 
implements ExplorationRuleFac
             context.recordFailReason(context.getStructInfo(),
                     "View struct info is invalid", () -> String.format("view 
plan is %s",
                             
context.getStructInfo().getOriginalPlan().treeString()));
-            LOG.debug(String.format("View struct info is invalid, mv 
identifier is %s, query plan is %s,"
-                            + "view plan is %s",
-                    context.generateMaterializationIdentifier(), 
queryPlan.treeString(),
-                    context.getStructInfo().getTopPlan().treeString()));
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(String.format("View struct info is invalid, mv 
identifier is %s, query plan is %s,"
+                                + "view plan is %s",
+                        context.generateMaterializationIdentifier(), 
queryPlan.treeString(),
+                        context.getStructInfo().getTopPlan().treeString()));
+            }
             return false;
         }
         if (!context.getStructInfo().isValid()) {
             context.recordFailReason(context.getStructInfo(),
                     "View original struct info is invalid", () -> 
String.format("view plan is %s",
                             
context.getStructInfo().getOriginalPlan().treeString()));
-            LOG.debug(String.format("View struct info is invalid, mv 
identifier is %s,  query plan is %s,"
-                            + "view plan is %s",
-                    context.generateMaterializationIdentifier(), 
queryPlan.treeString(),
-                    context.getStructInfo().getTopPlan().treeString()));
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(String.format("View struct info is invalid, mv 
identifier is %s,  query plan is %s,"
+                                + "view plan is %s",
+                        context.generateMaterializationIdentifier(), 
queryPlan.treeString(),
+                        context.getStructInfo().getTopPlan().treeString()));
+            }
             return false;
         }
         return true;


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

Reply via email to