This is an automated email from the ASF dual-hosted git repository.

morrySnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 989cca2875c [fix](mtmv) Add null-safety to getBaseViewsOneLevel for 
backward compatibility (#64412)
989cca2875c is described below

commit 989cca2875c59f6d29a36b63fcf62bc280e01d79
Author: yujun <[email protected]>
AuthorDate: Mon Jun 15 12:05:56 2026 +0800

    [fix](mtmv) Add null-safety to getBaseViewsOneLevel for backward 
compatibility (#64412)
    
    Introduced by #56423, the field baseViewsOneLevel may be null for MTMVs
    created before that PR. This causes NPE when querying
    information_schema.view_dependency:
    
    Cannot invoke java.util.Set.stream() because the return value of
    org.apache.doris.mtmv.MTMVRelation.getBaseViewsOneLevel() is null
    
    baseViewsOneLevel is currently only used for
    tablefunction/MetadataGenerator, so this change is safe.
    
    ---------
    
    Co-authored-by: Claude Fable 5 <[email protected]>
---
 .../src/main/java/org/apache/doris/mtmv/MTMVRelation.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

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 46caf032f53..452733cf7a7 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 class MTMVRelation {
         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{"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to