Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.doris.datasource.hive;

import org.apache.doris.catalog.Column;
import org.apache.doris.catalog.Env;
import org.apache.doris.catalog.MTMV;
import org.apache.doris.catalog.PartitionItem;
import org.apache.doris.catalog.PartitionType;
Expand Down Expand Up @@ -75,8 +74,6 @@ abstract MTMVSnapshotIf getTableSnapshot(MTMVRefreshContext context, Optional<Mv

@Override
public void beforeMTMVRefresh(MTMV mtmv) throws DdlException {
Env.getCurrentEnv().getRefreshManager()
.refreshTable(hmsTable.getCatalog().getName(), hmsTable.getDbName(), hmsTable.getName(), true);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1100,8 +1100,6 @@ public boolean isPartitionedTable() {

@Override
public void beforeMTMVRefresh(MTMV mtmv) throws DdlException {
makeSureInitialized();
dlaTable.beforeMTMVRefresh(mtmv);
}

@Override
Expand Down
6 changes: 6 additions & 0 deletions regression-test/data/mtmv_p0/test_hive_refresh_mtmv.out
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

-- !mtmv_2 --
1 1 2020

-- !mtmv_3 --
1 1 2020
1 1 2020

-- !task_error --
Expand All @@ -23,6 +26,9 @@ SUCCESS

-- !mtmv_2 --
1 1 2020

-- !mtmv_3 --
1 1 2020
1 1 2020

-- !task_error --
Expand Down
10 changes: 9 additions & 1 deletion regression-test/suites/mtmv_p0/test_hive_refresh_mtmv.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke

// hive data change
logger.info("hive sql: " + insert_str)

// If we didn't refresh the catalog, the data in mv should still be old
sql """
REFRESH MATERIALIZED VIEW ${mvName} auto
"""
waitingMTMVTaskFinished(jobName)
order_qt_mtmv_2 "SELECT * FROM ${mvName} order by user_id"

hive_docker """ ${insert_str} """
sql """
REFRESH catalog ${catalog_name}
Expand All @@ -111,7 +119,7 @@ suite("test_hive_refresh_mtmv", "p0,external,hive,external_docker,external_docke
REFRESH MATERIALIZED VIEW ${mvName} auto
"""
waitingMTMVTaskFinished(jobName)
order_qt_mtmv_2 "SELECT * FROM ${mvName} order by user_id"
order_qt_mtmv_3 "SELECT * FROM ${mvName} order by user_id"

// hive add partition
def add_partition2021_str = """
Expand Down