Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fe/fe-core/src/main/java/org/apache/doris/catalog/MTMV.java
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ public Set<String> getExcludedTriggerTables() {
/**
* Called when in query, Should use one connection context in query
*/
public MTMVCache getOrGenerateCache(ConnectContext connectionContext) throws AnalysisException {
public MTMVCache getOrGenerateCache(ConnectContext connectionContext) throws
org.apache.doris.nereids.exceptions.AnalysisException {
readMvLock();
try {
if (cache != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.NereidsPlanner;
import org.apache.doris.nereids.StatementContext;
import org.apache.doris.nereids.exceptions.AnalysisException;
import org.apache.doris.nereids.jobs.executor.Rewriter;
import org.apache.doris.nereids.parser.NereidsParser;
import org.apache.doris.nereids.properties.PhysicalProperties;
Expand Down Expand Up @@ -97,7 +98,7 @@ public StructInfo getStructInfo() {
public static MTMVCache from(String defSql,
ConnectContext createCacheContext,
boolean needCost, boolean needLock,
ConnectContext currentContext) {
ConnectContext currentContext) throws AnalysisException {
StatementContext mvSqlStatementContext = new StatementContext(createCacheContext,
new OriginStatement(defSql, 0));
if (!needLock) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import org.apache.doris.catalog.MTMV;
import org.apache.doris.catalog.Table;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.Id;
import org.apache.doris.common.Pair;
import org.apache.doris.mtmv.MTMVCache;
Expand Down Expand Up @@ -102,7 +101,7 @@ public Optional<Pair<Id, Statistics>> getPlanStatistics(CascadesContext cascades
MTMVCache mtmvCache;
try {
mtmvCache = mtmv.getOrGenerateCache(cascadesContext.getConnectContext());
} catch (AnalysisException e) {
} catch (Exception e) {
LOG.warn(String.format("get mv plan statistics fail, materialization qualifier is %s",
generateMaterializationIdentifier()), e);
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.apache.doris.catalog.MTMV;
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.Table;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.mtmv.MTMVCache;
import org.apache.doris.nereids.memo.GroupExpression;
import org.apache.doris.nereids.properties.DataTrait;
Expand Down Expand Up @@ -565,7 +564,7 @@ AGGREGATE KEY (siteid,citycode,username)
MTMVCache cache;
try {
cache = mtmv.getOrGenerateCache(ConnectContext.get());
} catch (AnalysisException e) {
} catch (Exception e) {
LOG.warn(String.format("LogicalOlapScan computeUnique fail, mv name is %s", mtmv.getName()), e);
return;
}
Expand Down Expand Up @@ -604,7 +603,7 @@ public void computeUniform(DataTrait.Builder builder) {
MTMVCache cache;
try {
cache = mtmv.getOrGenerateCache(ConnectContext.get());
} catch (AnalysisException e) {
} catch (Exception e) {
LOG.warn(String.format("LogicalOlapScan computeUniform fail, mv name is %s", mtmv.getName()), e);
return;
}
Expand All @@ -625,7 +624,7 @@ public void computeEqualSet(DataTrait.Builder builder) {
MTMVCache cache;
try {
cache = mtmv.getOrGenerateCache(ConnectContext.get());
} catch (AnalysisException e) {
} catch (Exception e) {
LOG.warn(String.format("LogicalOlapScan computeEqualSet fail, mv name is %s", mtmv.getName()), e);
return;
}
Expand All @@ -646,7 +645,7 @@ public void computeFd(DataTrait.Builder builder) {
MTMVCache cache;
try {
cache = mtmv.getOrGenerateCache(ConnectContext.get());
} catch (AnalysisException e) {
} catch (Exception e) {
LOG.warn(String.format("LogicalOlapScan computeFd fail, mv name is %s", mtmv.getName()), e);
return;
}
Expand Down Expand Up @@ -677,7 +676,7 @@ Map<Slot, Slot> constructReplaceMap(MTMV mtmv) {
MTMVCache cache;
try {
cache = mtmv.getOrGenerateCache(ConnectContext.get());
} catch (AnalysisException e) {
} catch (Exception e) {
LOG.warn(String.format("LogicalOlapScan constructReplaceMap fail, mv name is %s", mtmv.getName()), e);
return replaceMap;
}
Expand Down
6 changes: 6 additions & 0 deletions regression-test/data/mtmv_p0/test_env_db_dropped_mtmv.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- This file is automatically generated. You should know what you did if you want to edit this
-- !query1 --
0

-- !query2 --

Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,8 @@ suite("test_env_db_dropped_mtmv") {
def msg = sql """select ErrorMsg from tasks('type'='mv') where JobName = '${jobName}' order by CreateTime DESC limit 1"""
logger.info(msg.toString())
assertTrue(msg.toString().contains("does not exist"))

// select ${dbName2}.${mvName} should not throw exception
order_qt_query1 "select count(*) from ${dbName2}.${mvName};"
order_qt_query2 "select * from ${dbName2}.${mvName};"
}