[enhance](mtmv) refresh hms table before run mtmv task (#38212) (#39490)

pick from master #38212​
This commit is contained in:
zhangdong
2024-08-16 20:05:52 +08:00
committed by GitHub
parent ae8073f155
commit 472565cd48
2 changed files with 3 additions and 14 deletions

View File

@ -173,7 +173,7 @@ public class MTMVTask extends AbstractTask {
this.relation = MTMVPlanUtil.generateMTMVRelation(mtmv, ctx);
// Now, the MTMV first ensures consistency with the data in the cache.
// To be completely consistent with hive, you need to manually refresh the cache
// refreshHmsTable();
refreshHmsTable();
if (mtmv.getMvPartitionInfo().getPartitionType() != MTMVPartitionType.SELF_MANAGE) {
MTMVPartitionUtil.alignMvPartition(mtmv);
}
@ -282,7 +282,7 @@ public class MTMVTask extends AbstractTask {
}
/**
* // Before obtaining information from hmsTable, refresh to ensure that the data is up-to-date
* Before obtaining information from hmsTable, refresh to ensure that the data is up-to-date
*
* @throws AnalysisException
* @throws DdlException

View File

@ -104,9 +104,6 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke
// hive data change
logger.info("hive sql: " + insert_str)
hive_docker """ ${insert_str} """
sql """
REFRESH catalog ${catalog_name}
"""
sql """
REFRESH MATERIALIZED VIEW ${mvName} auto
"""
@ -120,9 +117,6 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke
"""
logger.info("hive sql: " + add_partition2021_str)
hive_docker """ ${add_partition2021_str} """
sql """
REFRESH catalog ${catalog_name}
"""
sql """
REFRESH MATERIALIZED VIEW ${mvName} auto
"""
@ -139,9 +133,6 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke
"""
logger.info("hive sql: " + drop_partition2021_str)
hive_docker """ ${drop_partition2021_str} """
sql """
REFRESH catalog ${catalog_name}
"""
sql """
REFRESH MATERIALIZED VIEW ${mvName} auto
"""
@ -157,9 +148,6 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke
"""
logger.info("hive sql: " + rename_column_str)
hive_docker """ ${rename_column_str} """
sql """
REFRESH catalog ${catalog_name}
"""
sql """
REFRESH MATERIALIZED VIEW ${mvName} complete
"""
@ -172,6 +160,7 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke
"""
logger.info("hive sql: " + recover_column_str)
hive_docker """ ${recover_column_str} """
// schema change need refresh catalog
sql """
REFRESH catalog ${catalog_name}
"""