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

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


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new ea562c47e2c branch-4.1: [fix](test) Make test_analyze_long_string Case 
5 stable against sample rows randomness #64408 (#64507)
ea562c47e2c is described below

commit ea562c47e2c989e0432e3fcc3e1def60b12c205d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Jun 16 13:20:35 2026 +0800

    branch-4.1: [fix](test) Make test_analyze_long_string Case 5 stable against 
sample rows randomness #64408 (#64507)
    
    Cherry-picked from #64408
    
    Co-authored-by: yujun <[email protected]>
    Co-authored-by: Claude <[email protected]>
---
 .../org/apache/doris/regression/suite/Suite.groovy | 27 ++++++++++++++++++++++
 .../statistics/test_analyze_long_string.groovy     | 12 ++++++----
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index 67c8be958c1..46966604815 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -2538,6 +2538,33 @@ class Suite implements GroovyInterceptable {
         return false;
     }
 
+    // Wait until the table row count reported by BE reaches the expected 
value.
+    // This is necessary before running sample analyze, because if row count 
is 0
+    // at task creation time, OlapAnalysisTask.doExecute() returns early 
without
+    // collecting any statistics, causing the analyze task to finish with an 
empty
+    // message instead of the expected skip reason.
+    void waitRowCountReady(String db, String table, long expectedRowCount) {
+        Awaitility.await().atMost(120, TimeUnit.SECONDS)
+                .pollInterval(3, TimeUnit.SECONDS).until {
+            def data = sql_return_maparray """SHOW DATA FROM ${db}.${table};"""
+            logger.info("SHOW DATA FROM ${db}.${table}: ${data}")
+            if (data.size() > 0) {
+                // Row 0 is the base index row which always has RowCount.
+                // The last row is "Total" whose RowCount may be empty.
+                def rc = data[0].RowCount
+                // RowCount may be empty string if BE hasn't reported yet.
+                if (rc == null || rc == '') {
+                    return false
+                }
+                def rowCount = (rc as long)
+                if (rowCount >= expectedRowCount) {
+                    return true
+                }
+            }
+            return false
+        }
+    }
+
     // Given tables to decide whether the table partition row count statistic 
is ready or not
     boolean is_partition_statistics_ready(db, tables)  {
         boolean isReady = true;
diff --git a/regression-test/suites/statistics/test_analyze_long_string.groovy 
b/regression-test/suites/statistics/test_analyze_long_string.groovy
index a234f44bad1..f9c0df470c2 100644
--- a/regression-test/suites/statistics/test_analyze_long_string.groovy
+++ b/regression-test/suites/statistics/test_analyze_long_string.groovy
@@ -162,6 +162,8 @@ suite("test_analyze_long_string", "nonConcurrent") {
     sql """insert into test_analyze_long_string_sample values(4, 'dd', 
'short3')"""
     sql """insert into test_analyze_long_string_sample values(5, 'ee', 
'short4')"""
 
+    waitRowCountReady("test_analyze_long_string", 
"test_analyze_long_string_sample", 5)
+
     setFeConfigTemporary([statistics_max_string_column_length: 1024]) {
         sql """analyze table test_analyze_long_string_sample with sample 
percent 100"""
         def jobId = findJobId("internal", "test_analyze_long_string", 
"test_analyze_long_string_sample")
@@ -232,10 +234,12 @@ suite("test_analyze_long_string", "nonConcurrent") {
         PROPERTIES ("replication_allocation" = "tag.location.default: 1");
     """
     sql """insert into test_analyze_long_string_duj1 values(1, 'aa', 
repeat('z', 2048))"""
-    sql """insert into test_analyze_long_string_duj1 values(2, 'bb', 
'short1')"""
-    sql """insert into test_analyze_long_string_duj1 values(3, 'cc', 
'short2')"""
-    sql """insert into test_analyze_long_string_duj1 values(4, 'dd', 
'short3')"""
-    sql """insert into test_analyze_long_string_duj1 values(5, 'ee', 
'short4')"""
+    sql """insert into test_analyze_long_string_duj1 values(2, 'bb', 
repeat('z', 2048))"""
+    sql """insert into test_analyze_long_string_duj1 values(3, 'cc', 
repeat('z', 2048))"""
+    sql """insert into test_analyze_long_string_duj1 values(4, 'dd', 
repeat('z', 2048))"""
+    sql """insert into test_analyze_long_string_duj1 values(5, 'ee', 
repeat('z', 2048))"""
+
+    waitRowCountReady("test_analyze_long_string", 
"test_analyze_long_string_duj1", 5)
 
     setFeConfigTemporary([statistics_max_string_column_length: 1024]) {
         
GetDebugPoint().enableDebugPointForAllFEs('OlapAnalysisTask.useDUJ1Template')


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

Reply via email to