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

commit 6545c83bfbfd39e686171dd5843b695f86c63b94
Author: zhangdong <493738...@qq.com>
AuthorDate: Thu Apr 11 16:15:36 2024 +0800

    [fix](mtmv)add logs for mv_infos() (#33485)
---
 .../main/java/org/apache/doris/catalog/MTMV.java   | 19 +++++++++++
 .../doris/tablefunction/MetadataGenerator.java     | 37 ++++++++++++++++++++++
 .../tablefunction/MvInfosTableValuedFunction.java  | 16 ++++++++++
 3 files changed, 72 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java
index 80feb8f12ae..a751cd4beec 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java
@@ -405,4 +405,23 @@ public class MTMV extends OlapTable {
         }
     }
 
+    @Override
+    public String toString() {
+        return "MTMV{"
+                + ", refreshInfo=" + refreshInfo
+                + ", querySql='" + querySql + '\''
+                + ", status=" + status
+                + ", envInfo=" + envInfo
+                + ", jobInfo=" + jobInfo
+                + ", mvProperties=" + mvProperties
+                + ", relation=" + relation
+                + ", mvPartitionInfo=" + mvPartitionInfo
+                + ", refreshSnapshot=" + refreshSnapshot
+                + ", cache=" + cache
+                + ", id=" + id
+                + ", name='" + name + '\''
+                + ", qualifiedDbName='" + qualifiedDbName + '\''
+                + ", comment='" + comment + '\''
+                + '}';
+    }
 }
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
 
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
index 4ac216d5334..da58b6e94ab 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MetadataGenerator.java
@@ -108,7 +108,13 @@ public class MetadataGenerator {
     }
 
     public static TFetchSchemaTableDataResult 
getMetadataTable(TFetchSchemaTableDataRequest request) throws TException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("getMetadataTable() start.");
+        }
         if (!request.isSetMetadaTableParams() || 
!request.getMetadaTableParams().isSetMetadataType()) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Metadata table params is not set.");
+            }
             return errorResult("Metadata table params is not set. ");
         }
         TFetchSchemaTableDataResult result;
@@ -147,6 +153,9 @@ public class MetadataGenerator {
         if (result.getStatus().getStatusCode() == TStatusCode.OK) {
             filterColumns(result, params.getColumnsName(), 
params.getMetadataType(), params);
         }
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("getMetadataTable() end.");
+        }
         return result;
     }
 
@@ -597,6 +606,9 @@ public class MetadataGenerator {
 
     private static void filterColumns(TFetchSchemaTableDataResult result,
             List<String> columnNames, TMetadataType type, 
TMetadataTableRequestParams params) throws TException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("filterColumns() start.");
+        }
         List<TRow> fullColumnsRow = result.getDataBatch();
         List<TRow> filterColumnsRows = Lists.newArrayList();
         for (TRow row : fullColumnsRow) {
@@ -612,6 +624,9 @@ public class MetadataGenerator {
             filterColumnsRows.add(filterRow);
         }
         result.setDataBatch(filterColumnsRows);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("filterColumns() end.");
+        }
     }
 
     private static void filterColumns(TFetchSchemaTableDataResult result,
@@ -642,14 +657,26 @@ public class MetadataGenerator {
     }
 
     private static TFetchSchemaTableDataResult 
mtmvMetadataResult(TMetadataTableRequestParams params) {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("mtmvMetadataResult() start");
+        }
         if (!params.isSetMaterializedViewsMetadataParams()) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("MaterializedViews metadata params is not set.");
+            }
             return errorResult("MaterializedViews metadata params is not 
set.");
         }
 
         TMaterializedViewsMetadataParams mtmvMetadataParams = 
params.getMaterializedViewsMetadataParams();
         String dbName = mtmvMetadataParams.getDatabase();
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("dbName: " + dbName);
+        }
         TUserIdentity currentUserIdent = 
mtmvMetadataParams.getCurrentUserIdent();
         UserIdentity userIdentity = UserIdentity.fromThrift(currentUserIdent);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("userIdentity: " + userIdentity);
