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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 7e9f6951c04 [fix](statistics)Fix skip analyze empty table case. 
(#45441) (#45455)
7e9f6951c04 is described below

commit 7e9f6951c040666757bcbaef2004fb4c5c0f749c
Author: James <lijib...@selectdb.com>
AuthorDate: Mon Dec 16 17:28:05 2024 +0800

    [fix](statistics)Fix skip analyze empty table case. (#45441) (#45455)
    
    backport: https://github.com/apache/doris/pull/45441
---
 .../doris/statistics/StatisticsAutoCollector.java      | 18 +++++++++---------
 .../doris/statistics/StatisticsAutoCollectorTest.java  |  5 +++++
 .../suites/statistics/test_analyze_mv.groovy           |  8 --------
 3 files changed, 14 insertions(+), 17 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsAutoCollector.java
 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsAutoCollector.java
index 1d7818a8e8d..574b25da422 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsAutoCollector.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/statistics/StatisticsAutoCollector.java
@@ -123,15 +123,6 @@ public class StatisticsAutoCollector extends MasterDaemon {
 
     protected void processOneJob(TableIf table, JobPriority priority)
                 throws DdlException, ExecutionException, InterruptedException {
-        List<Pair<String, String>> needRunColumns = table.getColumnIndexPairs(
-                table.getSchemaAllIndexes(false)
-                        .stream()
-                        .filter(c -> 
!StatisticsUtil.isUnsupportedType(c.getType()))
-                        .map(Column::getName)
-                        .collect(Collectors.toSet()));
-        if (needRunColumns == null || needRunColumns.isEmpty()) {
-            return;
-        }
         AnalysisMethod analysisMethod =
                 table.getDataSize(true) >= 
StatisticsUtil.getHugeTableLowerBoundSizeInBytes()
                         ? AnalysisMethod.SAMPLE : AnalysisMethod.FULL;
@@ -151,6 +142,15 @@ public class StatisticsAutoCollector extends MasterDaemon {
             }
             return;
         }
+        List<Pair<String, String>> needRunColumns = table.getColumnIndexPairs(
+                table.getSchemaAllIndexes(false)
+                        .stream()
+                        .filter(c -> 
!StatisticsUtil.isUnsupportedType(c.getType()))
+                        .map(Column::getName)
+                        .collect(Collectors.toSet()));
+        if (needRunColumns == null || needRunColumns.isEmpty()) {
+            return;
+        }
         StringJoiner stringJoiner = new StringJoiner(",", "[", "]");
         for (Pair<String, String> pair : needRunColumns) {
             stringJoiner.add(pair.toString());
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/statistics/StatisticsAutoCollectorTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/statistics/StatisticsAutoCollectorTest.java
index d687d111d2c..6c13bbc0f79 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/statistics/StatisticsAutoCollectorTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/statistics/StatisticsAutoCollectorTest.java
@@ -67,6 +67,11 @@ public class StatisticsAutoCollectorTest {
                 count[0]++;
                 return Pair.of(null, JobPriority.LOW);
             }
+
+            @Mock
+            protected void processOneJob(TableIf table, JobPriority priority) {
+                return;
+            }
         };
         count[0] = 0;
         count[1] = 0;
diff --git a/regression-test/suites/statistics/test_analyze_mv.groovy 
b/regression-test/suites/statistics/test_analyze_mv.groovy
index a4263975c26..f52295469db 100644
--- a/regression-test/suites/statistics/test_analyze_mv.groovy
+++ b/regression-test/suites/statistics/test_analyze_mv.groovy
@@ -717,14 +717,6 @@ suite("test_analyze_mv") {
         empty_test = sql """show auto analyze mvTestDup"""
         assertEquals(0, empty_test.size())
         empty_test = sql """show column stats mvTestDup"""
-        for (int i = 0; i < 100; i++) {
-            empty_test = sql """show column stats mvTestDup"""
-            if (empty_test.size() != 0) {
-                logger.info("async delete is not finished yet.")
-                Thread.sleep(1000)
-            }
-            break
-        }
         assertEquals(0, empty_test.size())
         // ** End of embedded test
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to