[enhance](mtmv) Prohibit creating materialized views in external cata… (#40420)

…logs (#39557)

pick: https://github.com/apache/doris/pull/39557
This commit is contained in:
zhangdong
2024-09-09 11:16:40 +08:00
committed by GitHub
parent ecb75c2e7d
commit fc4c2aed64
2 changed files with 14 additions and 0 deletions

View File

@ -38,6 +38,7 @@ import org.apache.doris.common.FeConstants;
import org.apache.doris.common.FeNameFormat;
import org.apache.doris.common.util.DynamicPartitionUtil;
import org.apache.doris.common.util.PropertyAnalyzer;
import org.apache.doris.datasource.InternalCatalog;
import org.apache.doris.mtmv.EnvInfo;
import org.apache.doris.mtmv.MTMVPartitionInfo;
import org.apache.doris.mtmv.MTMVPartitionInfo.MTMVPartitionType;
@ -151,6 +152,9 @@ public class CreateMTMVInfo {
public void analyze(ConnectContext ctx) throws Exception {
// analyze table name
mvName.analyze(ctx);
if (!InternalCatalog.INTERNAL_CATALOG_NAME.equals(mvName.getCtl())) {
throw new AnalysisException("Only support creating asynchronous materialized views in internal catalog");
}
try {
FeNameFormat.checkTableName(mvName.getTbl());
} catch (org.apache.doris.common.AnalysisException e) {

View File

@ -38,6 +38,16 @@ suite("test_hive_mtmv", "p0,external,hive,external_docker,external_docker_hive")
def dbName = "regression_test_mtmv_p0"
sql """drop materialized view if exists ${mvName};"""
test {
sql """CREATE MATERIALIZED VIEW ${catalog_name}.`default`.${mvName}
BUILD DEFERRED REFRESH AUTO ON MANUAL
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
SELECT * FROM ${catalog_name}.`default`.mtmv_base1;"""
exception "internal"
}
sql """
CREATE MATERIALIZED VIEW ${mvName}
BUILD DEFERRED REFRESH AUTO ON MANUAL