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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new ab5c1cc78fb branch-4.0: [fix](fe) Skip dropped columns in follower 
stats sync #63882 (#63947)
ab5c1cc78fb is described below

commit ab5c1cc78fb63fbeac7110c0d7ceb57d17815354
Author: yujun <[email protected]>
AuthorDate: Fri Jun 26 14:17:06 2026 +0800

    branch-4.0: [fix](fe) Skip dropped columns in follower stats sync #63882 
(#63947)
    
    cherry-pick: #63882
---
 .../doris/statistics/FollowerColumnSender.java     |  4 ++-
 .../doris/statistics/FollowerColumnSenderTest.java | 30 ++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/FollowerColumnSender.java
 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/FollowerColumnSender.java
index 22df039325d..86539a39b67 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/FollowerColumnSender.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/FollowerColumnSender.java
@@ -17,6 +17,7 @@
 
 package org.apache.doris.statistics;
 
+import org.apache.doris.catalog.Column;
 import org.apache.doris.catalog.Env;
 import org.apache.doris.catalog.TableIf;
 import org.apache.doris.common.ClientPool;
@@ -130,7 +131,8 @@ public class FollowerColumnSender extends MasterDaemon {
                 LOG.warn("Failed to find table for column {}", column.colName);
                 continue;
             }
-            if 
(StatisticsUtil.isUnsupportedType(table.getColumn(column.colName).getType())) {
+            Column col = table.getColumn(column.colName);
+            if (col == null || 
StatisticsUtil.isUnsupportedType(col.getType())) {
                 continue;
             }
             Set<Pair<String, String>> columnIndexPairs = 
table.getColumnIndexPairs(
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/statistics/FollowerColumnSenderTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/statistics/FollowerColumnSenderTest.java
index 2a5ae531d1e..377e631e690 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/statistics/FollowerColumnSenderTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/statistics/FollowerColumnSenderTest.java
@@ -30,6 +30,8 @@ import mockit.MockUp;
 import org.eclipse.jetty.util.BlockingArrayQueue;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
+import org.mockito.MockedStatic;
+import org.mockito.Mockito;
 
 import java.util.Collections;
 import java.util.Queue;
@@ -85,4 +87,32 @@ public class FollowerColumnSenderTest {
         Assertions.assertTrue(needAnalyzeColumns.contains(column4.toThrift()));
     }
 
+    @Test
+    public void testGetNeedAnalyzeColumnsSkipDroppedColumns() {
+        OlapTable mockTable = Mockito.mock(OlapTable.class);
+        Mockito.when(mockTable.getColumn("dropped")).thenReturn(null);
+        Mockito.when(mockTable.getColumn("visible")).thenReturn(new 
Column("visible", PrimitiveType.INT));
+        Mockito.when(mockTable.getColumnIndexPairs(Mockito.any()))
+                .thenReturn(Collections.singleton(Pair.of("mockIndex", 
"visible")));
+
+        try (MockedStatic<StatisticsUtil> statisticsUtilStatic = 
Mockito.mockStatic(StatisticsUtil.class)) {
+            statisticsUtilStatic.when(() -> 
StatisticsUtil.needAnalyzeColumn(Mockito.any(), Mockito.any()))
+                    .thenReturn(true);
+            statisticsUtilStatic.when(() -> 
StatisticsUtil.findTable(Mockito.anyLong(), Mockito.anyLong(), 
Mockito.anyLong()))
+                    .thenReturn(mockTable);
+
+            QueryColumn droppedColumn = new QueryColumn(1, 2, 3, "dropped");
+            QueryColumn visibleQueryColumn = new QueryColumn(1, 2, 3, 
"visible");
+            Queue<QueryColumn> queue = new BlockingArrayQueue<>();
+            queue.add(droppedColumn);
+            queue.add(visibleQueryColumn);
+
+            FollowerColumnSender sender = new FollowerColumnSender();
+            Set<TQueryColumn> needAnalyzeColumns = 
sender.getNeedAnalyzeColumns(queue);
+            Assertions.assertEquals(1, needAnalyzeColumns.size());
+            
Assertions.assertFalse(needAnalyzeColumns.contains(droppedColumn.toThrift()));
+            
Assertions.assertTrue(needAnalyzeColumns.contains(visibleQueryColumn.toThrift()));
+        }
+    }
+
 }


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

Reply via email to