Skip to content

Commit

Permalink
[fix](mtmv)Fix show mtmv time should wrapped in double quotation marks (
Browse files Browse the repository at this point in the history
apache#41419)

Fix show mtmv time should wrapped in double quotation marks
  • Loading branch information
zddr committed Sep 30, 2024
1 parent 4f81fc4 commit e80267d
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}, "
+ "envInfo=EnvInfo{ctlId='1', dbId='2'}, "
Expand Down
23 changes: 23 additions & 0 deletions regression-test/suites/mtmv_p0/test_show_create_mtmv.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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};"""
}

0 comments on commit e80267d

Please sign in to comment.