Skip to content

Commit

Permalink
Fix materialized view
Browse files Browse the repository at this point in the history
  • Loading branch information
w41ter committed Apr 16, 2024
1 parent 6bb1465 commit 9e61d8e
Showing 1 changed file with 38 additions and 14 deletions.
52 changes: 38 additions & 14 deletions regression-test/suites/table-sync/test_materialized_view.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -118,30 +118,54 @@ suite("test_materialized_index") {

assertTrue(checkRestoreFinishTimesOf("${tableName}", 30))

def checkViewExists = { res -> Boolean
for (List<Object> row : res) {
if ((row[1] as String).contains("mtr_${tableName}_full")) {
return true
}
}
return false
}
assertTrue(checkShowTimesOf("""
SHOW ALTER TABLE ROLLUP
FROM TEST_${context.dbName}
WHERE TableName = "${tableName}" AND State = "FINISHED"
""",
materializedFinished, 30, "target"))
SHOW CREATE MATERIALIZED VIEW mtr_${tableName}_full
ON ${tableName}
""",
checkViewExists, 30, "target"))


logger.info("=== Test 2: incremental update rollup ===")
sql """
CREATE MATERIALIZED VIEW ${tableName}_incr AS
SELECT id, col2, col4 FROM ${tableName}
"""

def materializedFinished1 = { res -> Boolean
for (List<Object> row : res) {
if ((row[5] as String).contains("${tableName}_incr")) {
return true
}
}
return false
}
assertTrue(checkShowTimesOf("""
SHOW ALTER TABLE ROLLUP
SHOW ALTER TABLE ROLLUP
FROM ${context.dbName}
WHERE TableName = "${tableName}" AND State = "FINISHED"
""",
materializedFinished, 30, "sql"))
""",
materializedFinished1, 30, "sql"))

def checkViewExists1 = { res -> Boolean
for (List<Object> row : res) {
if ((row[1] as String).contains("${tableName}_incr")) {
return true
}
}
return false
}
assertTrue(checkShowTimesOf("""
SHOW ALTER TABLE ROLLUP
FROM TEST_${context.dbName}
WHERE TableName = "${tableName}" AND State = "FINISHED"
""",
materializedFinished, 30, "target"))

SHOW CREATE MATERIALIZED VIEW ${tableName}_incr
ON ${tableName}
""",
checkViewExists1, 30, "target"))

}

0 comments on commit 9e61d8e

Please sign in to comment.