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

yiguolei pushed a commit to branch branch-4.2
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.2 by this push:
     new 301220850fb branch-4.2: [fix](meta) Rebuild view column lookup after 
metadata recovery #69150 (#69483)
301220850fb is described below

commit 301220850fb5e561bb5d4346580408ede9538353
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Oct 23 18:24:43 2026 +0800

    branch-4.2: [fix](meta) Rebuild view column lookup after metadata recovery 
#69150 (#69483)
    
    Cherry-picked from #69150
    
    Co-authored-by: feiniaofeiafei <[email protected]>
---
 .../main/java/org/apache/doris/catalog/View.java   |  1 +
 .../org/apache/doris/catalog/ViewReplayTest.java   | 51 ++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/View.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/View.java
index 7545d8f0e7c..a31ccb40eb1 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/View.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/View.java
@@ -169,6 +169,7 @@ public class View extends Table implements 
GsonPostProcessable, ViewIf {
 
     @Override
     public void gsonPostProcess() throws IOException {
+        super.gsonPostProcess();
         originalViewDef = "";
         if (sessionVariables == null) {
             sessionVariables = Maps.newHashMap();
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/catalog/ViewReplayTest.java 
b/fe/fe-core/src/test/java/org/apache/doris/catalog/ViewReplayTest.java
new file mode 100644
index 00000000000..d344735e5f3
--- /dev/null
+++ b/fe/fe-core/src/test/java/org/apache/doris/catalog/ViewReplayTest.java
@@ -0,0 +1,51 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.catalog;
+
+import org.apache.doris.persist.CreateTableInfo;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.util.Collections;
+
+public class ViewReplayTest {
+    @Test
+    public void testColumnLookupAfterDeserialization() throws Exception {
+        View view = new View(1L, "v", Collections.singletonList(
+                new Column("user_name", ScalarType.createVarcharType(20))));
+        ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+        view.write(new DataOutputStream(bytes));
+        Table imageView = Table.read(new DataInputStream(new 
ByteArrayInputStream(bytes.toByteArray())));
+        bytes.reset();
+        new CreateTableInfo("test", 2L, view).write(new 
DataOutputStream(bytes));
+        Table journalView = CreateTableInfo.read(new DataInputStream(
+                new ByteArrayInputStream(bytes.toByteArray()))).getTable();
+        for (Table restored : new Table[] {imageView, journalView}) {
+            Assertions.assertInstanceOf(View.class, restored);
+            Assertions.assertEquals(1, restored.getFullSchema().size());
+            Assertions.assertSame(restored.getFullSchema().get(0), 
restored.getColumn("user_name"));
+            Assertions.assertSame(restored.getColumn("user_name"), 
restored.getColumn("USER_NAME"));
+            Assertions.assertNull(restored.getColumn("missing"));
+        }
+    }
+}


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

Reply via email to