diff --git a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelation.java b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelation.java index 46caf032f53dc7..452733cf7a7486 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelation.java +++ b/fe/fe-core/src/main/java/org/apache/doris/mtmv/MTMVRelation.java @@ -18,13 +18,16 @@ package org.apache.doris.mtmv; import org.apache.doris.datasource.CatalogMgr; +import org.apache.doris.persist.gson.GsonPostProcessable; import com.google.gson.annotations.SerializedName; import org.apache.commons.collections4.CollectionUtils; +import java.io.IOException; +import java.util.HashSet; import java.util.Set; -public class MTMVRelation { +public class MTMVRelation implements GsonPostProcessable { // t1 => v1 => v2 // t2 => mv1 // mv1 join v2 => mv2 @@ -80,6 +83,14 @@ public Set getBaseViews() { return baseViews; } + @Override + public void gsonPostProcess() throws IOException { + // For backward compatibility: previously created MTMV may not have baseViewsOneLevel + if (baseViewsOneLevel == null) { + baseViewsOneLevel = baseViews == null ? new HashSet<>() : new HashSet<>(baseViews); + } + } + // toString() is not easy to find where to call the method public String toInfoString() { return "MTMVRelation{"