Skip to content

Commit

Permalink
[fix](mtmv)fix can not create mtmv all use default value (apache#28922)
Browse files Browse the repository at this point in the history
  • Loading branch information
zddr authored and stephen committed Dec 28, 2023
1 parent 8836fad commit 7164b4b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,9 @@ private String getOriginSql(ParserRuleContext ctx) {

@Override
public MTMVRefreshTriggerInfo visitRefreshTrigger(RefreshTriggerContext ctx) {
if (ctx == null) {
return new MTMVRefreshTriggerInfo(RefreshTrigger.MANUAL);
}
if (ctx.MANUAL() != null) {
return new MTMVRefreshTriggerInfo(RefreshTrigger.MANUAL);
}
Expand Down Expand Up @@ -662,6 +665,9 @@ public RefreshMethod visitRefreshMethod(RefreshMethodContext ctx) {

@Override
public BuildMode visitBuildMode(BuildModeContext ctx) {
if (ctx == null) {
return BuildMode.IMMEDIATE;
}
if (ctx.DEFERRED() != null) {
return BuildMode.DEFERRED;
} else if (ctx.IMMEDIATE() != null) {
Expand Down
13 changes: 13 additions & 0 deletions regression-test/suites/mtmv_p0/test_build_mtmv.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,19 @@ suite("test_build_mtmv") {
DROP MATERIALIZED VIEW ${mvName}
"""

// use default value
sql """
CREATE MATERIALIZED VIEW ${mvName}
DISTRIBUTED BY RANDOM BUCKETS 2
PROPERTIES ('replication_num' = '1')
AS
SELECT ${tableName}.username, ${tableNamePv}.pv FROM ${tableName}, ${tableNamePv} WHERE ${tableName}.id=${tableNamePv}.id;
"""

sql """
DROP MATERIALIZED VIEW ${mvName}
"""

// IMMEDIATE schedule interval
sql """
CREATE MATERIALIZED VIEW ${mvName}
Expand Down

0 comments on commit 7164b4b

Please sign in to comment.