Skip to content

Commit

Permalink
[BugFix] check base table existence when updating meta (backport #38464
Browse files Browse the repository at this point in the history
…) (#38511)

Co-authored-by: Murphy <[email protected]>
  • Loading branch information
mergify[bot] and murphyatwork authored Jan 5, 2024
1 parent 7bf30b0 commit 2b1a2c2
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ private void updateMetaForOlapTable(MaterializedView.AsyncRefreshContext refresh
currentTablePartitionInfo.putAll(partitionInfoMap);

// remove partition info of not-exist partition for snapshot table from version map
Table snapshotTable = snapshotBaseTables.get(tableId).second;
Table snapshotTable = Preconditions.checkNotNull(snapshotBaseTables.get(tableId),
"base table not found: " + tableId).second;
if (snapshotTable.isOlapOrLakeTable()) {
OlapTable snapshotOlapTable = (OlapTable) snapshotTable;
currentTablePartitionInfo.keySet().removeIf(partitionName ->
Expand Down Expand Up @@ -423,7 +424,10 @@ private void updateMetaForExternalTable(MaterializedView.AsyncRefreshContext ref
BaseTableInfo partitionTableInfo = null;
if (mvContext.hasNextBatchPartition()) {
Pair<Table, Column> partitionTableAndColumn = getPartitionTableAndColumn(snapshotBaseTables);
partitionTableInfo = snapshotBaseTables.get(partitionTableAndColumn.first.getId()).first;
partitionTableInfo =
Preconditions.checkNotNull(snapshotBaseTables.get(partitionTableAndColumn.first.getId()),
"base table not found: " + partitionTableAndColumn.first.getId())
.first;
}
// update version map of materialized view
for (Map.Entry<BaseTableInfo, Map<String, MaterializedView.BasePartitionInfo>> tableEntry
Expand Down

0 comments on commit 2b1a2c2

Please sign in to comment.