branch-2.1: [fix](cache) fix mtmv cache can not use test #46537 (#46607)

Cherry-picked from #46537

Co-authored-by: 924060929 <lanhuajian@selectdb.com>
This commit is contained in:
github-actions[bot]
2025-01-08 21:09:53 +08:00
committed by GitHub
parent 4a08d81acf
commit 6a68b09100
2 changed files with 4 additions and 2 deletions

View File

@ -321,7 +321,7 @@ public class NereidsSqlCacheManager {
// check table type and version
for (Entry<FullTableName, TableVersion> scanTable : sqlCacheContext.getUsedTables().entrySet()) {
TableVersion tableVersion = scanTable.getValue();
if (tableVersion.type != TableType.OLAP) {
if (tableVersion.type != TableType.OLAP && tableVersion.type != TableType.MATERIALIZED_VIEW) {
return true;
}
TableIf tableIf = findTableIf(env, scanTable.getKey());

View File

@ -63,12 +63,13 @@ suite("test_mtmv_sql_cache_and_profile", "mtmv") {
waitingMTMVTaskFinished(jobName)
sql """set enable_sql_cache=true;"""
sql "ADMIN SET FRONTEND CONFIG ('cache_last_version_interval_second' = '10')"
sleep(10 * 1000)
long startTime = System.currentTimeMillis()
long timeoutTimestamp = startTime + 5 * 60 * 1000
def explain_res = ""
while (System.currentTimeMillis() < timeoutTimestamp) {
sleep(5 * 1000)
sql """select k2 from ${mvName} group by k2;"""
try {
explain_res = sql """explain plan select k2 from ${mvName} group by k2;"""
@ -79,6 +80,7 @@ suite("test_mtmv_sql_cache_and_profile", "mtmv") {
if (explain_res.toString().indexOf("LogicalSqlCache") != -1 || explain_res.toString().indexOf("PhysicalSqlCache") != -1) {
break
}
sleep(5 * 1000)
}
assertTrue(explain_res.toString().indexOf("LogicalSqlCache") != -1 || explain_res.toString().indexOf("PhysicalSqlCache") != -1)