+        }
         List<TRow> dataBatch = Lists.newArrayList();
         TFetchSchemaTableDataResult result = new TFetchSchemaTableDataResult();
         List<Table> tables;
@@ -658,6 +685,7 @@ public class MetadataGenerator {
                     
.getCatalogOrAnalysisException(InternalCatalog.INTERNAL_CATALOG_NAME)
                     .getDbOrAnalysisException(dbName).getTables();
         } catch (AnalysisException e) {
+            LOG.warn(e.getMessage());
             return errorResult(e.getMessage());
         }
 
@@ -670,6 +698,9 @@ public class MetadataGenerator {
                     continue;
                 }
                 MTMV mv = (MTMV) table;
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("mv: " + mv);
+                }
                 TRow trow = new TRow();
                 trow.addToColumnValue(new TCell().setLongVal(mv.getId()));
                 trow.addToColumnValue(new TCell().setStringVal(mv.getName()));
@@ -683,11 +714,17 @@ public class MetadataGenerator {
                 trow.addToColumnValue(new 
TCell().setStringVal(mv.getMvProperties().toString()));
                 trow.addToColumnValue(new 
TCell().setStringVal(mv.getMvPartitionInfo().toNameString()));
                 trow.addToColumnValue(new 
TCell().setBoolVal(MTMVPartitionUtil.isMTMVSync(mv)));
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("mvend: " + mv.getName());
+                }
                 dataBatch.add(trow);
             }
         }
         result.setDataBatch(dataBatch);
         result.setStatus(new TStatus(TStatusCode.OK));
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("mtmvMetadataResult() end");
+        }
         return result;
     }
 
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java
 
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java
index 0b415ccae84..fbc414e717f 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/tablefunction/MvInfosTableValuedFunction.java
@@ -30,6 +30,8 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Maps;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
 import java.util.List;
 import java.util.Map;
@@ -39,6 +41,8 @@ import java.util.Map;
  * mv_infos("database" = "db1").
  */
 public class MvInfosTableValuedFunction extends MetadataTableValuedFunction {
+    private static final Logger LOG = 
LogManager.getLogger(MvInfosTableValuedFunction.class);
+
     public static final String NAME = "mv_infos";
     private static final String DB = "database";
 
@@ -75,6 +79,9 @@ public class MvInfosTableValuedFunction extends 
MetadataTableValuedFunction {
     private final String databaseName;
 
     public MvInfosTableValuedFunction(Map<String, String> params) throws 
AnalysisException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MvInfosTableValuedFunction() start");
+        }
         Map<String, String> validParams = Maps.newHashMap();
         for (String key : params.keySet()) {
             if (!PROPERTIES_SET.contains(key.toLowerCase())) {
@@ -88,6 +95,9 @@ public class MvInfosTableValuedFunction extends 
MetadataTableValuedFunction {
             throw new AnalysisException("Invalid mtmv metadata query");
         }
         this.databaseName = dbName;
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("MvInfosTableValuedFunction() end");
+        }
     }
 
     @Override
@@ -97,12 +107,18 @@ public class MvInfosTableValuedFunction extends 
MetadataTableValuedFunction {
 
     @Override
     public TMetaScanRange getMetaScanRange() {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("getMetaScanRange() start");
+        }
         TMetaScanRange metaScanRange = new TMetaScanRange();
         metaScanRange.setMetadataType(TMetadataType.MATERIALIZED_VIEWS);
         TMaterializedViewsMetadataParams mtmvParam = new 
TMaterializedViewsMetadataParams();
         mtmvParam.setDatabase(databaseName);
         
mtmvParam.setCurrentUserIdent(ConnectContext.get().getCurrentUserIdentity().toThrift());
         metaScanRange.setMaterializedViewsParams(mtmvParam);
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("getMetaScanRange() end");
+        }
         return metaScanRange;
     }
 


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

Reply via email to