diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/BaseTableInfo.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/BaseTableInfo.java index d4ad92224c04cc..fcf18d73a269bb 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/BaseTableInfo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/BaseTableInfo.java @@ -112,8 +112,7 @@ public void setTableName(String tableName) { // if compatible failed due catalog dropped, ctlName will be null public boolean isInternalTable() { - // - if (StringUtils.isEmpty(ctlName)) { + if (!StringUtils.isEmpty(ctlName)) { return InternalCatalog.INTERNAL_CATALOG_NAME.equals(ctlName); } else { return InternalCatalog.INTERNAL_CATALOG_ID == ctlId; diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/InitMaterializationContextHook.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/InitMaterializationContextHook.java index 0ad6f8f74a4410..2e8baecf165639 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/InitMaterializationContextHook.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/exploration/mv/InitMaterializationContextHook.java @@ -41,6 +41,7 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Sets; +import org.apache.commons.collections.CollectionUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -127,8 +128,15 @@ protected Set getAvailableMTMVs(Set usedTables, CascadesContext c private List createAsyncMaterializationContext(CascadesContext cascadesContext, Set usedTables) { - Set availableMTMVs = getAvailableMTMVs(usedTables, cascadesContext); - if (availableMTMVs.isEmpty()) { + Set availableMTMVs; + try { + availableMTMVs = getAvailableMTMVs(usedTables, cascadesContext); + } catch (Exception e) { + LOG.warn(String.format("MaterializationContext getAvailableMTMVs generate fail, current queryId is %s", + cascadesContext.getConnectContext().getQueryIdentifier()), e); + return ImmutableList.of(); + } + if (CollectionUtils.isEmpty(availableMTMVs)) { LOG.debug("Enable materialized view rewrite but availableMTMVs is empty, current queryId " + "is {}", cascadesContext.getConnectContext().getQueryIdentifier()); return ImmutableList.of();