diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshSchedule.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshSchedule.java index 17123a3235ec48..da873ea968c486 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshSchedule.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRefreshSchedule.java @@ -93,8 +93,9 @@ public String toString() { builder.append(" "); builder.append(timeUnit); if (!StringUtils.isEmpty(startTime)) { - builder.append(" STARTS "); + builder.append(" STARTS \""); builder.append(startTime); + builder.append("\""); } return builder.toString(); } diff --git a/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVTest.java b/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVTest.java index ca226218cfc4e3..de52b721287f61 100644 --- a/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVTest.java +++ b/fe/fe-core/src/test/java/org/apache/doris/mtmv/MTMVTest.java @@ -49,7 +49,7 @@ public class MTMVTest { @Test public void testToInfoString() { String expect - = "MTMV{refreshInfo=BUILD IMMEDIATE REFRESH COMPLETE ON SCHEDULE EVERY 2 SECOND STARTS ss, " + = "MTMV{refreshInfo=BUILD IMMEDIATE REFRESH COMPLETE ON SCHEDULE EVERY 2 SECOND STARTS \"ss\", " + "querySql='select * from xxx;', " + "status=MTMVStatus{state=INIT, schemaChangeDetail='null', refreshState=INIT}, " + "jobInfo=MTMVJobInfo{jobName='job1', " diff --git a/regression-test/suites/mtmv_p0/test_show_create_mtmv.groovy b/regression-test/suites/mtmv_p0/test_show_create_mtmv.groovy index 88f9de70865189..41f249e5fe382d 100644 --- a/regression-test/suites/mtmv_p0/test_show_create_mtmv.groovy +++ b/regression-test/suites/mtmv_p0/test_show_create_mtmv.groovy @@ -99,6 +99,29 @@ suite("test_show_create_mtmv","mtmv") { assertTrue(showCreateMTMVResult.toString().contains("BUILD IMMEDIATE REFRESH COMPLETE ON COMMIT")) assertTrue(showCreateMTMVResult.toString().contains("DISTRIBUTED BY RANDOM BUCKETS AUTO")) + + sql """drop materialized view if exists ${mvName};""" + sql """ + CREATE MATERIALIZED VIEW ${mvName} + BUILD DEFERRED REFRESH AUTO ON SCHEDULE EVERY 10 DAY starts "9999-01-01 10:10:10" + partition by (`k2`) + DISTRIBUTED BY hash(k1) BUCKETS 2 + PROPERTIES ( + 'replication_num' = '1' + ) + AS + SELECT * FROM ${tableName}; + """ + showCreateMTMVResult = sql """show CREATE MATERIALIZED VIEW ${mvName}""" + logger.info("showCreateMTMVResult: " + showCreateMTMVResult.toString()) + sql """drop materialized view if exists ${mvName};""" + sql """ + ${showCreateMTMVResult[0][1]} + """ + def showCreateMTMVResultAgain = sql """show CREATE MATERIALIZED VIEW ${mvName}""" + logger.info("showCreateMTMVAgainResult: " + showCreateMTMVResultAgain.toString()) + assertEquals(showCreateMTMVResult.toString(), showCreateMTMVResultAgain.toString()) + sql """drop table if exists `${tableName}`""" sql """drop materialized view if exists ${mvName};""" }